[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 30/49] x86: make a20_mask int32_t
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 30/49] x86: make a20_mask int32_t |
Date: |
Tue, 29 Sep 2009 22:48:49 +0200 |
This makes the savevm code correct, and sign extensins gives us exactly
what we need (namely, sign extend to 64 bits when used with 64bit addresess.
Once there, change 0x100000 for 1 << 20, that maks all a20 use the same syntax.
Signed-off-by: Juan Quintela <address@hidden>
---
target-i386/cpu.h | 2 +-
target-i386/helper.c | 6 +++---
target-i386/machine.c | 9 ++-------
3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index b9a6392..53f5a3d 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -588,7 +588,7 @@ typedef struct CPUX86State {
SegmentCache idt; /* only base and limit are used */
target_ulong cr[5]; /* NOTE: cr1 is unused */
- uint64_t a20_mask;
+ int32_t a20_mask;
/* FPU state */
unsigned int fpstt; /* top of stack index */
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 8111f25..999c1bf 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -780,7 +780,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
eflags & CC_C ? 'C' : '-',
env->hflags & HF_CPL_MASK,
(env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
- (int)(env->a20_mask >> 20) & 1,
+ (env->a20_mask >> 20) & 1,
(env->hflags >> HF_SMM_SHIFT) & 1,
env->halted);
} else
@@ -807,7 +807,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
eflags & CC_C ? 'C' : '-',
env->hflags & HF_CPL_MASK,
(env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
- (int)(env->a20_mask >> 20) & 1,
+ (env->a20_mask >> 20) & 1,
(env->hflags >> HF_SMM_SHIFT) & 1,
env->halted);
}
@@ -938,7 +938,7 @@ void cpu_x86_set_a20(CPUX86State *env, int a20_state)
/* when a20 is changed, all the MMU mappings are invalid, so
we must flush everything */
tlb_flush(env, 1);
- env->a20_mask = (~0x100000) | (a20_state << 20);
+ env->a20_mask = ~(1 << 20) | (a20_state << 20);
}
}
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 16dc4a2..3603a59 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -27,7 +27,6 @@ void cpu_save(QEMUFile *f, void *opaque)
{
CPUState *env = opaque;
uint16_t fptag, fpus, fpuc, fpregs_format;
- int32_t a20_mask;
int32_t pending_irq;
int i, bit;
@@ -98,8 +97,7 @@ void cpu_save(QEMUFile *f, void *opaque)
qemu_put_betls(f, &env->dr[i]);
/* MMU */
- a20_mask = (int32_t) env->a20_mask;
- qemu_put_sbe32s(f, &a20_mask);
+ qemu_put_sbe32s(f, &env->a20_mask);
/* XMM */
qemu_put_be32s(f, &env->mxcsr);
@@ -200,7 +198,6 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
CPUState *env = opaque;
int i, guess_mmx;
uint16_t fpus, fpuc, fptag, fpregs_format;
- int32_t a20_mask;
int32_t pending_irq;
cpu_synchronize_state(env);
@@ -299,9 +296,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
for (i = 0; i < 4; i++)
hw_breakpoint_insert(env, i);
- /* MMU */
- qemu_get_sbe32s(f, &a20_mask);
- env->a20_mask = a20_mask;
+ qemu_get_sbe32s(f, &env->a20_mask);
qemu_get_be32s(f, &env->mxcsr);
for(i = 0; i < CPU_NB_REGS; i++) {
--
1.6.2.5
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, (continued)
- Re: [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Anthony Liguori, 2009/09/30
- [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Juan Quintela, 2009/09/30
- Re: [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
- Re: [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, Anthony Liguori, 2009/09/30
- Re: [Qemu-devel] Re: [PATCH 27/49] ac97: add active to the state, malc, 2009/09/30
[Qemu-devel] [PATCH 28/49] vmstate: port ac97 device, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 29/49] x86: hflags is not modified at all, just save it directly, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 30/49] x86: make a20_mask int32_t,
Juan Quintela <=
[Qemu-devel] [PATCH 31/49] x86: fpuc is uint16_t not unsigned int, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 32/49] x86: fpus is uint16_t not unsigned int, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 33/49] x86: add fptag_vmstate to the state, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 34/49] x86: add pending_irq_vmstate to the state, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 35/49] x86: add fpregs_format_vmstate, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 36/49] x86: mce_banks always have the same size, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 37/49] x86: send mce_banks as an array, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 39/49] x86: split FPReg union, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 38/49] x86: mcg_cap is never 0, Juan Quintela, 2009/09/29
[Qemu-devel] [PATCH 40/49] x86: split MTRRVar union, Juan Quintela, 2009/09/29