aboutsummaryrefslogtreecommitdiff
path: root/cpu-exec.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-07-26 18:01:40 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-07-26 18:01:40 +0000
commita412ac572ffad45f663795ba7dfa8fa1603ef206 (patch)
tree5141b46ca291e230e70c1d81f440790ea8de62be /cpu-exec.c
parentb2b5fb228f273d2c72aefce3be1f9e11e23c6c24 (diff)
real mode support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@335 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 908f161840..1ffeb8e86c 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -244,12 +244,12 @@ int cpu_exec(CPUState *env1)
(unsigned long)env->segs[R_ES].base |
(unsigned long)env->segs[R_SS].base) != 0) <<
GEN_FLAG_ADDSEG_SHIFT;
- if (!(env->eflags & VM_MASK)) {
- flags |= (env->segs[R_CS].selector & 3) << GEN_FLAG_CPL_SHIFT;
- } else {
- /* NOTE: a dummy CPL is kept */
- flags |= (1 << GEN_FLAG_VM_SHIFT);
- flags |= (3 << GEN_FLAG_CPL_SHIFT);
+ if (env->cr[0] & CR0_PE_MASK) {
+ if (!(env->eflags & VM_MASK))
+ flags |= (env->segs[R_CS].selector & 3) <<
+ GEN_FLAG_CPL_SHIFT;
+ else
+ flags |= (1 << GEN_FLAG_VM_SHIFT);
}
flags |= (env->eflags & (IOPL_MASK | TF_MASK));
cs_base = env->segs[R_CS].base;
@@ -396,12 +396,10 @@ void cpu_x86_load_seg(CPUX86State *s, int seg_reg, int selector)
saved_env = env;
env = s;
- if (env->eflags & VM_MASK) {
+ if (!(env->cr[0] & CR0_PE_MASK) || (env->eflags & VM_MASK)) {
SegmentCache *sc;
selector &= 0xffff;
sc = &env->segs[seg_reg];
- /* NOTE: in VM86 mode, limit and flags are never reloaded,
- so we must load them here */
sc->base = (void *)(selector << 4);
sc->limit = 0xffff;
sc->flags = 0;