mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-09 14:45:34 +00:00
cpu-exec: introduce loop exit with restore function
This patch introduces loop exit function, which also restores guest CPU state according to the value of host program counter. Backports commit 1c3c8af1fb40a481c07749e0448644d9b7700415 from qemu
This commit is contained in:
parent
28f154129b
commit
4a05c9ee28
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_aarch64
|
#define arm_cpu_initfn arm_cpu_initfn_aarch64
|
||||||
#define arm_cpu_list arm_cpu_list_aarch64
|
#define arm_cpu_list arm_cpu_list_aarch64
|
||||||
#define cpu_loop_exit cpu_loop_exit_aarch64
|
#define cpu_loop_exit cpu_loop_exit_aarch64
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_aarch64
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_aarch64
|
#define arm_cpu_post_init arm_cpu_post_init_aarch64
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_aarch64
|
#define arm_cpu_realizefn arm_cpu_realizefn_aarch64
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_aarch64
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_aarch64
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_aarch64eb
|
#define arm_cpu_initfn arm_cpu_initfn_aarch64eb
|
||||||
#define arm_cpu_list arm_cpu_list_aarch64eb
|
#define arm_cpu_list arm_cpu_list_aarch64eb
|
||||||
#define cpu_loop_exit cpu_loop_exit_aarch64eb
|
#define cpu_loop_exit cpu_loop_exit_aarch64eb
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_aarch64eb
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_aarch64eb
|
#define arm_cpu_post_init arm_cpu_post_init_aarch64eb
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_aarch64eb
|
#define arm_cpu_realizefn arm_cpu_realizefn_aarch64eb
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_aarch64eb
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_aarch64eb
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_arm
|
#define arm_cpu_initfn arm_cpu_initfn_arm
|
||||||
#define arm_cpu_list arm_cpu_list_arm
|
#define arm_cpu_list arm_cpu_list_arm
|
||||||
#define cpu_loop_exit cpu_loop_exit_arm
|
#define cpu_loop_exit cpu_loop_exit_arm
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_arm
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_arm
|
#define arm_cpu_post_init arm_cpu_post_init_arm
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_arm
|
#define arm_cpu_realizefn arm_cpu_realizefn_arm
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_arm
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_arm
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_armeb
|
#define arm_cpu_initfn arm_cpu_initfn_armeb
|
||||||
#define arm_cpu_list arm_cpu_list_armeb
|
#define arm_cpu_list arm_cpu_list_armeb
|
||||||
#define cpu_loop_exit cpu_loop_exit_armeb
|
#define cpu_loop_exit cpu_loop_exit_armeb
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_armeb
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_armeb
|
#define arm_cpu_post_init arm_cpu_post_init_armeb
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_armeb
|
#define arm_cpu_realizefn arm_cpu_realizefn_armeb
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_armeb
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_armeb
|
||||||
|
|
|
@ -39,6 +39,15 @@ void cpu_loop_exit(CPUState *cpu)
|
||||||
siglongjmp(cpu->jmp_env, 1);
|
siglongjmp(cpu->jmp_env, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc)
|
||||||
|
{
|
||||||
|
if (pc) {
|
||||||
|
cpu_restore_state(cpu, pc);
|
||||||
|
}
|
||||||
|
cpu->current_tb = NULL;
|
||||||
|
siglongjmp(cpu->jmp_env, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/* exit the current TB from a signal handler. The host registers are
|
/* exit the current TB from a signal handler. The host registers are
|
||||||
restored in a state compatible with the CPU emulator
|
restored in a state compatible with the CPU emulator
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -133,6 +133,7 @@ symbols = (
|
||||||
'arm_cpu_initfn',
|
'arm_cpu_initfn',
|
||||||
'arm_cpu_list',
|
'arm_cpu_list',
|
||||||
'cpu_loop_exit',
|
'cpu_loop_exit',
|
||||||
|
'cpu_loop_exit_restore',
|
||||||
'arm_cpu_post_init',
|
'arm_cpu_post_init',
|
||||||
'arm_cpu_realizefn',
|
'arm_cpu_realizefn',
|
||||||
'arm_cpu_register_gdb_regs_for_features',
|
'arm_cpu_register_gdb_regs_for_features',
|
||||||
|
|
|
@ -86,6 +86,8 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
|
||||||
void cpu_exec_init(CPUState *env, void *opaque);
|
void cpu_exec_init(CPUState *env, void *opaque);
|
||||||
|
|
||||||
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu);
|
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu);
|
||||||
|
void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);
|
||||||
|
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
void cpu_reload_memory_map(CPUState *cpu);
|
void cpu_reload_memory_map(CPUState *cpu);
|
||||||
void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as);
|
void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as);
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_m68k
|
#define arm_cpu_initfn arm_cpu_initfn_m68k
|
||||||
#define arm_cpu_list arm_cpu_list_m68k
|
#define arm_cpu_list arm_cpu_list_m68k
|
||||||
#define cpu_loop_exit cpu_loop_exit_m68k
|
#define cpu_loop_exit cpu_loop_exit_m68k
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_m68k
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_m68k
|
#define arm_cpu_post_init arm_cpu_post_init_m68k
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_m68k
|
#define arm_cpu_realizefn arm_cpu_realizefn_m68k
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_m68k
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_m68k
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_mips
|
#define arm_cpu_initfn arm_cpu_initfn_mips
|
||||||
#define arm_cpu_list arm_cpu_list_mips
|
#define arm_cpu_list arm_cpu_list_mips
|
||||||
#define cpu_loop_exit cpu_loop_exit_mips
|
#define cpu_loop_exit cpu_loop_exit_mips
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_mips
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_mips
|
#define arm_cpu_post_init arm_cpu_post_init_mips
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_mips
|
#define arm_cpu_realizefn arm_cpu_realizefn_mips
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_mips
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_mips
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_mips64
|
#define arm_cpu_initfn arm_cpu_initfn_mips64
|
||||||
#define arm_cpu_list arm_cpu_list_mips64
|
#define arm_cpu_list arm_cpu_list_mips64
|
||||||
#define cpu_loop_exit cpu_loop_exit_mips64
|
#define cpu_loop_exit cpu_loop_exit_mips64
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_mips64
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_mips64
|
#define arm_cpu_post_init arm_cpu_post_init_mips64
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_mips64
|
#define arm_cpu_realizefn arm_cpu_realizefn_mips64
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_mips64
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_mips64
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_mips64el
|
#define arm_cpu_initfn arm_cpu_initfn_mips64el
|
||||||
#define arm_cpu_list arm_cpu_list_mips64el
|
#define arm_cpu_list arm_cpu_list_mips64el
|
||||||
#define cpu_loop_exit cpu_loop_exit_mips64el
|
#define cpu_loop_exit cpu_loop_exit_mips64el
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_mips64el
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_mips64el
|
#define arm_cpu_post_init arm_cpu_post_init_mips64el
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_mips64el
|
#define arm_cpu_realizefn arm_cpu_realizefn_mips64el
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_mips64el
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_mips64el
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_mipsel
|
#define arm_cpu_initfn arm_cpu_initfn_mipsel
|
||||||
#define arm_cpu_list arm_cpu_list_mipsel
|
#define arm_cpu_list arm_cpu_list_mipsel
|
||||||
#define cpu_loop_exit cpu_loop_exit_mipsel
|
#define cpu_loop_exit cpu_loop_exit_mipsel
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_mipsel
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_mipsel
|
#define arm_cpu_post_init arm_cpu_post_init_mipsel
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_mipsel
|
#define arm_cpu_realizefn arm_cpu_realizefn_mipsel
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_mipsel
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_mipsel
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_powerpc
|
#define arm_cpu_initfn arm_cpu_initfn_powerpc
|
||||||
#define arm_cpu_list arm_cpu_list_powerpc
|
#define arm_cpu_list arm_cpu_list_powerpc
|
||||||
#define cpu_loop_exit cpu_loop_exit_powerpc
|
#define cpu_loop_exit cpu_loop_exit_powerpc
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_powerpc
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_powerpc
|
#define arm_cpu_post_init arm_cpu_post_init_powerpc
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_powerpc
|
#define arm_cpu_realizefn arm_cpu_realizefn_powerpc
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_powerpc
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_powerpc
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_sparc
|
#define arm_cpu_initfn arm_cpu_initfn_sparc
|
||||||
#define arm_cpu_list arm_cpu_list_sparc
|
#define arm_cpu_list arm_cpu_list_sparc
|
||||||
#define cpu_loop_exit cpu_loop_exit_sparc
|
#define cpu_loop_exit cpu_loop_exit_sparc
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_sparc
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_sparc
|
#define arm_cpu_post_init arm_cpu_post_init_sparc
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_sparc
|
#define arm_cpu_realizefn arm_cpu_realizefn_sparc
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_sparc
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_sparc
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_sparc64
|
#define arm_cpu_initfn arm_cpu_initfn_sparc64
|
||||||
#define arm_cpu_list arm_cpu_list_sparc64
|
#define arm_cpu_list arm_cpu_list_sparc64
|
||||||
#define cpu_loop_exit cpu_loop_exit_sparc64
|
#define cpu_loop_exit cpu_loop_exit_sparc64
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_sparc64
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_sparc64
|
#define arm_cpu_post_init arm_cpu_post_init_sparc64
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_sparc64
|
#define arm_cpu_realizefn arm_cpu_realizefn_sparc64
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_sparc64
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_sparc64
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
#define arm_cpu_initfn arm_cpu_initfn_x86_64
|
#define arm_cpu_initfn arm_cpu_initfn_x86_64
|
||||||
#define arm_cpu_list arm_cpu_list_x86_64
|
#define arm_cpu_list arm_cpu_list_x86_64
|
||||||
#define cpu_loop_exit cpu_loop_exit_x86_64
|
#define cpu_loop_exit cpu_loop_exit_x86_64
|
||||||
|
#define cpu_loop_exit_restore cpu_loop_exit_restore_x86_64
|
||||||
#define arm_cpu_post_init arm_cpu_post_init_x86_64
|
#define arm_cpu_post_init arm_cpu_post_init_x86_64
|
||||||
#define arm_cpu_realizefn arm_cpu_realizefn_x86_64
|
#define arm_cpu_realizefn arm_cpu_realizefn_x86_64
|
||||||
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_x86_64
|
#define arm_cpu_register_gdb_regs_for_features arm_cpu_register_gdb_regs_for_features_x86_64
|
||||||
|
|
Loading…
Reference in a new issue