A hint is in unicorn\qemu\target\arm\cpu64.c, at the end of cpu_aarch64_init:
// Backward compatability to enable FULL 64bits address space.
env->pstate = PSTATE_MODE_EL1h;
arm_rebuild_hflags(env);
return cpu;
This confirms that the default EL is EL1, and also that arm_rebuild_hflags should be called if it's ever updated (something that doesn't happen in pstate_write).
I confirm that the following (very dirty) hack fixes the problem (calling arm_rebuild_hflags manually - unicorn.dll is unstripped in MinGW):
Hi In A64, when writing
UC_ARM64_REG_PSTATE
with a new EL value, nothing happens and the running code still sees the old value. Snippet:A hint is in
unicorn\qemu\target\arm\cpu64.c
, at the end ofcpu_aarch64_init
:This confirms that the default EL is EL1, and also that
arm_rebuild_hflags
should be called if it's ever updated (something that doesn't happen inpstate_write
).I confirm that the following (very dirty) hack fixes the problem (calling
arm_rebuild_hflags
manually -unicorn.dll
is unstripped in MinGW):Proposal: change
pstate_write
to the following:Thanks in advance