Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch On second thought do not use bit 13 as a flag for s...
details: https://anonhg.NetBSD.org/src/rev/9c5b423f1e38
branches: trunk
changeset: 763611:9c5b423f1e38
user: martin <martin%NetBSD.org@localhost>
date: Sun Mar 27 18:47:08 2011 +0000
description:
On second thought do not use bit 13 as a flag for syscall numbers, userland
typically sets those from a 13bit signed integer immediate field in the
instruction, so would need to jump through hoops (ok, small hoops) to
avoid sign extension.
Use a combination of the existing syscall flags instead.
diffstat:
sys/arch/sparc/include/trap.h | 4 ++--
sys/arch/sparc/sparc/syscall.c | 10 ++++++----
sys/arch/sparc64/include/trap.h | 4 ++--
sys/arch/sparc64/sparc64/syscall.c | 7 ++++---
4 files changed, 14 insertions(+), 11 deletions(-)
diffs (102 lines):
diff -r d8c4cff8aef3 -r 9c5b423f1e38 sys/arch/sparc/include/trap.h
--- a/sys/arch/sparc/include/trap.h Sun Mar 27 17:15:17 2011 +0000
+++ b/sys/arch/sparc/include/trap.h Sun Mar 27 18:47:08 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.h,v 1.17 2011/03/23 20:41:30 martin Exp $ */
+/* $NetBSD: trap.h,v 1.18 2011/03/27 18:47:08 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -131,7 +131,7 @@
/* flags to system call (flags in %g1 along with syscall number) */
#define SYSCALL_G2RFLAG 0x400 /* on success, return to %g2 rather than npc */
#define SYSCALL_G7RFLAG 0x800 /* use %g7 as above (deprecated) */
-#define SYSCALL_G5RFLAG 0x1000 /* use %g5 as above (only ABI compatible way) */
+#define SYSCALL_G5RFLAG 0xc00 /* use %g5 as above (only ABI compatible way) */
/*
* `software trap' macros to keep people happy (sparc v8 manual says not
diff -r d8c4cff8aef3 -r 9c5b423f1e38 sys/arch/sparc/sparc/syscall.c
--- a/sys/arch/sparc/sparc/syscall.c Sun Mar 27 17:15:17 2011 +0000
+++ b/sys/arch/sparc/sparc/syscall.c Sun Mar 27 18:47:08 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.24 2011/03/23 20:41:31 martin Exp $ */
+/* $NetBSD: syscall.c,v 1.25 2011/03/27 18:47:09 martin Exp $ */
/*
* Copyright (c) 1996
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.24 2011/03/23 20:41:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.25 2011/03/27 18:47:09 martin Exp $");
#include "opt_sparc_arch.h"
#include "opt_multiprocessor.h"
@@ -250,7 +250,8 @@
tf->tf_out[1] = rval.o[1];
if (new) {
/* jmp %g5, (or %g2 or %g7, deprecated) on success */
- if (new & SYSCALL_G5RFLAG)
+ if (__predict_true((new & SYSCALL_G5RFLAG)
+ == SYSCALL_G5RFLAG))
i = tf->tf_global[5];
else if (new & SYSCALL_G2RFLAG)
i = tf->tf_global[2];
@@ -340,7 +341,8 @@
tf->tf_out[1] = rval.o[1];
if (new) {
/* jmp %g5, (or %g2 or %g7, deprecated) on success */
- if (new & SYSCALL_G5RFLAG)
+ if (__predict_true((new & SYSCALL_G5RFLAG) ==
+ SYSCALL_G5RFLAG))
i = tf->tf_global[5];
else if (new & SYSCALL_G2RFLAG)
i = tf->tf_global[2];
diff -r d8c4cff8aef3 -r 9c5b423f1e38 sys/arch/sparc64/include/trap.h
--- a/sys/arch/sparc64/include/trap.h Sun Mar 27 17:15:17 2011 +0000
+++ b/sys/arch/sparc64/include/trap.h Sun Mar 27 18:47:08 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.h,v 1.8 2011/03/23 20:41:31 martin Exp $ */
+/* $NetBSD: trap.h,v 1.9 2011/03/27 18:47:09 martin Exp $ */
/*
* Copyright (c) 1996-1999 Eduardo Horvath
@@ -142,7 +142,7 @@
/* flags to system call (flags in %g1 along with syscall number) */
#define SYSCALL_G2RFLAG 0x400 /* on success, return to %g2 rather than npc */
#define SYSCALL_G7RFLAG 0x800 /* use %g7 as above (deprecated) */
-#define SYSCALL_G5RFLAG 0x1000 /* use %g5 as above (only ABI compatible way) */
+#define SYSCALL_G5RFLAG 0xc00 /* use %g5 as above (only ABI compatible way) */
/*
* `software trap' macros to keep people happy (sparc v8 manual says not
diff -r d8c4cff8aef3 -r 9c5b423f1e38 sys/arch/sparc64/sparc64/syscall.c
--- a/sys/arch/sparc64/sparc64/syscall.c Sun Mar 27 17:15:17 2011 +0000
+++ b/sys/arch/sparc64/sparc64/syscall.c Sun Mar 27 18:47:08 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.38 2011/03/23 20:41:31 martin Exp $ */
+/* $NetBSD: syscall.c,v 1.39 2011/03/27 18:47:09 martin Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.38 2011/03/23 20:41:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.39 2011/03/27 18:47:09 martin Exp $");
#include "opt_sa.h"
@@ -130,7 +130,8 @@
int new = *code & (SYSCALL_G7RFLAG|SYSCALL_G2RFLAG|SYSCALL_G5RFLAG);
*code &= ~(SYSCALL_G7RFLAG|SYSCALL_G2RFLAG|SYSCALL_G5RFLAG);
if (new) {
- if (new & SYSCALL_G5RFLAG)
+ /* note that G5RFLAG is multiple bits! */
+ if (__predict_true((new & SYSCALL_G5RFLAG) == SYSCALL_G5RFLAG))
tf->tf_pc = tf->tf_global[5];
else if (new & SYSCALL_G7RFLAG)
tf->tf_pc = tf->tf_global[7];
Home |
Main Index |
Thread Index |
Old Index