Commit 262ffdae6fdad3f6dab855a090543f5faa77ec96

Authored by bellard
1 parent 7e15e603

Fix i386 segment descriptor types on reset (Avi Kivity)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4686 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 15 additions and 9 deletions
target-i386/helper.c
... ... @@ -383,16 +383,22 @@ void cpu_reset(CPUX86State *env)
383 383 env->idt.limit = 0xffff;
384 384 env->gdt.limit = 0xffff;
385 385 env->ldt.limit = 0xffff;
386   - env->ldt.flags = DESC_P_MASK;
  386 + env->ldt.flags = DESC_P_MASK | (2 << DESC_TYPE_SHIFT);
387 387 env->tr.limit = 0xffff;
388   - env->tr.flags = DESC_P_MASK;
389   -
390   - cpu_x86_load_seg_cache(env, R_CS, 0xf000, 0xffff0000, 0xffff, 0);
391   - cpu_x86_load_seg_cache(env, R_DS, 0, 0, 0xffff, 0);
392   - cpu_x86_load_seg_cache(env, R_ES, 0, 0, 0xffff, 0);
393   - cpu_x86_load_seg_cache(env, R_SS, 0, 0, 0xffff, 0);
394   - cpu_x86_load_seg_cache(env, R_FS, 0, 0, 0xffff, 0);
395   - cpu_x86_load_seg_cache(env, R_GS, 0, 0, 0xffff, 0);
  388 + env->tr.flags = DESC_P_MASK | (11 < DESC_TYPE_SHIFT);
  389 +
  390 + cpu_x86_load_seg_cache(env, R_CS, 0xf000, 0xffff0000, 0xffff,
  391 + DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK);
  392 + cpu_x86_load_seg_cache(env, R_DS, 0, 0, 0xffff,
  393 + DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
  394 + cpu_x86_load_seg_cache(env, R_ES, 0, 0, 0xffff,
  395 + DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
  396 + cpu_x86_load_seg_cache(env, R_SS, 0, 0, 0xffff,
  397 + DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
  398 + cpu_x86_load_seg_cache(env, R_FS, 0, 0, 0xffff,
  399 + DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
  400 + cpu_x86_load_seg_cache(env, R_GS, 0, 0, 0xffff,
  401 + DESC_P_MASK | DESC_S_MASK | DESC_W_MASK);
396 402  
397 403 env->eip = 0xfff0;
398 404 env->regs[R_EDX] = env->cpuid_version;
... ...