patch-2.1.36 linux/arch/alpha/kernel/osf_sys.c

Next file: linux/arch/alpha/kernel/process.c
Previous file: linux/arch/alpha/kernel/entry.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.35/linux/arch/alpha/kernel/osf_sys.c linux/arch/alpha/kernel/osf_sys.c
@@ -33,6 +33,7 @@
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
+#include <asm/sysinfo.h>
 
 extern int do_mount(kdev_t, const char *, const char *, char *, int, void *);
 extern int do_pipe(int *);
@@ -171,7 +172,7 @@
 	int prio;
 
 	/*
-	 * We don't need to aquire the kernel lock here, because
+	 * We don't need to acquire the kernel lock here, because
 	 * all of these operations are local. sys_getpriority
 	 * will get the lock as required..
 	 */
@@ -193,7 +194,7 @@
 }
 
 /*
- * No need to aquire the kernel lock, we're local..
+ * No need to acquire the kernel lock, we're local..
  */
 asmlinkage unsigned long sys_getxuid(int a0, int a1, int a2, int a3, int a4, int a5,
 				     struct pt_regs regs)
@@ -218,7 +219,7 @@
 
 	/* 
 	 * This isn't strictly "local" any more and we should actually
-	 * aquire the kernel lock. The "p_opptr" pointer might change
+	 * acquire the kernel lock. The "p_opptr" pointer might change
 	 * if the parent goes away (or due to ptrace). But any race
 	 * isn't actually going to matter, as if the parent happens
 	 * to change we can happily return either of the pids.
@@ -840,62 +841,91 @@
 	return err;
 }
 
-asmlinkage unsigned long osf_getsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
+asmlinkage unsigned long osf_getsysinfo(unsigned long op, void *buffer,
+					unsigned long nbytes,
 					int *start, void *arg)
 {
 	extern unsigned long rdfpcr(void);
-	unsigned long fpcw;
-	unsigned long ret = -EOPNOTSUPP;
+	unsigned long w;
 
-	lock_kernel();
 	switch (op) {
-	case 45:		/* GSI_IEEE_FP_CONTROL */
+	case GSI_IEEE_FP_CONTROL:
 		/* build and return current fp control word: */
-		fpcw = current->tss.flags & IEEE_TRAP_ENABLE_MASK;
-		fpcw |= ((rdfpcr() >> 52) << 17) & IEEE_STATUS_MASK;
-		put_user(fpcw, (unsigned long *) buffer);
-		ret = 0;
-		break;
-	case 46:		/* GSI_IEEE_STATE_AT_SIGNAL */
+		w = current->tss.flags & IEEE_TRAP_ENABLE_MASK;
+		w |= ((rdfpcr() >> 52) << 17) & IEEE_STATUS_MASK;
+		if (put_user(w, (unsigned long *) buffer))
+			return -EFAULT;
+		return 0;
+
+	case GSI_IEEE_STATE_AT_SIGNAL:
 		/*
 		 * Not sure anybody will ever use this weird stuff.  These
 		 * ops can be used (under OSF/1) to set the fpcr that should
 		 * be used when a signal handler starts executing.
 		 */
 		break;
+
+ 	case GSI_UACPROC:
+ 		w = (current->tss.flags >> UAC_SHIFT) & UAC_BITMASK;
+ 		if (put_user(w, (unsigned int *)buffer))
+ 			return -EFAULT;
+ 		return 0;
+
 	default:
 		break;
 	}
-	unlock_kernel();
-	return ret;
+
+	return -EOPNOTSUPP;
 }
 
 
-asmlinkage unsigned long osf_setsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
+asmlinkage unsigned long osf_setsysinfo(unsigned long op, void *buffer,
+					unsigned long nbytes,
 					int *start, void *arg)
 {
-	unsigned long fpcw;
-	unsigned long ret = -EOPNOTSUPP;
+	unsigned long v, w, i;
 
-	lock_kernel();
 	switch (op) {
-	case 14:		/* SSI_IEEE_FP_CONTROL */
+	case SSI_IEEE_FP_CONTROL:
 		/* update trap enable bits: */
-		get_user(fpcw, (unsigned long *) buffer);
+		if (get_user(w, (unsigned long *) buffer))
+			return -EFAULT;
 		current->tss.flags &= ~IEEE_TRAP_ENABLE_MASK;
-		current->tss.flags |= (fpcw & IEEE_TRAP_ENABLE_MASK);
-		ret = 0;
-		break;
-	case 15:		/* SSI_IEEE_STATE_AT_SIGNAL */
-	case 16:		/* SSI_IEEE_IGNORE_STATE_AT_SIGNAL */
+		current->tss.flags |= (w & IEEE_TRAP_ENABLE_MASK);
+		return 0;
+
+	case SSI_IEEE_STATE_AT_SIGNAL:
+	case SSI_IEEE_IGNORE_STATE_AT_SIGNAL:
 		/*
 		 * Not sure anybody will ever use this weird stuff.  These
 		 * ops can be used (under OSF/1) to set the fpcr that should
 		 * be used when a signal handler starts executing.
 		 */
+		break;
+
+ 	case SSI_NVPAIRS:
+ 		for (i = 0; i < nbytes; ++i) {
+ 			if (get_user(v, 2*i + (unsigned int *)buffer))
+ 				return -EFAULT;
+ 			if (get_user(w, 2*i + 1 + (unsigned int *)buffer))
+ 				return -EFAULT;
+ 			switch (v) {
+ 			case SSIN_UACPROC:
+ 				current->tss.flags &=
+ 					~(UAC_BITMASK << UAC_SHIFT);
+ 				current->tss.flags |=
+ 					(w & UAC_BITMASK) << UAC_SHIFT;
+ 				break;
+ 
+ 			default:
+ 				return -EOPNOTSUPP;
+ 			}
+ 		}
+ 		return 0;
+ 
 	default:
 		break;
 	}
-	unlock_kernel();
-	return ret;
+
+	return -EOPNOTSUPP;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov