[4609] moved halted field to CPU_COMMON
Revision: 4609
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4609 Author: bellard Date: 2008-05-28 17:14:10 +0000 (Wed, 28 May 2008)
Log Message:
-----------
moved halted field to CPU_COMMON
Modified Paths:
--------------
trunk/cpu-defs.h
trunk/hw/apic.c
trunk/hw/pc.c
trunk/monitor.c
trunk/target-alpha/cpu.h
trunk/target-arm/cpu.h
trunk/target-cris/cpu.h
trunk/target-i386/cpu.h
trunk/target-i386/exec.h
trunk/target-i386/helper.c
trunk/target-i386/op_helper.c
trunk/target-m68k/cpu.h
trunk/target-mips/cpu.h
trunk/target-ppc/cpu.h
trunk/target-sh4/cpu.h
trunk/target-sparc/cpu.hModified: trunk/cpu-defs.h
===================================================================
cpu-defs.h +1 -0
@@ -140,6 +140,7 @@written */ \target_ulong mem_write_vaddr;/* target virtual addr at which the \ memory was written */ \ +int halted;/* TRUE if the CPU is in suspend state */ \/* The meaning of the MMU modes is defined in the target code. */ \CPUTLBEntry tlb_table[NB_MMU_MODES ][CPU_TLB_SIZE ]; \struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE ]; \
Modified: trunk/hw/apic.c
===================================================================
hw/apic.c +2 -2
@@ -443,12 +443,12 @@static void apic_startup (APICState *s,int vector_num) {CPUState *env = s->cpu_env; -if (!(env->hflags &HF_HALTED_MASK )) +if (!env->halted)return ; env->eip =0 ;cpu_x86_load_seg_cache (env,R_CS , vector_num <<8 , vector_num <<12 ,0xffff ,0 ); - env->hflags &= ~HF_HALTED_MASK ; + env->halted =0 ; } static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode,
Modified: trunk/hw/pc.c
===================================================================
hw/pc.c +1 -1
@@ -761,7 +761,7 @@exit (1 ); }if (i !=0 ) - env->hflags |=HF_HALTED_MASK ; + env->halted =1 ;if (smp_cpus >1 ) {/* XXX: enable it in all cases */ env->cpuid_features |=CPUID_APIC ;
Modified: trunk/monitor.c
===================================================================
monitor.c +1 -7
@@ -314,21 +314,15 @@ env->cpu_index);#if defined(TARGET_I386 )term_printf (" pc=0x" TARGET_FMT_lx, env->eip + env->segs[R_CS ].base); -if (env->hflags &HF_HALTED_MASK ) -term_printf (" (halted)" );#elif defined(TARGET_PPC )term_printf (" nip=0x" TARGET_FMT_lx, env->nip); -if (env->halted) -term_printf (" (halted)" );#elif defined(TARGET_SPARC )term_printf (" pc=0x" TARGET_FMT_lx" npc=0x" TARGET_FMT_lx, env->pc, env->npc); -if (env->halted) -term_printf (" (halted)" );#elif defined(TARGET_MIPS )term_printf (" PC=0x" TARGET_FMT_lx, env->PC[env->current_tc]); +#endif if (env->halted)term_printf (" (halted)" ); -#endif term_printf ("\n" ); } }
Modified: trunk/target-alpha/cpu.h
===================================================================
target-alpha/cpu.h +0 -1
@@ -285,7 +285,6 @@jmp_buf jmp_env;int user_mode_only;/* user mode only simulation */ uint32_t hflags; -int halted;int exception_index;int error_code;
Modified: trunk/target-arm/cpu.h
===================================================================
target-arm/cpu.h +0 -1
@@ -160,7 +160,6 @@int exception_index;int interrupt_request;int user_mode_only; -int halted;/* VFP coprocessor state. */ struct {
Modified: trunk/target-cris/cpu.h
===================================================================
target-cris/cpu.h +0 -1
@@ -157,7 +157,6 @@int features;int user_mode_only; -int halted;jmp_buf jmp_env;CPU_COMMON
Modified: trunk/target-i386/cpu.h
===================================================================
target-i386/cpu.h +1 -3
@@ -119,7 +119,7 @@#define ID_MASK 0x00200000/* hidden flags - used internally by qemu to represent additional cpu -states. Only the CPL, INHIBIT_IRQ and HALTED are not redundant. We avoid +states. Only the CPL and INHIBIT_IRQ are not redundant. We avoid using the IOPL_MASK, TF_MASK and VM_MASK bit position to ease oring with eflags. */ /* current cpl */
@@ -144,7 +144,6 @@#define HF_CS64_SHIFT 15/* only used on x86_64: 64 bit code segment */ #define HF_OSFXSR_SHIFT 16/* CR4.OSFXSR */ #define HF_VM_SHIFT 17/* must be same as eflags */ -#define HF_HALTED_SHIFT 18/* CPU halted */ #define HF_SMM_SHIFT 19/* CPU in SMM mode */ #define HF_GIF_SHIFT 20/* if set CPU takes interrupts */ #define HF_HIF_SHIFT 21/* shadow copy of IF_MASK when in SVM */
@@ -166,7 +165,6 @@#define HF_LMA_MASK (1 << HF_LMA_SHIFT)#define HF_CS64_MASK (1 << HF_CS64_SHIFT)#define HF_OSFXSR_MASK (1 << HF_OSFXSR_SHIFT) -#define HF_HALTED_MASK (1 << HF_HALTED_SHIFT)#define HF_SMM_MASK (1 << HF_SMM_SHIFT)#define HF_GIF_MASK (1 << HF_GIF_SHIFT)#define HF_HIF_MASK (1 << HF_HIF_SHIFT)
Modified: trunk/target-i386/exec.h
===================================================================
target-i386/exec.h +2 -2
@@ -385,13 +385,13 @@static inline int cpu_halted (CPUState *env) {/* handle exit of HALTED state */ -if (!(env->hflags &HF_HALTED_MASK )) +if (!env->halted)return 0 ;/* disable halt condition */ if (((env->interrupt_request &CPU_INTERRUPT_HARD ) && (env->eflags &IF_MASK )) || (env->interrupt_request &CPU_INTERRUPT_NMI )) { - env->hflags &= ~HF_HALTED_MASK ; + env->halted =0 ;return 0 ; }return EXCP_HALTED ;
Modified: trunk/target-i386/helper.c
===================================================================
target-i386/helper.c +2 -2
@@ -515,7 +515,7 @@ (env->hflags >>HF_INHIBIT_IRQ_SHIFT ) &1 , (int )(env->a20_mask >>20 ) &1 , (env->hflags >>HF_SMM_SHIFT ) &1 , - (env->hflags >> HF_HALTED_SHIFT) & 1); + env->halted); } else#endif {
@@ -542,7 +542,7 @@ (env->hflags >>HF_INHIBIT_IRQ_SHIFT ) &1 , (int )(env->a20_mask >>20 ) &1 , (env->hflags >>HF_SMM_SHIFT ) &1 , - (env->hflags >> HF_HALTED_SHIFT) & 1); + env->halted); }#ifdef TARGET_X86_64
Modified: trunk/target-i386/op_helper.c
===================================================================
target-i386/op_helper.c +1 -1
@@ -4546,7 +4546,7 @@helper_svm_check_intercept_param (SVM_EXIT_HLT ,0 ); env->hflags &= ~HF_INHIBIT_IRQ_MASK ;/* needed if sti is just before */ - env->hflags |=HF_HALTED_MASK ; + env->halted =1 ; env->exception_index =EXCP_HLT ;cpu_loop_exit (); }
Modified: trunk/target-m68k/cpu.h
===================================================================
target-m68k/cpu.h +0 -1
@@ -108,7 +108,6 @@int exception_index;int interrupt_request;int user_mode_only; -uint32_t halted;int pending_vector;int pending_level;
Modified: trunk/target-mips/cpu.h
===================================================================
target-mips/cpu.h +0 -2
@@ -449,8 +449,6 @@target_ulong btarget;/* Jump / branch target */ int bcond;/* Branch condition (if needed) */ -int halted;/* TRUE if the CPU is in suspend state */ -int SYNCI_Step;/* Address step size for SYNCI */ int CCRes;/* Cycle count resolution/divisor */ uint32_t CP0_Status_rw_bitmask;/* Read/write bits in CP0_Status */
Modified: trunk/target-ppc/cpu.h
===================================================================
target-ppc/cpu.h +0 -2
@@ -586,8 +586,6 @@CPU_COMMON - int halted; /* TRUE if the CPU is in suspend state */ - int access_type; /* when a memory exception occurs, the accesstype is stored here */
Modified: trunk/target-sh4/cpu.h
===================================================================
target-sh4/cpu.h +0 -1
@@ -117,7 +117,6 @@jmp_buf jmp_env;int user_mode_only;int interrupt_request; -int halted;int exception_index; CPU_COMMON tlb_t utlb[UTLB_SIZE]; /* unified translation table */tlb_t itlb[ITLB_SIZE ];/* instruction translation table */
Modified: trunk/target-sparc/cpu.h
===================================================================
target-sparc/cpu.h +0 -1
@@ -219,7 +219,6 @@int exception_index;int interrupt_index;int interrupt_request; -int halted;uint32_t mmu_bm;uint32_t mmu_ctpr_mask;uint32_t mmu_cxr_mask;
Quoted 8 lines · Fabrice Bellard
Revision: 4609
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4609 Author: bellard Date: 2008-05-28 17:14:10 +0000 (Wed, 28 May 2008)Log Message:
-----------
moved halted field toCPU_COMMON
It is very good to have it commited, but I feel really embarassed to see no mention to me at all in the changelog.
Even if it is a slightly modified version of the patch itself (although this one seems more like a subset), giving credit to the work I've done is a good thing. At the very least,
it will keep developers around and motivated.
Quoted 292 lines
Modified Paths:
--------------
trunk/cpu-defs.h
trunk/hw/apic.c
trunk/hw/pc.c
trunk/monitor.c
trunk/target-alpha/cpu.h
trunk/target-arm/cpu.h
trunk/target-cris/cpu.h
trunk/target-i386/cpu.h
trunk/target-i386/exec.h
trunk/target-i386/helper.c
trunk/target-i386/op_helper.c
trunk/target-m68k/cpu.h
trunk/target-mips/cpu.h
trunk/target-ppc/cpu.h
trunk/target-sh4/cpu.h
trunk/target-sparc/cpu.hModified:
trunk/cpu-defs.h
===================================================================cpu-defs.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from cpu-defs.h 2008-05-28 16:49:25 UTC (rev 4608) +1
-0@@ -140,6 +140,7 @@ written */ \ target_ulong mem_write_vaddr; /* target virtual addr at which the \ memory was written */ \ + int halted; /* TRUE if the CPU is in suspend state */ \ /* The meaning of the MMU modes is defined in the target code. */ \ CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; \ struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; \Modified:
trunk/hw/apic.c
===================================================================hw/apic.c 2008-05-28 17:14:10 UTC (rev 4609) renamed from hw/apic.c 2008-05-28 16:49:25 UTC (rev 4608) +2
-2@@ -443,12 +443,12 @@ static void apic_startup(APICState *s, int vector_num) { CPUState *env = s->cpu_env; - if (!(env->hflags & HF_HALTED_MASK)) + if (!env->halted) return; env->eip = 0; cpu_x86_load_seg_cache(env, R_CS, vector_num << 8, vector_num << 12, 0xffff, 0); - env->hflags &= ~HF_HALTED_MASK; + env->halted = 0; } static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode,Modified:
trunk/hw/pc.c
===================================================================hw/pc.c 2008-05-28 17:14:10 UTC (rev 4609) renamed from hw/pc.c 2008-05-28 16:49:25 UTC (rev 4608) +1
-1@@ -761,7 +761,7 @@ exit(1); } if (i != 0) - env->hflags |= HF_HALTED_MASK; + env->halted = 1; if (smp_cpus > 1) { /* XXX: enable it in all cases */ env->cpuid_features |= CPUID_APIC;Modified:
trunk/monitor.c
===================================================================monitor.c 2008-05-28 17:14:10 UTC (rev 4609) renamed from monitor.c 2008-05-28 16:49:25 UTC (rev 4608) +1
-7@@ -314,21 +314,15 @@ env->cpu_index); #if defined(TARGET_I386) term_printf(" pc=0x" TARGET_FMT_lx, env->eip + env->segs[R_CS].base); - if (env->hflags & HF_HALTED_MASK) - term_printf(" (halted)"); #elif defined(TARGET_PPC) term_printf(" nip=0x" TARGET_FMT_lx, env->nip); - if (env->halted) - term_printf(" (halted)"); #elif defined(TARGET_SPARC) term_printf(" pc=0x" TARGET_FMT_lx " npc=0x" TARGET_FMT_lx, env->pc, env->npc); - if (env->halted) - term_printf(" (halted)"); #elif defined(TARGET_MIPS) term_printf(" PC=0x" TARGET_FMT_lx, env->PC[env->current_tc]); +#endif if (env->halted) term_printf(" (halted)"); -#endif term_printf("\n"); } }Modified:
trunk/target-alpha/cpu.h
===================================================================target-alpha/cpu.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-alpha/cpu.h 2008-05-28 16:49:25 UTC (rev 4608) +0
-1@@ -285,7 +285,6 @@ jmp_buf jmp_env; int user_mode_only; /* user mode only simulation */ uint32_t hflags; - int halted; int exception_index; int error_code;Modified:
trunk/target-arm/cpu.h
===================================================================target-arm/cpu.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-arm/cpu.h 2008-05-28 16:49:25 UTC (rev 4608) +0
-1@@ -160,7 +160,6 @@ int exception_index; int interrupt_request; int user_mode_only; - int halted; /* VFP coprocessor state. */ struct {Modified:
trunk/target-cris/cpu.h
===================================================================target-cris/cpu.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-cris/cpu.h 2008-05-28 16:49:25 UTC (rev 4608) +0
-1@@ -157,7 +157,6 @@ int features; int user_mode_only; - int halted; jmp_buf jmp_env; CPU_COMMONModified:
trunk/target-i386/cpu.h
===================================================================target-i386/cpu.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-i386/cpu.h 2008-05-28 16:49:25 UTC (rev 4608) +1
-3@@ -119,7 +119,7 @@ #define ID_MASK 0x00200000 /* hidden flags - used internally by qemu to represent additional cpu - states. Only the CPL, INHIBIT_IRQ and HALTED are not redundant. We avoid + states. Only the CPL and INHIBIT_IRQ are not redundant. We avoid using the IOPL_MASK, TF_MASK and VM_MASK bit position to ease oring with eflags. */ /* current cpl */@@ -144,7 +144,6 @@ #define HF_CS64_SHIFT 15 /* only used on x86_64: 64 bit code segment */ #define HF_OSFXSR_SHIFT 16 /* CR4.OSFXSR */ #define HF_VM_SHIFT 17 /* must be same as eflags */ -#define HF_HALTED_SHIFT 18 /* CPU halted */ #define HF_SMM_SHIFT 19 /* CPU in SMM mode */ #define HF_GIF_SHIFT 20 /* if set CPU takes interrupts */ #define HF_HIF_SHIFT 21 /* shadow copy of IF_MASK when in SVM */@@ -166,7 +165,6 @@ #define HF_LMA_MASK (1 << HF_LMA_SHIFT) #define HF_CS64_MASK (1 << HF_CS64_SHIFT) #define HF_OSFXSR_MASK (1 << HF_OSFXSR_SHIFT) -#define HF_HALTED_MASK (1 << HF_HALTED_SHIFT) #define HF_SMM_MASK (1 << HF_SMM_SHIFT) #define HF_GIF_MASK (1 << HF_GIF_SHIFT) #define HF_HIF_MASK (1 << HF_HIF_SHIFT)Modified:
trunk/target-i386/exec.h
===================================================================target-i386/exec.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-i386/exec.h 2008-05-28 16:49:25 UTC (rev 4608) +2
-2@@ -385,13 +385,13 @@ static inline int cpu_halted(CPUState *env) { /* handle exit of HALTED state */ - if (!(env->hflags & HF_HALTED_MASK)) + if (!env->halted) return 0; /* disable halt condition */ if (((env->interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || (env->interrupt_request & CPU_INTERRUPT_NMI)) { - env->hflags &= ~HF_HALTED_MASK; + env->halted = 0; return 0; } return EXCP_HALTED;Modified:
trunk/target-i386/helper.c
===================================================================target-i386/helper.c 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-i386/helper.c 2008-05-28 16:49:25 UTC (rev 4608) +2
-2@@ -515,7 +515,7 @@ (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, (int)(env->a20_mask >> 20) & 1, (env->hflags >> HF_SMM_SHIFT) & 1, - (env->hflags >> HF_HALTED_SHIFT) & 1); + env->halted); } else #endif {@@ -542,7 +542,7 @@ (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, (int)(env->a20_mask >> 20) & 1, (env->hflags >> HF_SMM_SHIFT) & 1, - (env->hflags >> HF_HALTED_SHIFT) & 1); + env->halted); } #ifdef TARGET_X86_64Modified:
trunk/target-i386/op_helper.c
===================================================================target-i386/op_helper.c 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-i386/op_helper.c 2008-05-28 16:49:25 UTC (rev 4608) +1
-1@@ -4546,7 +4546,7 @@ helper_svm_check_intercept_param(SVM_EXIT_HLT, 0); env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */ - env->hflags |= HF_HALTED_MASK; + env->halted = 1; env->exception_index = EXCP_HLT; cpu_loop_exit(); }Modified:
trunk/target-m68k/cpu.h
===================================================================target-m68k/cpu.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-m68k/cpu.h 2008-05-28 16:49:25 UTC (rev 4608) +0
-1@@ -108,7 +108,6 @@ int exception_index; int interrupt_request; int user_mode_only; - uint32_t halted; int pending_vector; int pending_level;Modified:
trunk/target-mips/cpu.h
===================================================================target-mips/cpu.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-mips/cpu.h 2008-05-28 16:49:25 UTC (rev 4608) +0
-2@@ -449,8 +449,6 @@ target_ulong btarget; /* Jump / branch target */ int bcond; /* Branch condition (if needed) */ - int halted; /* TRUE if the CPU is in suspend state */ - int SYNCI_Step; /* Address step size for SYNCI */ int CCRes; /* Cycle count resolution/divisor */ uint32_t CP0_Status_rw_bitmask; /* Read/write bits in CP0_Status */Modified:
trunk/target-ppc/cpu.h
===================================================================target-ppc/cpu.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-ppc/cpu.h 2008-05-28 16:49:25 UTC (rev 4608) +0
-2@@ -586,8 +586,6 @@ CPU_COMMON - int halted; /* TRUE if the CPU is in suspend state */ - int access_type; /* when a memory exception occurs, the access type is stored here */Modified:
trunk/target-sh4/cpu.h
===================================================================target-sh4/cpu.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-sh4/cpu.h 2008-05-28 16:49:25 UTC (rev 4608) +0
-1@@ -117,7 +117,6 @@ jmp_buf jmp_env; int user_mode_only; int interrupt_request; - int halted; int exception_index; CPU_COMMON tlb_t utlb[UTLB_SIZE]; /* unified translation table */ tlb_t itlb[ITLB_SIZE]; /* instruction translation table */Modified:
trunk/target-sparc/cpu.h
===================================================================target-sparc/cpu.h 2008-05-28 17:14:10 UTC (rev 4609) renamed from target-sparc/cpu.h 2008-05-28 16:49:25 UTC (rev 4608) +0
-1@@ -219,7 +219,6 @@ int exception_index; int interrupt_index; int interrupt_request; - int halted; uint32_t mmu_bm; uint32_t mmu_ctpr_mask; uint32_t mmu_cxr_mask;
Signature · 5 lines
Glauber Costa. "Free as in Freedom" http://glommer.net "The less confident you are, the more serious you have to act."
Quoted 10 lines · Glauber Costa
Quoted 8 lines · Fabrice Bellard
Revision: 4609
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4609 Author: bellard Date: 2008-05-28 17:14:10 +0000 (Wed, 28 May 2008)Log Message:
-----------
moved halted field toCPU_COMMON
Quoted 6 lines
It is very good to have it commited, but I feel really embarassed to see no mention to me at all in the changelog.
Even if it is a slightly modified version of the patch itself (although this one seems more like a subset), giving credit to the work I've done is a good thing. At the very least,
it will keep developers around and motivated.
Sorry but I did redo this particular patch and I may redo the others as well as it is faster for me to write them as I'd like to see them rather than discussing on the mailing list.
Moreover, I consider your patches as cosmetic and as such I see no problem in not mentionning the author.
Regards,
Fabrice.