Commit ce5232c5c281552039466be5eadf93a712eb7611
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
Showing
16 changed files
with
11 additions
and
28 deletions
cpu-defs.h
| ... | ... | @@ -140,6 +140,7 @@ typedef struct CPUTLBEntry { |
| 140 | 140 | written */ \ |
| 141 | 141 | target_ulong mem_write_vaddr; /* target virtual addr at which the \ |
| 142 | 142 | memory was written */ \ |
| 143 | + int halted; /* TRUE if the CPU is in suspend state */ \ | |
| 143 | 144 | /* The meaning of the MMU modes is defined in the target code. */ \ |
| 144 | 145 | CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; \ |
| 145 | 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 | 443 | static void apic_startup(APICState *s, int vector_num) |
| 444 | 444 | { |
| 445 | 445 | CPUState *env = s->cpu_env; |
| 446 | - if (!(env->hflags & HF_HALTED_MASK)) | |
| 446 | + if (!env->halted) | |
| 447 | 447 | return; |
| 448 | 448 | env->eip = 0; |
| 449 | 449 | cpu_x86_load_seg_cache(env, R_CS, vector_num << 8, vector_num << 12, |
| 450 | 450 | 0xffff, 0); |
| 451 | - env->hflags &= ~HF_HALTED_MASK; | |
| 451 | + env->halted = 0; | |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode, | ... | ... |
hw/pc.c
| ... | ... | @@ -761,7 +761,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, |
| 761 | 761 | exit(1); |
| 762 | 762 | } |
| 763 | 763 | if (i != 0) |
| 764 | - env->hflags |= HF_HALTED_MASK; | |
| 764 | + env->halted = 1; | |
| 765 | 765 | if (smp_cpus > 1) { |
| 766 | 766 | /* XXX: enable it in all cases */ |
| 767 | 767 | env->cpuid_features |= CPUID_APIC; | ... | ... |
monitor.c
| ... | ... | @@ -314,21 +314,15 @@ static void do_info_cpus(void) |
| 314 | 314 | env->cpu_index); |
| 315 | 315 | #if defined(TARGET_I386) |
| 316 | 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 | 317 | #elif defined(TARGET_PPC) |
| 320 | 318 | term_printf(" nip=0x" TARGET_FMT_lx, env->nip); |
| 321 | - if (env->halted) | |
| 322 | - term_printf(" (halted)"); | |
| 323 | 319 | #elif defined(TARGET_SPARC) |
| 324 | 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 | 321 | #elif defined(TARGET_MIPS) |
| 328 | 322 | term_printf(" PC=0x" TARGET_FMT_lx, env->PC[env->current_tc]); |
| 323 | +#endif | |
| 329 | 324 | if (env->halted) |
| 330 | 325 | term_printf(" (halted)"); |
| 331 | -#endif | |
| 332 | 326 | term_printf("\n"); |
| 333 | 327 | } |
| 334 | 328 | } | ... | ... |
target-alpha/cpu.h
target-arm/cpu.h
target-cris/cpu.h
target-i386/cpu.h
| ... | ... | @@ -119,7 +119,7 @@ |
| 119 | 119 | #define ID_MASK 0x00200000 |
| 120 | 120 | |
| 121 | 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 | 123 | using the IOPL_MASK, TF_MASK and VM_MASK bit position to ease oring |
| 124 | 124 | with eflags. */ |
| 125 | 125 | /* current cpl */ |
| ... | ... | @@ -144,7 +144,6 @@ |
| 144 | 144 | #define HF_CS64_SHIFT 15 /* only used on x86_64: 64 bit code segment */ |
| 145 | 145 | #define HF_OSFXSR_SHIFT 16 /* CR4.OSFXSR */ |
| 146 | 146 | #define HF_VM_SHIFT 17 /* must be same as eflags */ |
| 147 | -#define HF_HALTED_SHIFT 18 /* CPU halted */ | |
| 148 | 147 | #define HF_SMM_SHIFT 19 /* CPU in SMM mode */ |
| 149 | 148 | #define HF_GIF_SHIFT 20 /* if set CPU takes interrupts */ |
| 150 | 149 | #define HF_HIF_SHIFT 21 /* shadow copy of IF_MASK when in SVM */ |
| ... | ... | @@ -166,7 +165,6 @@ |
| 166 | 165 | #define HF_LMA_MASK (1 << HF_LMA_SHIFT) |
| 167 | 166 | #define HF_CS64_MASK (1 << HF_CS64_SHIFT) |
| 168 | 167 | #define HF_OSFXSR_MASK (1 << HF_OSFXSR_SHIFT) |
| 169 | -#define HF_HALTED_MASK (1 << HF_HALTED_SHIFT) | |
| 170 | 168 | #define HF_SMM_MASK (1 << HF_SMM_SHIFT) |
| 171 | 169 | #define HF_GIF_MASK (1 << HF_GIF_SHIFT) |
| 172 | 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 | 385 | |
| 386 | 386 | static inline int cpu_halted(CPUState *env) { |
| 387 | 387 | /* handle exit of HALTED state */ |
| 388 | - if (!(env->hflags & HF_HALTED_MASK)) | |
| 388 | + if (!env->halted) | |
| 389 | 389 | return 0; |
| 390 | 390 | /* disable halt condition */ |
| 391 | 391 | if (((env->interrupt_request & CPU_INTERRUPT_HARD) && |
| 392 | 392 | (env->eflags & IF_MASK)) || |
| 393 | 393 | (env->interrupt_request & CPU_INTERRUPT_NMI)) { |
| 394 | - env->hflags &= ~HF_HALTED_MASK; | |
| 394 | + env->halted = 0; | |
| 395 | 395 | return 0; |
| 396 | 396 | } |
| 397 | 397 | return EXCP_HALTED; | ... | ... |
target-i386/helper.c
| ... | ... | @@ -515,7 +515,7 @@ void cpu_dump_state(CPUState *env, FILE *f, |
| 515 | 515 | (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, |
| 516 | 516 | (int)(env->a20_mask >> 20) & 1, |
| 517 | 517 | (env->hflags >> HF_SMM_SHIFT) & 1, |
| 518 | - (env->hflags >> HF_HALTED_SHIFT) & 1); | |
| 518 | + env->halted); | |
| 519 | 519 | } else |
| 520 | 520 | #endif |
| 521 | 521 | { |
| ... | ... | @@ -542,7 +542,7 @@ void cpu_dump_state(CPUState *env, FILE *f, |
| 542 | 542 | (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, |
| 543 | 543 | (int)(env->a20_mask >> 20) & 1, |
| 544 | 544 | (env->hflags >> HF_SMM_SHIFT) & 1, |
| 545 | - (env->hflags >> HF_HALTED_SHIFT) & 1); | |
| 545 | + env->halted); | |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | #ifdef TARGET_X86_64 | ... | ... |
target-i386/op_helper.c
| ... | ... | @@ -4546,7 +4546,7 @@ void helper_hlt(void) |
| 4546 | 4546 | helper_svm_check_intercept_param(SVM_EXIT_HLT, 0); |
| 4547 | 4547 | |
| 4548 | 4548 | env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */ |
| 4549 | - env->hflags |= HF_HALTED_MASK; | |
| 4549 | + env->halted = 1; | |
| 4550 | 4550 | env->exception_index = EXCP_HLT; |
| 4551 | 4551 | cpu_loop_exit(); |
| 4552 | 4552 | } | ... | ... |
target-m68k/cpu.h
target-mips/cpu.h
| ... | ... | @@ -449,8 +449,6 @@ struct CPUMIPSState { |
| 449 | 449 | target_ulong btarget; /* Jump / branch target */ |
| 450 | 450 | int bcond; /* Branch condition (if needed) */ |
| 451 | 451 | |
| 452 | - int halted; /* TRUE if the CPU is in suspend state */ | |
| 453 | - | |
| 454 | 452 | int SYNCI_Step; /* Address step size for SYNCI */ |
| 455 | 453 | int CCRes; /* Cycle count resolution/divisor */ |
| 456 | 454 | uint32_t CP0_Status_rw_bitmask; /* Read/write bits in CP0_Status */ | ... | ... |
target-ppc/cpu.h
target-sh4/cpu.h
| ... | ... | @@ -117,7 +117,6 @@ typedef struct CPUSH4State { |
| 117 | 117 | jmp_buf jmp_env; |
| 118 | 118 | int user_mode_only; |
| 119 | 119 | int interrupt_request; |
| 120 | - int halted; | |
| 121 | 120 | int exception_index; |
| 122 | 121 | CPU_COMMON tlb_t utlb[UTLB_SIZE]; /* unified translation table */ |
| 123 | 122 | tlb_t itlb[ITLB_SIZE]; /* instruction translation table */ | ... | ... |