Commit 9656f324d25895ec16ebc5eaf624e28a96c1f1be
1 parent
a5cdf952
Move interrupt_request and user_mode_only to common cpu state.
Save and restore env->interrupt_request and env->halted. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4817 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
12 changed files
with
38 additions
and
28 deletions
cpu-defs.h
| ... | ... | @@ -153,7 +153,8 @@ typedef struct icount_decr_u16 { |
| 153 | 153 | accessed */ \ |
| 154 | 154 | target_ulong mem_io_vaddr; /* target virtual addr at which the \ |
| 155 | 155 | memory was accessed */ \ |
| 156 | - int halted; /* TRUE if the CPU is in suspend state */ \ | |
| 156 | + uint32_t halted; /* Nonzero if the CPU is in suspend state */ \ | |
| 157 | + uint32_t interrupt_request; \ | |
| 157 | 158 | /* The meaning of the MMU modes is defined in the target code. */ \ |
| 158 | 159 | CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; \ |
| 159 | 160 | target_phys_addr_t iotlb[NB_MMU_MODES][CPU_TLB_SIZE]; \ |
| ... | ... | @@ -188,6 +189,8 @@ typedef struct icount_decr_u16 { |
| 188 | 189 | jmp_buf jmp_env; \ |
| 189 | 190 | int exception_index; \ |
| 190 | 191 | \ |
| 192 | + int user_mode_only; \ | |
| 193 | + \ | |
| 191 | 194 | void *next_cpu; /* next CPU sharing TB cache */ \ |
| 192 | 195 | int cpu_index; /* CPU index (informative) */ \ |
| 193 | 196 | int running; /* Nonzero if cpu is currently running(usermode). */ \ | ... | ... |
exec.c
| ... | ... | @@ -443,6 +443,33 @@ void cpu_exec_init_all(unsigned long tb_size) |
| 443 | 443 | #endif |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | +#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY) | |
| 447 | + | |
| 448 | +#define CPU_COMMON_SAVE_VERSION 1 | |
| 449 | + | |
| 450 | +static void cpu_common_save(QEMUFile *f, void *opaque) | |
| 451 | +{ | |
| 452 | + CPUState *env = opaque; | |
| 453 | + | |
| 454 | + qemu_put_be32s(f, &env->halted); | |
| 455 | + qemu_put_be32s(f, &env->interrupt_request); | |
| 456 | +} | |
| 457 | + | |
| 458 | +static int cpu_common_load(QEMUFile *f, void *opaque, int version_id) | |
| 459 | +{ | |
| 460 | + CPUState *env = opaque; | |
| 461 | + | |
| 462 | + if (version_id != CPU_COMMON_SAVE_VERSION) | |
| 463 | + return -EINVAL; | |
| 464 | + | |
| 465 | + qemu_get_be32s(f, &env->halted); | |
| 466 | + qemu_put_be32s(f, &env->interrupt_request); | |
| 467 | + tlb_flush(env, 1); | |
| 468 | + | |
| 469 | + return 0; | |
| 470 | +} | |
| 471 | +#endif | |
| 472 | + | |
| 446 | 473 | void cpu_exec_init(CPUState *env) |
| 447 | 474 | { |
| 448 | 475 | CPUState **penv; |
| ... | ... | @@ -459,6 +486,8 @@ void cpu_exec_init(CPUState *env) |
| 459 | 486 | env->nb_watchpoints = 0; |
| 460 | 487 | *penv = env; |
| 461 | 488 | #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY) |
| 489 | + register_savevm("cpu_common", cpu_index, CPU_COMMON_SAVE_VERSION, | |
| 490 | + cpu_common_save, cpu_common_load, env); | |
| 462 | 491 | register_savevm("cpu", cpu_index, CPU_SAVE_VERSION, |
| 463 | 492 | cpu_save, cpu_load, env); |
| 464 | 493 | #endif | ... | ... |
target-alpha/cpu.h
| ... | ... | @@ -282,11 +282,9 @@ struct CPUAlphaState { |
| 282 | 282 | /* Those resources are used only in Qemu core */ |
| 283 | 283 | CPU_COMMON |
| 284 | 284 | |
| 285 | - int user_mode_only; /* user mode only simulation */ | |
| 286 | 285 | uint32_t hflags; |
| 287 | 286 | |
| 288 | 287 | int error_code; |
| 289 | - int interrupt_request; | |
| 290 | 288 | |
| 291 | 289 | uint32_t features; |
| 292 | 290 | uint32_t amask; | ... | ... |
target-arm/cpu.h
| ... | ... | @@ -156,10 +156,6 @@ typedef struct CPUARMState { |
| 156 | 156 | int (*get_irq_vector)(struct CPUARMState *); |
| 157 | 157 | void *irq_opaque; |
| 158 | 158 | |
| 159 | - /* exception/interrupt handling */ | |
| 160 | - int interrupt_request; | |
| 161 | - int user_mode_only; | |
| 162 | - | |
| 163 | 159 | /* VFP coprocessor state. */ |
| 164 | 160 | struct { |
| 165 | 161 | float64 regs[32]; | ... | ... |
target-cris/cpu.h
| ... | ... | @@ -125,7 +125,6 @@ typedef struct CPUCRISState { |
| 125 | 125 | /* X flag at the time of cc snapshot. */ |
| 126 | 126 | int cc_x; |
| 127 | 127 | |
| 128 | - int interrupt_request; | |
| 129 | 128 | int interrupt_vector; |
| 130 | 129 | int fault_vector; |
| 131 | 130 | int trap_vector; |
| ... | ... | @@ -156,8 +155,6 @@ typedef struct CPUCRISState { |
| 156 | 155 | uint32_t lo; |
| 157 | 156 | } tlbsets[2][4][16]; |
| 158 | 157 | |
| 159 | - int user_mode_only; | |
| 160 | - | |
| 161 | 158 | CPU_COMMON |
| 162 | 159 | } CPUCRISState; |
| 163 | 160 | ... | ... |
target-i386/cpu.h
| ... | ... | @@ -567,8 +567,6 @@ typedef struct CPUX86State { |
| 567 | 567 | target_ulong exception_next_eip; |
| 568 | 568 | target_ulong dr[8]; /* debug registers */ |
| 569 | 569 | uint32_t smbase; |
| 570 | - int interrupt_request; | |
| 571 | - int user_mode_only; /* user mode only simulation */ | |
| 572 | 570 | int old_exception; /* exception in flight */ |
| 573 | 571 | |
| 574 | 572 | CPU_COMMON |
| ... | ... | @@ -726,7 +724,7 @@ static inline int cpu_get_time_fast(void) |
| 726 | 724 | #define cpu_signal_handler cpu_x86_signal_handler |
| 727 | 725 | #define cpu_list x86_cpu_list |
| 728 | 726 | |
| 729 | -#define CPU_SAVE_VERSION 5 | |
| 727 | +#define CPU_SAVE_VERSION 6 | |
| 730 | 728 | |
| 731 | 729 | /* MMU modes definitions */ |
| 732 | 730 | #define MMU_MODE0_SUFFIX _kernel | ... | ... |
target-i386/machine.c
| ... | ... | @@ -123,7 +123,6 @@ void cpu_save(QEMUFile *f, void *opaque) |
| 123 | 123 | |
| 124 | 124 | qemu_put_be64s(f, &env->pat); |
| 125 | 125 | qemu_put_be32s(f, &env->hflags2); |
| 126 | - qemu_put_be32s(f, (uint32_t *)&env->halted); | |
| 127 | 126 | |
| 128 | 127 | qemu_put_be64s(f, &env->vm_hsave); |
| 129 | 128 | qemu_put_be64s(f, &env->vm_vmcb); |
| ... | ... | @@ -169,7 +168,8 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) |
| 169 | 168 | uint16_t fpus, fpuc, fptag, fpregs_format; |
| 170 | 169 | int32_t a20_mask; |
| 171 | 170 | |
| 172 | - if (version_id != 3 && version_id != 4 && version_id != 5) | |
| 171 | + if (version_id != 3 && version_id != 4 && version_id != 5 | |
| 172 | + && version_id != 6) | |
| 173 | 173 | return -EINVAL; |
| 174 | 174 | for(i = 0; i < CPU_NB_REGS; i++) |
| 175 | 175 | qemu_get_betls(f, &env->regs[i]); |
| ... | ... | @@ -279,7 +279,8 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) |
| 279 | 279 | if (version_id >= 5) { |
| 280 | 280 | qemu_get_be64s(f, &env->pat); |
| 281 | 281 | qemu_get_be32s(f, &env->hflags2); |
| 282 | - qemu_get_be32s(f, (uint32_t *)&env->halted); | |
| 282 | + if (version_id < 6) | |
| 283 | + qemu_get_be32s(f, &env->halted); | |
| 283 | 284 | |
| 284 | 285 | qemu_get_be64s(f, &env->vm_hsave); |
| 285 | 286 | qemu_get_be64s(f, &env->vm_vmcb); | ... | ... |
target-m68k/cpu.h
target-mips/cpu.h
| ... | ... | @@ -411,9 +411,7 @@ struct CPUMIPSState { |
| 411 | 411 | /* We waste some space so we can handle shadow registers like TCs. */ |
| 412 | 412 | TCState tcs[MIPS_SHADOW_SET_MAX]; |
| 413 | 413 | /* Qemu */ |
| 414 | - int interrupt_request; | |
| 415 | 414 | int error_code; |
| 416 | - int user_mode_only; /* user mode only simulation */ | |
| 417 | 415 | uint32_t hflags; /* CPU State */ |
| 418 | 416 | /* TMASK defines different execution modes */ |
| 419 | 417 | #define MIPS_HFLAG_TMASK 0x01FF | ... | ... |
target-ppc/cpu.h
| ... | ... | @@ -647,7 +647,6 @@ struct CPUPPCState { |
| 647 | 647 | uint32_t flags; |
| 648 | 648 | |
| 649 | 649 | int error_code; |
| 650 | - int interrupt_request; | |
| 651 | 650 | uint32_t pending_interrupts; |
| 652 | 651 | #if !defined(CONFIG_USER_ONLY) |
| 653 | 652 | /* This is the IRQ controller, which is implementation dependant |
| ... | ... | @@ -671,7 +670,6 @@ struct CPUPPCState { |
| 671 | 670 | opc_handler_t *opcodes[0x40]; |
| 672 | 671 | |
| 673 | 672 | /* Those resources are used only in Qemu core */ |
| 674 | - int user_mode_only; /* user mode only simulation */ | |
| 675 | 673 | target_ulong hflags; /* hflags is a MSR & HFLAGS_MASK */ |
| 676 | 674 | target_ulong hflags_nmsr; /* specific hflags, not comming from MSR */ |
| 677 | 675 | int mmu_idx; /* precomputed MMU index to speed up mem accesses */ | ... | ... |
target-sh4/cpu.h
| ... | ... | @@ -114,8 +114,6 @@ typedef struct CPUSH4State { |
| 114 | 114 | uint32_t expevt; /* exception event register */ |
| 115 | 115 | uint32_t intevt; /* interrupt event register */ |
| 116 | 116 | |
| 117 | - int user_mode_only; | |
| 118 | - int interrupt_request; | |
| 119 | 117 | CPU_COMMON tlb_t utlb[UTLB_SIZE]; /* unified translation table */ |
| 120 | 118 | tlb_t itlb[ITLB_SIZE]; /* instruction translation table */ |
| 121 | 119 | void *intc_handle; | ... | ... |
target-sparc/cpu.h
| ... | ... | @@ -215,9 +215,7 @@ typedef struct CPUSPARCState { |
| 215 | 215 | uint32_t pil_in; /* incoming interrupt level bitmap */ |
| 216 | 216 | int psref; /* enable fpu */ |
| 217 | 217 | target_ulong version; |
| 218 | - int user_mode_only; | |
| 219 | 218 | int interrupt_index; |
| 220 | - int interrupt_request; | |
| 221 | 219 | uint32_t mmu_bm; |
| 222 | 220 | uint32_t mmu_ctpr_mask; |
| 223 | 221 | uint32_t mmu_cxr_mask; | ... | ... |