Commit ce5232c5c281552039466be5eadf93a712eb7611

Authored by bellard
1 parent d377440d

moved halted field to CPU_COMMON

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4609 c046a42c-6fe2-441c-8c8c-71466251a162
cpu-defs.h
@@ -140,6 +140,7 @@ typedef struct CPUTLBEntry { @@ -140,6 +140,7 @@ typedef struct CPUTLBEntry {
140 written */ \ 140 written */ \
141 target_ulong mem_write_vaddr; /* target virtual addr at which the \ 141 target_ulong mem_write_vaddr; /* target virtual addr at which the \
142 memory was written */ \ 142 memory was written */ \
  143 + int halted; /* TRUE if the CPU is in suspend state */ \
143 /* The meaning of the MMU modes is defined in the target code. */ \ 144 /* The meaning of the MMU modes is defined in the target code. */ \
144 CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; \ 145 CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; \
145 struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; \ 146 struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; \
hw/apic.c
@@ -443,12 +443,12 @@ static void apic_init_ipi(APICState *s) @@ -443,12 +443,12 @@ static void apic_init_ipi(APICState *s)
443 static void apic_startup(APICState *s, int vector_num) 443 static void apic_startup(APICState *s, int vector_num)
444 { 444 {
445 CPUState *env = s->cpu_env; 445 CPUState *env = s->cpu_env;
446 - if (!(env->hflags & HF_HALTED_MASK)) 446 + if (!env->halted)
447 return; 447 return;
448 env->eip = 0; 448 env->eip = 0;
449 cpu_x86_load_seg_cache(env, R_CS, vector_num << 8, vector_num << 12, 449 cpu_x86_load_seg_cache(env, R_CS, vector_num << 8, vector_num << 12,
450 0xffff, 0); 450 0xffff, 0);
451 - env->hflags &= ~HF_HALTED_MASK; 451 + env->halted = 0;
452 } 452 }
453 453
454 static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode, 454 static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode,
@@ -761,7 +761,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, @@ -761,7 +761,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
761 exit(1); 761 exit(1);
762 } 762 }
763 if (i != 0) 763 if (i != 0)
764 - env->hflags |= HF_HALTED_MASK; 764 + env->halted = 1;
765 if (smp_cpus > 1) { 765 if (smp_cpus > 1) {
766 /* XXX: enable it in all cases */ 766 /* XXX: enable it in all cases */
767 env->cpuid_features |= CPUID_APIC; 767 env->cpuid_features |= CPUID_APIC;
monitor.c
@@ -314,21 +314,15 @@ static void do_info_cpus(void) @@ -314,21 +314,15 @@ static void do_info_cpus(void)
314 env->cpu_index); 314 env->cpu_index);
315 #if defined(TARGET_I386) 315 #if defined(TARGET_I386)
316 term_printf(" pc=0x" TARGET_FMT_lx, env->eip + env->segs[R_CS].base); 316 term_printf(" pc=0x" TARGET_FMT_lx, env->eip + env->segs[R_CS].base);
317 - if (env->hflags & HF_HALTED_MASK)  
318 - term_printf(" (halted)");  
319 #elif defined(TARGET_PPC) 317 #elif defined(TARGET_PPC)
320 term_printf(" nip=0x" TARGET_FMT_lx, env->nip); 318 term_printf(" nip=0x" TARGET_FMT_lx, env->nip);
321 - if (env->halted)  
322 - term_printf(" (halted)");  
323 #elif defined(TARGET_SPARC) 319 #elif defined(TARGET_SPARC)
324 term_printf(" pc=0x" TARGET_FMT_lx " npc=0x" TARGET_FMT_lx, env->pc, env->npc); 320 term_printf(" pc=0x" TARGET_FMT_lx " npc=0x" TARGET_FMT_lx, env->pc, env->npc);
325 - if (env->halted)  
326 - term_printf(" (halted)");  
327 #elif defined(TARGET_MIPS) 321 #elif defined(TARGET_MIPS)
328 term_printf(" PC=0x" TARGET_FMT_lx, env->PC[env->current_tc]); 322 term_printf(" PC=0x" TARGET_FMT_lx, env->PC[env->current_tc]);
  323 +#endif
