Revision bfed01fc
b/cpu-exec.c | ||
---|---|---|
40 | 40 |
//#define DEBUG_EXEC |
41 | 41 |
//#define DEBUG_SIGNAL |
42 | 42 |
|
43 |
#if defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_M68K) || \ |
|
44 |
defined(TARGET_ALPHA) |
|
45 |
/* XXX: unify with i386 target */ |
|
46 | 43 |
void cpu_loop_exit(void) |
47 | 44 |
{ |
45 |
/* NOTE: the register at this point must be saved by hand because |
|
46 |
longjmp restore them */ |
|
47 |
regs_to_env(); |
|
48 | 48 |
longjmp(env->jmp_env, 1); |
49 | 49 |
} |
50 |
#endif |
|
50 |
|
|
51 | 51 |
#if !(defined(TARGET_SPARC) || defined(TARGET_SH4) || defined(TARGET_M68K)) |
52 | 52 |
#define reg_T2 |
53 | 53 |
#endif |
... | ... | |
249 | 249 |
TranslationBlock *tb; |
250 | 250 |
uint8_t *tc_ptr; |
251 | 251 |
|
252 |
#if defined(TARGET_I386) |
|
253 |
/* handle exit of HALTED state */ |
|
254 |
if (env1->hflags & HF_HALTED_MASK) { |
|
255 |
/* disable halt condition */ |
|
256 |
if ((env1->interrupt_request & CPU_INTERRUPT_HARD) && |
|
257 |
(env1->eflags & IF_MASK)) { |
|
258 |
env1->hflags &= ~HF_HALTED_MASK; |
|
259 |
} else { |
|
260 |
return EXCP_HALTED; |
|
261 |
} |
|
262 |
} |
|
263 |
#elif defined(TARGET_PPC) |
|
264 |
if (env1->halted) { |
|
265 |
if (env1->msr[MSR_EE] && |
|
266 |
(env1->interrupt_request & CPU_INTERRUPT_HARD)) { |
|
267 |
env1->halted = 0; |
|
268 |
} else { |
|
269 |
return EXCP_HALTED; |
|
270 |
} |
|
271 |
} |
|
272 |
#elif defined(TARGET_SPARC) |
|
273 |
if (env1->halted) { |
|
274 |
if ((env1->interrupt_request & CPU_INTERRUPT_HARD) && |
|
275 |
(env1->psret != 0)) { |
|
276 |
env1->halted = 0; |
|
277 |
} else { |
|
278 |
return EXCP_HALTED; |
|
279 |
} |
|
280 |
} |
|
281 |
#elif defined(TARGET_ARM) |
|
282 |
if (env1->halted) { |
|
283 |
/* An interrupt wakes the CPU even if the I and F CPSR bits are |
|
284 |
set. We use EXITTB to silently wake CPU without causing an |
|
285 |
actual interrupt. */ |
|
286 |
if (env1->interrupt_request & |
|
287 |
(CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB)) { |
|
288 |
env1->halted = 0; |
|
289 |
} else { |
|
290 |
return EXCP_HALTED; |
|
291 |
} |
|
292 |
} |
|
293 |
#elif defined(TARGET_MIPS) |
|
294 |
if (env1->halted) { |
|
295 |
if (env1->interrupt_request & |
|
296 |
(CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER)) { |
|
297 |
env1->halted = 0; |
|
298 |
} else { |
|
299 |
return EXCP_HALTED; |
|
300 |
} |
|
301 |
} |
|
302 |
#elif defined(TARGET_ALPHA) || defined(TARGET_M68K) |
|
303 |
if (env1->halted) { |
|
304 |
if (env1->interrupt_request & CPU_INTERRUPT_HARD) { |
|
305 |
env1->halted = 0; |
|
306 |
} else { |
|
307 |
return EXCP_HALTED; |
|
308 |
} |
|
309 |
} |
|
310 |
#endif |
|
252 |
if (cpu_halted(env1) == EXCP_HALTED) |
|
253 |
return EXCP_HALTED; |
|
311 | 254 |
|
312 | 255 |
cpu_single_env = env1; |
313 | 256 |
|
b/target-alpha/exec.h | ||
---|---|---|
79 | 79 |
|
80 | 80 |
void do_interrupt (CPUState *env); |
81 | 81 |
|
82 |
static inline int cpu_halted(CPUState *env) { |
|
83 |
if (!env->halted) |
|
84 |
return 0; |
|
85 |
if (env->interrupt_request & CPU_INTERRUPT_HARD) { |
|
86 |
env->halted = 0; |
|
87 |
return 0; |
|
88 |
} |
|
89 |
return EXCP_HALTED; |
|
90 |
} |
|
91 |
|
|
82 | 92 |
#endif /* !defined (__ALPHA_EXEC_H__) */ |
b/target-arm/exec.h | ||
---|---|---|
48 | 48 |
int cpu_arm_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
49 | 49 |
int is_user, int is_softmmu); |
50 | 50 |
|
51 |
static inline int cpu_halted(CPUState *env) { |
|
52 |
if (!env->halted) |
|
53 |
return 0; |
|
54 |
/* An interrupt wakes the CPU even if the I and F CPSR bits are |
|
55 |
set. We use EXITTB to silently wake CPU without causing an |
|
56 |
actual interrupt. */ |
|
57 |
if (env->interrupt_request & |
|
58 |
(CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB)) { |
|
59 |
env->halted = 0; |
|
60 |
return 0; |
|
61 |
} |
|
62 |
return EXCP_HALTED; |
|
63 |
} |
|
64 |
|
|
51 | 65 |
#if !defined(CONFIG_USER_ONLY) |
52 | 66 |
#include "softmmu_exec.h" |
53 | 67 |
#endif |
b/target-i386/exec.h | ||
---|---|---|
575 | 575 |
env->regs[R_EDI] = EDI; |
576 | 576 |
#endif |
577 | 577 |
} |
578 |
|
|
579 |
static inline int cpu_halted(CPUState *env) { |
|
580 |
/* handle exit of HALTED state */ |
|
581 |
if (env->hflags & HF_HALTED_MASK) |
|
582 |
return 0; |
|
583 |
/* disable halt condition */ |
|
584 |
if ((env->interrupt_request & CPU_INTERRUPT_HARD) && |
|
585 |
(env->eflags & IF_MASK)) { |
|
586 |
env->hflags &= ~HF_HALTED_MASK; |
|
587 |
return 0; |
|
588 |
} |
|
589 |
return EXCP_HALTED; |
|
590 |
} |
b/target-i386/helper.c | ||
---|---|---|
106 | 106 |
spin_unlock(&global_cpu_lock); |
107 | 107 |
} |
108 | 108 |
|
109 |
void cpu_loop_exit(void) |
|
110 |
{ |
|
111 |
/* NOTE: the register at this point must be saved by hand because |
|
112 |
longjmp restore them */ |
|
113 |
regs_to_env(); |
|
114 |
longjmp(env->jmp_env, 1); |
|
115 |
} |
|
116 |
|
|
117 | 109 |
/* return non zero if error */ |
118 | 110 |
static inline int load_segment(uint32_t *e1_ptr, uint32_t *e2_ptr, |
119 | 111 |
int selector) |
b/target-m68k/exec.h | ||
---|---|---|
49 | 49 |
void helper_movec(CPUM68KState *env, int reg, uint32_t val); |
50 | 50 |
|
51 | 51 |
void cpu_loop_exit(void); |
52 |
|
|
53 |
static inline int cpu_halted(CPUState *env) { |
|
54 |
if (!env->halted) |
|
55 |
return 0; |
|
56 |
if (env->interrupt_request & CPU_INTERRUPT_HARD) { |
|
57 |
env->halted = 0; |
|
58 |
return 0; |
|
59 |
} |
|
60 |
return EXCP_HALTED; |
|
61 |
} |
b/target-mips/exec.h | ||
---|---|---|
56 | 56 |
#include "softmmu_exec.h" |
57 | 57 |
#endif /* !defined(CONFIG_USER_ONLY) */ |
58 | 58 |
|
59 |
static inline void env_to_regs(void) |
|
60 |
{ |
|
61 |
} |
|
62 |
|
|
63 |
static inline void regs_to_env(void) |
|
64 |
{ |
|
65 |
} |
|
66 |
|
|
67 | 59 |
#ifdef TARGET_MIPS64 |
68 | 60 |
#if TARGET_LONG_BITS > HOST_LONG_BITS |
69 | 61 |
void do_dsll (void); |
... | ... | |
240 | 232 |
FOP_PROTO(ngt) |
241 | 233 |
#undef FOP_PROTO |
242 | 234 |
|
235 |
static inline void env_to_regs(void) |
|
236 |
{ |
|
237 |
} |
|
238 |
|
|
239 |
static inline void regs_to_env(void) |
|
240 |
{ |
|
241 |
} |
|
242 |
|
|
243 |
static inline int cpu_halted(CPUState *env) { |
|
244 |
if (!env->halted) |
|
245 |
return 0; |
|
246 |
if (env->interrupt_request & |
|
247 |
(CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER)) { |
|
248 |
env->halted = 0; |
|
249 |
return 0; |
|
250 |
} |
|
251 |
return EXCP_HALTED; |
|
252 |
} |
|
253 |
|
|
243 | 254 |
#endif /* !defined(__QEMU_MIPS_EXEC_H__) */ |
b/target-mips/op_helper.c | ||
---|---|---|
24 | 24 |
|
25 | 25 |
/*****************************************************************************/ |
26 | 26 |
/* Exceptions processing helpers */ |
27 |
void cpu_loop_exit(void) |
|
28 |
{ |
|
29 |
longjmp(env->jmp_env, 1); |
|
30 |
} |
|
31 | 27 |
|
32 | 28 |
void do_raise_exception_err (uint32_t exception, int error_code) |
33 | 29 |
{ |
b/target-ppc/exec.h | ||
---|---|---|
122 | 122 |
int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, |
123 | 123 |
int is_user, int is_softmmu); |
124 | 124 |
|
125 |
static inline int cpu_halted(CPUState *env) { |
|
126 |
if (!env->halted) |
|
127 |
return 0; |
|
128 |
if (env->msr[MSR_EE] && (env->interrupt_request & CPU_INTERRUPT_HARD)) { |
|
129 |
env->halted = 0; |
|
130 |
return 0; |
|
131 |
} |
|
132 |
return EXCP_HALTED; |
|
133 |
} |
|
134 |
|
|
125 | 135 |
#endif /* !defined (__PPC_H__) */ |
b/target-ppc/op_helper.c | ||
---|---|---|
40 | 40 |
|
41 | 41 |
/*****************************************************************************/ |
42 | 42 |
/* Exceptions processing helpers */ |
43 |
void cpu_loop_exit (void) |
|
44 |
{ |
|
45 |
longjmp(env->jmp_env, 1); |
|
46 |
} |
|
47 | 43 |
|
48 | 44 |
void do_raise_exception_err (uint32_t exception, int error_code) |
49 | 45 |
{ |
b/target-sh4/op_helper.c | ||
---|---|---|
20 | 20 |
#include <assert.h> |
21 | 21 |
#include "exec.h" |
22 | 22 |
|
23 |
void cpu_loop_exit(void) |
|
24 |
{ |
|
25 |
longjmp(env->jmp_env, 1); |
|
26 |
} |
|
27 |
|
|
28 | 23 |
void do_raise_exception(void) |
29 | 24 |
{ |
30 | 25 |
cpu_loop_exit(); |
b/target-sparc/exec.h | ||
---|---|---|
115 | 115 |
int cpu_sparc_handle_mmu_fault(CPUState *env, target_ulong address, int rw, |
116 | 116 |
int is_user, int is_softmmu); |
117 | 117 |
|
118 |
static inline int cpu_halted(CPUState *env) { |
|
119 |
if (!env->halted) |
|
120 |
return 0; |
|
121 |
if ((env->interrupt_request & CPU_INTERRUPT_HARD) && (env->psret != 0)) { |
|
122 |
env->halted = 0; |
|
123 |
return 0; |
|
124 |
} |
|
125 |
return EXCP_HALTED; |
|
126 |
} |
|
127 |
|
|
118 | 128 |
#endif |
Also available in: Unified diff