Commit 5a1e3cfcb0f1b7108542d04fababd433938bf8fe

Authored by bellard
1 parent d2ac63e0

better halted state support


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1652 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 14 additions and 2 deletions
cpu-defs.h
@@ -74,7 +74,7 @@ typedef unsigned long ram_addr_t; @@ -74,7 +74,7 @@ typedef unsigned long ram_addr_t;
74 #define EXCP_INTERRUPT 0x10000 /* async interruption */ 74 #define EXCP_INTERRUPT 0x10000 /* async interruption */
75 #define EXCP_HLT 0x10001 /* hlt instruction reached */ 75 #define EXCP_HLT 0x10001 /* hlt instruction reached */
76 #define EXCP_DEBUG 0x10002 /* cpu stopped after a breakpoint or singlestep */ 76 #define EXCP_DEBUG 0x10002 /* cpu stopped after a breakpoint or singlestep */
77 - 77 +#define EXCP_HALTED 0x10003 /* cpu is halted (waiting for external event) */
78 #define MAX_BREAKPOINTS 32 78 #define MAX_BREAKPOINTS 32
79 79
80 #define TB_JMP_CACHE_BITS 12 80 #define TB_JMP_CACHE_BITS 12
@@ -96,7 +96,6 @@ typedef struct CPUTLBEntry { @@ -96,7 +96,6 @@ typedef struct CPUTLBEntry {
96 96
97 #define CPU_COMMON \ 97 #define CPU_COMMON \
98 struct TranslationBlock *current_tb; /* currently executing TB */ \ 98 struct TranslationBlock *current_tb; /* currently executing TB */ \
99 - int cpu_halted; /* TRUE if cpu is halted (sleep mode) */ \  
100 /* soft mmu support */ \ 99 /* soft mmu support */ \
101 /* in order to avoid passing too many arguments to the memory \ 100 /* in order to avoid passing too many arguments to the memory \
102 write helpers, we store some rarely used information in the CPU \ 101 write helpers, we store some rarely used information in the CPU \
cpu-exec.c
@@ -251,6 +251,19 @@ int cpu_exec(CPUState *env1) @@ -251,6 +251,19 @@ int cpu_exec(CPUState *env1)
251 TranslationBlock *tb; 251 TranslationBlock *tb;
252 uint8_t *tc_ptr; 252 uint8_t *tc_ptr;
253 253
  254 +#if defined(TARGET_I386)
  255 + /* handle exit of HALTED state */
  256 + if (env1->hflags & HF_HALTED_MASK) {
  257 + /* disable halt condition */
  258 + if ((env1->interrupt_request & CPU_INTERRUPT_HARD) &&
  259 + (env1->eflags & IF_MASK)) {
  260 + env1->hflags &= ~HF_HALTED_MASK;
  261 + } else {
  262 + return EXCP_HALTED;
  263 + }
  264 + }
  265 +#endif
  266 +
254 cpu_single_env = env1; 267 cpu_single_env = env1;
255 268
256 /* first we save global registers */ 269 /* first we save global registers */