From 1bc796d774d363ff46527720b335cee6a28c686c Mon Sep 17 00:00:00 2001 From: Jake Burkholder Date: Sun, 27 Oct 2002 17:22:43 +0000 Subject: [PATCH] Don peril sensitive sun glasses and change the default system call vector for sparc64 from trap #9 to trap #65. This is one of the ABI "blessed" system call vectors and is different from any other system that we might want to emulate, making the emulation easier by reducing the number of code paths that need to be shared. Compatibility with old applications is provided with COMPAT_FREEBSD4. Add defines for a few special traps that we may need to implement for compatibility with 32bit applications, and add comments on which vectors are used for what in other systems, and which are available. Pass magic flags to trap() for deprecated or unimplemented system call vectors so they will deliver SIGSYS instead of SIGILL. This piggy backs nicely with the recent sigaction(2) system call number change, and provided the rules are followed for upgrading past it, this change should not be noticed. --- sys/sparc64/include/utrap.h | 25 ++++++++++++++++++++++++- sys/sparc64/sparc64/exception.S | 16 +++++++++++++--- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/sys/sparc64/include/utrap.h b/sys/sparc64/include/utrap.h index b738eff05cf..8ce79257720 100644 --- a/sys/sparc64/include/utrap.h +++ b/sys/sparc64/include/utrap.h @@ -64,14 +64,37 @@ #define UT_TRAP_INSTRUCTION_31 33 #define UT_MAX 34 +#define ST_SUNOS_SYSCALL 0 #define ST_BREAKPOINT 1 #define ST_DIVISION_BY_ZERO 2 +#define ST_FLUSH_WINDOWS 3 /* XXX implement! */ #define ST_CLEAN_WINDOW 4 #define ST_RANGE_CHECK 5 #define ST_FIX_ALIGNMENT 6 #define ST_INTEGER_OVERFLOW 7 -#define ST_SYSCALL 9 +/* 8 is 32-bit ABI syscall (old solaris syscall?) */ +#define ST_BSD_SYSCALL 9 #define ST_FP_RESTORE 10 +/* 11-15 are available */ +/* 16 is linux 32 bit syscall (but supposed to be reserved, grr) */ +/* 17 is old linux 64 bit syscall (but supposed to be reserved, grr) */ +/* 16-31 are reserved for user applications (utraps) */ +#define ST_GETCC 32 /* XXX implement! */ +#define ST_SETCC 33 /* XXX implement! */ +#define ST_GETPSR 34 /* XXX implement! */ +#define ST_SETPSR 35 /* XXX implement! */ +/* 36-63 are available */ +#define ST_SOLARIS_SYSCALL 64 +#define ST_SYSCALL 65 +#define ST_SYSCALL32 66 +/* 67 is reserved to OS source licensee */ +/* 68 is return from deferred trap (not supported) */ +/* 69-95 are reserved to SPARC international */ +/* 96-108 are available */ +/* 109 is linux 64 bit syscall */ +/* 110 is linux 64 bit getcontext (?) */ +/* 111 is linux 64 bit setcontext (?) */ +/* 112-255 are available */ #define UTH_NOCHANGE (-1) diff --git a/sys/sparc64/sparc64/exception.S b/sys/sparc64/sparc64/exception.S index 2b453f26ab8..cc8cba95f58 100644 --- a/sys/sparc64/sparc64/exception.S +++ b/sys/sparc64/sparc64/exception.S @@ -55,6 +55,7 @@ * $FreeBSD$ */ +#include "opt_compat.h" #include "opt_ddb.h" #include @@ -1878,7 +1879,7 @@ tl0_fill_1_n: tl0_fill_1_n ! 0xc4 tl0_fill_bad 14 ! 0xc8-0xff tl0_soft: - tl0_reserved 1 ! 0x100 + tl0_gen T_SYSCALL ! 0x100 tl0_gen T_BREAKPOINT ! 0x101 tl0_gen T_DIVISION_BY_ZERO ! 0x102 tl0_reserved 1 ! 0x103 @@ -1886,8 +1887,12 @@ tl0_soft: tl0_gen T_RANGE_CHECK ! 0x105 tl0_gen T_FIX_ALIGNMENT ! 0x106 tl0_gen T_INTEGER_OVERFLOW ! 0x107 - tl0_reserved 1 ! 0x108 + tl0_gen T_SYSCALL ! 0x108 +#ifdef COMPAT_FREEBSD4 tl0_syscall ! 0x109 +#else + tl0_gen T_SYSCALL ! 0x109 +#endif tl0_fp_restore ! 0x10a tl0_reserved 5 ! 0x10b-0x10f tl0_gen T_TRAP_INSTRUCTION_16 ! 0x110 @@ -1906,7 +1911,12 @@ tl0_soft: tl0_gen T_TRAP_INSTRUCTION_29 ! 0x11d tl0_gen T_TRAP_INSTRUCTION_30 ! 0x11e tl0_gen T_TRAP_INSTRUCTION_31 ! 0x11f - tl0_reserved 224 ! 0x120-0x1ff + tl0_reserved 32 ! 0x120-0x13f + tl0_gen T_SYSCALL ! 0x140 + tl0_syscall ! 0x141 + tl0_gen T_SYSCALL ! 0x142 + tl0_gen T_SYSCALL ! 0x143 + tl0_reserved 188 ! 0x144-0x1ff tl1_base: tl1_reserved 8 ! 0x200-0x207