diff options
author | charnier <charnier@FreeBSD.org> | 1997-08-18 06:58:59 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-08-18 06:58:59 +0000 |
commit | e0224667fe353de8d6394686a4589a5a7935b6b2 (patch) | |
tree | 09a2df2389cb19d23678a3b740fd0debb15ff871 /sys | |
parent | b224a05842b1f2b4d5704ed084f9ca79471d929d (diff) | |
download | FreeBSD-src-e0224667fe353de8d6394686a4589a5a7935b6b2.zip FreeBSD-src-e0224667fe353de8d6394686a4589a5a7935b6b2.tar.gz |
Use CS_SECURE macro.
Reviewed by: John Dyson
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 9a3a734..fcdd49f 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.14 1997/05/07 20:05:45 peter Exp $ + * $Id: linux_sysvec.c,v 1.15 1997/07/20 16:06:06 bde Exp $ */ /* XXX we use functions that might not exist. */ @@ -317,7 +317,6 @@ 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 69a88e1..19a8d00 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.22 1997/04/26 19:12:03 peter Exp $ + * $Id: db_trace.c,v 1.23 1997/07/20 08:37:17 bde Exp $ */ #include <sys/param.h> @@ -187,7 +187,7 @@ db_nextframe(fp, ip) */ tf = (struct trapframe *) ((int)*fp + 8); - esp = (ISPL(tf->tf_cs) == SEL_UPL) ? tf->tf_esp : (int)&tf->tf_esp; + esp = CS_SECURE(tf->tf_cs) ? 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 32fa57a..bfd2f8a 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.49 1997/07/21 07:57:50 fsmp Exp $ + * $Id: npx.c,v 1.50 1997/08/09 00:03:39 dyson Exp $ */ #include "npx.h" @@ -515,7 +515,7 @@ npxintr(unit) * Pass exception to process. */ frame = (struct intrframe *)&unit; /* XXX */ - if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) { + if (CS_SECURE(frame->if_cs) || (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 0205647..ae70bfc 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.254 1997/08/05 00:01:10 dyson Exp $ + * $Id: machdep.c,v 1.255 1997/08/09 00:02:40 dyson Exp $ */ #include "apm.h" @@ -672,7 +672,6 @@ 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 4498fc3..72df964 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.103 1997/08/09 10:13:32 dyson Exp $ + * $Id: trap.c,v 1.104 1997/08/12 19:07:42 dyson Exp $ */ /* @@ -206,7 +206,7 @@ trap(frame) type = frame.tf_trapno; code = frame.tf_err; - if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) { + if (CS_SECURE(frame.tf_cs) || (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" : - ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); + CS_SECURE(frame->tf_cs) ? "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 ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) { + if (CS_SECURE(frame->tf_cs) || (frame->tf_eflags & PSL_VM)) { ss = frame->tf_ss & 0xffff; esp = frame->tf_esp; } else { @@ -885,7 +885,7 @@ syscall(frame) u_int code; sticks = p->p_sticks; - if (ISPL(frame.tf_cs) != SEL_UPL) + if (!CS_SECURE(frame.tf_cs)) panic("syscall"); p->p_md.md_regs = &frame; diff --git a/sys/amd64/include/cpu.h b/sys/amd64/include/cpu.h index 0aedc2a..8f07480 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.29 1997/04/07 07:15:58 peter Exp $ + * $Id: cpu.h,v 1.30 1997/08/09 00:03:09 dyson 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) \ - ((ISPL((framep)->cf_cs) == SEL_UPL) || (framep->cf_eflags & PSL_VM)) + (CS_SECURE((framep)->cf_cs) || (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 a5799d3..b97c42e 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.1 1997/07/19 01:32:04 smp Exp smp $ + * $Id: segments.h,v 1.15 1997/07/19 02:24:37 fsmp Exp $ */ #ifndef _MACHINE_SEGMENTS_H_ @@ -59,6 +59,8 @@ #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 32fa57a..bfd2f8a 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.49 1997/07/21 07:57:50 fsmp Exp $ + * $Id: npx.c,v 1.50 1997/08/09 00:03:39 dyson Exp $ */ #include "npx.h" @@ -515,7 +515,7 @@ npxintr(unit) * Pass exception to process. */ frame = (struct intrframe *)&unit; /* XXX */ - if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) { + if (CS_SECURE(frame->if_cs) || (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 69a88e1..19a8d00 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.22 1997/04/26 19:12:03 peter Exp $ + * $Id: db_trace.c,v 1.23 1997/07/20 08:37:17 bde Exp $ */ #include <sys/param.h> @@ -187,7 +187,7 @@ db_nextframe(fp, ip) */ tf = (struct trapframe *) ((int)*fp + 8); - esp = (ISPL(tf->tf_cs) == SEL_UPL) ? tf->tf_esp : (int)&tf->tf_esp; + esp = CS_SECURE(tf->tf_cs) ? 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 0205647..ae70bfc 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.254 1997/08/05 00:01:10 dyson Exp $ + * $Id: machdep.c,v 1.255 1997/08/09 00:02:40 dyson Exp $ */ #include "apm.h" @@ -672,7 +672,6 @@ 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 4498fc3..72df964 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.103 1997/08/09 10:13:32 dyson Exp $ + * $Id: trap.c,v 1.104 1997/08/12 19:07:42 dyson Exp $ */ /* @@ -206,7 +206,7 @@ trap(frame) type = frame.tf_trapno; code = frame.tf_err; - if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) { + if (CS_SECURE(frame.tf_cs) || (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" : - ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); + CS_SECURE(frame->tf_cs) ? "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 ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) { + if (CS_SECURE(frame->tf_cs) || (frame->tf_eflags & PSL_VM)) { ss = frame->tf_ss & 0xffff; esp = frame->tf_esp; } else { @@ -885,7 +885,7 @@ syscall(frame) u_int code; sticks = p->p_sticks; - if (ISPL(frame.tf_cs) != SEL_UPL) + if (!CS_SECURE(frame.tf_cs)) panic("syscall"); p->p_md.md_regs = &frame; diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h index 0aedc2a..8f07480 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.29 1997/04/07 07:15:58 peter Exp $ + * $Id: cpu.h,v 1.30 1997/08/09 00:03:09 dyson 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) \ - ((ISPL((framep)->cf_cs) == SEL_UPL) || (framep->cf_eflags & PSL_VM)) + (CS_SECURE((framep)->cf_cs) || (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 a5799d3..b97c42e 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.1 1997/07/19 01:32:04 smp Exp smp $ + * $Id: segments.h,v 1.15 1997/07/19 02:24:37 fsmp Exp $ */ #ifndef _MACHINE_SEGMENTS_H_ @@ -59,6 +59,8 @@ #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 32fa57a..bfd2f8a 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.49 1997/07/21 07:57:50 fsmp Exp $ + * $Id: npx.c,v 1.50 1997/08/09 00:03:39 dyson Exp $ */ #include "npx.h" @@ -515,7 +515,7 @@ npxintr(unit) * Pass exception to process. */ frame = (struct intrframe *)&unit; /* XXX */ - if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) { + if (CS_SECURE(frame->if_cs) || (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 9a3a734..fcdd49f 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.14 1997/05/07 20:05:45 peter Exp $ + * $Id: linux_sysvec.c,v 1.15 1997/07/20 16:06:06 bde Exp $ */ /* XXX we use functions that might not exist. */ @@ -317,7 +317,6 @@ 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 4498fc3..72df964 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.103 1997/08/09 10:13:32 dyson Exp $ + * $Id: trap.c,v 1.104 1997/08/12 19:07:42 dyson Exp $ */ /* @@ -206,7 +206,7 @@ trap(frame) type = frame.tf_trapno; code = frame.tf_err; - if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) { + if (CS_SECURE(frame.tf_cs) || (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" : - ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); + CS_SECURE(frame->tf_cs) ? "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 ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) { + if (CS_SECURE(frame->tf_cs) || (frame->tf_eflags & PSL_VM)) { ss = frame->tf_ss & 0xffff; esp = frame->tf_esp; } else { @@ -885,7 +885,7 @@ syscall(frame) u_int code; sticks = p->p_sticks; - if (ISPL(frame.tf_cs) != SEL_UPL) + if (!CS_SECURE(frame.tf_cs)) panic("syscall"); p->p_md.md_regs = &frame; |