diff options
author | charnier <charnier@FreeBSD.org> | 1997-08-21 06:33:04 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-08-21 06:33:04 +0000 |
commit | ec0491b457704b183e5677671c5f9c091b706bad (patch) | |
tree | 97135bfb08c05cabc164f0bca66b668fa0244b79 /sys | |
parent | 7511b8f464a83d4d3fcab8607f7c224a08b65a74 (diff) | |
download | FreeBSD-src-ec0491b457704b183e5677671c5f9c091b706bad.zip FreeBSD-src-ec0491b457704b183e5677671c5f9c091b706bad.tar.gz |
Revert my previous commit about using CS_SECURE macro.
Requested by: Bruce.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/alpha/linux/linux_sysvec.c | 3 | ||||
-rw-r--r-- | sys/amd64/amd64/db_trace.c | 4 | ||||
-rw-r--r-- | sys/amd64/amd64/fpu.c | 4 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 3 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 10 | ||||
-rw-r--r-- | sys/amd64/include/cpu.h | 4 | ||||
-rw-r--r-- | sys/amd64/include/segments.h | 4 | ||||
-rw-r--r-- | sys/amd64/isa/npx.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/db_trace.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 3 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 10 | ||||
-rw-r--r-- | sys/i386/include/cpu.h | 4 | ||||
-rw-r--r-- | sys/i386/include/segments.h | 4 | ||||
-rw-r--r-- | sys/i386/isa/npx.c | 4 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 3 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 10 |
16 files changed, 39 insertions, 39 deletions
diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c index fcdd49f..e3046b0 100644 --- a/sys/alpha/linux/linux_sysvec.c +++ b/sys/alpha/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.15 1997/07/20 16:06:06 bde Exp $ + * $Id: linux_sysvec.c,v 1.16 1997/08/18 06:58:59 charnier Exp $ */ /* XXX we use functions that might not exist. */ @@ -317,6 +317,7 @@ linux_sigreturn(p, args, retval) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ +#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(context.sc_cs)) { trapsignal(p, SIGBUS, T_PROTFLT); return(EINVAL); diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index 19a8d00..d16b92d 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_trace.c,v 1.23 1997/07/20 08:37:17 bde Exp $ + * $Id: db_trace.c,v 1.24 1997/08/18 06:58:06 charnier Exp $ */ #include <sys/param.h> @@ -187,7 +187,7 @@ db_nextframe(fp, ip) */ tf = (struct trapframe *) ((int)*fp + 8); - esp = CS_SECURE(tf->tf_cs) ? tf->tf_esp : (int)&tf->tf_esp; + esp = (ISPL(tf->tf_cs) == SEL_UPL) ? tf->tf_esp : (int)&tf->tf_esp; switch (frame_type) { case TRAP: if (INKERNEL((int) tf)) { diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index bfd2f8a..8e2416d 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.50 1997/08/09 00:03:39 dyson Exp $ + * $Id: npx.c,v 1.51 1997/08/18 06:58:44 charnier Exp $ */ #include "npx.h" @@ -515,7 +515,7 @@ npxintr(unit) * Pass exception to process. */ frame = (struct intrframe *)&unit; /* XXX */ - if (CS_SECURE(frame->if_cs) || (frame->if_eflags & PSL_VM)) { + if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) { /* * Interrupt is essentially a trap, so we can afford to call * the SIGFPE handler (if any) as soon as the interrupt diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index ae70bfc..7376267 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.255 1997/08/09 00:02:40 dyson Exp $ + * $Id: machdep.c,v 1.256 1997/08/18 06:58:09 charnier Exp $ */ #include "apm.h" @@ -672,6 +672,7 @@ sigreturn(p, uap, retval) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ +#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(scp->sc_cs)) { #ifdef DEBUG printf("sigreturn: cs = 0x%x\n", scp->sc_cs); diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index de901c0..ac139d5 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.1 1997/08/19 20:26:01 smp Exp smp $ + * $Id: trap.c,v 1.106 1997/08/20 05:25:48 fsmp Exp $ */ /* @@ -206,7 +206,7 @@ trap(frame) type = frame.tf_trapno; code = frame.tf_err; - if (CS_SECURE(frame.tf_cs) || (frame.tf_eflags & PSL_VM)) { + if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) { /* user trap */ sticks = p->p_sticks; @@ -722,7 +722,7 @@ trap_fatal(frame) printf("\n\nFatal trap %d: %s while in %s mode\n", type, trap_msg[type], frame->tf_eflags & PSL_VM ? "vm86" : - CS_SECURE(frame->tf_cs) ? "user" : "kernel"); + ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); #ifdef SMP printf("cpuid = %d\n", cpuid); #endif @@ -735,7 +735,7 @@ trap_fatal(frame) } printf("instruction pointer = 0x%x:0x%x\n", frame->tf_cs & 0xffff, frame->tf_eip); - if (CS_SECURE(frame->tf_cs) || (frame->tf_eflags & PSL_VM)) { + if ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) { ss = frame->tf_ss & 0xffff; esp = frame->tf_esp; } else { @@ -893,7 +893,7 @@ syscall(frame) u_int code; sticks = p->p_sticks; - if (!CS_SECURE(frame.tf_cs)) + if (ISPL(frame.tf_cs) != SEL_UPL) panic("syscall"); p->p_md.md_regs = &frame; diff --git a/sys/amd64/include/cpu.h b/sys/amd64/include/cpu.h index 8f07480..12b7ef7 100644 --- a/sys/amd64/include/cpu.h +++ b/sys/amd64/include/cpu.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 - * $Id: cpu.h,v 1.30 1997/08/09 00:03:09 dyson Exp $ + * $Id: cpu.h,v 1.31 1997/08/18 06:58:29 charnier Exp $ */ #ifndef _MACHINE_CPU_H_ @@ -59,7 +59,7 @@ #define cpu_set_init_frame(p, fp) ((p)->p_md.md_regs = (fp)) #define CLKF_USERMODE(framep) \ - (CS_SECURE((framep)->cf_cs) || (framep->cf_eflags & PSL_VM)) + ((ISPL((framep)->cf_cs) == SEL_UPL) || (framep->cf_eflags & PSL_VM)) #define CLKF_INTR(framep) (intr_nesting_level >= 2) #if 0 diff --git a/sys/amd64/include/segments.h b/sys/amd64/include/segments.h index b97c42e..894e6c5 100644 --- a/sys/amd64/include/segments.h +++ b/sys/amd64/include/segments.h @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)segments.h 7.1 (Berkeley) 5/9/91 - * $Id: segments.h,v 1.15 1997/07/19 02:24:37 fsmp Exp $ + * $Id: segments.h,v 1.16 1997/08/18 06:58:31 charnier Exp $ */ #ifndef _MACHINE_SEGMENTS_H_ @@ -59,8 +59,6 @@ #define LSEL(s,r) (((s)<<3) | SEL_LDT | r) /* a local selector */ #define GSEL(s,r) (((s)<<3) | r) /* a global selector */ -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) - /* * Memory and System segment descriptors */ diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c index bfd2f8a..8e2416d 100644 --- a/sys/amd64/isa/npx.c +++ b/sys/amd64/isa/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.50 1997/08/09 00:03:39 dyson Exp $ + * $Id: npx.c,v 1.51 1997/08/18 06:58:44 charnier Exp $ */ #include "npx.h" @@ -515,7 +515,7 @@ npxintr(unit) * Pass exception to process. */ frame = (struct intrframe *)&unit; /* XXX */ - if (CS_SECURE(frame->if_cs) || (frame->if_eflags & PSL_VM)) { + if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) { /* * Interrupt is essentially a trap, so we can afford to call * the SIGFPE handler (if any) as soon as the interrupt diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index 19a8d00..d16b92d 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_trace.c,v 1.23 1997/07/20 08:37:17 bde Exp $ + * $Id: db_trace.c,v 1.24 1997/08/18 06:58:06 charnier Exp $ */ #include <sys/param.h> @@ -187,7 +187,7 @@ db_nextframe(fp, ip) */ tf = (struct trapframe *) ((int)*fp + 8); - esp = CS_SECURE(tf->tf_cs) ? tf->tf_esp : (int)&tf->tf_esp; + esp = (ISPL(tf->tf_cs) == SEL_UPL) ? tf->tf_esp : (int)&tf->tf_esp; switch (frame_type) { case TRAP: if (INKERNEL((int) tf)) { diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index ae70bfc..7376267 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.255 1997/08/09 00:02:40 dyson Exp $ + * $Id: machdep.c,v 1.256 1997/08/18 06:58:09 charnier Exp $ */ #include "apm.h" @@ -672,6 +672,7 @@ sigreturn(p, uap, retval) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ +#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(scp->sc_cs)) { #ifdef DEBUG printf("sigreturn: cs = 0x%x\n", scp->sc_cs); diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index de901c0..ac139d5 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.1 1997/08/19 20:26:01 smp Exp smp $ + * $Id: trap.c,v 1.106 1997/08/20 05:25:48 fsmp Exp $ */ /* @@ -206,7 +206,7 @@ trap(frame) type = frame.tf_trapno; code = frame.tf_err; - if (CS_SECURE(frame.tf_cs) || (frame.tf_eflags & PSL_VM)) { + if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) { /* user trap */ sticks = p->p_sticks; @@ -722,7 +722,7 @@ trap_fatal(frame) printf("\n\nFatal trap %d: %s while in %s mode\n", type, trap_msg[type], frame->tf_eflags & PSL_VM ? "vm86" : - CS_SECURE(frame->tf_cs) ? "user" : "kernel"); + ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); #ifdef SMP printf("cpuid = %d\n", cpuid); #endif @@ -735,7 +735,7 @@ trap_fatal(frame) } printf("instruction pointer = 0x%x:0x%x\n", frame->tf_cs & 0xffff, frame->tf_eip); - if (CS_SECURE(frame->tf_cs) || (frame->tf_eflags & PSL_VM)) { + if ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) { ss = frame->tf_ss & 0xffff; esp = frame->tf_esp; } else { @@ -893,7 +893,7 @@ syscall(frame) u_int code; sticks = p->p_sticks; - if (!CS_SECURE(frame.tf_cs)) + if (ISPL(frame.tf_cs) != SEL_UPL) panic("syscall"); p->p_md.md_regs = &frame; diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h index 8f07480..12b7ef7 100644 --- a/sys/i386/include/cpu.h +++ b/sys/i386/include/cpu.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 - * $Id: cpu.h,v 1.30 1997/08/09 00:03:09 dyson Exp $ + * $Id: cpu.h,v 1.31 1997/08/18 06:58:29 charnier Exp $ */ #ifndef _MACHINE_CPU_H_ @@ -59,7 +59,7 @@ #define cpu_set_init_frame(p, fp) ((p)->p_md.md_regs = (fp)) #define CLKF_USERMODE(framep) \ - (CS_SECURE((framep)->cf_cs) || (framep->cf_eflags & PSL_VM)) + ((ISPL((framep)->cf_cs) == SEL_UPL) || (framep->cf_eflags & PSL_VM)) #define CLKF_INTR(framep) (intr_nesting_level >= 2) #if 0 diff --git a/sys/i386/include/segments.h b/sys/i386/include/segments.h index b97c42e..894e6c5 100644 --- a/sys/i386/include/segments.h +++ b/sys/i386/include/segments.h @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)segments.h 7.1 (Berkeley) 5/9/91 - * $Id: segments.h,v 1.15 1997/07/19 02:24:37 fsmp Exp $ + * $Id: segments.h,v 1.16 1997/08/18 06:58:31 charnier Exp $ */ #ifndef _MACHINE_SEGMENTS_H_ @@ -59,8 +59,6 @@ #define LSEL(s,r) (((s)<<3) | SEL_LDT | r) /* a local selector */ #define GSEL(s,r) (((s)<<3) | r) /* a global selector */ -#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) - /* * Memory and System segment descriptors */ diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index bfd2f8a..8e2416d 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.50 1997/08/09 00:03:39 dyson Exp $ + * $Id: npx.c,v 1.51 1997/08/18 06:58:44 charnier Exp $ */ #include "npx.h" @@ -515,7 +515,7 @@ npxintr(unit) * Pass exception to process. */ frame = (struct intrframe *)&unit; /* XXX */ - if (CS_SECURE(frame->if_cs) || (frame->if_eflags & PSL_VM)) { + if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) { /* * Interrupt is essentially a trap, so we can afford to call * the SIGFPE handler (if any) as soon as the interrupt diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index fcdd49f..e3046b0 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.15 1997/07/20 16:06:06 bde Exp $ + * $Id: linux_sysvec.c,v 1.16 1997/08/18 06:58:59 charnier Exp $ */ /* XXX we use functions that might not exist. */ @@ -317,6 +317,7 @@ linux_sigreturn(p, args, retval) * hardware check for invalid selectors, excess privilege in * other selectors, invalid %eip's and invalid %esp's. */ +#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) if (!CS_SECURE(context.sc_cs)) { trapsignal(p, SIGBUS, T_PROTFLT); return(EINVAL); diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index de901c0..ac139d5 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.1 1997/08/19 20:26:01 smp Exp smp $ + * $Id: trap.c,v 1.106 1997/08/20 05:25:48 fsmp Exp $ */ /* @@ -206,7 +206,7 @@ trap(frame) type = frame.tf_trapno; code = frame.tf_err; - if (CS_SECURE(frame.tf_cs) || (frame.tf_eflags & PSL_VM)) { + if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) { /* user trap */ sticks = p->p_sticks; @@ -722,7 +722,7 @@ trap_fatal(frame) printf("\n\nFatal trap %d: %s while in %s mode\n", type, trap_msg[type], frame->tf_eflags & PSL_VM ? "vm86" : - CS_SECURE(frame->tf_cs) ? "user" : "kernel"); + ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); #ifdef SMP printf("cpuid = %d\n", cpuid); #endif @@ -735,7 +735,7 @@ trap_fatal(frame) } printf("instruction pointer = 0x%x:0x%x\n", frame->tf_cs & 0xffff, frame->tf_eip); - if (CS_SECURE(frame->tf_cs) || (frame->tf_eflags & PSL_VM)) { + if ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) { ss = frame->tf_ss & 0xffff; esp = frame->tf_esp; } else { @@ -893,7 +893,7 @@ syscall(frame) u_int code; sticks = p->p_sticks; - if (!CS_SECURE(frame.tf_cs)) + if (ISPL(frame.tf_cs) != SEL_UPL) panic("syscall"); p->p_md.md_regs = &frame; |