target-arm queue
The following changes since commit 1430500bb8ba0bf15bad235439d62276c1b6b22f:
Merge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into staging (2014-10-23 17:05:15 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20141024
for you to fetch changes up to dbe9d1636787dd226d3f9a61c07fbc27e0db5bbf:
target-arm: A32: Emulate the SMC instruction (2014-10-24 12:19:15 +0100)
----------------------------------------------------------------
target-arm queue:
* remove pointless 'info pcmcia' and a lot of now-dead code
* register ARM cpu reset handlers even if not using -kernel
* update to libvixl 1.6
* various minor code cleanups
* support PSCI under TCG ('virt' machine can now be shut down, SMP configurations work)
* correct the sense of the AArch64 DCZID DZP bit
* report a valid L1Ip field in CTR_EL0 for CPU type "any"
* correctly UNDEF writes to FPINST/FPINST2 from EL0
* more preparatory code refactoring for EL2/EL3 support
----------------------------------------------------------------
Ard Biesheuvel (2):
hw/arm/boot: register cpu reset handlers if using -bios
target-arm: add missing PSCI constants needed for PSCI emulation
Chen Gang (1):
disas/libvixl/a64/instructions-a64.h: Remove unused constants
Claudio Fontana (1):
hw/arm/virt: mark timer in fdt as v8-compatible
Dr. David Alan Gilbert (1):
omap_gpmc.c: Remove duplicate assignment
Fabian Aggeler (4):
target-arm: increase arrays of registers R13 & R14
target-arm: add arm_is_secure() function
target-arm: make arm_current_el() return EL3
target-arm: A32: Emulate the SMC instruction
Greg Bellows (1):
target-arm: rename arm_current_pl to arm_current_el
KONRAD Frederic (1):
arm_gic: remove unused parameter.
Markus Armbruster (1):
hmp: Remove "info pcmcia"
Peter Maydell (6):
disas/libvixl: Update to libvixl 1.6
target-arm: Handle SMC/HVC undef-if-no-ELx in pre_* helpers
target-arm: Add support for A32 and T32 HVC and SMC insns
target-arm: Correct sense of the DCZID DZP bit
target-arm: Report a valid L1Ip field in CTR_EL0 for CPU type "any"
target-arm: correctly UNDEF writes to FPINST/FPINST2 from EL0
Rob Herring (4):
target-arm: add powered off cpu state
target-arm: do not set do_interrupt handlers for ARM and AArch64 user modes
target-arm: add emulation of PSCI calls for system emulation arm/virt: enable PSCI emulation support for system emulation
Sergey Fedorov (1):
target-arm: reject switching to monitor mode
disas/arm-a64.cc | 2 +- disas/libvixl/README | 2 +- disas/libvixl/a64/assembler-a64.h | 385 ++++++++++++++++++++++------------ disas/libvixl/a64/decoder-a64.cc | 34 ++- disas/libvixl/a64/decoder-a64.h | 102 ++++++--- disas/libvixl/a64/disasm-a64.cc | 259 +++++++++++++++-------- disas/libvixl/a64/disasm-a64.h | 84 +++++--- disas/libvixl/a64/instructions-a64.cc | 22 +- disas/libvixl/a64/instructions-a64.h | 64 +++--- disas/libvixl/code-buffer.h | 113 ++++++++++ disas/libvixl/utils.cc | 1 + disas/libvixl/utils.h | 3 +- hmp-commands.hx | 2 - hw/arm/boot.c | 17 +- hw/arm/virt.c | 97 ++++----- hw/ide/microdrive.c | 1 - hw/intc/arm_gic.c | 4 +- hw/intc/armv7m_nvic.c | 2 +- hw/intc/gic_internal.h | 2 +- hw/misc/omap_gpmc.c | 2 - hw/pcmcia/pxa2xx.c | 21 -- include/hw/pcmcia.h | 6 - monitor.c | 8 - target-arm/Makefile.objs | 1 + target-arm/cpu-qom.h | 7 + target-arm/cpu.c | 24 ++- target-arm/cpu.h | 111 ++++++++-- target-arm/cpu64.c | 4 +- target-arm/helper-a64.c | 15 +- target-arm/helper.c | 48 +++-- target-arm/internals.h | 24 ++- target-arm/kvm-consts.h | 40 ++++ target-arm/machine.c | 9 +- target-arm/op_helper.c | 52 +++-- target-arm/psci.c | 242 +++++++++++++++++++++ target-arm/translate-a64.c | 16 +- target-arm/translate.c | 110 ++++++++-- target-arm/translate.h | 6 +- vl.c | 44 ---- 39 files changed, 1395 insertions(+), 591 deletions(-) create mode 100644 disas/libvixl/code-buffer.h create mode 100644 target-arm/psci.c
[Qemu-devel] [PULL 22/23] target-arm: make arm_current_el() return EL3
From: Fabian Aggeler <[email protected]>
Make arm_current_el() return EL3 for secure PL1 and monitor mode. Increase MMU modes since mmu_index is directly inferred from arm_ current_el(). Change assertion in arm_el_is_aa64() to allow EL3.
Message-id: [email protected]
--- target-arm/cpu.h | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
target-arm/cpu.h +20 -9
@@ -100,7 +100,7 @@ typedef uint32_t ARMReadCPFunc(void *opaque, int cp_info,struct arm_boot_info ; -#define NB_MMU_MODES 2 +#define NB_MMU_MODES 4/* We currently assume float and double are IEEE single and double precision respectively.
@@ -803,11 +803,12 @@ static inline bool arm_is_secure(CPUARMState *env)/* Return true if the specified exception level is running in AArch64 state. */ static inline bool arm_el_is_aa64 (CPUARMState *env,int el) { -/* We don't currently support EL2 or EL3, and this isn't valid for EL0 +/* We don't currently support EL2, and this isn't valid for EL0 * (if we're in EL0, is_a64() is what you want, and if we're not in EL0 * then the state of EL0 isn't well defined.) */ -assert (el ==1 ); +assert (el ==1 || el ==3 ); +/* AArch64-capable CPUs always run with EL1 in AArch64 mode. This * is a QEMU-imposed simplification which we may wish to change later. * If we in future support EL2 and/or EL3, then the state of lower
@@ -996,17 +997,27 @@ static inline bool cptype_valid(int cptype)*/ static inline int arm_current_el (CPUARMState *env) { -if (env->aarch64) { +if (is_a64 (env)) {return extract32 (env->pstate,2 ,2 ); } -if ((env->uncached_cpsr &0x1f ) ==ARM_CPU_MODE_USR ) { +switch (env->uncached_cpsr &0x1f ) { +case ARM_CPU_MODE_USR :return 0 ; +case ARM_CPU_MODE_HYP : +return 2 ; +case ARM_CPU_MODE_MON : +return 3 ; +default : +if (arm_is_secure (env) && !arm_el_is_aa64 (env,3 )) { +/* If EL3 is 32-bit then all secure privileged modes run in +* EL3 +*/ +return 3 ; + } + +return 1 ; } -/* We don't currently implement the Virtualization or TrustZone -* extensions, so EL2 and EL3 don't exist for us. -*/ -return 1 ; }typedef struct ARMCPRegInfo ARMCPRegInfo ;
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 16/23] target-arm: Report a valid L1Ip field in CTR_EL0 for CPU type "any"
In reply to Peter MaydellFor the CPU type "any" (only used with linux-user) we were reporting the L1Ip field as 0b00, which is reserved. Change this field to 0b10 instead, indicating a VIPT icache as the comment describes.
Message-id: [email protected]
--- target-arm/cpu64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-arm/cpu64.c +1 -1
@@ -151,7 +151,7 @@ static void aarch64_any_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_V8_SHA256 );set_feature (&cpu->env,ARM_FEATURE_V8_PMULL );set_feature (&cpu->env,ARM_FEATURE_CRC ); - cpu->ctr =0x80030003 ;/* 32 byte I and D cacheline size, VIPT icache */ + cpu->ctr =0x80038003 ;/* 32 byte I and D cacheline size, VIPT icache */ cpu->dcz_blocksize = 7; /* 512 bytes */ }#endif
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 15/23] target-arm: Correct sense of the DCZID DZP bit
In reply to Peter MaydellThe DZP bit in the DCZID system register should be set if the control bits which prohibit use of the DC ZVA instruction have been set (it stands for Data Zero Prohibited). However we had the sense of the test inverted; fix this so that the bit reads correctly.
To avoid this regressing the behaviour of the user-mode emulator, we must set the DZE bit in the SCTLR for that config so that userspace continues to see DZP as zero (it was getting the correct result by accident previously).
Message-id: [email protected]
--- target-arm/cpu.c | 4 ++-- target-arm/helper.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
target-arm/cpu.c +2 -2
@@ -108,8 +108,8 @@ static void arm_cpu_reset(CPUState *s) env->aarch64 =1 ;#if defined(CONFIG_USER_ONLY ) env->pstate = PSTATE_MODE_EL0t; -/* Userspace expects access to CTL_EL0 and the cache ops */ - env->cp15.c1_sys |=SCTLR_UCT |SCTLR_UCI ; +/* Userspace expects access to DC ZVA, CTL_EL0 and the cache ops */ + env->cp15.c1_sys |=SCTLR_UCT |SCTLR_UCI |SCTLR_DZE ;/* and to the FP/Neon instructions */ env->cp15.c1_coproc =deposit64 (env->cp15.c1_coproc,20 ,2 ,3 );#else
target-arm/helper.c +1 -1
@@ -2018,7 +2018,7 @@ static uint64_t aa64_dczid_read(CPUARMState *env, const ARMCPRegInfo *ri)int dzp_bit =1 <<4 ;/* DZP indicates whether DC ZVA access is allowed */ -if (aa64_zva_access (env,NULL ) !=CP_ACCESS_OK ) { +if (aa64_zva_access (env,NULL ) ==CP_ACCESS_OK ) { dzp_bit =0 ; }return cpu->dcz_blocksize | dzp_bit;
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 11/23] target-arm: Handle SMC/HVC undef-if-no-ELx in pre_* helpers
In reply to Peter MaydellSMC must UNDEF if EL3 is not implemented; similarly HVC UNDEFs if EL2 is not implemented. Move the handling of this from translate-a64.c into the pre_smc and pre_hvc helper functions. This is necessary because use of these instructions for PSCI takes precedence over this UNDEF case, and we can't tell if this is a PSCI call until runtime.
Message-id: [email protected]
--- target-arm/op_helper.c | 17 ++++++++++------- target-arm/translate-a64.c | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-)
target-arm/op_helper.c +10 -7
@@ -392,10 +392,11 @@ void HELPER(pre_hvc)(CPUARMState *env)bool secure = false;bool undef; -/* We've already checked that EL2 exists at translation time. -* EL3.HCE has priority over EL2.HCD. -*/ -if (arm_feature (env,ARM_FEATURE_EL3 )) { +if (!arm_feature (env,ARM_FEATURE_EL2 )) { +/* If EL2 doesn't exist, HVC always UNDEFs */ + undef = true; + }else if (arm_feature (env,ARM_FEATURE_EL3 )) { +/* EL3.HCE has priority over EL2.HCD. */ undef = !(env->cp15.scr_el3 &SCR_HCE ); }else { undef = env->cp15.hcr_el2 &HCR_HCD ;
@@ -429,13 +430,15 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome)*/ bool undef =is_a64 (env) ? smd : (!secure && smd); -/* In NS EL1, HCR controlled routing to EL2 has priority over SMD. */ -if (!secure && cur_el ==1 && (env->cp15.hcr_el2 &HCR_TSC )) { +if (!arm_feature (env,ARM_FEATURE_EL3 )) { +/* If we have no EL3 then SMC always UNDEFs */ + undef = true; + }else if (!secure && cur_el ==1 && (env->cp15.hcr_el2 &HCR_TSC )) { +/* In NS EL1, HCR controlled routing to EL2 has priority over SMD. */ env->exception.syndrome = syndrome;raise_exception (env,EXCP_HYP_TRAP ); } -/* We've already checked that EL3 exists at translation time. */ if (undef) { env->exception.syndrome =syn_uncategorized ();raise_exception (env,EXCP_UDEF );
target-arm/translate-a64.c +2 -2
@@ -1485,7 +1485,7 @@ static void disas_exc(DisasContext *s, uint32_t insn)gen_exception_insn (s,0 ,EXCP_SWI ,syn_aa64_svc (imm16));break ;case 2 : -if (!arm_dc_feature (s,ARM_FEATURE_EL2 ) || s->current_pl ==0 ) { +if (s->current_pl ==0 ) {unallocated_encoding (s);break ; }
@@ -1498,7 +1498,7 @@ static void disas_exc(DisasContext *s, uint32_t insn)gen_exception_insn (s,0 ,EXCP_HVC ,syn_aa64_hvc (imm16));break ;case 3 : -if (!arm_dc_feature (s,ARM_FEATURE_EL3 ) || s->current_pl ==0 ) { +if (s->current_pl ==0 ) {unallocated_encoding (s);break ; }
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 14/23] arm/virt: enable PSCI emulation support for system emulation
In reply to Peter MaydellFrom: Rob Herring <[email protected]>
Now that we have PSCI emulation, enable it for the virt platform. This simplifies the virt machine a bit now that PSCI no longer needs to be a KVM only feature.
Message-id: [email protected]
--- hw/arm/virt.c | 82 +++++++++++++++++++++++++++-------------------------------- 1 file changed, 38 insertions(+), 44 deletions(-)
hw/arm/virt.c +38 -44
@@ -191,47 +191,48 @@ static void create_fdt(VirtBoardInfo *vbi)static void fdt_add_psci_node (const VirtBoardInfo *vbi) { +uint32_t cpu_suspend_fn; +uint32_t cpu_off_fn; +uint32_t cpu_on_fn; +uint32_t migrate_fn;void *fdt = vbi->fdt;ARMCPU *armcpu =ARM_CPU (qemu_get_cpu (0 )); -/* No PSCI for TCG yet */ -if (kvm_enabled ()) { -uint32_t cpu_suspend_fn; -uint32_t cpu_off_fn; -uint32_t cpu_on_fn; -uint32_t migrate_fn; - -qemu_fdt_add_subnode (fdt,"/psci" ); -if (armcpu->psci_version ==2 ) { -const char comp[] ="arm,psci-0.2\0arm,psci" ; -qemu_fdt_setprop (fdt,"/psci" ,"compatible" , comp,sizeof (comp)); - - cpu_off_fn =QEMU_PSCI_0_2_FN_CPU_OFF ; -if (arm_feature (&armcpu->env,ARM_FEATURE_AARCH64 )) { - cpu_suspend_fn =QEMU_PSCI_0_2_FN64_CPU_SUSPEND ; - cpu_on_fn =QEMU_PSCI_0_2_FN64_CPU_ON ; - migrate_fn =QEMU_PSCI_0_2_FN64_MIGRATE ; - }else { - cpu_suspend_fn =QEMU_PSCI_0_2_FN_CPU_SUSPEND ; - cpu_on_fn =QEMU_PSCI_0_2_FN_CPU_ON ; - migrate_fn =QEMU_PSCI_0_2_FN_MIGRATE ; - } - }else { -qemu_fdt_setprop_string (fdt,"/psci" ,"compatible" ,"arm,psci" ); +qemu_fdt_add_subnode (fdt,"/psci" ); +if (armcpu->psci_version ==2 ) { +const char comp[] ="arm,psci-0.2\0arm,psci" ; +qemu_fdt_setprop (fdt,"/psci" ,"compatible" , comp,sizeof (comp)); - cpu_suspend_fn =QEMU_PSCI_0_1_FN_CPU_SUSPEND ; - cpu_off_fn =QEMU_PSCI_0_1_FN_CPU_OFF ; - cpu_on_fn =QEMU_PSCI_0_1_FN_CPU_ON ; - migrate_fn =QEMU_PSCI_0_1_FN_MIGRATE ; + cpu_off_fn =QEMU_PSCI_0_2_FN_CPU_OFF ; +if (arm_feature (&armcpu->env,ARM_FEATURE_AARCH64 )) { + cpu_suspend_fn =QEMU_PSCI_0_2_FN64_CPU_SUSPEND ; + cpu_on_fn =QEMU_PSCI_0_2_FN64_CPU_ON ; + migrate_fn =QEMU_PSCI_0_2_FN64_MIGRATE ; + }else { + cpu_suspend_fn =QEMU_PSCI_0_2_FN_CPU_SUSPEND ; + cpu_on_fn =QEMU_PSCI_0_2_FN_CPU_ON ; + migrate_fn =QEMU_PSCI_0_2_FN_MIGRATE ; } + }else { +qemu_fdt_setprop_string (fdt,"/psci" ,"compatible" ,"arm,psci" ); -qemu_fdt_setprop_string (fdt,"/psci" ,"method" ,"hvc" ); - -qemu_fdt_setprop_cell (fdt,"/psci" ,"cpu_suspend" , cpu_suspend_fn); -qemu_fdt_setprop_cell (fdt,"/psci" ,"cpu_off" , cpu_off_fn); -qemu_fdt_setprop_cell (fdt,"/psci" ,"cpu_on" , cpu_on_fn); -qemu_fdt_setprop_cell (fdt,"/psci" ,"migrate" , migrate_fn); + cpu_suspend_fn =QEMU_PSCI_0_1_FN_CPU_SUSPEND ; + cpu_off_fn =QEMU_PSCI_0_1_FN_CPU_OFF ; + cpu_on_fn =QEMU_PSCI_0_1_FN_CPU_ON ; + migrate_fn =QEMU_PSCI_0_1_FN_MIGRATE ; } + +/* We adopt the PSCI spec's nomenclature, and use 'conduit' to refer +* to the instruction that should be used to invoke PSCI functions. +* However, the device tree binding uses 'method' instead, so that is +* what we should use here. +*/ +qemu_fdt_setprop_string (fdt,"/psci" ,"method" ,"hvc" ); + +qemu_fdt_setprop_cell (fdt,"/psci" ,"cpu_suspend" , cpu_suspend_fn); +qemu_fdt_setprop_cell (fdt,"/psci" ,"cpu_off" , cpu_off_fn); +qemu_fdt_setprop_cell (fdt,"/psci" ,"cpu_on" , cpu_on_fn); +qemu_fdt_setprop_cell (fdt,"/psci" ,"migrate" , migrate_fn); }static void fdt_add_timer_nodes (const VirtBoardInfo *vbi)
@@ -548,16 +549,6 @@ static void machvirt_init(MachineState *machine) vbi->smp_cpus = smp_cpus; -/* -* Only supported method of starting secondary CPUs is PSCI and -* PSCI is not yet supported with TCG, so limit smp_cpus to 1 -* if we're not using KVM. -*/ -if (!kvm_enabled () && smp_cpus >1 ) { -error_report ("mach-virt: must enable KVM to use multiple CPUs" ); -exit (1 ); - } -if (machine->ram_size > vbi->memmap[VIRT_MEM ].size) {error_report ("mach-virt: cannot model more than 30GB RAM" );exit (1 );
@@ -575,6 +566,9 @@ static void machvirt_init(MachineState *machine) } cpuobj =object_new (object_class_get_name (oc)); +object_property_set_int (cpuobj,QEMU_PSCI_CONDUIT_HVC ,"psci-conduit" , +NULL ); +/* Secondary CPUs start in PSCI powered-down state */ if (n >0 ) {object_property_set_bool (cpuobj, true,"start-powered-off" ,NULL );
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 09/23] target-arm: do not set do_interrupt handlers for ARM and AArch64 user modes
In reply to Peter MaydellFrom: Rob Herring <[email protected]>
User mode emulation should never get interrupts and thus should not use the system emulation exception handler function. Remove the reference, and '#ifndef USER_MODE_ONLY' the function itself as well, so that we can add system mode only functionality to it.
Message-id: [email protected]
--- target-arm/cpu.c | 2 +- target-arm/cpu64.c | 2 ++ target-arm/helper-a64.c | 3 +++ target-arm/helper.c | 5 ----- 4 files changed, 6 insertions(+), 6 deletions(-)
target-arm/cpu.c +1 -1
@@ -1109,7 +1109,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = arm_cpu_class_by_name; cc->has_work = arm_cpu_has_work; - cc->do_interrupt = arm_cpu_do_interrupt; cc->cpu_exec_interrupt = arm_cpu_exec_interrupt; cc->dump_state = arm_cpu_dump_state; cc->set_pc = arm_cpu_set_pc;
@@ -1118,6 +1117,7 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)#ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = arm_cpu_handle_mmu_fault;#else + cc->do_interrupt = arm_cpu_do_interrupt; cc->get_phys_page_debug = arm_cpu_get_phys_page_debug; cc->vmsd = &vmstate_arm_cpu;#endif
target-arm/cpu64.c +2 -0
@@ -196,7 +196,9 @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data) {CPUClass *cc =CPU_CLASS (oc); +#if !defined(CONFIG_USER_ONLY ) cc->do_interrupt = aarch64_cpu_do_interrupt; +#endif cc->cpu_exec_interrupt = arm_cpu_exec_interrupt; cc->set_pc = aarch64_cpu_set_pc; cc->gdb_read_register = aarch64_cpu_gdb_read_register;
target-arm/helper-a64.c +3 -0
@@ -438,6 +438,8 @@ uint64_t HELPER(crc32c_64)(uint64_t acc, uint64_t val, uint32_t bytes)return crc32c (acc, buf, bytes) ^0xffffffff ; } +#if !defined(CONFIG_USER_ONLY ) +/* Handle a CPU exception. */ void aarch64_cpu_do_interrupt (CPUState *cs) {
@@ -518,3 +520,4 @@ void aarch64_cpu_do_interrupt(CPUState *cs) env->pc = addr; cs->interrupt_request |= CPU_INTERRUPT_EXITTB; } +#endif
target-arm/helper.c +0 -5
@@ -3644,11 +3644,6 @@ uint32_t HELPER(rbit)(uint32_t x)#if defined(CONFIG_USER_ONLY ) -void arm_cpu_do_interrupt (CPUState *cs) -{ - cs->exception_index =-1 ; -} -int arm_cpu_handle_mmu_fault (CPUState *cs,vaddr address,int rw,int mmu_idx) {
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 10/23] target-arm: add missing PSCI constants needed for PSCI emulation
In reply to Peter MaydellFrom: Ard Biesheuvel <[email protected]>
This adds some PSCI function IDs and symbolic return codes that are needed to implement PSCI emulation in TCG mode.
Message-id: [email protected]
--- target-arm/kvm-consts.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
target-arm/kvm-consts.h +40 -0
@@ -59,14 +59,21 @@ MISMATCH_CHECK(QEMU_PSCI_0_1_FN_MIGRATE, KVM_PSCI_FN_MIGRATE) (QEMU_PSCI_0_2_FN_BASE + QEMU_PSCI_0_2_64BIT)#define QEMU_PSCI_0_2_FN64 (n) (QEMU_PSCI_0_2_FN64_BASE + (n)) +#define QEMU_PSCI_0_2_FN_PSCI_VERSION QEMU_PSCI_0_2_FN(0)#define QEMU_PSCI_0_2_FN_CPU_SUSPEND QEMU_PSCI_0_2_FN(1)#define QEMU_PSCI_0_2_FN_CPU_OFF QEMU_PSCI_0_2_FN(2)#define QEMU_PSCI_0_2_FN_CPU_ON QEMU_PSCI_0_2_FN(3) +#define QEMU_PSCI_0_2_FN_AFFINITY_INFO QEMU_PSCI_0_2_FN(4)#define QEMU_PSCI_0_2_FN_MIGRATE QEMU_PSCI_0_2_FN(5) +#define QEMU_PSCI_0_2_FN_MIGRATE_INFO_TYPE QEMU_PSCI_0_2_FN(6) +#define QEMU_PSCI_0_2_FN_MIGRATE_INFO_UP_CPU QEMU_PSCI_0_2_FN(7) +#define QEMU_PSCI_0_2_FN_SYSTEM_OFF QEMU_PSCI_0_2_FN(8) +#define QEMU_PSCI_0_2_FN_SYSTEM_RESET QEMU_PSCI_0_2_FN(9)#define QEMU_PSCI_0_2_FN64_CPU_SUSPEND QEMU_PSCI_0_2_FN64(1)#define QEMU_PSCI_0_2_FN64_CPU_OFF QEMU_PSCI_0_2_FN64(2)#define QEMU_PSCI_0_2_FN64_CPU_ON QEMU_PSCI_0_2_FN64(3) +#define QEMU_PSCI_0_2_FN64_AFFINITY_INFO QEMU_PSCI_0_2_FN64(4)#define QEMU_PSCI_0_2_FN64_MIGRATE QEMU_PSCI_0_2_FN64(5)MISMATCH_CHECK (QEMU_PSCI_0_2_FN_CPU_SUSPEND ,PSCI_0_2_FN_CPU_SUSPEND )
@@ -77,6 +84,39 @@ MISMATCH_CHECK(QEMU_PSCI_0_2_FN64_CPU_SUSPEND, PSCI_0_2_FN64_CPU_SUSPEND) MISMATCH_CHECK(QEMU_PSCI_0_2_FN64_CPU_ON, PSCI_0_2_FN64_CPU_ON)MISMATCH_CHECK (QEMU_PSCI_0_2_FN64_MIGRATE ,PSCI_0_2_FN64_MIGRATE ) +/* PSCI v0.2 return values used by TCG emulation of PSCI */ + +/* No Trusted OS migration to worry about when offlining CPUs */ +#define QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED 2 + +/* We implement version 0.2 only */ +#define QEMU_PSCI_0_2_RET_VERSION_0_2 2 + +MISMATCH_CHECK(QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED, PSCI_0_2_TOS_MP) +MISMATCH_CHECK (QEMU_PSCI_0_2_RET_VERSION_0_2 , + (PSCI_VERSION_MAJOR (0 ) |PSCI_VERSION_MINOR (2 ))) + +/* PSCI return values (inclusive of all PSCI versions) */ +#define QEMU_PSCI_RET_SUCCESS 0 +#define QEMU_PSCI_RET_NOT_SUPPORTED -1 +#define QEMU_PSCI_RET_INVALID_PARAMS -2 +#define QEMU_PSCI_RET_DENIED -3 +#define QEMU_PSCI_RET_ALREADY_ON -4 +#define QEMU_PSCI_RET_ON_PENDING -5 +#define QEMU_PSCI_RET_INTERNAL_FAILURE -6 +#define QEMU_PSCI_RET_NOT_PRESENT -7 +#define QEMU_PSCI_RET_DISABLED -8 + +MISMATCH_CHECK(QEMU_PSCI_RET_SUCCESS, PSCI_RET_SUCCESS) +MISMATCH_CHECK(QEMU_PSCI_RET_NOT_SUPPORTED, PSCI_RET_NOT_SUPPORTED) +MISMATCH_CHECK(QEMU_PSCI_RET_INVALID_PARAMS, PSCI_RET_INVALID_PARAMS) +MISMATCH_CHECK(QEMU_PSCI_RET_DENIED, PSCI_RET_DENIED) +MISMATCH_CHECK(QEMU_PSCI_RET_ALREADY_ON, PSCI_RET_ALREADY_ON) +MISMATCH_CHECK(QEMU_PSCI_RET_ON_PENDING, PSCI_RET_ON_PENDING) +MISMATCH_CHECK(QEMU_PSCI_RET_INTERNAL_FAILURE, PSCI_RET_INTERNAL_FAILURE) +MISMATCH_CHECK(QEMU_PSCI_RET_NOT_PRESENT, PSCI_RET_NOT_PRESENT) +MISMATCH_CHECK (QEMU_PSCI_RET_DISABLED ,PSCI_RET_DISABLED ) +/* Note that KVM uses overlapping values for AArch32 and AArch64 * target CPU numbers. AArch32 targets: */
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 12/23] target-arm: Add support for A32 and T32 HVC and SMC insns
In reply to Peter MaydellAdd support for HVC and SMC instructions to the A32 and T32 decoder. Using these for real exceptions to EL2 or EL3 is currently not supported (the do_interrupt routine does not handle them) but we require the instruction support to implement PSCI.
Message-id: [email protected]
--- target-arm/internals.h | 10 +++++ target-arm/translate.c | 103 +++++++++++++++++++++++++++++++++++++++++++------ target-arm/translate.h | 2 + 3 files changed, 104 insertions(+), 11 deletions(-)
target-arm/internals.h +10 -0
@@ -236,6 +236,16 @@ static inline uint32_t syn_aa32_svc(uint32_t imm16, bool is_thumb) | (is_thumb ? 0 : ARM_EL_IL); } +static inline uint32_t syn_aa32_hvc (uint32_t imm16) +{ +return (EC_AA32_HVC <<ARM_EL_EC_SHIFT ) |ARM_EL_IL | (imm16 &0xffff ); +} + +static inline uint32_t syn_aa32_smc (void ) +{ +return (EC_AA32_SMC <<ARM_EL_EC_SHIFT ) |ARM_EL_IL ; +} +static inline uint32_t syn_aa64_bkpt (uint32_t imm16) {return (EC_AA64_BKPT <<ARM_EL_EC_SHIFT ) |ARM_EL_IL | (imm16 &0xffff );
target-arm/translate.c +92 -11
141 lines not on this page · raw message
target-arm/translate.h +2 -0
@@ -84,6 +84,8 @@ static inline int get_mem_index(DisasContext *s)#define DISAS_EXC 6/* WFE */ #define DISAS_WFE 7 +#define DISAS_HVC 8 +#define DISAS_SMC 9#ifdef TARGET_AARCH64 void a64_translate_init (void );
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 17/23] target-arm: correctly UNDEF writes to FPINST/FPINST2 from EL0
In reply to Peter MaydellThe ARM ARM requires that the FPINST and FPINST2 VFP control registers are not accessible to code at EL0. We were already correctly implementing this for reads of these registers; add the missing check for the write code path.
Message-id: [email protected]
--- target-arm/translate.c | 3 +++ 1 file changed, 3 insertions(+)
target-arm/translate.c +3 -0
@@ -3232,6 +3232,9 @@ static int disas_vfp_insn(CPUARMState * env, DisasContext *s, uint32_t insn)break ;case ARM_VFP_FPINST :case ARM_VFP_FPINST2 : +if (IS_USER (s)) { +return 1 ; + } tmp =load_reg (s, rd);store_cpu_field (tmp, vfp.xregs[rn]);break ;
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 07/23] omap_gpmc.c: Remove duplicate assignment
In reply to Peter MaydellFrom: "Dr. David Alan Gilbert" <[email protected]>
This looks like an old merge error and should have no effect. (Build tested only)
Found by Coccinelle using Julia Lawall's script:
https://lkml.org/lkml/2014/8/23/128
Message-id: [email protected]
--- hw/misc/omap_gpmc.c | 2 -- 1 file changed, 2 deletions(-)
hw/misc/omap_gpmc.c +0 -2
@@ -466,8 +466,6 @@ void omap_gpmc_reset(struct omap_gpmc_s *s) s->cs_file[i].config[3 ] =0x10031003 ; s->cs_file[i].config[4 ] =0x10f1111 ; s->cs_file[i].config[5 ] =0 ; - s->cs_file[i].config[6 ] =0xf00 | (i ?0 :1 <<6 ); - s->cs_file[i].config[6 ] =0xf00 ;/* In theory we could probe attached devices for some CFG1 * bits here, but we just retain them across resets as they
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 08/23] target-arm: add powered off cpu state
In reply to Peter MaydellFrom: Rob Herring <[email protected]>
Add tracking of cpu power state in order to support powering off of cores in system emuluation. The initial state is determined by the start-powered-off QOM property.
Message-id: [email protected]
--- target-arm/cpu-qom.h | 2 ++ target-arm/cpu.c | 8 +++++++- target-arm/machine.c | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-)
target-arm/cpu-qom.h +2 -0
@@ -98,6 +98,8 @@ typedef struct ARMCPU {/* Should CPU start in PSCI powered-off state? */ bool start_powered_off; +/* CPU currently in PSCI powered-off state */ +bool powered_off;/* [QEMU_]KVM_ARM_TARGET_* constant for this CPU, or * QEMU_KVM_ARM_TARGET_NONE if the kernel doesn't support this CPU type.
target-arm/cpu.c +7 -1
@@ -40,7 +40,10 @@ static void arm_cpu_set_pc(CPUState *cs, vaddr value)static bool arm_cpu_has_work (CPUState *cs) { -return cs->interrupt_request & +ARMCPU *cpu =ARM_CPU (cs); + +return !cpu->powered_off + && cs->interrupt_request & (CPU_INTERRUPT_FIQ |CPU_INTERRUPT_HARD |CPU_INTERRUPT_VFIQ |CPU_INTERRUPT_VIRQ |CPU_INTERRUPT_EXITTB );
@@ -93,6 +96,9 @@ static void arm_cpu_reset(CPUState *s) env->vfp.xregs[ARM_VFP_MVFR1 ] = cpu->mvfr1; env->vfp.xregs[ARM_VFP_MVFR2 ] = cpu->mvfr2; + cpu->powered_off = cpu->start_powered_off; + s->halted = cpu->start_powered_off; +if (arm_feature (env,ARM_FEATURE_IWMMXT )) { env->iwmmxt.cregs[ARM_IWMMXT_wCID] =0x69051000 |'Q' ; }
target-arm/machine.c +3 -2
@@ -222,8 +222,8 @@ static int cpu_post_load(void *opaque, int version_id)const VMStateDescription vmstate_arm_cpu = { .name ="cpu" , - .version_id =20 , - .minimum_version_id =20 , + .version_id =21 , + .minimum_version_id =21 , .pre_save = cpu_pre_save, .post_load = cpu_post_load, .fields = (VMStateField []) {
@@ -263,6 +263,7 @@ const VMStateDescription vmstate_arm_cpu = {VMSTATE_UINT64 (env.exception.vaddress,ARMCPU ),VMSTATE_TIMER (gt_timer[GTIMER_PHYS ],ARMCPU ),VMSTATE_TIMER (gt_timer[GTIMER_VIRT ],ARMCPU ), +VMSTATE_BOOL (powered_off,ARMCPU ),VMSTATE_END_OF_LIST () }, .subsections = (VMStateSubsection[]) {
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 13/23] target-arm: add emulation of PSCI calls for system emulation
In reply to Peter MaydellFrom: Rob Herring <[email protected]>
Add support for handling PSCI calls in system emulation. Both version 0.1 and 0.2 of the PSCI spec are supported. Platforms can enable support by setting the "psci-conduit" QOM property on the cpus to SMC or HVC emulation and having a PSCI binding in their dtb.
Message-id: [email protected] [PMM: made system reset/off PSCI functions power down the CPU so
we obey the PSCI API requirement never to return from them; rearranged how the code is plumbed into the exception system, so that we split "is this a valid call?" from "do the call"]
--- target-arm/Makefile.objs | 1 + target-arm/cpu-qom.h | 5 + target-arm/cpu.c | 10 +- target-arm/cpu.h | 6 ++ target-arm/helper-a64.c | 6 ++ target-arm/helper.c | 6 ++ target-arm/internals.h | 12 +++ target-arm/op_helper.c | 16 ++++ target-arm/psci.c | 242 +++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 301 insertions(+), 3 deletions(-) create mode 100644 target-arm/psci.c
target-arm/Makefile.objs +1 -0
@@ -7,5 +7,6 @@ obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o obj-y += translate.o op_helper.o helper.o cpu.o obj-y += neon_helper.o iwmmxt_helper.o obj-y += gdbstub.o +obj-$(CONFIG_SOFTMMU) += psci.o obj-$(TARGET_AARCH64) += cpu64.o translate-a64.o helper-a64.o gdbstub64.o obj-y += crypto_helper.o
target-arm/cpu-qom.h +5 -0
@@ -101,6 +101,11 @@ typedef struct ARMCPU {/* CPU currently in PSCI powered-off state */ bool powered_off; +/* PSCI conduit used to invoke PSCI methods +* 0 - disabled, 1 - smc, 2 - hvc +*/ +uint32_t psci_conduit; +/* [QEMU_]KVM_ARM_TARGET_* constant for this CPU, or * QEMU_KVM_ARM_TARGET_NONE if the kernel doesn't support this CPU type. */
target-arm/cpu.c +7 -3
@@ -334,9 +334,12 @@ static void arm_cpu_initfn(Object *obj) cpu->psci_version =1 ;/* By default assume PSCI v0.1 */ cpu->kvm_target =QEMU_KVM_ARM_TARGET_NONE ; -if (tcg_enabled () && !inited) { - inited = true; -arm_translate_init (); +if (tcg_enabled ()) { + cpu->psci_version =2 ;/* TCG implements PSCI 0.2 */ +if (!inited) { + inited = true; +arm_translate_init (); + } } }
@@ -1090,6 +1093,7 @@ static const ARMCPUInfo arm_cpus[] = {static Property arm_cpu_properties[] = {DEFINE_PROP_BOOL ("start-powered-off" ,ARMCPU , start_powered_off, false), +DEFINE_PROP_UINT32 ("psci-conduit" ,ARMCPU , psci_conduit,0 ),DEFINE_PROP_UINT32 ("midr" ,ARMCPU , midr,0 ),DEFINE_PROP_END_OF_LIST () };
target-arm/cpu.h +6 -0
@@ -1484,4 +1484,10 @@ static inline void cpu_pc_from_tb(CPUARMState *env, TranslationBlock *tb) } } +enum { +QEMU_PSCI_CONDUIT_DISABLED =0 , +QEMU_PSCI_CONDUIT_SMC =1 , +QEMU_PSCI_CONDUIT_HVC =2 , +}; +#endif
target-arm/helper-a64.c +6 -0
@@ -468,6 +468,12 @@ void aarch64_cpu_do_interrupt(CPUState *cs) env->exception.syndrome); } +if (arm_is_psci_call (cpu, cs->exception_index)) { +arm_handle_psci_call (cpu); +qemu_log_mask (CPU_LOG_INT ,"...handled as PSCI call\n" ); +return ; + } +switch (cs->exception_index) {case EXCP_PREFETCH_ABORT :case EXCP_DATA_ABORT :
target-arm/helper.c +6 -0
@@ -3970,6 +3970,12 @@ void arm_cpu_do_interrupt(CPUState *cs)arm_log_exception (cs->exception_index); +if (arm_is_psci_call (cpu, cs->exception_index)) { +arm_handle_psci_call (cpu); +qemu_log_mask (CPU_LOG_INT ,"...handled as PSCI call\n" ); +return ; + } +/* If this is a debug exception we must update the DBGDSCR.MOE bits */ switch (env->exception.syndrome >>ARM_EL_EC_SHIFT ) {case EC_BREAKPOINT :
target-arm/internals.h +12 -0
@@ -366,4 +366,16 @@ void hw_breakpoint_update_all(ARMCPU *cpu);/* Callback function for when a watchpoint or breakpoint triggers. */ void arm_debug_excp_handler (CPUState *cs); +#ifdef CONFIG_USER_ONLY +static inline bool arm_is_psci_call (ARMCPU *cpu,int excp_type) +{ +return false; +} +#else +/* Return true if the r0/x0 value indicates that this SMC/HVC is a PSCI call. */ +bool arm_is_psci_call (ARMCPU *cpu,int excp_type); +/* Actually handle a PSCI call */ +void arm_handle_psci_call (ARMCPU *cpu); +#endif +#endif
target-arm/op_helper.c +16 -0
@@ -387,11 +387,19 @@ void HELPER(clear_pstate_ss)(CPUARMState *env)void HELPER (pre_hvc )(CPUARMState *env) { +ARMCPU *cpu =arm_env_get_cpu (env);int cur_el =arm_current_pl (env);/* FIXME: Use actual secure state. */ bool secure = false;bool undef; +if (arm_is_psci_call (cpu,EXCP_HVC )) { +/* If PSCI is enabled and this looks like a valid PSCI call then +* that overrides the architecturally mandated HVC behaviour. +*/ +return ; + } +if (!arm_feature (env,ARM_FEATURE_EL2 )) {/* If EL2 doesn't exist, HVC always UNDEFs */ undef = true;
@@ -419,6 +427,7 @@ void HELPER(pre_hvc)(CPUARMState *env)void HELPER (pre_smc )(CPUARMState *env,uint32_t syndrome) { +ARMCPU *cpu =arm_env_get_cpu (env);int cur_el =arm_current_pl (env);/* FIXME: Use real secure state. */ bool secure = false;
@@ -430,6 +439,13 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome)*/ bool undef =is_a64 (env) ? smd : (!secure && smd); +if (arm_is_psci_call (cpu,EXCP_SMC )) { +/* If PSCI is enabled and this looks like a valid PSCI call then +* that overrides the architecturally mandated SMC behaviour. +*/ +return ; + } +if (!arm_feature (env,ARM_FEATURE_EL3 )) {/* If we have no EL3 then SMC always UNDEFs */ undef = true;
target-arm/psci.c new file +242 -0
242 lines not on this page · raw message
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 18/23] target-arm: increase arrays of registers R13 & R14
In reply to Peter MaydellFrom: Fabian Aggeler <[email protected]>
Increasing banked_r13 and banked_r14 to store LR_mon and SP_mon (bank index 7).
Message-id: [email protected]
--- target-arm/cpu.h | 4 ++-- target-arm/machine.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
target-arm/cpu.h +2 -2
@@ -153,8 +153,8 @@ typedef struct CPUARMState {/* Banked registers. */ uint64_t banked_spsr[8 ]; -uint32_t banked_r13[6 ]; -uint32_t banked_r14[6 ]; +uint32_t banked_r13[8 ]; +uint32_t banked_r14[8 ];/* These hold r8-r12. */ uint32_t usr_regs[5 ];
target-arm/machine.c +2 -2
@@ -238,8 +238,8 @@ const VMStateDescription vmstate_arm_cpu = { },VMSTATE_UINT32 (env.spsr,ARMCPU ),VMSTATE_UINT64_ARRAY (env.banked_spsr,ARMCPU ,8 ), -VMSTATE_UINT32_ARRAY (env.banked_r13,ARMCPU ,6 ), -VMSTATE_UINT32_ARRAY (env.banked_r14,ARMCPU ,6 ), +VMSTATE_UINT32_ARRAY (env.banked_r13,ARMCPU ,8 ), +VMSTATE_UINT32_ARRAY (env.banked_r14,ARMCPU ,8 ),VMSTATE_UINT32_ARRAY (env.usr_regs,ARMCPU ,5 ),VMSTATE_UINT32_ARRAY (env.fiq_regs,ARMCPU ,5 ), VMSTATE_UINT64_ARRAY(env.elr_el, ARMCPU, 4),
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 20/23] target-arm: reject switching to monitor mode
In reply to Peter MaydellFrom: Sergey Fedorov <[email protected]>
Reject switching to monitor mode from non-secure state.
Message-id: [email protected]
--- target-arm/helper.c | 2 ++ 1 file changed, 2 insertions(+)
target-arm/helper.c +2 -0
@@ -3531,6 +3531,8 @@ static int bad_mode_switch(CPUARMState *env, int mode)case ARM_CPU_MODE_IRQ :case ARM_CPU_MODE_FIQ :return 0 ; +case ARM_CPU_MODE_MON : +return !arm_is_secure (env);default :return 1 ; }
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 23/23] target-arm: A32: Emulate the SMC instruction
In reply to Peter MaydellFrom: Fabian Aggeler <[email protected]>
Implements SMC instruction in AArch32 using the A32 syndrome. When executing SMC instruction from monitor CPU mode SCR.NS bit is reset.
Message-id: [email protected]
--- target-arm/helper.c | 11 +++++++++++ target-arm/op_helper.c | 3 +-- 2 files changed, 12 insertions(+), 2 deletions(-)
target-arm/helper.c +11 -0
@@ -4091,6 +4091,12 @@ void arm_cpu_do_interrupt(CPUState *cs) mask =CPSR_A |CPSR_I |CPSR_F ; offset =4 ;break ; +case EXCP_SMC : + new_mode =ARM_CPU_MODE_MON ; + addr =0x08 ; + mask =CPSR_A |CPSR_I |CPSR_F ; + offset =0 ; +break ;default :cpu_abort (cs,"Unhandled exception 0x%x\n" , cs->exception_index);return ;/* Never happens. Keep compiler happy. */
@@ -4109,6 +4115,11 @@ void arm_cpu_do_interrupt(CPUState *cs)*/ addr += env->cp15.vbar_el[1 ]; } + +if ((env->uncached_cpsr &CPSR_M ) ==ARM_CPU_MODE_MON ) { + env->cp15.scr_el3 &= ~SCR_NS ; + } +switch_mode (env, new_mode);/* For exceptions taken to AArch32 we must clear the SS bit in both * PSTATE and in the old-state value we save to SPSR_<mode>, so zero it now.
target-arm/op_helper.c +1 -2
@@ -429,8 +429,7 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome) {ARMCPU *cpu =arm_env_get_cpu (env);int cur_el =arm_current_el (env); -/* FIXME: Use real secure state. */ -bool secure = false; +bool secure =arm_is_secure (env);bool smd = env->cp15.scr_el3 &SCR_SMD ;/* On ARMv8 AArch32, SMD only applies to NS state. * On ARMv7 SMD only applies to NS state and only if EL2 is available.
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 05/23] arm_gic: remove unused parameter.
In reply to Peter MaydellFrom: KONRAD Frederic <[email protected]>
This removes num_irq parameter from gic_init_irqs_and_distributor as it is not used.
Message-id: [email protected]
--- hw/intc/arm_gic.c | 4 ++-- hw/intc/armv7m_nvic.c | 2 +- hw/intc/gic_internal.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
hw/intc/arm_gic.c +2 -2
@@ -769,7 +769,7 @@ static const MemoryRegionOps gic_cpu_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -void gic_init_irqs_and_distributor (GICState *s,int num_irq) +void gic_init_irqs_and_distributor (GICState *s) {SysBusDevice *sbd =SYS_BUS_DEVICE (s);int i;
@@ -808,7 +808,7 @@ static void arm_gic_realize(DeviceState *dev, Error **errp)return ; } -gic_init_irqs_and_distributor (s, s->num_irq); +gic_init_irqs_and_distributor (s);/* Memory regions for the CPU interfaces (NVIC doesn't have these): * a region for "CPU interface for this core", then a region for
hw/intc/armv7m_nvic.c +1 -1
@@ -488,7 +488,7 @@ static void armv7m_nvic_realize(DeviceState *dev, Error **errp)error_propagate (errp, local_err);return ; } -gic_init_irqs_and_distributor (&s->gic, s->num_irq); +gic_init_irqs_and_distributor (&s->gic);/* The NVIC and system controller register area looks like this: * 0..0xff : system control registers, including systick * 0x100..0xcff : GIC-like registers
hw/intc/gic_internal.h +1 -1
@@ -59,7 +59,7 @@ void gic_set_pending_private(GICState *s, int cpu, int irq);uint32_t gic_acknowledge_irq (GICState *s,int cpu);void gic_complete_irq (GICState *s,int cpu,int irq);void gic_update (GICState *s); -void gic_init_irqs_and_distributor (GICState *s,int num_irq); +void gic_init_irqs_and_distributor (GICState *s);void gic_set_priority (GICState *s,int cpu,int irq,uint8_t val);static inline bool gic_test_pending (GICState *s,int irq,int cm)
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 06/23] disas/libvixl/a64/instructions-a64.h: Remove unused constants
In reply to Peter MaydellFrom: Chen Gang <[email protected]>
The instructions-a64.h header defines a number of floating point constants whose initializers are function calls. gcc 5 will warn if these constants are not used by the C or C++ file which includes the header, because they imply a runtime cost. Since for the files QEMU uses from libvixl we don't use these constants at all, just remove them.
Upstream intend to fix these by shifting to an 'extern const' in the header plus definition in a suitable source file, so we can drop this patch when we sync with the upcoming libvixl 1.7.
The related compiling error:
CXX disas/arm-a64.o
In file included from /upstream/qemu/disas/libvixl/a64/disasm-a64.h:32:0,
from disas/arm-a64.cc:20:
disas/libvixl/a64/instructions-a64.h:98:13: error: 'vixl::kFP32PositiveInfinity' defined but not used [-Werror=unused-variable]
const float kFP32PositiveInfinity = rawbits_to_float(0x7f800000);
^
disas/libvixl/a64/instructions-a64.h:99:13: error: 'vixl::kFP32NegativeInfinity' defined but not used [-Werror=unused-variable]
const float kFP32NegativeInfinity = rawbits_to_float(0xff800000);
^
disas/libvixl/a64/instructions-a64.h:100:14: error: 'vixl::kFP64PositiveInfinity' defined but not used [-Werror=unused-variable]
const double kFP64PositiveInfinity =
^
disas/libvixl/a64/instructions-a64.h:102:14: error: 'vixl::kFP64NegativeInfinity' defined but not used [-Werror=unused-variable]
const double kFP64NegativeInfinity =
^
disas/libvixl/a64/instructions-a64.h:107:21: error: 'vixl::kFP64SignallingNaN' defined but not used [-Werror=unused-variable]
static const double kFP64SignallingNaN =
^
disas/libvixl/a64/instructions-a64.h:109:20: error: 'vixl::kFP32SignallingNaN' defined but not used [-Werror=unused-variable]
static const float kFP32SignallingNaN = rawbits_to_float(0x7f800001);
^
disas/libvixl/a64/instructions-a64.h:112:21: error: 'vixl::kFP64QuietNaN' defined but not used [-Werror=unused-variable]
static const double kFP64QuietNaN =
^
disas/libvixl/a64/instructions-a64.h:114:20: error: 'vixl::kFP32QuietNaN' defined but not used [-Werror=unused-variable]
static const float kFP32QuietNaN = rawbits_to_float(0x7fc00001);
^
disas/libvixl/a64/instructions-a64.h:117:21: error: 'vixl::kFP64DefaultNaN' defined but not used [-Werror=unused-variable]
static const double kFP64DefaultNaN =
^
disas/libvixl/a64/instructions-a64.h:119:20: error: 'vixl::kFP32DefaultNaN' defined but not used [-Werror=unused-variable]
static const float kFP32DefaultNaN = rawbits_to_float(0x7fc00000);
^ cc1plus: all warnings being treated as errors
make: *** [disas/arm-a64.o] Error 1
--- disas/libvixl/a64/instructions-a64.h | 24 ------------------------ 1 file changed, 24 deletions(-)
disas/libvixl/a64/instructions-a64.h +0 -24
@@ -96,30 +96,6 @@ const unsigned kDoubleExponentBits = 11;const unsigned kFloatMantissaBits =23 ;const unsigned kFloatExponentBits =8 ; -const float kFP32PositiveInfinity =rawbits_to_float (0x7f800000 ); -const float kFP32NegativeInfinity =rawbits_to_float (0xff800000 ); -const double kFP64PositiveInfinity = -rawbits_to_double (UINT64_C (0x7ff0000000000000 )); -const double kFP64NegativeInfinity = -rawbits_to_double (UINT64_C (0xfff0000000000000 )); - -// This value is a signalling NaN as both a double and as a float (taking the -// least-significant word). -static const double kFP64SignallingNaN = -rawbits_to_double (UINT64_C (0x7ff000007f800001 )); -static const float kFP32SignallingNaN =rawbits_to_float (0x7f800001 ); - -// A similar value, but as a quiet NaN. -static const double kFP64QuietNaN = -rawbits_to_double (UINT64_C (0x7ff800007fc00001 )); -static const float kFP32QuietNaN =rawbits_to_float (0x7fc00001 ); - -// The default NaN values (for FPCR.DN=1). -static const double kFP64DefaultNaN = -rawbits_to_double (UINT64_C (0x7ff8000000000000 )); -static const float kFP32DefaultNaN =rawbits_to_float (0x7fc00000 ); - -enum LSDataSize { LSByte =0 , LSHalfword =1 ,
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 19/23] target-arm: add arm_is_secure() function
In reply to Peter MaydellFrom: Fabian Aggeler <[email protected]>
arm_is_secure() function allows to determine CPU security state if the CPU implements Security Extensions/EL3. arm_is_secure_below_el3() returns true if CPU is in secure state below EL3.
Message-id: [email protected]
--- target-arm/cpu.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
target-arm/cpu.h +47 -0
@@ -753,6 +753,53 @@ static inline int arm_feature(CPUARMState *env, int feature)return (env->features & (1ULL << feature)) !=0 ; } +#if !defined(CONFIG_USER_ONLY ) +/* Return true if exception levels below EL3 are in secure state, +* or would be following an exception return to that level. +* Unlike arm_is_secure() (which is always a question about the +* _current_ state of the CPU) this doesn't care about the current +* EL or mode. +*/ +static inline bool arm_is_secure_below_el3 (CPUARMState *env) +{ +if (arm_feature (env,ARM_FEATURE_EL3 )) { +return !(env->cp15.scr_el3 &SCR_NS ); + }else { +/* If EL2 is not supported then the secure state is implementation +* defined, in which case QEMU defaults to non-secure. +*/ +return false; + } +} + +/* Return true if the processor is in secure state */ +static inline bool arm_is_secure (CPUARMState *env) +{ +if (arm_feature (env,ARM_FEATURE_EL3 )) { +if (is_a64 (env) &&extract32 (env->pstate,2 ,2 ) ==3 ) { +/* CPU currently in AArch64 state and EL3 */ +return true; + }else if (!is_a64 (env) && + (env->uncached_cpsr &CPSR_M ) ==ARM_CPU_MODE_MON ) { +/* CPU currently in AArch32 state and monitor mode */ +return true; + } + } +return arm_is_secure_below_el3 (env); +} + +#else +static inline bool arm_is_secure_below_el3 (CPUARMState *env) +{ +return false; +} + +static inline bool arm_is_secure (CPUARMState *env) +{ +return false; +} +#endif +/* Return true if the specified exception level is running in AArch64 state. */ static inline bool arm_el_is_aa64 (CPUARMState *env,int el) {
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 03/23] hw/arm/boot: register cpu reset handlers if using -bios
In reply to Peter MaydellFrom: Ard Biesheuvel <[email protected]>
Move the registering of CPU reset handlers to before the point where we leave the function in the -bios (not -kernel) case, so CPU reset works correctly with -bios as well.
--- hw/arm/boot.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
hw/arm/boot.c +12 -5
@@ -478,7 +478,7 @@ static void do_cpu_reset(void *opaque)void arm_load_kernel (ARMCPU *cpu,struct arm_boot_info *info) { -CPUState *cs =CPU (cpu); +CPUState *cs;int kernel_size;int initrd_size;int is_linux =0 ;
@@ -488,6 +488,15 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)int big_endian;static const ARMInsnFixup *primary_loader; +/* CPU objects (unlike devices) are not automatically reset on system +* reset, so we must always register a handler to do so. If we're +* actually loading a kernel, the handler is also responsible for +* arranging that we start it correctly. +*/ +for (cs =CPU (cpu); cs; cs =CPU_NEXT (cs)) { +qemu_register_reset (do_cpu_reset,ARM_CPU (cs)); + } +/* Load the kernel. */ if (!info->kernel_filename) {
@@ -652,9 +661,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) } info->is_linux = is_linux; -for (; cs; cs =CPU_NEXT (cs)) { - cpu =ARM_CPU (cs); - cpu->env.boot_info = info; -qemu_register_reset (do_cpu_reset, cpu); +for (cs =CPU (cpu); cs; cs =CPU_NEXT (cs)) { +ARM_CPU (cs)->env.boot_info = info; } }
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 01/23] hmp: Remove "info pcmcia"
In reply to Peter MaydellFrom: Markus Armbruster <[email protected]>
This command lists PCMCIA sockets and cards. Only a few ARM boards have sockets (akita, borzoi, connex, mainstone, spitz, terrier, tosa, verdex, z2), the only card is the DSCM-1xxxx Hitachi Microdrive (qdev "microdrive"), and it is only inserted during machine init, if ever. So this command doesn't really tell anybody anything new so far.
Moreover, pcmcia_socket_unregister() has a use-after-free bug, flagged by Coverity. Has never been used, because there has never been code to eject a PCMCIA card.
Not worth fixing & converting to QMP. Remove it.
Message-id: [email protected]
--- hmp-commands.hx | 2 -- hw/ide/microdrive.c | 1 - hw/pcmcia/pxa2xx.c | 21 --------------------- include/hw/pcmcia.h | 6 ------ monitor.c | 8 -------- vl.c | 44 -------------------------------------------- 6 files changed, 82 deletions(-)
hmp-commands.hx +0 -2
@@ -1748,8 +1748,6 @@ show information about active capturing show list of VM snapshots @item info status show the current VM status (running|paused) -@item info pcmcia -show guest PCMCIA status @item info mice show which guest mouse is receiving events @item info vnc
hw/ide/microdrive.c +0 -1
@@ -543,7 +543,6 @@ static int dscm1xxxx_attach(PCMCIACardState *card)device_reset (DEVICE (md));md_interrupt_update (md); - card->slot->card_string ="DSCM-1xxxx Hitachi Microdrive" ;return 0 ; }
hw/pcmcia/pxa2xx.c +0 -21
@@ -149,24 +149,11 @@ PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem,sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 , base); s =PXA2XX_PCMCIA (dev); -if (base ==0x30000000 ) { - s->slot.slot_string ="PXA PC Card Socket 1" ; - }else { - s->slot.slot_string ="PXA PC Card Socket 0" ; - } -qdev_init_nofail (dev);return s; } -static void pxa2xx_pcmcia_realize (DeviceState *dev,Error **errp) -{ -PXA2xxPCMCIAState *s =PXA2XX_PCMCIA (dev); - -pcmcia_socket_register (&s->slot); -} -static void pxa2xx_pcmcia_initfn (Object *obj) {SysBusDevice *sbd =SYS_BUS_DEVICE (obj);
@@ -262,19 +249,11 @@ void pxa2xx_pcmcia_set_irq_cb(void *opaque, qemu_irq irq, qemu_irq cd_irq) s->cd_irq = cd_irq; } -static void pxa2xx_pcmcia_class_init (ObjectClass *oc,void *data) -{ -DeviceClass *dc =DEVICE_CLASS (oc); - - dc->realize = pxa2xx_pcmcia_realize; -} -static const TypeInfo pxa2xx_pcmcia_type_info = { .name =TYPE_PXA2XX_PCMCIA , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (PXA2xxPCMCIAState), .instance_init = pxa2xx_pcmcia_initfn, - .class_init = pxa2xx_pcmcia_class_init, };static void pxa2xx_pcmcia_register_types (void )
include/hw/pcmcia.h +0 -6
@@ -8,14 +8,8 @@typedef struct PCMCIASocket {qemu_irq irq;bool attached; -const char *slot_string; -const char *card_string; }PCMCIASocket ; -void pcmcia_socket_register (PCMCIASocket *socket); -void pcmcia_socket_unregister (PCMCIASocket *socket); -void pcmcia_info (Monitor *mon,const QDict *qdict); -#define TYPE_PCMCIA_CARD "pcmcia-card"#define PCMCIA_CARD (obj) \ OBJECT_CHECK(PCMCIACardState, (obj), TYPE_PCMCIA_CARD)
monitor.c +0 -8
@@ -25,7 +25,6 @@#include "hw/hw.h" #include "monitor/qdev.h" #include "hw/usb.h" -#include "hw/pcmcia.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" #include "sysemu/watchdog.h"
@@ -2792,13 +2791,6 @@ static mon_cmd_t info_cmds[] = { .mhandler.cmd = hmp_info_status, }, { - .name = "pcmcia", - .args_type = "", - .params = "", - .help = "show guest PCMCIA status", - .mhandler.cmd = pcmcia_info, - }, - { .name = "mice", .args_type = "", .params = "",
vl.c +0 -44
56 lines not on this page · raw message
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 21/23] target-arm: rename arm_current_pl to arm_current_el
In reply to Peter MaydellFrom: Greg Bellows <[email protected]>
Renamed the arm_current_pl CPU function to more accurately represent that it returns the ARMv8 EL rather than ARMv7 PL.
Message-id: [email protected]
--- target-arm/cpu.h | 27 +++++++++++++++------------ target-arm/helper-a64.c | 6 +++--- target-arm/helper.c | 22 +++++++++++----------- target-arm/internals.h | 2 +- target-arm/op_helper.c | 16 ++++++++-------- target-arm/translate-a64.c | 16 ++++++++-------- target-arm/translate.c | 4 ++-- target-arm/translate.h | 4 ++-- 8 files changed, 50 insertions(+), 47 deletions(-)
target-arm/cpu.h +15 -12
@@ -991,7 +991,10 @@ static inline bool cptype_valid(int cptype)#define PL1_RW (PL1_R | PL1_W)#define PL0_RW (PL0_R | PL0_W) -static inline int arm_current_pl (CPUARMState *env) +/* Return the current Exception Level (as per ARMv8; note that this differs +* from the ARMv7 Privilege Level). +*/ +static inline int arm_current_el (CPUARMState *env) {if (env->aarch64) {return extract32 (env->pstate,2 ,2 );
@@ -1001,7 +1004,7 @@ static inline int arm_current_pl(CPUARMState *env)return 0 ; }/* We don't currently implement the Virtualization or TrustZone -* extensions, so PL2 and PL3 don't exist for us. +* extensions, so EL2 and EL3 don't exist for us. */ return 1 ; }
@@ -1164,10 +1167,10 @@ static inline bool cpreg_field_is_64bit(const ARMCPRegInfo *ri)return (ri->state ==ARM_CP_STATE_AA64 ) || (ri->type &ARM_CP_64BIT ); } -static inline bool cp_access_ok (int current_pl, +static inline bool cp_access_ok (int current_el,const ARMCPRegInfo *ri,int isread) { -return (ri->access >> ((current_pl *2 ) + isread)) &1 ; +return (ri->access >> ((current_el *2 ) + isread)) &1 ; }/**
@@ -1231,7 +1234,7 @@ bool write_cpustate_to_list(ARMCPU *cpu);static inline bool arm_excp_unmasked (CPUState *cs,unsigned int excp_idx) {CPUARMState *env = cs->env_ptr; -unsigned int cur_el =arm_current_pl (env); +unsigned int cur_el =arm_current_el (env);unsigned int target_el =arm_excp_target_el (cs, excp_idx);/* FIXME: Use actual secure state. */ bool secure = false;
@@ -1303,7 +1306,7 @@ static inline CPUARMState *cpu_init(const char *cpu_model)#define MMU_USER_IDX 0static inline int cpu_mmu_index (CPUARMState *env) { -return arm_current_pl (env); +return arm_current_el (env); }/* Return the Exception Level targeted by debug exceptions;
@@ -1316,7 +1319,7 @@ static inline int arm_debug_target_el(CPUARMState *env)static inline bool aa64_generate_debug_exceptions (CPUARMState *env) { -if (arm_current_pl (env) ==arm_debug_target_el (env)) { +if (arm_current_el (env) ==arm_debug_target_el (env)) {if ((extract32 (env->cp15.mdscr_el1,13 ,1 ) ==0 ) || (env->daif &PSTATE_D )) {return false;
@@ -1327,10 +1330,10 @@ static inline bool aa64_generate_debug_exceptions(CPUARMState *env)static inline bool aa32_generate_debug_exceptions (CPUARMState *env) { -if (arm_current_pl (env) ==0 &&arm_el_is_aa64 (env,1 )) { +if (arm_current_el (env) ==0 &&arm_el_is_aa64 (env,1 )) {return aa64_generate_debug_exceptions (env); } -return arm_current_pl (env) !=2 ; +return arm_current_el (env) !=2 ; }/* Return true if debugging exceptions are currently enabled.
@@ -1460,8 +1463,8 @@ static inline void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,if (is_a64 (env)) { *pc = env->pc; *flags =ARM_TBFLAG_AARCH64_STATE_MASK - | (arm_current_pl (env) <<ARM_TBFLAG_AA64_EL_SHIFT ); -if (fpen ==3 || (fpen ==1 &&arm_current_pl (env) !=0 )) { + | (arm_current_el (env) <<ARM_TBFLAG_AA64_EL_SHIFT ); +if (fpen ==3 || (fpen ==1 &&arm_current_el (env) !=0 )) { *flags |=ARM_TBFLAG_AA64_FPEN_MASK ; }/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
@@ -1497,7 +1500,7 @@ static inline void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, || arm_el_is_aa64(env, 1)) { *flags |=ARM_TBFLAG_VFPEN_MASK ; } -if (fpen ==3 || (fpen ==1 &&arm_current_pl (env) !=0 )) { +if (fpen ==3 || (fpen ==1 &&arm_current_el (env) !=0 )) { *flags |=ARM_TBFLAG_CPACR_FPEN_MASK ; }/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
target-arm/helper-a64.c +3 -3
@@ -450,7 +450,7 @@ void aarch64_cpu_do_interrupt(CPUState *cs)unsigned int new_mode =aarch64_pstate_mode (new_el, true);int i; -if (arm_current_pl (env) < new_el) { +if (arm_current_el (env) < new_el) {if (env->aarch64) { addr +=0x400 ; }else {
@@ -461,7 +461,7 @@ void aarch64_cpu_do_interrupt(CPUState *cs) }arm_log_exception (cs->exception_index); -qemu_log_mask (CPU_LOG_INT ,"...from EL%d\n" ,arm_current_pl (env)); +qemu_log_mask (CPU_LOG_INT ,"...from EL%d\n" ,arm_current_el (env));if (qemu_loglevel_mask (CPU_LOG_INT ) && !excp_is_internal (cs->exception_index)) { qemu_log_mask(CPU_LOG_INT, "...with ESR 0x%" PRIx32 "\n",
@@ -503,7 +503,7 @@ void aarch64_cpu_do_interrupt(CPUState *cs)if (is_a64 (env)) { env->banked_spsr[aarch64_banked_spsr_index (new_el)] =pstate_read (env); -aarch64_save_sp (env,arm_current_pl (env)); +aarch64_save_sp (env,arm_current_el (env)); env->elr_el[new_el] = env->pc; }else { env->banked_spsr[0 ] =cpsr_read (env);
target-arm/helper.c +11 -11
@@ -571,7 +571,7 @@ static CPAccessResult pmreg_access(CPUARMState *env, const ARMCPRegInfo *ri)/* Performance monitor registers user accessibility is controlled * by PMUSERENR. */ -if (arm_current_pl (env) ==0 && !env->cp15.c9_pmuserenr) { +if (arm_current_el (env) ==0 && !env->cp15.c9_pmuserenr) {return CP_ACCESS_TRAP ; }return CP_ACCESS_OK ;
@@ -996,7 +996,7 @@ static void teecr_write(CPUARMState *env, const ARMCPRegInfo *ri,static CPAccessResult teehbr_access (CPUARMState *env,const ARMCPRegInfo *ri) { -if (arm_current_pl (env) ==0 && (env->teecr &1 )) { +if (arm_current_el (env) ==0 && (env->teecr &1 )) {return CP_ACCESS_TRAP ; }return CP_ACCESS_OK ;
@@ -1042,7 +1042,7 @@ static const ARMCPRegInfo v6k_cp_reginfo[] = {static CPAccessResult gt_cntfrq_access (CPUARMState *env,const ARMCPRegInfo *ri) {/* CNTFRQ: not visible from PL0 if both PL0PCTEN and PL0VCTEN are zero */ -if (arm_current_pl (env) ==0 && !extract32 (env->cp15.c14_cntkctl,0 ,2 )) { +if (arm_current_el (env) ==0 && !extract32 (env->cp15.c14_cntkctl,0 ,2 )) {return CP_ACCESS_TRAP ; }return CP_ACCESS_OK ;
@@ -1051,7 +1051,7 @@ static CPAccessResult gt_cntfrq_access(CPUARMState *env, const ARMCPRegInfo *ri)static CPAccessResult gt_counter_access (CPUARMState *env,int timeridx) {/* CNT[PV]CT: not visible from PL0 if ELO[PV]CTEN is zero */ -if (arm_current_pl (env) ==0 && +if (arm_current_el (env) ==0 && !extract32 (env->cp15.c14_cntkctl, timeridx,1 )) {return CP_ACCESS_TRAP ; }
@@ -1063,7 +1063,7 @@ static CPAccessResult gt_timer_access(CPUARMState *env, int timeridx)/* CNT[PV]_CVAL, CNT[PV]_CTL, CNT[PV]_TVAL: not visible from PL0 if * EL0[PV]TEN is zero. */ -if (arm_current_pl (env) ==0 && +if (arm_current_el (env) ==0 && !extract32 (env->cp15.c14_cntkctl,9 - timeridx,1 )) {return CP_ACCESS_TRAP ; }
@@ -1911,7 +1911,7 @@ static void aa64_fpsr_write(CPUARMState *env, const ARMCPRegInfo *ri,static CPAccessResult aa64_daif_access (CPUARMState *env,const ARMCPRegInfo *ri) { -if (arm_current_pl (env) ==0 && !(env->cp15.c1_sys &SCTLR_UMA )) { +if (arm_current_el (env) ==0 && !(env->cp15.c1_sys &SCTLR_UMA )) {return CP_ACCESS_TRAP ; }return CP_ACCESS_OK ;
@@ -1929,7 +1929,7 @@ static CPAccessResult aa64_cacheop_access(CPUARMState *env,/* Cache invalidate/clean: NOP, but EL0 must UNDEF unless * SCTLR_EL1.UCI is set. */ -if (arm_current_pl (env) ==0 && !(env->cp15.c1_sys &SCTLR_UCI )) { +if (arm_current_el (env) ==0 && !(env->cp15.c1_sys &SCTLR_UCI )) {return CP_ACCESS_TRAP ; }return CP_ACCESS_OK ;
@@ -2006,7 +2006,7 @@ static CPAccessResult aa64_zva_access(CPUARMState *env, const ARMCPRegInfo *ri)/* We don't implement EL2, so the only control on DC ZVA is the * bit in the SCTLR which can prohibit access for EL0. */ -if (arm_current_pl (env) ==0 && !(env->cp15.c1_sys &SCTLR_DZE )) { +if (arm_current_el (env) ==0 && !(env->cp15.c1_sys &SCTLR_DZE )) {return CP_ACCESS_TRAP ; }return CP_ACCESS_OK ;
@@ -2366,7 +2366,7 @@ static CPAccessResult ctr_el0_access(CPUARMState *env, const ARMCPRegInfo *ri)/* Only accessible in EL0 if SCTLR.UCT is set (and only in AArch64, * but the AArch32 CTR has its own reginfo struct) */ -if (arm_current_pl (env) ==0 && !(env->cp15.c1_sys &SCTLR_UCT )) { +if (arm_current_el (env) ==0 && !(env->cp15.c1_sys &SCTLR_UCT )) {return CP_ACCESS_TRAP ; }return CP_ACCESS_OK ;
@@ -3768,7 +3768,7 @@ unsigned int arm_excp_target_el(CPUState *cs, unsigned int excp_idx) {ARMCPU *cpu =ARM_CPU (cs);CPUARMState *env = &cpu->env; -unsigned int cur_el =arm_current_pl (env); +unsigned int cur_el =arm_current_el (env);unsigned int target_el;/* FIXME: Use actual secure state. */ bool secure = false;
@@ -4770,7 +4770,7 @@ int arm_cpu_handle_mmu_fault(CPUState *cs, vaddr address,int prot;int ret, is_user;uint32_t syn; -bool same_el = (arm_current_pl (env) !=0 ); +bool same_el = (arm_current_el (env) !=0 ); is_user = mmu_idx ==MMU_USER_IDX ; ret = get_phys_addr(env, address, access_type, is_user, &phys_addr, &prot,
target-arm/internals.h +1 -1
@@ -130,7 +130,7 @@ static inline void aarch64_restore_sp(CPUARMState *env, int el)static inline void update_spsel (CPUARMState *env,uint32_t imm) { -unsigned int cur_el =arm_current_pl (env); +unsigned int cur_el =arm_current_el (env);/* Update PSTATE SPSel bit; this requires us to update the * working stack pointer in xregs[31]. */
target-arm/op_helper.c +8 -8
@@ -361,7 +361,7 @@ void HELPER(msr_i_pstate)(CPUARMState *env, uint32_t op, uint32_t imm)* Note that SPSel is never OK from EL0; we rely on handle_msr_i() * to catch that case at translate time. */ -if (arm_current_pl (env) ==0 && !(env->cp15.c1_sys &SCTLR_UMA )) { +if (arm_current_el (env) ==0 && !(env->cp15.c1_sys &SCTLR_UMA )) {raise_exception (env,EXCP_UDEF ); }
@@ -388,7 +388,7 @@ void HELPER(clear_pstate_ss)(CPUARMState *env)void HELPER (pre_hvc )(CPUARMState *env) {ARMCPU *cpu =arm_env_get_cpu (env); -int cur_el =arm_current_pl (env); +int cur_el =arm_current_el (env);/* FIXME: Use actual secure state. */ bool secure = false;bool undef;
@@ -428,7 +428,7 @@ void HELPER(pre_hvc)(CPUARMState *env)void HELPER (pre_smc )(CPUARMState *env,uint32_t syndrome) {ARMCPU *cpu =arm_env_get_cpu (env); -int cur_el =arm_current_pl (env); +int cur_el =arm_current_el (env);/* FIXME: Use real secure state. */ bool secure = false;bool smd = env->cp15.scr_el3 &SCR_SMD ;
@@ -463,7 +463,7 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome)void HELPER (exception_return )(CPUARMState *env) { -int cur_el =arm_current_pl (env); +int cur_el =arm_current_el (env);unsigned int spsr_idx =aarch64_banked_spsr_index (cur_el);uint32_t spsr = env->banked_spsr[spsr_idx];int new_el, i;
@@ -580,7 +580,7 @@ static bool linked_bp_matches(ARMCPU *cpu, int lbn)switch (bt) {case 3 :/* linked context ID match */ -if (arm_current_pl (env) >1 ) { +if (arm_current_el (env) >1 ) {/* Context matches never fire in EL2 or (AArch64) EL3 */ return false; }
@@ -660,7 +660,7 @@ static bool bp_wp_matches(ARMCPU *cpu, int n, bool is_wp)* rely on this behaviour currently. * For breakpoints we do want to use the current CPU state. */ -switch (arm_current_pl (env)) { +switch (arm_current_el (env)) {case 3 :case 2 :if (!hmc) {
@@ -747,7 +747,7 @@ void arm_debug_excp_handler(CPUState *cs) cs->watchpoint_hit =NULL ;if (check_watchpoints (cpu)) {bool wnr = (wp_hit->flags &BP_WATCHPOINT_HIT_WRITE ) !=0 ; -bool same_el =arm_debug_target_el (env) ==arm_current_pl (env); +bool same_el =arm_debug_target_el (env) ==arm_current_el (env); env->exception.syndrome =syn_watchpoint (same_el,0 , wnr);if (extended_addresses_enabled (env)) {
@@ -763,7 +763,7 @@ void arm_debug_excp_handler(CPUState *cs) } }else {if (check_breakpoints (cpu)) { -bool same_el = (arm_debug_target_el (env) ==arm_current_pl (env)); +bool same_el = (arm_debug_target_el (env) ==arm_current_el (env)); env->exception.syndrome =syn_breakpoint (same_el);if (extended_addresses_enabled (env)) { env->exception.fsr = (1 <<9 ) |0x22 ;
target-arm/translate-a64.c +8 -8
@@ -1226,7 +1226,7 @@ static void handle_msr_i(DisasContext *s, uint32_t insn,int op = op1 <<3 | op2;switch (op) {case 0x05 :/* SPSel */ -if (s->current_pl ==0 ) { +if (s->current_el ==0 ) {unallocated_encoding (s);return ; }
@@ -1323,7 +1323,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, }/* Check access permissions */ -if (!cp_access_ok (s->current_pl, ri, isread)) { +if (!cp_access_ok (s->current_el, ri, isread)) {unallocated_encoding (s);return ; }
@@ -1362,7 +1362,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,* guaranteed to be constant by the tb flags. */ tcg_rt =cpu_reg (s, rt); -tcg_gen_movi_i64 (tcg_rt, s->current_pl <<2 ); +tcg_gen_movi_i64 (tcg_rt, s->current_el <<2 );return ;case ARM_CP_DC_ZVA :/* Writes clear the aligned block of memory which rt points into. */
@@ -1485,7 +1485,7 @@ static void disas_exc(DisasContext *s, uint32_t insn)gen_exception_insn (s,0 ,EXCP_SWI ,syn_aa64_svc (imm16));break ;case 2 : -if (s->current_pl ==0 ) { +if (s->current_el ==0 ) {unallocated_encoding (s);break ; }
@@ -1498,7 +1498,7 @@ static void disas_exc(DisasContext *s, uint32_t insn)gen_exception_insn (s,0 ,EXCP_HVC ,syn_aa64_hvc (imm16));break ;case 3 : -if (s->current_pl ==0 ) { +if (s->current_el ==0 ) {unallocated_encoding (s);break ; }
@@ -1575,7 +1575,7 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn)tcg_gen_movi_i64 (cpu_reg (s,30 ), s->pc);break ;case 4 :/* ERET */ -if (s->current_pl ==0 ) { +if (s->current_el ==0 ) {unallocated_encoding (s);return ; }
@@ -10930,7 +10930,7 @@ void gen_intermediate_code_internal_a64(ARMCPU *cpu, dc->vec_len =0 ; dc->vec_stride =0 ; dc->cp_regs = cpu->cp_regs; - dc->current_pl =arm_current_pl (env); + dc->current_el =arm_current_el (env); dc->features = env->features;/* Single step state. The code-generation logic here is:
@@ -10951,7 +10951,7 @@ void gen_intermediate_code_internal_a64(ARMCPU *cpu, dc->ss_active =ARM_TBFLAG_AA64_SS_ACTIVE (tb->flags); dc->pstate_ss =ARM_TBFLAG_AA64_PSTATE_SS (tb->flags); dc->is_ldex = false; - dc->ss_same_el = (arm_debug_target_el (env) == dc->current_pl); + dc->ss_same_el = (arm_debug_target_el (env) == dc->current_el);init_tmp_a64_array (dc);
target-arm/translate.c +2 -2
@@ -7077,7 +7077,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn) ENCODE_CP_REG(cpnum, is64, crn, crm, opc1, opc2));if (ri) {/* Check access permissions */ -if (!cp_access_ok (s->current_pl, ri, isread)) { +if (!cp_access_ok (s->current_el, ri, isread)) {return 1 ; }
@@ -11011,7 +11011,7 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu, dc->vec_stride =ARM_TBFLAG_VECSTRIDE (tb->flags); dc->c15_cpar =ARM_TBFLAG_XSCALE_CPAR (tb->flags); dc->cp_regs = cpu->cp_regs; - dc->current_pl =arm_current_pl (env); + dc->current_el =arm_current_el (env); dc->features = env->features;/* Single step state. The code-generation logic here is:
target-arm/translate.h +2 -2
@@ -29,7 +29,7 @@ typedef struct DisasContext {*/ uint32_t svc_imm;int aarch64; -int current_pl; +int current_el;GHashTable *cp_regs;uint64_t features;/* CPU features bits */ /* Because unallocated encodings generate different exception syndrome
@@ -68,7 +68,7 @@ static inline int arm_dc_feature(DisasContext *dc, int feature)static inline int get_mem_index (DisasContext *s) { -return s->current_pl; +return s->current_el; }/* target-specific extra values for is_jmp */
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 02/23] hw/arm/virt: mark timer in fdt as v8-compatible
In reply to Peter MaydellFrom: Claudio Fontana <[email protected]>
check if the first cpu is an armv8 cpu, and if so, put arm,armv8-timer in the compatible string list.
Note that due to this check, this patch moves the creation of the timer fdt node to after the cpu creation loop.
Message-id: [email protected]
--- hw/arm/virt.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
hw/arm/virt.c +12 -3
@@ -240,14 +240,23 @@ static void fdt_add_timer_nodes(const VirtBoardInfo *vbi)* but for the GIC implementation provided by both QEMU and KVM * they are edge-triggered. */ +ARMCPU *armcpu;uint32_t irqflags =GIC_FDT_IRQ_FLAGS_EDGE_LO_HI ; irqflags =deposit32 (irqflags,GIC_FDT_IRQ_PPI_CPU_START ,GIC_FDT_IRQ_PPI_CPU_WIDTH , (1 << vbi->smp_cpus) -1 );qemu_fdt_add_subnode (vbi->fdt,"/timer" ); -qemu_fdt_setprop_string (vbi->fdt,"/timer" , -"compatible" ,"arm,armv7-timer" ); + + armcpu =ARM_CPU (qemu_get_cpu (0 )); +if (arm_feature (&armcpu->env,ARM_FEATURE_V8 )) { +const char compat[] ="arm,armv8-timer\0arm,armv7-timer" ; +qemu_fdt_setprop (vbi->fdt,"/timer" ,"compatible" , + compat,sizeof (compat)); + }else { +qemu_fdt_setprop_string (vbi->fdt,"/timer" ,"compatible" , +"arm,armv7-timer" ); + } qemu_fdt_setprop_cells(vbi->fdt, "/timer", "interrupts", GIC_FDT_IRQ_TYPE_PPI, 13, irqflags, GIC_FDT_IRQ_TYPE_PPI, 14, irqflags,
@@ -555,7 +564,6 @@ static void machvirt_init(MachineState *machine) }create_fdt (vbi); -fdt_add_timer_nodes (vbi);for (n =0 ; n < smp_cpus; n++) {ObjectClass *oc =cpu_class_by_name (TYPE_ARM_CPU , cpu_model);
@@ -579,6 +587,7 @@ static void machvirt_init(MachineState *machine)object_property_set_bool (cpuobj, true,"realized" ,NULL ); } +fdt_add_timer_nodes (vbi);fdt_add_cpu_nodes (vbi);fdt_add_psci_node (vbi);
Signature · 1 line
1.9.1
[Qemu-devel] [PULL 04/23] disas/libvixl: Update to libvixl 1.6
In reply to Peter MaydellUpdate our copy of libvixl to upstream 1.6. There are no changes of any particular interest to QEMU, so this is simply keeping up with current upstream.
Message-id: [email protected]
--- disas/arm-a64.cc | 2 +- disas/libvixl/README | 2 +- disas/libvixl/a64/assembler-a64.h | 385 ++++++++++++++++++++++------------ disas/libvixl/a64/decoder-a64.cc | 34 ++- disas/libvixl/a64/decoder-a64.h | 102 ++++++--- disas/libvixl/a64/disasm-a64.cc | 259 +++++++++++++++-------- disas/libvixl/a64/disasm-a64.h | 84 +++++--- disas/libvixl/a64/instructions-a64.cc | 22 +- disas/libvixl/a64/instructions-a64.h | 40 ++-- disas/libvixl/code-buffer.h | 113 ++++++++++ disas/libvixl/utils.cc | 1 + disas/libvixl/utils.h | 3 +- 12 files changed, 715 insertions(+), 332 deletions(-) create mode 100644 disas/libvixl/code-buffer.h
disas/arm-a64.cc +1 -1
@@ -39,7 +39,7 @@ public: ~QEMUDisassembler() { } protected: - void ProcessOutput(Instruction *instr) { + virtual void ProcessOutput(const Instruction *instr) { fprintf(stream_, "%08" PRIx32 " %s", instr->InstructionBits(), GetOutput()); }
disas/libvixl/README +1 -1
@@ -2,7 +2,7 @@ The code in this directory is a subset of libvixl: https://github.com/armvixl/vixl (specifically, it is the set of files needed for disassembly only, -taken from libvixl 1.5). +taken from libvixl 1.6). Bugfixes should preferably be sent upstream initially. The disassembler does not currently support the entire A64 instruction
disas/libvixl/a64/assembler-a64.h +249 -136
562 lines not on this page · raw message
disas/libvixl/a64/decoder-a64.cc +15 -19
@@ -29,8 +29,8 @@ #include "a64/decoder-a64.h" namespace vixl { -// Top-level instruction decode function. -void Decoder::Decode(Instruction *instr) { + +void Decoder::DecodeInstruction(const Instruction *instr) { if (instr->Bits(28, 27) == 0) { VisitUnallocated(instr); } else {
@@ -109,20 +109,17 @@ void Decoder::Decode(Instruction *instr) { } void Decoder::AppendVisitor(DecoderVisitor* new_visitor) { - visitors_.remove(new_visitor); - visitors_.push_front(new_visitor); + visitors_.push_back(new_visitor); } void Decoder::PrependVisitor(DecoderVisitor* new_visitor) { - visitors_.remove(new_visitor); - visitors_.push_back(new_visitor); + visitors_.push_front(new_visitor); } void Decoder::InsertVisitorBefore(DecoderVisitor* new_visitor, DecoderVisitor* registered_visitor) { - visitors_.remove(new_visitor); std::list<DecoderVisitor*>::iterator it; for (it = visitors_.begin(); it != visitors_.end(); it++) { if (*it == registered_visitor) {
@@ -139,7 +136,6 @@ void Decoder::InsertVisitorBefore(DecoderVisitor* new_visitor, void Decoder::InsertVisitorAfter(DecoderVisitor* new_visitor, DecoderVisitor* registered_visitor) { - visitors_.remove(new_visitor); std::list<DecoderVisitor*>::iterator it; for (it = visitors_.begin(); it != visitors_.end(); it++) { if (*it == registered_visitor) {
@@ -160,7 +156,7 @@ void Decoder::RemoveVisitor(DecoderVisitor* visitor) { } -void Decoder::DecodePCRelAddressing(Instruction* instr) { +void Decoder::DecodePCRelAddressing(const Instruction* instr) { VIXL_ASSERT(instr->Bits(27, 24) == 0x0); // We know bit 28 is set, as <b28:b27> = 0 is filtered out at the top level // decode.
@@ -169,7 +165,7 @@ void Decoder::DecodePCRelAddressing(Instruction* instr) { } -void Decoder::DecodeBranchSystemException(Instruction* instr) { +void Decoder::DecodeBranchSystemException(const Instruction* instr) { VIXL_ASSERT((instr->Bits(27, 24) == 0x4) || (instr->Bits(27, 24) == 0x5) || (instr->Bits(27, 24) == 0x6) ||
@@ -270,7 +266,7 @@ void Decoder::DecodeBranchSystemException(Instruction* instr) { } -void Decoder::DecodeLoadStore(Instruction* instr) { +void Decoder::DecodeLoadStore(const Instruction* instr) { VIXL_ASSERT((instr->Bits(27, 24) == 0x8) || (instr->Bits(27, 24) == 0x9) || (instr->Bits(27, 24) == 0xC) ||
@@ -388,7 +384,7 @@ void Decoder::DecodeLoadStore(Instruction* instr) { } -void Decoder::DecodeLogical(Instruction* instr) { +void Decoder::DecodeLogical(const Instruction* instr) { VIXL_ASSERT(instr->Bits(27, 24) == 0x2); if (instr->Mask(0x80400000) == 0x00400000) {
@@ -407,7 +403,7 @@ void Decoder::DecodeLogical(Instruction* instr) { } -void Decoder::DecodeBitfieldExtract(Instruction* instr) { +void Decoder::DecodeBitfieldExtract(const Instruction* instr) { VIXL_ASSERT(instr->Bits(27, 24) == 0x3); if ((instr->Mask(0x80400000) == 0x80000000) ||
@@ -432,7 +428,7 @@ void Decoder::DecodeBitfieldExtract(Instruction* instr) { } -void Decoder::DecodeAddSubImmediate(Instruction* instr) { +void Decoder::DecodeAddSubImmediate(const Instruction* instr) { VIXL_ASSERT(instr->Bits(27, 24) == 0x1); if (instr->Bit(23) == 1) { VisitUnallocated(instr);
@@ -442,7 +438,7 @@ void Decoder::DecodeAddSubImmediate(Instruction* instr) { } -void Decoder::DecodeDataProcessing(Instruction* instr) { +void Decoder::DecodeDataProcessing(const Instruction* instr) { VIXL_ASSERT((instr->Bits(27, 24) == 0xA) || (instr->Bits(27, 24) == 0xB));
@@ -557,7 +553,7 @@ void Decoder::DecodeDataProcessing(Instruction* instr) { } -void Decoder::DecodeFP(Instruction* instr) { +void Decoder::DecodeFP(const Instruction* instr) { VIXL_ASSERT((instr->Bits(27, 24) == 0xE) || (instr->Bits(27, 24) == 0xF));
@@ -684,14 +680,14 @@ void Decoder::DecodeFP(Instruction* instr) { } -void Decoder::DecodeAdvSIMDLoadStore(Instruction* instr) { +void Decoder::DecodeAdvSIMDLoadStore(const Instruction* instr) { // TODO: Implement Advanced SIMD load/store instruction decode. VIXL_ASSERT(instr->Bits(29, 25) == 0x6); VisitUnimplemented(instr); } -void Decoder::DecodeAdvSIMDDataProcessing(Instruction* instr) { +void Decoder::DecodeAdvSIMDDataProcessing(const Instruction* instr) { // TODO: Implement Advanced SIMD data processing instruction decode. VIXL_ASSERT(instr->Bits(27, 25) == 0x7); VisitUnimplemented(instr);
@@ -699,7 +695,7 @@ void Decoder::DecodeAdvSIMDDataProcessing(Instruction* instr) { #define DEFINE_VISITOR_CALLERS(A) \ - void Decoder::Visit##A(Instruction *instr) { \ + void Decoder::Visit##A(const Instruction *instr) { \ VIXL_ASSERT(instr->Mask(A##FMask) == A##Fixed); \ std::list<DecoderVisitor*>::iterator it; \ for (it = visitors_.begin(); it != visitors_.end(); it++) { \
disas/libvixl/a64/decoder-a64.h +71 -31
183 lines not on this page · raw message
disas/libvixl/a64/disasm-a64.cc +168 -91
671 lines not on this page · raw message
disas/libvixl/a64/disasm-a64.h +60 -24
124 lines not on this page · raw message
disas/libvixl/a64/instructions-a64.cc +11 -11
@@ -57,7 +57,7 @@ static uint64_t RepeatBitsAcrossReg(unsigned reg_size, // Logical immediates can't encode zero, so a return value of zero is used to // indicate a failure case. Specifically, where the constraints on imm_s are // not met. -uint64_t Instruction::ImmLogical() { +uint64_t Instruction::ImmLogical() const { unsigned reg_size = SixtyFourBits() ? kXRegSize : kWRegSize; int64_t n = BitN(); int64_t imm_s = ImmSetBits();
@@ -108,7 +108,7 @@ uint64_t Instruction::ImmLogical() { } -float Instruction::ImmFP32() { +float Instruction::ImmFP32() const { // ImmFP: abcdefgh (8 bits) // Single: aBbb.bbbc.defg.h000.0000.0000.0000.0000 (32 bits) // where B is b ^ 1
@@ -122,7 +122,7 @@ float Instruction::ImmFP32() { } -double Instruction::ImmFP64() { +double Instruction::ImmFP64() const { // ImmFP: abcdefgh (8 bits) // Double: aBbb.bbbb.bbcd.efgh.0000.0000.0000.0000 // 0000.0000.0000.0000.0000.0000.0000.0000 (64 bits)
@@ -148,8 +148,8 @@ LSDataSize CalcLSPairDataSize(LoadStorePairOp op) { } -Instruction* Instruction::ImmPCOffsetTarget() { - Instruction * base = this; +const Instruction* Instruction::ImmPCOffsetTarget() const { + const Instruction * base = this; ptrdiff_t offset; if (IsPCRelAddressing()) { // ADR and ADRP.
@@ -182,7 +182,7 @@ inline int Instruction::ImmBranch() const { } -void Instruction::SetImmPCOffsetTarget(Instruction* target) { +void Instruction::SetImmPCOffsetTarget(const Instruction* target) { if (IsPCRelAddressing()) { SetPCRelImmTarget(target); } else {
@@ -191,7 +191,7 @@ void Instruction::SetImmPCOffsetTarget(Instruction* target) { } -void Instruction::SetPCRelImmTarget(Instruction* target) { +void Instruction::SetPCRelImmTarget(const Instruction* target) { int32_t imm21; if ((Mask(PCRelAddressingMask) == ADR)) { imm21 = target - this;
@@ -207,7 +207,7 @@ void Instruction::SetPCRelImmTarget(Instruction* target) { } -void Instruction::SetBranchImmTarget(Instruction* target) { +void Instruction::SetBranchImmTarget(const Instruction* target) { VIXL_ASSERT(((target - this) & 3) == 0); Instr branch_imm = 0; uint32_t imm_mask = 0;
@@ -239,9 +239,9 @@ void Instruction::SetBranchImmTarget(Instruction* target) { } -void Instruction::SetImmLLiteral(Instruction* source) { - VIXL_ASSERT(((source - this) & 3) == 0); - int offset = (source - this) >> kLiteralEntrySizeLog2; +void Instruction::SetImmLLiteral(const Instruction* source) { + VIXL_ASSERT(IsWordAligned(source)); + ptrdiff_t offset = (source - this) >> kLiteralEntrySizeLog2; Instr imm = Assembler::ImmLLiteral(offset); Instr mask = ImmLLiteral_mask;
disas/libvixl/a64/instructions-a64.h +24 -16
@@ -44,6 +44,7 @@ const unsigned kMaxLoadLiteralRange = 1 * MBytes;// This is the nominal page size (as used by the adrp instruction); the actual // size of the memory pages allocated by the kernel is likely to differ. const unsigned kPageSize =4 * KBytes; +const unsigned kPageSizeLog2 =12 ;const unsigned kWRegSize =32 ;const unsigned kWRegSizeLog2 =5 ;
@@ -201,9 +202,9 @@ class Instruction {return signed_bitextract_32 (width-1 ,0 , offset); } -uint64_t ImmLogical (); -float ImmFP32 (); -double ImmFP64 (); + uint64_t ImmLogical() const; + float ImmFP32() const; + double ImmFP64() const; inline LSDataSize SizeLSPair() const { return CalcLSPairDataSize(
@@ -311,46 +312,49 @@ class Instruction {// Find the target of this instruction. 'this' may be a branch or a // PC-relative addressing instruction. -Instruction *ImmPCOffsetTarget (); +const Instruction *ImmPCOffsetTarget () const;// Patch a PC-relative offset to refer to 'target'. 'this' may be a branch or // a PC-relative addressing instruction. -void SetImmPCOffsetTarget (Instruction * target); +void SetImmPCOffsetTarget (const Instruction * target);// Patch a literal load instruction to load from 'source'. -void SetImmLLiteral (Instruction * source); +void SetImmLLiteral (const Instruction * source); -inline uint8_t *LiteralAddress () { +inline uint8_t *LiteralAddress () const {int offset =ImmLLiteral () << kLiteralEntrySizeLog2; - return reinterpret_cast<uint8_t*>(this) + offset; + const uint8_t* address = reinterpret_cast<const uint8_t*>(this) + offset; +// Note that the result is safely mutable only if the backing buffer is +// safely mutable. + return const_cast<uint8_t*>(address); } -inline uint32_t Literal32 () { + inline uint32_t Literal32() const {uint32_t literal; memcpy(&literal, LiteralAddress(), sizeof(literal)); return literal; } -inline uint64_t Literal64 () { + inline uint64_t Literal64() const {uint64_t literal;memcpy (&literal,LiteralAddress (),sizeof (literal));return literal; } -inline float LiteralFP32 () { + inline float LiteralFP32() const { return rawbits_to_float(Literal32()); } -inline double LiteralFP64 () { + inline double LiteralFP64() const {return rawbits_to_double (Literal64 ()); } -inline Instruction *NextInstruction () { +inline const Instruction *NextInstruction () const {return this + kInstructionSize; } -inline Instruction *InstructionAtOffset (int64_t offset) { +inline const Instruction *InstructionAtOffset (int64_t offset) const {VIXL_ASSERT (IsWordAligned (this + offset));return this + offset; }
@@ -359,11 +363,15 @@ class Instruction { return reinterpret_cast<Instruction*>(src); } + template<typename T> static inline const Instruction* CastConst(T src) { + return reinterpret_cast<const Instruction*>(src); + } + private: inline int ImmBranch() const; -void SetPCRelImmTarget (Instruction * target); -void SetBranchImmTarget (Instruction * target); +void SetPCRelImmTarget (const Instruction * target); +void SetBranchImmTarget (const Instruction * target); }; }// namespace vixl
disas/libvixl/code-buffer.h new file +113 -0
113 lines not on this page · raw message
disas/libvixl/utils.cc +1 -0
@@ -134,4 +134,5 @@ uint64_t LowestSetBit(uint64_t value) { bool IsPowerOf2(int64_t value) { return (value != 0) && ((value & (value - 1)) == 0); } + } // namespace vixl
disas/libvixl/utils.h +1 -2
@@ -171,7 +171,7 @@ bool IsPowerOf2(int64_t value); template<typename T> bool IsWordAligned(T pointer) {VIXL_ASSERT (sizeof (pointer) ==sizeof (intptr_t ));// NOLINT(runtime/sizeof) -return (reinterpret_cast<intptr_t>(pointer) &3 ) ==0 ; +return ((intptr_t )(pointer) &3 ) ==0 ; }// Increment a pointer until it has the specified alignment.
@@ -204,7 +204,6 @@ T AlignDown(T pointer, size_t alignment) { return (T)(pointer_raw - align_step); } - }// namespace vixl #endif // VIXL_UTILS_H
Signature · 1 line
1.9.1
Peter Maydell
AppliedQuoted 26 lines · Peter Maydell
The following changes since commit
1430500bb8ba0bf15bad235439d62276c1b6b22f:Merge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into staging (2014-10-23 17:05:15 +0100)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.gittags/pull-target-arm-20141024for you to fetch changes up to
dbe9d1636787dd226d3f9a61c07fbc27e0db5bbf:target-arm: A32: Emulate the SMC instruction (2014-10-24 12:19:15 +0100)
----------------------------------------------------------------
target-arm queue:
* remove pointless 'info pcmcia' and a lot of now-dead code
* register ARM cpu reset handlers even if not using -kernel
* update to libvixl 1.6
* various minor code cleanups
* support PSCI under TCG ('virt' machine can now be shut down, SMP configurations work)
* correct the sense of the AArch64 DCZID DZP bit
* report a valid L1Ip field inCTR_EL0for CPU type "any"
* correctly UNDEF writes to FPINST/FPINST2 from EL0
* more preparatory code refactoring for EL2/EL3 support
Quoted 1 line
----------------------------------------------------------------
Applied, thanks.
-- PMM