329 if (env->halted) 324 if (env->halted)
330 term_printf(" (halted)"); 325 term_printf(" (halted)");
331 -#endif  
332 term_printf("\n"); 326 term_printf("\n");
333 } 327 }
334 } 328 }
target-alpha/cpu.h
@@ -285,7 +285,6 @@ struct CPUAlphaState { @@ -285,7 +285,6 @@ struct CPUAlphaState {
285 jmp_buf jmp_env; 285 jmp_buf jmp_env;
286 int user_mode_only; /* user mode only simulation */ 286 int user_mode_only; /* user mode only simulation */
287 uint32_t hflags; 287 uint32_t hflags;
288 - int halted;  
289 288
290 int exception_index; 289 int exception_index;
291 int error_code; 290 int error_code;
target-arm/cpu.h
@@ -160,7 +160,6 @@ typedef struct CPUARMState { @@ -160,7 +160,6 @@ typedef struct CPUARMState {
160 int exception_index; 160 int exception_index;
161 int interrupt_request; 161 int interrupt_request;
162 int user_mode_only; 162 int user_mode_only;
163 - int halted;  
164 163
165 /* VFP coprocessor state. */ 164 /* VFP coprocessor state. */
166 struct { 165 struct {
target-cris/cpu.h
@@ -157,7 +157,6 @@ typedef struct CPUCRISState { @@ -157,7 +157,6 @@ typedef struct CPUCRISState {
157 157
158 int features; 158 int features;
159 int user_mode_only; 159 int user_mode_only;
160 - int halted;  
161 160
162 jmp_buf jmp_env; 161 jmp_buf jmp_env;
163 CPU_COMMON 162 CPU_COMMON
target-i386/cpu.h
@@ -119,7 +119,7 @@ @@ -119,7 +119,7 @@
119 #define ID_MASK 0x00200000 119 #define ID_MASK 0x00200000
120 120
121 /* hidden flags - used internally by qemu to represent additional cpu 121 /* hidden flags - used internally by qemu to represent additional cpu
122 - states. Only the CPL, INHIBIT_IRQ and HALTED are not redundant. We avoid 122 + states. Only the CPL and INHIBIT_IRQ are not redundant. We avoid
123 using the IOPL_MASK, TF_MASK and VM_MASK bit position to ease oring 123 using the IOPL_MASK, TF_MASK and VM_MASK bit position to ease oring
124 with eflags. */ 124 with eflags. */
125 /* current cpl */ 125 /* current cpl */
@@ -144,7 +144,6 @@ @@ -144,7 +144,6 @@
144 #define HF_CS64_SHIFT 15 /* only used on x86_64: 64 bit code segment */ 144 #define HF_CS64_SHIFT 15 /* only used on x86_64: 64 bit code segment */
145 #define HF_OSFXSR_SHIFT 16 /* CR4.OSFXSR */ 145 #define HF_OSFXSR_SHIFT 16 /* CR4.OSFXSR */
146 #define HF_VM_SHIFT 17 /* must be same as eflags */ 146 #define HF_VM_SHIFT 17 /* must be same as eflags */
147 -#define HF_HALTED_SHIFT 18 /* CPU halted */  
148 #define HF_SMM_SHIFT 19 /* CPU in SMM mode */ 147 #define HF_SMM_SHIFT 19 /* CPU in SMM mode */
149 #define HF_GIF_SHIFT 20 /* if set CPU takes interrupts */ 148 #define HF_GIF_SHIFT 20 /* if set CPU takes interrupts */
150 #define HF_HIF_SHIFT 21 /* shadow copy of IF_MASK when in SVM */ 149 #define HF_HIF_SHIFT 21 /* shadow copy of IF_MASK when in SVM */
@@ -166,7 +165,6 @@ @@ -166,7 +165,6 @@
166 #define HF_LMA_MASK (1 << HF_LMA_SHIFT) 165 #define HF_LMA_MASK (1 << HF_LMA_SHIFT)
167 #define HF_CS64_MASK (1 << HF_CS64_SHIFT) 166 #define HF_CS64_MASK (1 << HF_CS64_SHIFT)
168 #define HF_OSFXSR_MASK (1 << HF_OSFXSR_SHIFT) 167 #define HF_OSFXSR_MASK (1 << HF_OSFXSR_SHIFT)
169 -#define HF_HALTED_MASK (1 << HF_HALTED_SHIFT)  
170 #define HF_SMM_MASK (1 << HF_SMM_SHIFT) 168 #define HF_SMM_MASK (1 << HF_SMM_SHIFT)
171 #define HF_GIF_MASK (1 << HF_GIF_SHIFT) 169 #define HF_GIF_MASK (1 << HF_GIF_SHIFT)
172 #define HF_HIF_MASK (1 << HF_HIF_SHIFT) 170 #define HF_HIF_MASK (1 << HF_HIF_SHIFT)
target-i386/exec.h
@@ -385,13 +385,13 @@ static inline void regs_to_env(void) @@ -385,13 +385,13 @@ static inline void regs_to_env(void)
385 385
386 static inline int cpu_halted(CPUState *env) { 386 static inline int cpu_halted(CPUState *env) {
387 /* handle exit of HALTED state */ 387 /* handle exit of HALTED state */
388 - if (!(env->hflags & HF_HALTED_MASK)) 388 + if (!env->halted)
389 return 0; 389 return 0;
390 /* disable halt condition */ 390 /* disable halt condition */
391 if (((env->interrupt_request & CPU_INTERRUPT_HARD) && 391 if (((env->interrupt_request & CPU_INTERRUPT_HARD) &&
392 (env->eflags & IF_MASK)) || 392 (env->eflags & IF_MASK)) ||
393 (env->interrupt_request & CPU_INTERRUPT_NMI)) { 393 (env->interrupt_request & CPU_INTERRUPT_NMI)) {
394 - env->hflags &= ~HF_HALTED_MASK; 394 + env->halted = 0;
395 return 0; 395 return 0;
396 } 396 }
397 return EXCP_HALTED; 397 return EXCP_HALTED;
target-i386/helper.c
@@ -515,7 +515,7 @@ void cpu_dump_state(CPUState *env, FILE *f, @@ -515,7 +515,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
515 (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, 515 (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
516 (int)(env->a20_mask >> 20) & 1, 516 (int)(env->a20_mask >> 20) & 1,
517 (env->hflags >> HF_SMM_SHIFT) & 1, 517 (env->hflags >> HF_SMM_SHIFT) & 1,
518 - (env->hflags >> HF_HALTED_SHIFT) & 1); 518 + env->halted);
519 } else 519 } else
520 #endif 520 #endif
521 { 521 {
@@ -542,7 +542,7 @@ void cpu_dump_state(CPUState *env, FILE *f, @@ -542,7 +542,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
542 (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, 542 (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
543 (int)(env->a20_mask >> 20) & 1, 543 (int)(env->a20_mask >> 20) & 1,
544 (env->hflags >> HF_SMM_SHIFT) & 1, 544 (env->hflags >> HF_SMM_SHIFT) & 1,
545 - (env->hflags >> HF_HALTED_SHIFT) & 1); 545 + env->halted);
546 } 546 }
547 547
548 #ifdef TARGET_X86_64 548 #ifdef TARGET_X86_64
target-i386/op_helper.c
@@ -4546,7 +4546,7 @@ void helper_hlt(void) @@ -4546,7 +4546,7 @@ void helper_hlt(void)
4546 helper_svm_check_intercept_param(SVM_EXIT_HLT, 0); 4546 helper_svm_check_intercept_param(SVM_EXIT_HLT, 0);
4547 4547
4548 env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */ 4548 env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */
4549 - env->hflags |= HF_HALTED_MASK; 4549 + env->halted = 1;
4550 env->exception_index = EXCP_HLT; 4550 env->exception_index = EXCP_HLT;
4551 cpu_loop_exit(); 4551 cpu_loop_exit();
4552 } 4552 }
target-m68k/cpu.h
@@ -108,7 +108,6 @@ typedef struct CPUM68KState { @@ -108,7 +108,6 @@ typedef struct CPUM68KState {
108 int exception_index; 108 int exception_index;
109 int interrupt_request; 109 int interrupt_request;
110 int user_mode_only; 110 int user_mode_only;
111 - uint32_t halted;  
112 111
113 int pending_vector; 112 int pending_vector;
114 int pending_level; 113 int pending_level;
target-mips/cpu.h
@@ -449,8 +449,6 @@ struct CPUMIPSState { @@ -449,8 +449,6 @@ struct CPUMIPSState {
449 target_ulong btarget; /* Jump / branch target */ 449 target_ulong btarget; /* Jump / branch target */
450 int bcond; /* Branch condition (if needed) */ 450 int bcond; /* Branch condition (if needed) */
451 451
452 - int halted; /* TRUE if the CPU is in suspend state */  
453 -  
454 int SYNCI_Step; /* Address step size for SYNCI */ 452 int SYNCI_Step; /* Address step size for SYNCI */
455 int CCRes; /* Cycle count resolution/divisor */ 453 int CCRes; /* Cycle count resolution/divisor */
456 uint32_t CP0_Status_rw_bitmask; /* Read/write bits in CP0_Status */ 454 uint32_t CP0_Status_rw_bitmask; /* Read/write bits in CP0_Status */
target-ppc/cpu.h
@@ -586,8 +586,6 @@ struct CPUPPCState { @@ -586,8 +586,6 @@ struct CPUPPCState {
586 586
587 CPU_COMMON 587 CPU_COMMON
588 588
589 - int halted; /* TRUE if the CPU is in suspend state */  
590 -  
591 int access_type; /* when a memory exception occurs, the access 589 int access_type; /* when a memory exception occurs, the access
592 type is stored here */ 590 type is stored here */
593 591
target-sh4/cpu.h
@@ -117,7 +117,6 @@ typedef struct CPUSH4State { @@ -117,7 +117,6 @@ typedef struct CPUSH4State {
117 jmp_buf jmp_env; 117 jmp_buf jmp_env;
118 int user_mode_only; 118 int user_mode_only;
119 int interrupt_request; 119 int interrupt_request;
120 - int halted;  
121 int exception_index; 120 int exception_index;
122 CPU_COMMON tlb_t utlb[UTLB_SIZE]; /* unified translation table */ 121 CPU_COMMON tlb_t utlb[UTLB_SIZE]; /* unified translation table */
123 tlb_t itlb[ITLB_SIZE]; /* instruction translation table */ 122 tlb_t itlb[ITLB_SIZE]; /* instruction translation table */
target-sparc/cpu.h
@@ -219,7 +219,6 @@ typedef struct CPUSPARCState { @@ -219,7 +219,6 @@ typedef struct CPUSPARCState {
219 int exception_index; 219 int exception_index;
220 int interrupt_index; 220 int interrupt_index;
221 int interrupt_request; 221 int interrupt_request;
222 - int halted;  
223 uint32_t mmu_bm; 222 uint32_t mmu_bm;
224 uint32_t mmu_ctpr_mask; 223 uint32_t mmu_ctpr_mask;
225 uint32_t mmu_cxr_mask; 224 uint32_t mmu_cxr_mask;