Révision | 1c3c8af1fb40a481c07749e0448644d9b7700415 (tree) |
---|---|
l'heure | 2015-09-12 00:16:16 |
Auteur | Pavel Dovgalyuk <Pavel.Dovgaluk@ispr...> |
Commiter | Richard Henderson |
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.
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150710095702.13280.97477.stgit@PASHA-ISP>
Signed-off-by: Richard Henderson <rth@twiddle.net>
@@ -134,6 +134,15 @@ void cpu_loop_exit(CPUState *cpu) | ||
134 | 134 | siglongjmp(cpu->jmp_env, 1); |
135 | 135 | } |
136 | 136 | |
137 | +void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc) | |
138 | +{ | |
139 | + if (pc) { | |
140 | + cpu_restore_state(cpu, pc); | |
141 | + } | |
142 | + cpu->current_tb = NULL; | |
143 | + siglongjmp(cpu->jmp_env, 1); | |
144 | +} | |
145 | + | |
137 | 146 | /* exit the current TB from a signal handler. The host registers are |
138 | 147 | restored in a state compatible with the CPU emulator |
139 | 148 | */ |
@@ -90,6 +90,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, | ||
90 | 90 | int cflags); |
91 | 91 | void cpu_exec_init(CPUState *cpu, Error **errp); |
92 | 92 | void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); |
93 | +void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); | |
93 | 94 | |
94 | 95 | #if !defined(CONFIG_USER_ONLY) |
95 | 96 | bool qemu_in_vcpu_thread(void); |