1. 18 4月, 2014 5 次提交
    • P
      target-arm: Fix VFP enables for AArch32 EL0 under AArch64 EL1 · 2c7ffc41
      Peter Maydell 提交于
      The current A32/T32 decoder bases its "is VFP/Neon enabled?" check
      on the FPSCR.EN bit. This is correct if EL1 is AArch32, but for
      an AArch64 EL1 the logic is different: it must act as if FPSCR.EN
      is always set. Instead, trapping must happen according to CPACR
      bits for cp10/cp11; these cover all of FP/Neon, including the
      FPSCR/FPSID/MVFR register accesses which FPSCR.EN does not affect.
      Add support for CPACR checks (which are also required for ARMv7,
      but were unimplemented because Linux happens not to use them)
      and make sure they generate exceptions with the correct syndrome.
      
      We actually return incorrect syndrome information for cases
      where FP is disabled but the specific instruction bit pattern
      is unallocated: strictly these should be the Uncategorized
      exception, not a "SIMD disabled" exception. This should be
      mostly harmless, and the structure of the A32/T32 VFP/Neon
      decoder makes it painful to put the 'FP disabled?' checks in
      the right places.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      2c7ffc41
    • P
      target-arm: A64: Correctly fault FP/Neon if CPACR.FPEN set · 8c6afa6a
      Peter Maydell 提交于
      For the A64 instruction set, the only FP/Neon disable trap
      is the CPACR FPEN bits, which may indicate "enabled", "disabled"
      or "disabled for EL0". Add a bit to the AArch64 tb flags indicating
      whether FP/Neon access is currently enabled and make the decoder
      emit code to raise exceptions on use of FP/Neon insns if it is not.
      
      We use a new flag in DisasContext rather than borrowing the
      existing vfp_enabled flag because the A32/T32 decoder is going
      to need both.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Acked-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      ---
      I'm aware this is a rather hard to review patch; sorry.
      I have done an exhaustive check that we have fp access checks
      in all code paths with the aid of the assertions added in the
      next patch plus the code-coverage hack patch I posted to the
      list earlier.
      
      This patch is correct as of
      09e03735 target-arm: A64: Add saturating accumulate ops (USQADD/SUQADD)
      which was the last of the Neon insns to be added, so assuming
      no refactoring of the code it should be fine.
      8c6afa6a
    • P
      target-arm: Define exception record for AArch64 exceptions · abf1172f
      Peter Maydell 提交于
      For AArch32 exceptions, the only information provided about
      the cause of an exception is the individual exception type (data
      abort, undef, etc), which we store in cs->exception_index. For
      AArch64, the CPU provides much more detail about the cause of
      the exception, which can be found in the syndrome register.
      Create a set of fields in CPUARMState which must be filled in
      whenever an exception is raised, so that exception entry can
      correctly fill in the syndrome register for the guest.
      This includes the information which in AArch32 appears in
      the DFAR and IFAR (fault address registers) and the DFSR
      and IFSR (fault status registers) for data aborts and
      prefetch aborts, since if we end up taking the MMU fault
      to AArch64 rather than AArch32 this will need to end up
      in different system registers.
      
      This patch does a refactoring which moves the setting of the
      AArch32 DFAR/DFSR/IFAR/IFSR from the point where the exception
      is raised to the point where it is taken. (This is no change
      for cores with an MMU, retains the existing clearly incorrect
      behaviour for ARM946 of trashing the MP access permissions
      registers which share the c5_data and c5_insn state fields,
      and has no effect for v7M because we don't implement its
      MPU fault status or address registers.)
      
      As a side effect of the cleanup we fix a bug in the AArch64
      linux-user mode code where we were passing a 64 bit fault
      address through the 32 bit c6_data/c6_insn fields: it now
      goes via the always-64-bit exception.vaddress.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      abf1172f
    • P
      target-arm: Implement AArch64 DAIF system register · c2b820fe
      Peter Maydell 提交于
      Implement the DAIF system register which is a view of the
      DAIF bits in PSTATE. To avoid needing a readfn, we widen
      the daif field in CPUARMState to uint64_t.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      c2b820fe
    • P
      target-arm: Split out private-to-target functions into internals.h · ccd38087
      Peter Maydell 提交于
      Currently cpu.h defines a mixture of functions and types needed by
      the rest of QEMU and those needed only by files within target-arm/.
      Split the latter out into a new header so they aren't needlessly
      exposed further than required.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      ccd38087
  2. 14 3月, 2014 2 次提交
  3. 10 3月, 2014 1 次提交
  4. 27 2月, 2014 15 次提交
  5. 20 2月, 2014 4 次提交
  6. 31 1月, 2014 1 次提交
  7. 13 1月, 2014 1 次提交
  8. 09 1月, 2014 2 次提交
    • A
      target-arm: Give the FPSCR rounding modes names · 4d3da0f3
      Alexander Graf 提交于
      When setting rounding modes we currently just hardcode the numeric values
      for rounding modes in a big switch statement.
      
      With AArch64 support coming, we will need to refer to these rounding modes
      at different places throughout the code though, so let's better give them
      names so we don't get confused by accident.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      [WN: Commit message tweak, use names from ARM ARM.]
      Signed-off-by: NWill Newton <will.newton@linaro.org>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      4d3da0f3
    • P
      target-arm: Widen exclusive-access support struct fields to 64 bits · 03d05e2d
      Peter Maydell 提交于
      In preparation for adding support for A64 load/store exclusive instructions,
      widen the fields in the CPU state struct that deal with address and data values
      for exclusives from 32 to 64 bits. Although in practice AArch64 and AArch32
      exclusive accesses will be generally separate there are some odd theoretical
      corner cases (eg you should be able to do the exclusive load in AArch32, take
      an exception to AArch64 and successfully do the store exclusive there), and it's
      also easier to reason about.
      
      The changes in semantics for the variables are:
       exclusive_addr  -> extended to 64 bits; -1ULL for "monitor lost",
         otherwise always < 2^32 for AArch32
       exclusive_val   -> extended to 64 bits. 64 bit exclusives in AArch32 now
         use the high half of exclusive_val instead of a separate exclusive_high
       exclusive_high  -> is no longer used in AArch32; extended to 64 bits as
         it will be needed for AArch64's pair-of-64-bit-values exclusives.
       exclusive_test  -> extended to 64 bits, as it is an address. Since this is
         a linux-user-only field, in arm-linux-user it will always have the top
         32 bits zero.
       exclusive_info  -> stays 32 bits, as it is neither data nor address, but
         simply holds register indexes etc. AArch64 will be able to fit all its
         information into 32 bits as well.
      
      Note that the refactoring of gen_store_exclusive() coincidentally fixes
      a minor bug where ldrexd would incorrectly update the first CPU register
      even if the load for the second register faulted.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      03d05e2d
  9. 08 1月, 2014 6 次提交
    • A
      target-arm: Give the FPSCR rounding modes names · f9dfa558
      Alexander Graf 提交于
      When setting rounding modes we currently just hardcode the numeric values
      for rounding modes in a big switch statement.
      
      With AArch64 support coming, we will need to refer to these rounding modes
      at different places throughout the code though, so let's better give them
      names so we don't get confused by accident.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      [WN: Commit message tweak, use names from ARM ARM.]
      Signed-off-by: NWill Newton <will.newton@linaro.org>
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      f9dfa558
    • P
      target-arm: Widen exclusive-access support struct fields to 64 bits · 90ba562c
      Peter Maydell 提交于
      In preparation for adding support for A64 load/store exclusive instructions,
      widen the fields in the CPU state struct that deal with address and data values
      for exclusives from 32 to 64 bits. Although in practice AArch64 and AArch32
      exclusive accesses will be generally separate there are some odd theoretical
      corner cases (eg you should be able to do the exclusive load in AArch32, take
      an exception to AArch64 and successfully do the store exclusive there), and it's
      also easier to reason about.
      
      The changes in semantics for the variables are:
       exclusive_addr  -> extended to 64 bits; -1ULL for "monitor lost",
         otherwise always < 2^32 for AArch32
       exclusive_val   -> extended to 64 bits. 64 bit exclusives in AArch32 now
         use the high half of exclusive_val instead of a separate exclusive_high
       exclusive_high  -> is no longer used in AArch32; extended to 64 bits as
         it will be needed for AArch64's pair-of-64-bit-values exclusives.
       exclusive_test  -> extended to 64 bits, as it is an address. Since this is
         a linux-user-only field, in arm-linux-user it will always have the top
         32 bits zero.
       exclusive_info  -> stays 32 bits, as it is neither data nor address, but
         simply holds register indexes etc. AArch64 will be able to fit all its
         information into 32 bits as well.
      
      Note that the refactoring of gen_store_exclusive() coincidentally fixes
      a minor bug where ldrexd would incorrectly update the first CPU register
      even if the load for the second register faulted.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      90ba562c
    • P
      target-arm: Widen thread-local register state fields to 64 bits · e4fe830b
      Peter Maydell 提交于
      The common pattern for system registers in a 64-bit capable ARM
      CPU is that when in AArch32 the cp15 register is a view of the
      bottom 32 bits of the 64-bit AArch64 system register; writes in
      AArch32 leave the top half unchanged. The most natural way to
      model this is to have the state field in the CPU struct be a
      64 bit value, and simply have the AArch32 TCG code operate on
      a pointer to its lower half.
      
      For aarch64-linux-user the only registers we need to share like
      this are the thread-local-storage ones. Widen their fields to
      64 bits and provide the 64 bit reginfo struct to make them
      visible in AArch64 state. Note that minor cleanup of the AArch64
      system register encoding space means We can share the TPIDR_EL1
      reginfo but need split encodings for TPIDR_EL0 and TPIDRRO_EL0.
      
      Since we're touching almost every line in QEMU that uses the
      c13_tls* fields in this patch anyway, we take the opportunity
      to rename them in line with the standard ARM architectural names
      for these registers.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      e4fe830b
    • P
      target-arm: Widen thread-local register state fields to 64 bits · 19917791
      Peter Maydell 提交于
      The common pattern for system registers in a 64-bit capable ARM
      CPU is that when in AArch32 the cp15 register is a view of the
      bottom 32 bits of the 64-bit AArch64 system register; writes in
      AArch32 leave the top half unchanged. The most natural way to
      model this is to have the state field in the CPU struct be a
      64 bit value, and simply have the AArch32 TCG code operate on
      a pointer to its lower half.
      
      For aarch64-linux-user the only registers we need to share like
      this are the thread-local-storage ones. Widen their fields to
      64 bits and provide the 64 bit reginfo struct to make them
      visible in AArch64 state. Note that minor cleanup of the AArch64
      system register encoding space means We can share the TPIDR_EL1
      reginfo but need split encodings for TPIDR_EL0 and TPIDRRO_EL0.
      
      Since we're touching almost every line in QEMU that uses the
      c13_tls* fields in this patch anyway, we take the opportunity
      to rename them in line with the standard ARM architectural names
      for these registers.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      19917791
    • P
      target-arm: A64: Implement minimal set of EL0-visible sysregs · b0d2b7d0
      Peter Maydell 提交于
      Implement an initial minimal set of EL0-visible system registers:
       * NZCV
       * FPCR
       * FPSR
       * CTR_EL0
       * DCZID_EL0
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      b0d2b7d0
    • P
      target-arm: Remove ARMCPU/CPUARMState from cpregs APIs used by decoder · 60322b39
      Peter Maydell 提交于
      The cpregs APIs used by the decoder (get_arm_cp_reginfo() and
      cp_access_ok()) currently take either a CPUARMState* or an ARMCPU*.
      This is problematic for the A64 decoder, which doesn't pass the
      environment pointer around everywhere the way the 32 bit decoder
      does. Adjust the parameters these functions take so that we can
      copy only the relevant info from the CPUARMState into the
      DisasContext and then use that.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      60322b39
  10. 05 1月, 2014 1 次提交
  11. 18 12月, 2013 2 次提交
    • P
      target-arm: A64: provide functions for accessing FPCR and FPSR · f903fa22
      Peter Maydell 提交于
      The information which AArch32 holds in the FPSCR is split for
      AArch64 into two logically distinct registers, FPSR and FPCR.
      Since they are carefully arranged to use non-overlapping bits,
      we leave the underlying state in the same place, and provide
      accessor functions which just update the appropriate bits
      via vfp_get_fpscr() and vfp_set_fpscr().
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NRichard Henderson <rth@twiddle.net>
      f903fa22
    • P
      target-arm: Clean up handling of AArch64 PSTATE · d356312f
      Peter Maydell 提交于
      The env->pstate field is a little odd since it doesn't strictly
      speaking represent an architectural register. However it's convenient
      for QEMU to use it to hold the various PSTATE architectural bits
      in the same format the architecture specifies for SPSR registers
      (since this is the same format the kernel uses for signal handlers
      and the KVM register). Add some structure to how we deal with it:
       * document what env->pstate is
       * add some #defines for various bits in it
       * add helpers for reading/writing it taking account of caching
         of NZCV, and use them where appropriate
       * reset it on startup
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1385645602-18662-3-git-send-email-peter.maydell@linaro.org
      Reviewed-by: NChristoffer Dall <christoffer.dall@linaro.org>
      d356312f