]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Followup to r6650: tidy up sys_sigreturn/sys_rt_sigreturn on ppc32/64-linux.
authorJulian Seward <jseward@acm.org>
Mon, 19 Mar 2007 14:34:08 +0000 (14:34 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 19 Mar 2007 14:34:08 +0000 (14:34 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6651

coregrind/m_syswrap/syswrap-amd64-linux.c
coregrind/m_syswrap/syswrap-ppc32-linux.c
coregrind/m_syswrap/syswrap-ppc64-linux.c
coregrind/m_syswrap/syswrap-x86-linux.c

index 9f61aad08b23acf23b68cfde10a347ec390e09e4..335a112675390b2dbb120be36ec5d629b92b6b6f 100644 (file)
@@ -487,7 +487,7 @@ PRE(sys_rt_sigreturn)
    *flags |= SfNoWriteResult;
    SET_STATUS_Success(0);
 
-   /* Check to see if some any signals arose as a result of this. */
+   /* Check to see if any signals arose as a result of this. */
    *flags |= SfPollAfter;
 }
 
index f7fd293ca84be5760a48f064eb15db409641c946..ef865baa0c697a836c54eb0aa9846cdc845837ed 100644 (file)
@@ -1024,8 +1024,11 @@ PRE(sys_clone)
 
 PRE(sys_sigreturn)
 {
+   /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for
+      an explanation of what follows. */
+
    ThreadState* tst;
-   PRINT("sigreturn ( )");
+   PRINT("sys_sigreturn ( )");
 
    vg_assert(VG_(is_valid_tid)(tid));
    vg_assert(tid >= 1 && tid < VG_N_THREADS);
@@ -1042,38 +1045,23 @@ PRE(sys_sigreturn)
    //ML_(fixup_guest_state_to_restart_syscall)(&tst->arch);
    // Should we do something equivalent on ppc32?  Who knows.
 
+   /* Restore register state from frame and remove it */
    VG_(sigframe_destroy)(tid, False);
 
-   /* For unclear reasons, it appears we need the syscall to return
-      without changing R3.  Since R3 is the return value, and can
-      denote either success or failure, we must set up so that the
-      driver logic copies it back unchanged.  Also, note R3 is of
-      the guest registers written by VG_(sigframe_destroy). */
-   /* jrs 16 Nov 05: for some reason this occasionally causes the 
-      is-this-a-sane-error-value sanity check to fail:
-      m_syswrap/syswrap-ppc32-linux.c:1037
-        (vgSysWrap_ppc32_linux_sys_sigreturn_before): 
-        Assertion 'wzz >= 0 && wzz < 10000' failed.
-      Hence use a sanity-check-free version.  
-      Perhaps we should ignore CR0.S0 here?
-      In general I have no idea what this is for or if it is necessary.
-      It's a conceptual copy-n-paste from the x86 equivalent, but I'm 
-      equally unclear as to whether it is needed there either.
-   */
-   SET_STATUS_from_SysRes(
-      VG_(mk_SysRes_ppc32_linux)( 
-         tst->arch.vex.guest_GPR3,
-         /* get CR0.SO */
-         (LibVEX_GuestPPC32_get_CR( &tst->arch.vex ) >> 28) & 1
-      )
-   );
-
-   /* Check to see if some any signals arose as a result of this. */
+   /* Tell the driver not to update the guest state with the "result",
+      and set a bogus result to keep it happy. */
+   *flags |= SfNoWriteResult;
+   SET_STATUS_Success(0);
+
+   /* Check to see if any signals arose as a result of this. */
    *flags |= SfPollAfter;
 }
 
 PRE(sys_rt_sigreturn)
 {
+   /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for
+      an explanation of what follows. */
+
    ThreadState* tst;
    PRINT("rt_sigreturn ( )");
 
@@ -1092,18 +1080,15 @@ PRE(sys_rt_sigreturn)
    //ML_(fixup_guest_state_to_restart_syscall)(&tst->arch);
    // Should we do something equivalent on ppc32?  Who knows.
 
+   /* Restore register state from frame and remove it */
    VG_(sigframe_destroy)(tid, True);
 
-   /* See comments above in PRE(sys_sigreturn) about this. */
-   SET_STATUS_from_SysRes(
-      VG_(mk_SysRes_ppc32_linux)( 
-         tst->arch.vex.guest_GPR3,
-         /* get CR0.SO */
-         (LibVEX_GuestPPC32_get_CR( &tst->arch.vex ) >> 28) & 1
-      )
-   );
+   /* Tell the driver not to update the guest state with the "result",
+      and set a bogus result to keep it happy. */
+   *flags |= SfNoWriteResult;
+   SET_STATUS_Success(0);
 
-   /* Check to see if some any signals arose as a result of this. */
+   /* Check to see if any signals arose as a result of this. */
    *flags |= SfPollAfter;
 }
 
index 02e1fd33c8410d0e1c2d16f27e784380b4ce3d90..427d3649fe1db10d492fec779ea731e27fb8b284 100644 (file)
@@ -1000,60 +1000,13 @@ PRE(sys_clone)
    }
 }
 
