Commit ed2dcdf68e73348764850251443fd0c32dd33e81
1 parent
4304763b
save FPU state in signal handler
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@201 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
11 additions
and
32 deletions
linux-user/signal.c
@@ -536,15 +536,12 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate, | @@ -536,15 +536,12 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate, | ||
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], (unsigned int *)&sc->ss); |
539 | -#if 0 | ||
540 | - tmp = save_i387(fpstate); | ||
541 | - if (tmp < 0) | ||
542 | - err = 1; | ||
543 | - else | ||
544 | - err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate); | ||
545 | -#else | ||
546 | - err |= __put_user(0, &sc->fpstate); | ||
547 | -#endif | 539 | + |
540 | + cpu_x86_fsave(env, (void *)fpstate, 1); | ||
541 | + fpstate->status = fpstate->sw; | ||
542 | + err |= __put_user(0xffff, &fpstate->magic); | ||
543 | + err |= __put_user(fpstate, &sc->fpstate); | ||
544 | + | ||
548 | /* non-iBCS2 extensions.. */ | 545 | /* non-iBCS2 extensions.. */ |
549 | err |= __put_user(mask, &sc->oldmask); | 546 | err |= __put_user(mask, &sc->oldmask); |
550 | err |= __put_user(env->cr2, &sc->cr2); | 547 | err |= __put_user(env->cr2, &sc->cr2); |
@@ -721,25 +718,6 @@ restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax) | @@ -721,25 +718,6 @@ restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax) | ||
721 | { | 718 | { |
722 | unsigned int err = 0; | 719 | unsigned int err = 0; |
723 | 720 | ||
724 | - | ||
725 | - | ||
726 | -#define COPY(x) err |= __get_user(regs->x, &sc->x) | ||
727 | - | ||
728 | -#define COPY_SEG(seg) \ | ||
729 | - { unsigned short tmp; \ | ||
730 | - err |= __get_user(tmp, &sc->seg); \ | ||
731 | - regs->x##seg = tmp; } | ||
732 | - | ||
733 | -#define COPY_SEG_STRICT(seg) \ | ||
734 | - { unsigned short tmp; \ | ||
735 | - err |= __get_user(tmp, &sc->seg); \ | ||
736 | - regs->x##seg = tmp|3; } | ||
737 | - | ||
738 | -#define GET_SEG(seg) \ | ||
739 | - { unsigned short tmp; \ | ||
740 | - err |= __get_user(tmp, &sc->seg); \ | ||
741 | - loadsegment(seg,tmp); } | ||
742 | - | ||
743 | cpu_x86_load_seg(env, R_GS, lduw(&sc->gs)); | 721 | cpu_x86_load_seg(env, R_GS, lduw(&sc->gs)); |
744 | cpu_x86_load_seg(env, R_FS, lduw(&sc->fs)); | 722 | cpu_x86_load_seg(env, R_FS, lduw(&sc->fs)); |
745 | cpu_x86_load_seg(env, R_ES, lduw(&sc->es)); | 723 | cpu_x86_load_seg(env, R_ES, lduw(&sc->es)); |
@@ -764,17 +742,18 @@ restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax) | @@ -764,17 +742,18 @@ restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax) | ||
764 | // regs->orig_eax = -1; /* disable syscall checks */ | 742 | // regs->orig_eax = -1; /* disable syscall checks */ |
765 | } | 743 | } |
766 | 744 | ||
767 | -#if 0 | ||
768 | { | 745 | { |
769 | struct _fpstate * buf; | 746 | struct _fpstate * buf; |
770 | - err |= __get_user(buf, &sc->fpstate); | 747 | + buf = (void *)ldl(&sc->fpstate); |
771 | if (buf) { | 748 | if (buf) { |
749 | +#if 0 | ||
772 | if (verify_area(VERIFY_READ, buf, sizeof(*buf))) | 750 | if (verify_area(VERIFY_READ, buf, sizeof(*buf))) |
773 | goto badframe; | 751 | goto badframe; |
774 | - err |= restore_i387(buf); | 752 | +#endif |
753 | + cpu_x86_frstor(env, (void *)buf, 1); | ||
775 | } | 754 | } |
776 | } | 755 | } |
777 | -#endif | 756 | + |
778 | *peax = ldl(&sc->eax); | 757 | *peax = ldl(&sc->eax); |
779 | return err; | 758 | return err; |
780 | #if 0 | 759 | #if 0 |