changeset 9fa13250abd8 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=9fa13250abd8
description:
        SE: Ignore FUTEX_PRIVATE_FLAG of sys_futex

        This patch ignores the FUTEX_PRIVATE_FLAG of the sys_futex system call
        in SE mode.

        With this patch, when sys_futex with the options FUTEX_WAIT_PRIVATE or
        FUTEX_WAKE_PRIVATE is emulated, the FUTEX_PRIVATE_FLAG is ignored and
        so their behaviours are the regular FUTEX_WAIT and FUTEX_WAKE.

        Emulating FUTEX_WAIT_PRIVATE and FUTEX_WAKE_PRIVATE as if they were
        non-private is safe from a functional point of view. The
        FUTEX_PRIVATE_FLAG does not change the semantics of the futex, it's
        just a mechanism to improve performance under certain circunstances
        that can be ignored in SE mode.

diffstat:

 src/kern/linux/linux.hh |  1 +
 src/sim/syscall_emul.hh |  3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diffs (31 lines):

diff -r cb942df51335 -r 9fa13250abd8 src/kern/linux/linux.hh
--- a/src/kern/linux/linux.hh   Thu Sep 20 17:25:52 2012 -0400
+++ b/src/kern/linux/linux.hh   Fri Sep 21 04:51:18 2012 -0400
@@ -225,6 +225,7 @@
     static const unsigned TGT_FUTEX_WAKE  = 1;
     static const unsigned TGT_EAGAIN      = 11;
     static const unsigned TGT_EWOULDBLOCK = TGT_EAGAIN;
+    static const unsigned TGT_FUTEX_PRIVATE_FLAG = 128;
 
 };  // class Linux
 
diff -r cb942df51335 -r 9fa13250abd8 src/sim/syscall_emul.hh
--- a/src/sim/syscall_emul.hh   Thu Sep 20 17:25:52 2012 -0400
+++ b/src/sim/syscall_emul.hh   Fri Sep 21 04:51:18 2012 -0400
@@ -359,6 +359,7 @@
     DPRINTF(SyscallVerbose, "In sys_futex: Address=%llx, op=%d, val=%d\n",
             uaddr, op, val);
 
+    op &= ~OS::TGT_FUTEX_PRIVATE_FLAG;
 
     if (op == OS::TGT_FUTEX_WAIT) {
         if (timeout != 0) {
@@ -410,7 +411,7 @@
                                 "thread contexts\n", wokenUp);
         return wokenUp;
     } else {
-        warn("sys_futex: op %d is not implemented, just returning...");
+        warn("sys_futex: op %d is not implemented, just returning...", op);
         return 0;
     }
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to