-//zz PRE(sys_sigreturn)
-//zz {
-//zz    ThreadState* tst;
-//zz    PRINT("sigreturn ( )");
-//zz 
-//zz    vg_assert(VG_(is_valid_tid)(tid));
-//zz    vg_assert(tid >= 1 && tid < VG_N_THREADS);
-//zz    vg_assert(VG_(is_running_thread)(tid));
-//zz 
-//zz    ///* Adjust esp to point to start of frame; skip back up over
-//zz    //   sigreturn sequence's "popl %eax" and handler ret addr */
-//zz    tst = VG_(get_ThreadState)(tid);
-//zz    //tst->arch.vex.guest_ESP -= sizeof(Addr)+sizeof(Word);
-//zz    // Should we do something equivalent on ppc64?  Who knows.
-//zz 
-//zz    ///* This is only so that the EIP is (might be) useful to report if
-//zz    //   something goes wrong in the sigreturn */
-//zz    //ML_(fixup_guest_state_to_restart_syscall)(&tst->arch);
-//zz    // Should we do something equivalent on ppc64?  Who knows.
-//zz 
-//zz    VG_(sigframe_destroy)(tid, False);
-//zz 
-//zz    /* For unclear reasons, it appears we need the syscall to return
-//zz       without changing R3.  Since R3 is the return value, and can
-//zz       denote either success or failure, we must set up so that the
-//zz       driver logic copies it back unchanged.  Also, note R3 is of
-//zz       the guest registers written by VG_(sigframe_destroy). */
-//zz    /* jrs 16 Nov 05: for some reason this occasionally causes the 
-//zz       is-this-a-sane-error-value sanity check to fail:
-//zz       m_syswrap/syswrap-ppc64-linux.c:1037
-//zz         (vgSysWrap_ppc64_linux_sys_sigreturn_before): 
-//zz         Assertion 'wzz >= 0 && wzz < 10000' failed.
-//zz       Hence use a sanity-check-free version.  
-//zz       Perhaps we should ignore CR0.S0 here?
-//zz       In general I have no idea what this is for or if it is necessary.
-//zz       It's a conceptual copy-n-paste from the x86 equivalent, but I'm 
-//zz       equally unclear as to whether it is needed there either.
-//zz    */
-//zz    SET_STATUS_from_SysRes_NO_SANITY_CHECK(
-//zz       VG_(mk_SysRes_ppc64_linux)( 
-//zz          tst->arch.vex.guest_GPR3,
-//zz          /* get CR0.SO */
-//zz          (LibVEX_GuestPPC32_get_CR( &tst->arch.vex ) >> 28) & 1
-//zz       )
-//zz    );
-//zz 
-//zz    /* Check to see if some any signals arose as a result of this. */
-//zz    *flags |= SfPollAfter;
-//zz }
-
 PRE(sys_rt_sigreturn)
 {
+   /* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for
+      an explanation of what follows. */
+
    ThreadState* tst;
-   PRINT("rt_sigreturn ( )");
+   PRINT("sys_rt_sigreturn ( )");
 
    vg_assert(VG_(is_valid_tid)(tid));
    vg_assert(tid >= 1 && tid < VG_N_THREADS);
@@ -1063,25 +1016,22 @@ PRE(sys_rt_sigreturn)
    //   ret addr */
    tst = VG_(get_ThreadState)(tid);
    //tst->arch.vex.guest_ESP -= sizeof(Addr);
-   // Should we do something equivalent on ppc64?  Who knows.
+   // Should we do something equivalent on ppc64-linux?  Who knows.
 
    ///* This is only so that the EIP is (might be) useful to report if
    //   something goes wrong in the sigreturn */
    //ML_(fixup_guest_state_to_restart_syscall)(&tst->arch);
    // Should we do something equivalent on ppc64?  Who knows.
 
+   /* Restore register state from frame and remove it */
    VG_(sigframe_destroy)(tid, True);
 
-   /* See comments above in PRE(sys_sigreturn) about this. */
-   SET_STATUS_from_SysRes(
-      VG_(mk_SysRes_ppc64_linux)( 
-         tst->arch.vex.guest_GPR3,
-         /* get CR0.SO */
-         (LibVEX_GuestPPC64_get_CR( &tst->arch.vex ) >> 28) & 1
-      )
-   );
+   /* Tell the driver not to update the guest state with the "result",
+      and set a bogus result to keep it happy. */
+   *flags |= SfNoWriteResult;
+   SET_STATUS_Success(0);
 
-   /* Check to see if some any signals arose as a result of this. */
+   /* Check to see if any signals arose as a result of this. */
    *flags |= SfPollAfter;
 }
 
index 4c7258acccf18089d0e772f4c51db03d3794b3c4..6a9486548ddfa79080c53246753763fd2f711148 100644 (file)
@@ -963,7 +963,7 @@ PRE(sys_sigreturn)
    *flags |= SfNoWriteResult;
    SET_STATUS_Success(0);
 
-   /* Check to see if some any signals arose as a result of this. */
+   /* Check to see if any signals arose as a result of this. */
    *flags |= SfPollAfter;
 }
 
@@ -997,7 +997,7 @@ PRE(sys_rt_sigreturn)
    *flags |= SfNoWriteResult;
    SET_STATUS_Success(0);
 
-   /* Check to see if some any signals arose as a result of this. */
+   /* Check to see if any signals arose as a result of this. */
    *flags |= SfPollAfter;
 }