Commit a52c757c9f98311c3ba22744d609caa767b899e1

Authored by bellard
1 parent 970a87a6

fixed case where SS != USER_DS (fixes dosemu DPMI emulation)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@256 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 14 additions and 13 deletions
linux-user/signal.c
@@ -517,10 +517,10 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate, @@ -517,10 +517,10 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate,
517 { 517 {
518 int err = 0; 518 int err = 0;
519 519
520 - err |= __put_user(env->segs[R_GS], (unsigned int *)&sc->gs);  
521 - err |= __put_user(env->segs[R_FS], (unsigned int *)&sc->fs);  
522 - err |= __put_user(env->segs[R_ES], (unsigned int *)&sc->es);  
523 - err |= __put_user(env->segs[R_DS], (unsigned int *)&sc->ds); 520 + err |= __put_user(env->segs[R_GS].selector, (unsigned int *)&sc->gs);
  521 + err |= __put_user(env->segs[R_FS].selector, (unsigned int *)&sc->fs);
  522 + err |= __put_user(env->segs[R_ES].selector, (unsigned int *)&sc->es);
  523 + err |= __put_user(env->segs[R_DS].selector, (unsigned int *)&sc->ds);
524 err |= __put_user(env->regs[R_EDI], &sc->edi); 524 err |= __put_user(env->regs[R_EDI], &sc->edi);
525 err |= __put_user(env->regs[R_ESI], &sc->esi); 525 err |= __put_user(env->regs[R_ESI], &sc->esi);
526 err |= __put_user(env->regs[R_EBP], &sc->ebp); 526 err |= __put_user(env->regs[R_EBP], &sc->ebp);
@@ -532,10 +532,10 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate, @@ -532,10 +532,10 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate,
532 err |= __put_user(env->exception_index, &sc->trapno); 532 err |= __put_user(env->exception_index, &sc->trapno);
533 err |= __put_user(env->error_code, &sc->err); 533 err |= __put_user(env->error_code, &sc->err);
534 err |= __put_user(env->eip, &sc->eip); 534 err |= __put_user(env->eip, &sc->eip);
535 - err |= __put_user(env->segs[R_CS], (unsigned int *)&sc->cs); 535 + err |= __put_user(env->segs[R_CS].selector, (unsigned int *)&sc->cs);
536 err |= __put_user(env->eflags, &sc->eflags); 536 err |= __put_user(env->eflags, &sc->eflags);
537 err |= __put_user(env->regs[R_ESP], &sc->esp_at_signal); 537 err |= __put_user(env->regs[R_ESP], &sc->esp_at_signal);
538 - err |= __put_user(env->segs[R_SS], (unsigned int *)&sc->ss); 538 + err |= __put_user(env->segs[R_SS].selector, (unsigned int *)&sc->ss);
539 539
540 cpu_x86_fsave(env, (void *)fpstate, 1); 540 cpu_x86_fsave(env, (void *)fpstate, 1);
541 fpstate->status = fpstate->sw; 541 fpstate->status = fpstate->sw;
@@ -544,7 +544,7 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate, @@ -544,7 +544,7 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate,
544 544
545 /* non-iBCS2 extensions.. */ 545 /* non-iBCS2 extensions.. */
546 err |= __put_user(mask, &sc->oldmask); 546 err |= __put_user(mask, &sc->oldmask);
547 - err |= __put_user(env->cr2, &sc->cr2); 547 + err |= __put_user(env->cr[2], &sc->cr2);
548 return err; 548 return err;
549 } 549 }
550 550
@@ -567,13 +567,14 @@ get_sigframe(struct emulated_sigaction *ka, CPUX86State *env, size_t frame_size) @@ -567,13 +567,14 @@ get_sigframe(struct emulated_sigaction *ka, CPUX86State *env, size_t frame_size)
567 } 567 }
568 568
569 /* This is the legacy signal stack switching. */ 569 /* This is the legacy signal stack switching. */
570 - else if ((regs->xss & 0xffff) != __USER_DS &&  
571 - !(ka->sa.sa_flags & SA_RESTORER) &&  
572 - ka->sa.sa_restorer) {  
573 - esp = (unsigned long) ka->sa.sa_restorer;  
574 - } 570 + else
575 #endif 571 #endif
576 - return (void *)((esp - frame_size) & -8ul); 572 + if ((env->segs[R_SS].selector & 0xffff) != __USER_DS &&
  573 + !(ka->sa.sa_flags & TARGET_SA_RESTORER) &&
  574 + ka->sa.sa_restorer) {
  575 + esp = (unsigned long) ka->sa.sa_restorer;
  576 + }
  577 + return (void *)((esp - frame_size) & -8ul);
577 } 578 }
578 579
579 static void setup_frame(int sig, struct emulated_sigaction *ka, 580 static void setup_frame(int sig, struct emulated_sigaction *ka,