Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/arch/mips Implements ATOMIC_SET in linux_sy...



details:   https://anonhg.NetBSD.org/src/rev/198d5b6273a0
branches:  trunk
changeset: 515859:198d5b6273a0
user:      manu <manu%NetBSD.org@localhost>
date:      Sat Oct 06 13:32:18 2001 +0000

description:
Implements ATOMIC_SET in linux_sys_sysmips

diffstat:

 sys/compat/linux/arch/mips/linux_machdep.c |  29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diffs (58 lines):

diff -r adaff2d0527a -r 198d5b6273a0 sys/compat/linux/arch/mips/linux_machdep.c
--- a/sys/compat/linux/arch/mips/linux_machdep.c        Sat Oct 06 12:25:56 2001 +0000
+++ b/sys/compat/linux/arch/mips/linux_machdep.c        Sat Oct 06 13:32:18 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.c,v 1.2 2001/09/30 20:52:40 manu Exp $ */
+/*     $NetBSD: linux_machdep.c,v 1.3 2001/10/06 13:32:18 manu Exp $ */
 
 /*-
  * Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
@@ -351,7 +351,7 @@
        void *v;
        register_t *retval;
 {
-       return linux_sys_uname(p, v, retval);
+        return linux_sys_uname(p, v, retval);
 }
 
 /*
@@ -404,8 +404,29 @@
                
                break;
        }
-       case LINUX_MIPS_ATOMIC_SET:     /* XXX not implemented */
+       case LINUX_MIPS_ATOMIC_SET: {
+               void *addr;
+               int s;
+
+               addr = (void *)SCARG(uap, arg1);
+
+               if ((uvm_useracc((caddr_t)addr, sizeof(int), 
+                   B_READ | B_WRITE)) != 1)
+                       return EFAULT;
+
+               s = splhigh();
+               /*
+                * No error testing here. This is bad, but Linux does
+                * it like this. The source aknowledge "This is broken"
+                * in a comment...
+                */
+               *retval = (register_t)fubyte(addr);
+               error = subyte(addr, SCARG(uap, arg2));
+               splx(s);
+
+               return 0;
                break;
+       }
        case LINUX_MIPS_FIXADE:         /* XXX not implemented */
                break;
        case LINUX_FLUSH_CACHE:
@@ -418,7 +439,7 @@
                return EINVAL;
                break;
        }
-#if 1 /* def DEBUG_LINUX */
+#ifdef DEBUG_LINUX
        printf("linux_sys_sysmips(): unimplemented command %d\n", 
            SCARG(uap,cmd));    
 #endif /* DEBUG_LINUX */



Home | Main Index | Thread Index | Old Index