summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-30 09:30:36 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-30 09:30:36 +0000
commitf345fe14aab7ab69dfed45a4d8f8e477d66959f5 (patch)
treea804d6dca0a01afda4a31b1c2d445bb8703883e4
parent491833d0c6eb815fa66f89b10587f8b97cf09561 (diff)
clean & sync
-rw-r--r--sys/arch/i386/i386/gdt.c12
-rw-r--r--sys/arch/i386/i386/machdep.c10
-rw-r--r--sys/arch/i386/i386/mainbus.c6
-rw-r--r--sys/arch/i386/i386/pmap.c6
-rw-r--r--sys/arch/i386/i386/pmap.old.c6
-rw-r--r--sys/arch/i386/i386/process_machdep.c9
-rw-r--r--sys/arch/i386/i386/vm86.c6
-rw-r--r--sys/arch/i386/include/gdt.h5
-rw-r--r--sys/arch/i386/include/joystick.h22
-rw-r--r--sys/arch/i386/include/vm86.h5
10 files changed, 21 insertions, 66 deletions
diff --git a/sys/arch/i386/i386/gdt.c b/sys/arch/i386/i386/gdt.c
index fc8a6dc18bb..1f6be4d6c1c 100644
--- a/sys/arch/i386/i386/gdt.c
+++ b/sys/arch/i386/i386/gdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gdt.c,v 1.9 1996/05/07 07:21:38 deraadt Exp $ */
+/* $OpenBSD: gdt.c,v 1.10 1996/05/30 09:30:06 deraadt Exp $ */
/* $NetBSD: gdt.c,v 1.8 1996/05/03 19:42:06 christos Exp $ */
/*-
@@ -223,16 +223,6 @@ gdt_get_slot()
if (gdt_next != gdt_count)
panic("gdt_get_slot botch 1");
if (gdt_next >= gdt_size) {
- /*
- * gdt_size is clamped by maxproc, set in
- * /sys/conf/param.c and clamped in init386().
- * It's held there to (MAXGDTSIZ - NGDT) if no
- * user LDTs, or half that if user LDTs are
- * allowed. It's important to count that
- * correctly, because by the time we get here,
- * it's too late to abort the fork operation
- * -- we must have a GDT slot available.
- */
if (gdt_size >= MAXGDTSIZ)
panic("gdt_get_slot botch 2");
if (dynamic_gdt == gdt)
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index ca28e938d4d..03ea79cef85 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.18 1996/05/23 08:38:54 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.19 1996/05/30 09:30:09 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.202 1996/05/18 15:54:59 christos Exp $ */
/*-
@@ -412,7 +412,7 @@ identifycpu()
break;
}
strcat(cpu_model, "-class CPU)");
- printf("%s", cpu_model); /* cpu speed would be nice, but how? */
+ printf("%s", cpu_model);
#if defined(I586_CPU)
if (cpu_class == CPUCLASS_586) {
calibrate_cyclecounter();
@@ -709,12 +709,6 @@ sys_sigreturn(p, v, retval)
p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
p->p_sigmask = context.sc_mask & ~sigcantmask;
- if (context.sc_onstack & 01)
- p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK;
- else
- p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
- p->p_sigmask = context.sc_mask & ~sigcantmask;
-
return (EJUSTRETURN);
}
diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c
index c820ad08cea..a7cfcf65def 100644
--- a/sys/arch/i386/i386/mainbus.c
+++ b/sys/arch/i386/i386/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.4 1996/05/07 07:21:47 deraadt Exp $ */
+/* $OpenBSD: mainbus.c,v 1.5 1996/05/30 09:30:08 deraadt Exp $ */
/* $NetBSD: mainbus.c,v 1.8 1996/04/11 22:13:37 cgd Exp $ */
/*
@@ -105,11 +105,7 @@ mainbus_attach(parent, self, aux)
config_found(self, &mba.mba_iba, mainbus_print);
}
-#ifndef AHA284X_HACK
if (!bcmp(ISA_HOLE_VADDR(EISA_ID_PADDR), EISA_ID, EISA_ID_LEN)) {
-#else
- {
-#endif
mba.mba_eba.eba_busname = "eisa";
mba.mba_eba.eba_bc = NULL;
mba.mba_eba.eba_ec = NULL;
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index e525220592b..d1a6b0f5743 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.9 1996/05/07 07:21:51 deraadt Exp $ */
+/* $OpenBSD: pmap.c,v 1.10 1996/05/30 09:30:08 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */
/*
@@ -182,7 +182,6 @@ char *pmap_attributes; /* reference and modify bits */
TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;
int pv_nfree;
-void i386_protection_init __P((void));
pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t));
struct pv_entry * pmap_alloc_pv __P((void));
void pmap_free_pv __P((struct pv_entry *));
@@ -1380,8 +1379,7 @@ pmap_collect(pmap)
pmap_t pmap;
{
#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_collect(%x) ", pmap);
+ printf("pmap_collect(%x) ", pmap);
#endif
if (pmap != pmap_kernel())
diff --git a/sys/arch/i386/i386/pmap.old.c b/sys/arch/i386/i386/pmap.old.c
index 81acff1a817..a4fe896f23d 100644
--- a/sys/arch/i386/i386/pmap.old.c
+++ b/sys/arch/i386/i386/pmap.old.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.old.c,v 1.9 1996/05/07 07:21:51 deraadt Exp $ */
+/* $OpenBSD: pmap.old.c,v 1.10 1996/05/30 09:30:08 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */
/*
@@ -182,7 +182,6 @@ char *pmap_attributes; /* reference and modify bits */
TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;
int pv_nfree;
-void i386_protection_init __P((void));
pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t));
struct pv_entry * pmap_alloc_pv __P((void));
void pmap_free_pv __P((struct pv_entry *));
@@ -1380,8 +1379,7 @@ pmap_collect(pmap)
pmap_t pmap;
{
#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_collect(%x) ", pmap);
+ printf("pmap_collect(%x) ", pmap);
#endif
if (pmap != pmap_kernel())
diff --git a/sys/arch/i386/i386/process_machdep.c b/sys/arch/i386/i386/process_machdep.c
index 8d2c12dc019..033f5974761 100644
--- a/sys/arch/i386/i386/process_machdep.c
+++ b/sys/arch/i386/i386/process_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process_machdep.c,v 1.5 1996/05/07 07:21:53 deraadt Exp $ */
+/* $OpenBSD: process_machdep.c,v 1.6 1996/05/30 09:30:07 deraadt Exp $ */
/* $NetBSD: process_machdep.c,v 1.22 1996/05/03 19:42:25 christos Exp $ */
/*
@@ -194,6 +194,13 @@ process_write_regs(p, regs)
#define valid_sel(sel) (ISPL(sel) == SEL_UPL && verr(sel))
#define null_sel(sel) (!ISLDT(sel) && IDXSEL(sel) == 0)
+ /*
+ * Check for security violations.
+ */
+ if (((regs->r_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 ||
+ !USERMODE(regs->r_cs, regs->r_eflags))
+ return (EINVAL);
+
if ((regs->r_gs != pcb->pcb_gs && \
!valid_sel(regs->r_gs) && !null_sel(regs->r_gs)) ||
(regs->r_fs != pcb->pcb_fs && \
diff --git a/sys/arch/i386/i386/vm86.c b/sys/arch/i386/i386/vm86.c
index 18cf71c06d8..a968c811bc9 100644
--- a/sys/arch/i386/i386/vm86.c
+++ b/sys/arch/i386/i386/vm86.c
@@ -1,4 +1,3 @@
-/* $OpenBSD: vm86.c,v 1.6 1996/05/07 07:21:58 deraadt Exp $ */
/* $NetBSD: vm86.c,v 1.15 1996/05/03 19:42:33 christos Exp $ */
/*-
@@ -75,10 +74,9 @@
static void fast_intxx __P((struct proc *, int));
static __inline int is_bitset __P((int, caddr_t));
-#define SETDIRECT ((~(PSL_USERSTATIC|PSL_NT)) & 0xffff)
-#define GETDIRECT (SETDIRECT|0x02a) /* add in two MBZ bits */
-
+#define CS(tf) (*(u_short *)&tf->tf_cs)
#define IP(tf) (*(u_short *)&tf->tf_eip)
+#define SS(tf) (*(u_short *)&tf->tf_ss)
#define SP(tf) (*(u_short *)&tf->tf_esp)
diff --git a/sys/arch/i386/include/gdt.h b/sys/arch/i386/include/gdt.h
index 7b7a6ea5ac5..80d437de1db 100644
--- a/sys/arch/i386/include/gdt.h
+++ b/sys/arch/i386/include/gdt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: gdt.h,v 1.3 1996/04/29 14:13:48 hvozda Exp $ */
+/* $OpenBSD: gdt.h,v 1.4 1996/05/30 09:30:10 deraadt Exp $ */
/* $NetBSD: gdt.h,v 1.3 1996/02/27 22:32:11 jtc Exp $ */
/*-
@@ -37,9 +37,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define MAXGDTSIZ 8192 /* max # entries in an i386 GDT */
-extern union descriptor *dynamic_gdt;
-
void tss_alloc __P((struct pcb *));
void tss_free __P((struct pcb *));
void ldt_alloc __P((struct pcb *, union descriptor *, size_t));
diff --git a/sys/arch/i386/include/joystick.h b/sys/arch/i386/include/joystick.h
index 464777c97eb..4b1bce47583 100644
--- a/sys/arch/i386/include/joystick.h
+++ b/sys/arch/i386/include/joystick.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: joystick.h,v 1.3 1996/05/30 09:30:10 deraadt Exp $ */
/* $NetBSD: joystick.h,v 1.1 1996/03/27 19:18:56 perry Exp $ */
#ifndef _JOY_IOCTL_H_
@@ -21,24 +22,3 @@ struct joystick {
#define JOY_GET_Y_OFFSET _IOR('J', 6, int) /* get offset on Y-axis */
#endif /* _JOY_IOCTL_H_ */
-#ifndef _JOY_IOCTL_H_
-#define _JOY_IOCTL_H_
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-
-struct joystick {
- int x;
- int y;
- int b1;
- int b2;
-};
-
-#define JOY_SETTIMEOUT _IOW('J', 1, int) /* set timeout */
-#define JOY_GETTIMEOUT _IOR('J', 2, int) /* get timeout */
-#define JOY_SET_X_OFFSET _IOW('J', 3, int) /* set offset on X-axis */
-#define JOY_SET_Y_OFFSET _IOW('J', 4, int) /* set offset on X-axis */
-#define JOY_GET_X_OFFSET _IOR('J', 5, int) /* get offset on X-axis */
-#define JOY_GET_Y_OFFSET _IOR('J', 6, int) /* get offset on Y-axis */
-
-#endif /* _JOY_IOCTL_H_ */
diff --git a/sys/arch/i386/include/vm86.h b/sys/arch/i386/include/vm86.h
index 58069b33dc9..f8a9f0d7c20 100644
--- a/sys/arch/i386/include/vm86.h
+++ b/sys/arch/i386/include/vm86.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm86.h,v 1.6 1996/05/07 07:22:11 deraadt Exp $ */
+/* $OpenBSD: vm86.h,v 1.7 1996/05/30 09:30:11 deraadt Exp $ */
/* $NetBSD: vm86.h,v 1.8 1996/05/03 19:26:32 christos Exp $ */
#undef VM86_USE_VIF
@@ -52,9 +52,6 @@
#define VM86_REALFLAGS (~PSL_USERSTATIC)
#define VM86_VIRTFLAGS (PSL_USERSTATIC & ~(PSL_MBO | PSL_MBZ))
-#define VM86_SETDIRECT (~PSL_USERSTATIC)
-#define VM86_GETDIRECT (VM86_SETDIRECT|PSL_MBO|PSL_MBZ)
-
struct vm86_regs {
struct sigcontext vmsc;
};