diff options
-rw-r--r-- | etc/etc.i386/sysctl.conf | 2 | ||||
-rw-r--r-- | lib/libarch/i386/Makefile | 11 | ||||
-rw-r--r-- | lib/libarch/i386/i386_get_ldt.2 | 124 | ||||
-rw-r--r-- | lib/libarch/i386/i386_get_ldt.c | 45 | ||||
-rw-r--r-- | lib/libarch/i386/i386_set_ldt.c | 45 | ||||
-rw-r--r-- | regress/sys/arch/i386/Makefile | 8 | ||||
-rw-r--r-- | regress/sys/arch/i386/ldt/Makefile | 33 | ||||
-rw-r--r-- | regress/sys/arch/i386/ldt/testldt.c | 273 | ||||
-rw-r--r-- | sbin/sysctl/sysctl.8 | 5 | ||||
-rw-r--r-- | share/man/man3/intro.3 | 5 | ||||
-rw-r--r-- | share/man/man4/options.4 | 15 | ||||
-rw-r--r-- | sys/arch/i386/conf/GENERIC | 3 | ||||
-rw-r--r-- | sys/arch/i386/i386/gdt.c | 27 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 15 | ||||
-rw-r--r-- | sys/arch/i386/i386/pmap.c | 85 | ||||
-rw-r--r-- | sys/arch/i386/i386/sys_machdep.c | 254 | ||||
-rw-r--r-- | sys/arch/i386/include/cpu.h | 12 | ||||
-rw-r--r-- | sys/arch/i386/include/gdt.h | 4 | ||||
-rw-r--r-- | sys/arch/i386/include/pmap.h | 11 | ||||
-rw-r--r-- | sys/arch/i386/include/sysarch.h | 18 | ||||
-rw-r--r-- | sys/uvm/uvm_map.c | 6 | ||||
-rw-r--r-- | sys/uvm/uvm_pmap.h | 6 |
22 files changed, 22 insertions, 985 deletions
diff --git a/etc/etc.i386/sysctl.conf b/etc/etc.i386/sysctl.conf index 2051fd7f06a..48f492dc82d 100644 --- a/etc/etc.i386/sysctl.conf +++ b/etc/etc.i386/sysctl.conf @@ -2,5 +2,3 @@ #machdep.apmhalt=1 # 1=powerdown hack, try if halt -p doesn't work #machdep.kbdreset=1 # permit console CTRL-ALT-DEL to do a nice halt #machdep.lidsuspend=0 # do not suspend laptop upon lid closing -#machdep.userldt=1 # allow userland programs to play with ldt, - # required by some ports diff --git a/lib/libarch/i386/Makefile b/lib/libarch/i386/Makefile index 4cb11d3dc2e..873c20531ef 100644 --- a/lib/libarch/i386/Makefile +++ b/lib/libarch/i386/Makefile @@ -1,21 +1,18 @@ -# $OpenBSD: Makefile,v 1.7 2014/07/16 20:02:17 okan Exp $ +# $OpenBSD: Makefile,v 1.8 2016/03/03 12:41:29 naddy Exp $ # $NetBSD: Makefile,v 1.1 1996/02/21 02:45:47 jtk Exp $ -MAN+= i386_get_ldt.2 \ - i386_get_fsbase.2 i386_get_gsbase.2 \ +MAN+= i386_get_fsbase.2 i386_get_gsbase.2 \ i386_iopl.2 i386_get_ioperm.2 \ i386_vm86.2 MANSUBDIR=i386 -MLINKS+=i386_get_ldt.2 i386_set_ldt.2 \ - i386_get_fsbase.2 i386_set_fsbase.2 \ +MLINKS+=i386_get_fsbase.2 i386_set_fsbase.2 \ i386_get_gsbase.2 i386_set_gsbase.2 \ i386_get_ioperm.2 i386_set_ioperm.2 .if ${MACHINE} == "i386" .PATH: ${LIBC}/i386 NOPIC= -SRCS+= i386_get_ldt.c i386_set_ldt.c \ - i386_iopl.c i386_get_ioperm.c i386_set_ioperm.c \ +SRCS+= i386_iopl.c i386_get_ioperm.c i386_set_ioperm.c \ i386_get_fsbase.c i386_get_gsbase.c \ i386_set_fsbase.c i386_set_gsbase.c \ i386_vm86.c diff --git a/lib/libarch/i386/i386_get_ldt.2 b/lib/libarch/i386/i386_get_ldt.2 deleted file mode 100644 index 6ed839e0794..00000000000 --- a/lib/libarch/i386/i386_get_ldt.2 +++ /dev/null @@ -1,124 +0,0 @@ -.\" $OpenBSD: i386_get_ldt.2,v 1.18 2015/09/10 17:55:21 schwarze Exp $ -.\" -.\" Copyright (c) 1980, 1991 Regents of the University of California. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" from: @(#)fork.2 6.5 (Berkeley) 3/10/91 -.\" $NetBSD: i386_get_ldt.2,v 1.3 1996/01/05 14:56:44 pk Exp $ -.\" -.Dd $Mdocdate: September 10 2015 $ -.Dt I386_GET_LDT 2 i386 -.Os -.Sh NAME -.Nm i386_get_ldt , -.Nm i386_set_ldt -.Nd manage i386 per-process Local Descriptor Table entries -.Sh SYNOPSIS -.In sys/types.h -.In machine/segments.h -.In machine/sysarch.h -.Ft int -.Fn i386_get_ldt "int start_sel" "union descriptor *descs" "int num_sels" -.Ft int -.Fn i386_set_ldt "int start_sel" "union descriptor *descs" "int num_sels" -.Sh DESCRIPTION -.Fn i386_get_ldt -returns a list of the i386 descriptors in the current process' -LDT. -.Fn i386_set_ldt -sets a list of i386 descriptors in the current process' -LDT. -For both routines, -.Fa start_sel -specifies the index of the selector in the LDT at which to begin and -.Fa descs -points to an array of -.Fa num_sels -descriptors to be set or returned. -.Pp -Each entry in the -.Fa descs -array can be either a segment_descriptor or a gate_descriptor, -as defined in -.In i386/segments.h . -These structures are defined by the architecture -as disjoint bit-fields, so care must be taken in constructing them. -.Pp -Before this API can be used the functionality has to be enabled -using the machdep.userldt -.Xr sysctl 8 -variable. -.Pp -.Sy Note: -Code using the -.Fn i386_get_ldt -and -.Fn i386_set_ldt -functions must be compiled using -.Cm -li386 . -.Sh RETURN VALUES -Upon successful completion, -.Fn i386_get_ldt -returns the number of i386 descriptors copied into -.Fa descs -from the current process' LDT. -Otherwise, a value of \-1 is returned and the global -variable -.Va errno -is set to indicate the error. -.Pp -Upon successful completion, -.Fn i386_set_ldt -returns the first selector set; -if the kernel allocated a descriptor in the LDT, -the allocated index is returned. -Otherwise, a value of \-1 is returned and the global -variable -.Va errno -is set to indicate the error. -.Sh ERRORS -.Fn i386_get_ldt -and -.Fn i386_set_ldt -will fail if: -.Bl -tag -width [EINVAL] -.It Bq Er EINVAL -An inappropriate parameter was used for -.Fa start_sel -or -.Fa num_sels . -.It Bq Er EACCES -The caller attempted to use a descriptor that would -circumvent protection or cause a failure. -.El -.Sh REFERENCES -.Rs -.%A Intel -.%T i386 Microprocessor Programmer's Reference Manual -.Re -.Sh WARNING -You can really hose your process using this. diff --git a/lib/libarch/i386/i386_get_ldt.c b/lib/libarch/i386/i386_get_ldt.c deleted file mode 100644 index 649bcf8eb48..00000000000 --- a/lib/libarch/i386/i386_get_ldt.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1993 John Brezak - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <sys/types.h> - -#include <machine/segments.h> -#include <machine/sysarch.h> - -int -i386_get_ldt(int start, union descriptor *desc, int num) -{ - struct i386_get_ldt_args p; - - p.start = start; - p.desc = desc; - p.num = num; - - return sysarch(I386_GET_LDT, &p); -} diff --git a/lib/libarch/i386/i386_set_ldt.c b/lib/libarch/i386/i386_set_ldt.c deleted file mode 100644 index 08fef8c08a7..00000000000 --- a/lib/libarch/i386/i386_set_ldt.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1993 John Brezak - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <sys/types.h> - -#include <machine/segments.h> -#include <machine/sysarch.h> - -int -i386_set_ldt(int start, union descriptor *desc, int num) -{ - struct i386_set_ldt_args p; - - p.start = start; - p.desc = desc; - p.num = num; - - return sysarch(I386_SET_LDT, &p); -} diff --git a/regress/sys/arch/i386/Makefile b/regress/sys/arch/i386/Makefile deleted file mode 100644 index e8f955124ca..00000000000 --- a/regress/sys/arch/i386/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $OpenBSD: Makefile,v 1.3 2002/02/23 01:25:11 art Exp $ -# $NetBSD: Makefile,v 1.2 1995/04/20 22:41:43 cgd Exp $ - -SUBDIR+= ldt - -install: - -.include <bsd.subdir.mk> diff --git a/regress/sys/arch/i386/ldt/Makefile b/regress/sys/arch/i386/ldt/Makefile deleted file mode 100644 index c0d1dfa81b2..00000000000 --- a/regress/sys/arch/i386/ldt/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# $OpenBSD: Makefile,v 1.8 2014/07/16 20:04:21 okan Exp $ -# $NetBSD: Makefile,v 1.3 1995/04/20 22:42:19 cgd Exp $ -# -# C Optimizer (-O) breaks this program - don't use !! -CFLAGS=-g -PROG= testldt - -DPADD+= ${LIBARCH} -LDADD+= -li386 - -USERLDT_ENABLE!=sysctl -n machdep.userldt - -.ifmake !obj && !clean && !cleandir && !depend && !regress -.INTERRUPT: - -@${SUDO} sysctl -q machdep.userldt=${USERLDT_ENABLE} - -.END: - -@${SUDO} sysctl -q machdep.userldt=${USERLDT_ENABLE} -.endif - -.if ${MACHINE_ARCH} != "i386" -REGRESS_SKIP="yes" -.endif - -do-testldt: ${PROG} - @${SUDO} sysctl -q machdep.userldt=1 - ./${PROG} - -REGRESS_TARGETS=do-testldt -REGRESS_ROOT_TARGETS=${REGRESS_TARGETS} -.PHONY: ${REGRESS_TARGETS} - -.include <bsd.regress.mk> diff --git a/regress/sys/arch/i386/ldt/testldt.c b/regress/sys/arch/i386/ldt/testldt.c deleted file mode 100644 index 3258f8cec50..00000000000 --- a/regress/sys/arch/i386/ldt/testldt.c +++ /dev/null @@ -1,273 +0,0 @@ -/* $OpenBSD: testldt.c,v 1.9 2014/04/18 14:38:21 guenther Exp $ */ -/* $NetBSD: testldt.c,v 1.4 1995/04/20 22:42:38 cgd Exp $ */ - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/mman.h> -#include <machine/segments.h> - -extern int i386_get_ldt(int, union descriptor *, int); -extern int i386_set_ldt(int, union descriptor *, int); - -int verbose = 0; -struct sigaction segv_act; - -static inline void -set_fs(unsigned long val) -{ - __asm__ volatile("mov %0,%%fs"::"r" ((unsigned short) val)); -} - -static inline unsigned char -get_fs_byte(const char * addr) -{ - unsigned register char _v; - - __asm__ ("movb %%fs:%1,%0":"=q" (_v):"m" (*addr)); - return _v; -} - -static inline unsigned short -get_cs(void) -{ - unsigned register short _v; - - __asm__ ("movw %%cs,%0"::"r" ((unsigned short) _v)); - return _v; -} - -static int -check_desc(unsigned int desc) -{ - desc = LSEL(desc, SEL_UPL); - set_fs(desc); - return(get_fs_byte((char *) 0)); -} - -static void -gated_call(void) -{ - printf("Called from call gate..."); - __asm__ volatile("popl %ebp"); - __asm__ volatile(".byte 0xcb"); -} - -static struct segment_descriptor * -make_sd(unsigned base, unsigned limit, int type, int dpl, int seg32, int inpgs) -{ - static struct segment_descriptor d; - - d.sd_lolimit = limit & 0x0000ffff; - d.sd_lobase = base & 0x00ffffff; - d.sd_type = type & 0x01f; - d.sd_dpl = dpl & 0x3; - d.sd_p = 1; - d.sd_hilimit = (limit & 0x00ff0000) >> 16; - d.sd_xx = 0; - d.sd_def32 = seg32?1:0; - d.sd_gran = inpgs?1:0; - d.sd_hibase = (base & 0xff000000) >> 24; - - return (&d); -} - -static struct gate_descriptor * -make_gd(unsigned offset, unsigned int sel, unsigned stkcpy, int type, int dpl) -{ - static struct gate_descriptor d; - - d.gd_looffset = offset & 0x0000ffff; - d.gd_selector = sel & 0xffff; - d.gd_stkcpy = stkcpy & 0x1ff; - d.gd_type = type & 0x1ff; - d.gd_dpl = dpl & 0x3; - d.gd_p = 1; - d.gd_hioffset = (offset & 0xffff0000) >> 16; - - return(&d); -} - -static void -print_ldt(union descriptor *dp) -{ - unsigned long base_addr, limit, offset, selector, stack_copy; - int type, dpl, i; - unsigned long *lp = (unsigned long *)dp; - - /* First 32 bits of descriptor */ - selector = base_addr = (*lp >> 16) & 0x0000FFFF; - offset = limit = *lp & 0x0000FFFF; - lp++; - - /* First 32 bits of descriptor */ - base_addr |= (*lp & 0xFF000000) | ((*lp << 16) & 0x00FF0000); - limit |= (*lp & 0x000F0000); - type = dp->sd.sd_type; - dpl = dp->sd.sd_dpl; - stack_copy = dp->gd.gd_stkcpy; - offset |= (*lp >> 16) & 0x0000FFFF; - - if (type == SDT_SYS386CGT || type == SDT_SYS286CGT) - printf("LDT: Gate Off %08.8x, Sel %05.5x, Stkcpy %d DPL %d, Type %d\n", - offset, selector, stack_copy, dpl, type); - else - printf("LDT: Seg Base %08.8x, Limit %05.5x, DPL %d, Type %d\n", - base_addr, limit, dpl, type); - printf(" "); - if (*lp & 0x100) - printf("Accessed, "); - if (*lp & 8000) - printf("Present, "); - if (type != SDT_SYS386CGT && type != SDT_SYS286CGT) { - if (*lp & 0x100000) - printf("User, "); - if (*lp & 0x200000) - printf("X, "); - if (*lp & 0x400000) - printf("32, "); - else - printf("16, "); - if (*lp & 0x800000) - printf("page limit, "); - else - printf("byte limit, "); - } - printf("\n"); - printf(" %08.8x %08.8x\n", *(lp), *(lp-1)); -} - -static void busfault(int signal, int code, struct sigcontext *sc) -{ - fprintf(stderr, "\nbus fault - investigate.\n"); - _exit(1); -} - -static void usage(int status) -{ - fprintf(stderr, "Usage: testldt [-v]\n"); - exit(status); -} - -#define MAX_USER_LDT 1024 -main(int argc, char *argv[]) -{ - union descriptor ldt[MAX_USER_LDT]; - int num, n, ch; - unsigned int cs = get_cs(); - char *data; - struct segment_descriptor *sd; - struct gate_descriptor *gd; - - segv_act.sa_handler = (sig_t) busfault; - if (sigaction(SIGBUS, &segv_act, NULL) < 0) { - perror("sigaction"); - exit(1); - } - - while ((ch = getopt(argc, argv, "v")) != -1) { - switch (ch) { - case 'v': - verbose++; - break; - default: - usage(1); - break; - } - } - - printf("Testing i386_get_ldt...\n"); - if ((num = i386_get_ldt(0, ldt, MAX_USER_LDT)) < 0) { - perror("get_ldt"); - exit(2); - } - if (num == 0) { - fprintf(stderr, "ERROR: i386_get_ldt() return 0 default LDT entries.\n"); - exit(1); - } - - if (verbose) { - printf("Got %d (default) LDTs\n", num); - for (n=0; n < num; n++) { - printf("Entry %d: ", n); - print_ldt(&ldt[n]); - } - } - - /* - * mmap a data area and assign an LDT to it - */ - printf("Testing i386_set_ldt...\n"); - data = (void *) mmap( (char *)0x005f0000, 0x0fff, - PROT_EXEC | PROT_READ | PROT_WRITE, - MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0); - if (data == MAP_FAILED) { - perror("mmap"); - exit(1); - } - if (verbose) printf("data address: %8.8x\n", data); - - *data = 0x97; - - /* Get the next free LDT and set it to the allocated data. */ - sd = make_sd((unsigned)data, 4096, SDT_MEMRW, SEL_UPL, 0, 0); - if ((num = i386_set_ldt(6, (union descriptor *)sd, 1)) < 0) { - perror("set_ldt"); - exit(1); - } - if (verbose) printf("setldt returned: %d\n", num); - if ((n = i386_get_ldt(num, ldt, 1)) < 0) { - perror("get_ldt"); - exit(1); - } - if (verbose) { - printf("Entry %d: ", num); - print_ldt(&ldt[0]); - } - - if (verbose) printf("Checking desc (should be 0x97): 0x%x\n", check_desc(num)); - if (check_desc(num) != 0x97) { - fprintf(stderr, "ERROR: descriptor check failed: (should be 0x97): 0x%x\n", check_desc(num)); - exit(1); - } - - /* - * Test a Call Gate - */ - printf("Testing Call Gate..."); - gd = make_gd((unsigned)gated_call, cs, 0, SDT_SYS386CGT, SEL_UPL); - if ((num = i386_set_ldt(5, (union descriptor *)gd, 1)) < 0) { - perror("set_ldt: call gate"); - exit(1); - } - if (verbose) printf("setldt returned: %d\n", num); - if (verbose) printf("Call gate sel = 0x%x\n", LSEL(num, SEL_UPL)); - if ((n = i386_get_ldt(num, ldt, 1)) < 0) { - perror("get_ldt"); - exit(1); - } - if (verbose) printf("Entry %d: ", num); - if (verbose) print_ldt(&ldt[0]); - -#if 0 - err = setldt(5, - gated_call, /* Offset */ - 0x0001, /* This selector is for the executable segment descriptor. It - is the standard linux text descriptor. */ - 0x00008c00); /* Descriptor flags (you can't set all, the OS protects some) */ - printf("setldt returned: %d\n", err); -#endif - - __asm__ volatile(".byte 0x9a"); /* This is a call to a call gate. */ - __asm__ volatile(".byte 0x00"); /* Value is ignored in a call gate but can be used. */ - __asm__ volatile(".byte 0x00"); /* by the called procedure. */ - __asm__ volatile(".byte 0x00"); - __asm__ volatile(".byte 0x00"); - __asm__ volatile(".byte 0x2f"); /* Selector 0x002f. This is index = 5 (the call gate), */ - __asm__ volatile(".byte 0x00"); /* and a requestor priveledge level of 3. */ - - printf("Gated call returned\n"); - exit (0); -} diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index a8aa0fdcbbc..9e732c00aea 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.8,v 1.191 2016/02/29 19:44:07 naddy Exp $ +.\" $OpenBSD: sysctl.8,v 1.192 2016/03/03 12:41:30 naddy Exp $ .\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $ .\" .\" Copyright (c) 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)sysctl.8 8.2 (Berkeley) 5/9/95 .\" -.Dd $Mdocdate: February 29 2016 $ +.Dd $Mdocdate: March 3 2016 $ .Dt SYSCTL 8 .Os .Sh NAME @@ -368,7 +368,6 @@ and a few require a kernel compiled with non-standard .It machdep.apmwarn Ta integer Ta yes .It machdep.apmhalt Ta integer Ta yes .It machdep.kbdreset Ta integer Ta yes -.It machdep.userldt Ta integer Ta yes .It machdep.osfxsr Ta integer Ta no .It machdep.sse Ta integer Ta no .It machdep.sse2 Ta integer Ta no diff --git a/share/man/man3/intro.3 b/share/man/man3/intro.3 index 1414636c307..aafaea59607 100644 --- a/share/man/man3/intro.3 +++ b/share/man/man3/intro.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: intro.3,v 1.73 2015/11/14 23:56:50 deraadt Exp $ +.\" $OpenBSD: intro.3,v 1.74 2016/03/03 12:41:30 naddy Exp $ .\" $NetBSD: intro.3,v 1.5 1995/05/10 22:46:24 jtc Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)intro.3 8.1 (Berkeley) 6/5/93 .\" -.Dd $Mdocdate: November 14 2015 $ +.Dd $Mdocdate: March 3 2016 $ .Dt INTRO 3 .Os .Sh NAME @@ -398,7 +398,6 @@ and i386 I/O and memory access functions. See .Xr i386_get_ioperm 2 , -.Xr i386_get_ldt 2 , .Xr i386_iopl 2 , and .Xr i386_vm86 2 . diff --git a/share/man/man4/options.4 b/share/man/man4/options.4 index be87210202d..7ce3ca1919f 100644 --- a/share/man/man4/options.4 +++ b/share/man/man4/options.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: options.4,v 1.241 2016/02/28 15:46:18 naddy Exp $ +.\" $OpenBSD: options.4,v 1.242 2016/03/03 12:41:30 naddy Exp $ .\" $NetBSD: options.4,v 1.21 1997/06/25 03:13:00 thorpej Exp $ .\" .\" Copyright (c) 1998 Theo de Raadt @@ -34,7 +34,7 @@ .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd $Mdocdate: February 28 2016 $ +.Dd $Mdocdate: March 3 2016 $ .Dt OPTIONS 4 .Os .Sh NAME @@ -377,17 +377,6 @@ Makes the boot process more verbose for PCI peripherals (vendor names and other information is printed, etc.). .It Cd option PCMCIAVERBOSE Makes the boot process more verbose for PCMCIA peripherals. -.It Cd option USER_LDT -Enable userland manipulation of per-process -Local Descriptor Table (LDT) entries; -see -.Xr i386_set_ldt 2 -and the -.Va machdep.userldt -.Xr sysctl 8 . -This option is supported on the -.Va i386 -architecture. .It Cd option USER_PCICONF Enables the user level access to the PCI bus configuration space through ioctls on the diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index 7eb8672183c..0984e5b5226 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.812 2016/02/28 15:46:18 naddy Exp $ +# $OpenBSD: GENERIC,v 1.813 2016/03/03 12:41:30 naddy Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -17,7 +17,6 @@ option USER_PCICONF # user-space PCI configuration #option VM86 # Virtual 8086 emulation option KVM86 # Kernel Virtual 8086 emulation -option USER_LDT # user-settable LDT; see i386_set_ldt(2) option APERTURE # in-kernel aperture driver for XFree86 option MTRR # CPU memory range attributes control diff --git a/sys/arch/i386/i386/gdt.c b/sys/arch/i386/i386/gdt.c index 26e35b77d54..71a7a4cb8e1 100644 --- a/sys/arch/i386/i386/gdt.c +++ b/sys/arch/i386/i386/gdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt.c,v 1.35 2015/02/11 05:54:48 dlg Exp $ */ +/* $OpenBSD: gdt.c,v 1.36 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: gdt.c,v 1.28 2002/12/14 09:38:50 junyoung Exp $ */ /*- @@ -221,28 +221,3 @@ tss_free(int sel) gdt_put_slot(IDXSEL(sel)); } - -#ifdef USER_LDT -/* - * Caller must have pmap locked for both of these functions. - */ -void -ldt_alloc(struct pmap *pmap, union descriptor *ldt, size_t len) -{ - int slot; - - slot = gdt_get_slot(); - setgdt(slot, ldt, len - 1, SDT_SYSLDT, SEL_KPL, 0, 0); - pmap->pm_ldt_sel = GSEL(slot, SEL_KPL); -} - -void -ldt_free(struct pmap *pmap) -{ - int slot; - - slot = IDXSEL(pmap->pm_ldt_sel); - - gdt_put_slot(slot); -} -#endif /* USER_LDT */ diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 68352e91744..1677fa5f622 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.579 2015/12/27 04:31:34 jsg Exp $ */ +/* $OpenBSD: machdep.c,v 1.580 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -189,10 +189,6 @@ void (*cpu_idle_enter_fcn)(void) = NULL; int cpu_apmhalt = 0; /* sysctl'd to 1 for halt -p hack */ #endif -#ifdef USER_LDT -int user_ldt_enable = 0; /* sysctl'd to 1 to enable */ -#endif - struct uvm_constraint_range isa_constraint = { 0x0, 0x00ffffffUL }; struct uvm_constraint_range dma_constraint = { 0x0, 0xffffffffUL }; struct uvm_constraint_range *uvm_md_constraints[] = { @@ -2907,10 +2903,6 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack, p->p_md.md_flags &= ~MDP_USEDFPU; #endif -#ifdef USER_LDT - pmap_ldt_cleanup(p); -#endif - /* * Reset the code segment limit to I386_MAX_EXE_ADDR in the pmap; * this gets copied into the GDT for GUCODE_SEL by pmap_activate(). @@ -3585,11 +3577,6 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, else return (sysctl_int(oldp, oldlenp, newp, newlen, &kbd_reset)); -#ifdef USER_LDT - case CPU_USERLDT: - return (sysctl_int(oldp, oldlenp, newp, newlen, - &user_ldt_enable)); -#endif case CPU_OSFXSR: return (sysctl_rdint(oldp, oldlenp, newp, i386_use_fxsave)); case CPU_SSE: diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 0338dc848c4..c487e959c0e 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.186 2015/10/23 09:36:09 kettenis Exp $ */ +/* $OpenBSD: pmap.c,v 1.187 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -1362,20 +1362,6 @@ pmap_destroy(struct pmap *pmap) uvm_km_free(kernel_map, pmap->pm_pdir, pmap->pm_pdirsize); pmap->pm_pdir = 0; -#ifdef USER_LDT - if (pmap->pm_flags & PMF_USER_LDT) { - /* - * no need to switch the LDT; this address space is gone, - * nothing is using it. - * - * No need to lock the pmap for ldt_free (or anything else), - * we're the last one to use it. - */ - ldt_free(pmap); - uvm_km_free(kernel_map, (vaddr_t)pmap->pm_ldt, - pmap->pm_ldt_len * sizeof(union descriptor)); - } -#endif pool_put(&pmap_pmap_pool, pmap); } @@ -1390,75 +1376,6 @@ pmap_reference(struct pmap *pmap) atomic_inc_int(&pmap->pm_obj.uo_refs); } -#if defined(PMAP_FORK) -/* - * pmap_fork: perform any necessary data structure manipulation when - * a VM space is forked. - */ - -void -pmap_fork(struct pmap *pmap1, struct pmap *pmap2) -{ -#ifdef USER_LDT - /* Copy the LDT, if necessary. */ - if (pmap1->pm_flags & PMF_USER_LDT) { - union descriptor *new_ldt; - size_t len; - - len = pmap1->pm_ldt_len * sizeof(union descriptor); - new_ldt = (union descriptor *)uvm_km_alloc(kernel_map, len); - if (new_ldt == NULL) { - /* XXX needs to be able to fail properly */ - panic("pmap_fork: out of kva"); - } - bcopy(pmap1->pm_ldt, new_ldt, len); - pmap2->pm_ldt = new_ldt; - pmap2->pm_ldt_len = pmap1->pm_ldt_len; - pmap2->pm_flags |= PMF_USER_LDT; - ldt_alloc(pmap2, new_ldt, len); - } -#endif /* USER_LDT */ -} -#endif /* PMAP_FORK */ - -#ifdef USER_LDT -/* - * pmap_ldt_cleanup: if the pmap has a local LDT, deallocate it, and - * restore the default. - */ - -void -pmap_ldt_cleanup(struct proc *p) -{ - struct pcb *pcb = &p->p_addr->u_pcb; - pmap_t pmap = p->p_vmspace->vm_map.pmap; - union descriptor *old_ldt = NULL; - size_t len = 0; - - if (pmap->pm_flags & PMF_USER_LDT) { - ldt_free(pmap); - pmap->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL); - pcb->pcb_ldt_sel = pmap->pm_ldt_sel; - /* Reset the cached address of the LDT that this process uses */ -#ifdef MULTIPROCESSOR - pcb->pcb_ldt = curcpu()->ci_ldt; -#else - pcb->pcb_ldt = ldt; -#endif - if (pcb == curpcb) - lldt(pcb->pcb_ldt_sel); - old_ldt = pmap->pm_ldt; - len = pmap->pm_ldt_len * sizeof(union descriptor); - pmap->pm_ldt = NULL; - pmap->pm_ldt_len = 0; - pmap->pm_flags &= ~PMF_USER_LDT; - } - - if (old_ldt != NULL) - uvm_km_free(kernel_map, (vaddr_t)old_ldt, len); -} -#endif /* USER_LDT */ - void pmap_activate(struct proc *p) { diff --git a/sys/arch/i386/i386/sys_machdep.c b/sys/arch/i386/i386/sys_machdep.c index bf509e25eec..285b7f2ce9f 100644 --- a/sys/arch/i386/i386/sys_machdep.c +++ b/sys/arch/i386/i386/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.35 2015/09/08 07:12:56 deraadt Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.36 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: sys_machdep.c,v 1.28 1996/05/03 19:42:29 christos Exp $ */ /*- @@ -73,248 +73,6 @@ int i386_iopl(struct proc *, void *, register_t *); int i386_get_ioperm(struct proc *, void *, register_t *); int i386_set_ioperm(struct proc *, void *, register_t *); -#ifdef USER_LDT - -#ifdef LDT_DEBUG -static void i386_print_ldt(int, const struct segment_descriptor *); - -static void -i386_print_ldt(int i, const struct segment_descriptor *d) -{ - printf("[%d] lolimit=0x%x, lobase=0x%x, type=%u, dpl=%u, p=%u, " - "hilimit=0x%x, xx=%x, def32=%u, gran=%u, hibase=0x%x\n", - i, d->sd_lolimit, d->sd_lobase, d->sd_type, d->sd_dpl, d->sd_p, - d->sd_hilimit, d->sd_xx, d->sd_def32, d->sd_gran, d->sd_hibase); -} -#endif - -int -i386_get_ldt(struct proc *p, void *args, register_t *retval) -{ - int error; - pmap_t pmap = p->p_vmspace->vm_map.pmap; - int nldt, num; - union descriptor *lp, *cp; - struct i386_get_ldt_args ua; - - if (user_ldt_enable == 0) - return (ENOSYS); - - if ((error = copyin(args, &ua, sizeof(ua))) != 0) - return (error); - -#ifdef LDT_DEBUG - printf("i386_get_ldt: start=%d num=%d descs=%p\n", ua.start, - ua.num, ua.desc); -#endif - - if (ua.start < 0 || ua.num < 0 || ua.start > 8192 || ua.num > 8192 || - ua.start + ua.num > 8192) - return (EINVAL); - - cp = mallocarray(ua.num, sizeof(union descriptor), M_TEMP, M_WAITOK); - - if (pmap->pm_flags & PMF_USER_LDT) { - nldt = pmap->pm_ldt_len; - lp = pmap->pm_ldt; - } else { - nldt = NLDT; - lp = ldt; - } - - if (ua.start > nldt) { - free(cp, M_TEMP, ua.num * sizeof(union descriptor)); - return (EINVAL); - } - - lp += ua.start; - num = min(ua.num, nldt - ua.start); -#ifdef LDT_DEBUG - { - int i; - for (i = 0; i < num; i++) - i386_print_ldt(i, &lp[i].sd); - } -#endif - - memcpy(cp, lp, num * sizeof(union descriptor)); - - error = copyout(cp, ua.desc, num * sizeof(union descriptor)); - if (error == 0) - *retval = num; - - free(cp, M_TEMP, ua.num * sizeof(union descriptor)); - return (error); -} - -int -i386_set_ldt(struct proc *p, void *args, register_t *retval) -{ - int error, i, n; - struct pcb *pcb = &p->p_addr->u_pcb; - pmap_t pmap = p->p_vmspace->vm_map.pmap; - struct i386_set_ldt_args ua; - union descriptor *descv; - size_t old_len, new_len, ldt_len; - union descriptor *old_ldt, *new_ldt; - - if (user_ldt_enable == 0) - return (ENOSYS); - - if ((error = copyin(args, &ua, sizeof(ua))) != 0) - return (error); - - if (ua.start < 0 || ua.num < 0 || ua.start > 8192 || ua.num > 8192 || - ua.start + ua.num > 8192) - return (EINVAL); - - descv = mallocarray(ua.num, sizeof(*descv), M_TEMP, M_NOWAIT); - if (descv == NULL) - return (ENOMEM); - - if ((error = copyin(ua.desc, descv, sizeof (*descv) * ua.num)) != 0) - goto out; - - /* Check descriptors for access violations. */ - for (i = 0; i < ua.num; i++) { - union descriptor *desc = &descv[i]; - - switch (desc->sd.sd_type) { - case SDT_SYSNULL: - desc->sd.sd_p = 0; - break; - case SDT_SYS286CGT: - case SDT_SYS386CGT: - /* - * Only allow call gates targeting a segment - * in the LDT or a user segment in the fixed - * part of the gdt. Segments in the LDT are - * constrained (below) to be user segments. - */ - if (desc->gd.gd_p != 0 && - !ISLDT(desc->gd.gd_selector) && - ((IDXSEL(desc->gd.gd_selector) >= NGDT) || - (gdt[IDXSEL(desc->gd.gd_selector)].sd.sd_dpl != - SEL_UPL))) { - error = EACCES; - goto out; - } - break; - case SDT_MEMEC: - case SDT_MEMEAC: - case SDT_MEMERC: - case SDT_MEMERAC: - /* Must be "present" if executable and conforming. */ - if (desc->sd.sd_p == 0) { - error = EACCES; - goto out; - } - break; - case SDT_MEMRO: - case SDT_MEMROA: - case SDT_MEMRW: - case SDT_MEMRWA: - case SDT_MEMROD: - case SDT_MEMRODA: - case SDT_MEMRWD: - case SDT_MEMRWDA: - case SDT_MEME: - case SDT_MEMEA: - case SDT_MEMER: - case SDT_MEMERA: - break; - default: - /* - * Make sure that unknown descriptor types are - * not marked present. - */ - if (desc->sd.sd_p != 0) { - error = EACCES; - goto out; - } - break; - } - - if (desc->sd.sd_p != 0) { - /* Only user (ring-3) descriptors may be present. */ - if (desc->sd.sd_dpl != SEL_UPL) { - error = EACCES; - goto out; - } - } - } - - /* allocate user ldt */ - if (pmap->pm_ldt == 0 || (ua.start + ua.num) > pmap->pm_ldt_len) { - if (pmap->pm_flags & PMF_USER_LDT) - ldt_len = pmap->pm_ldt_len; - else - ldt_len = 512; - while ((ua.start + ua.num) > ldt_len) - ldt_len *= 2; - new_len = ldt_len * sizeof(union descriptor); - - new_ldt = (union descriptor *)uvm_km_alloc(kernel_map, - new_len); - if (new_ldt == NULL) { - error = ENOMEM; - goto out; - } - - if (pmap->pm_ldt != NULL && ldt_len <= pmap->pm_ldt_len) { - /* - * Another thread (re)allocated the LDT to - * sufficient size while we were blocked in - * uvm_km_alloc. Oh well. The new entries - * will quite probably not be right, but - * hey.. not our problem if user applications - * have race conditions like that. - */ - uvm_km_free(kernel_map, (vaddr_t)new_ldt, new_len); - goto copy; - } - - old_ldt = pmap->pm_ldt; - - if (old_ldt != NULL) { - old_len = pmap->pm_ldt_len * sizeof(union descriptor); - } else { - old_len = NLDT * sizeof(union descriptor); - old_ldt = ldt; - } - - memcpy(new_ldt, old_ldt, old_len); - memset((caddr_t)new_ldt + old_len, 0, new_len - old_len); - - if (old_ldt != ldt) - uvm_km_free(kernel_map, (vaddr_t)old_ldt, old_len); - - pmap->pm_ldt = new_ldt; - pmap->pm_ldt_len = ldt_len; - - if (pmap->pm_flags & PMF_USER_LDT) - ldt_free(pmap); - else - pmap->pm_flags |= PMF_USER_LDT; - ldt_alloc(pmap, new_ldt, new_len); - pcb->pcb_ldt_sel = pmap->pm_ldt_sel; - if (pcb == curpcb) - lldt(pcb->pcb_ldt_sel); - - } -copy: - /* Now actually replace the descriptors. */ - for (i = 0, n = ua.start; i < ua.num; i++, n++) - pmap->pm_ldt[n] = descv[i]; - - *retval = ua.start; - -out: - free(descv, M_TEMP, ua.num * sizeof(*descv)); - return (error); -} -#endif /* USER_LDT */ - #ifdef APERTURE extern int allowaperture; #endif @@ -425,16 +183,6 @@ sys_sysarch(struct proc *p, void *v, register_t *retval) int error = 0; switch(SCARG(uap, op)) { -#ifdef USER_LDT - case I386_GET_LDT: - error = i386_get_ldt(p, SCARG(uap, parms), retval); - break; - - case I386_SET_LDT: - error = i386_set_ldt(p, SCARG(uap, parms), retval); - break; -#endif - case I386_IOPL: error = i386_iopl(p, SCARG(uap, parms), retval); break; diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index 3d27ce6b0af..3d9bc1bef7a 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.145 2015/12/07 06:34:14 jsg Exp $ */ +/* $OpenBSD: cpu.h,v 1.146 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */ /*- @@ -441,13 +441,6 @@ void npxdrop(struct proc *); void npxsave_proc(struct proc *, int); void npxsave_cpu(struct cpu_info *, int); -#ifdef USER_LDT -/* sys_machdep.h */ -extern int user_ldt_enable; -int i386_get_ldt(struct proc *, void *, register_t *); -int i386_set_ldt(struct proc *, void *, register_t *); -#endif - /* isa_machdep.c */ void isa_defaultirq(void); int isa_nmi(void); @@ -485,7 +478,6 @@ int cpu_paenable(void *); #define CPU_APMWARN 9 /* APM battery warning percentage */ #define CPU_KBDRESET 10 /* keyboard reset under pcvt */ #define CPU_APMHALT 11 /* halt -p hack */ -#define CPU_USERLDT 12 #define CPU_OSFXSR 13 /* uses FXSAVE/FXRSTOR */ #define CPU_SSE 14 /* supports SSE */ #define CPU_SSE2 15 /* supports SSE2 */ @@ -506,7 +498,7 @@ int cpu_paenable(void *); { "apmwarn", CTLTYPE_INT }, \ { "kbdreset", CTLTYPE_INT }, \ { "apmhalt", CTLTYPE_INT }, \ - { "userldt", CTLTYPE_INT }, \ + { 0, 0 }, \ { "osfxsr", CTLTYPE_INT }, \ { "sse", CTLTYPE_INT }, \ { "sse2", CTLTYPE_INT }, \ diff --git a/sys/arch/i386/include/gdt.h b/sys/arch/i386/include/gdt.h index b34872d6ff3..2b5d0dcf3b3 100644 --- a/sys/arch/i386/include/gdt.h +++ b/sys/arch/i386/include/gdt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt.h,v 1.12 2009/02/03 11:24:19 mikeb Exp $ */ +/* $OpenBSD: gdt.h,v 1.13 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: gdt.h,v 1.7.10.6 2002/08/19 01:22:36 sommerfeld Exp $ */ /*- @@ -42,8 +42,6 @@ int gdt_get_slot(void); void gdt_init(void); void gdt_init_cpu(struct cpu_info *); void gdt_reload_cpu(/* XXX struct cpu_info * */ void); -void ldt_alloc(struct pmap *, union descriptor *, size_t); -void ldt_free(struct pmap *); int tss_alloc(struct pcb *); void tss_free(int); void setgdt(int, void *, size_t, int, int, int, int); diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h index 6ef814f36e2..39667e4c8fc 100644 --- a/sys/arch/i386/include/pmap.h +++ b/sys/arch/i386/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.79 2015/10/23 09:36:09 kettenis Exp $ */ +/* $OpenBSD: pmap.h,v 1.80 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */ /* @@ -111,9 +111,6 @@ struct pmap { int pm_ldt_sel; /* LDT selector */ }; -/* pm_flags */ -#define PMF_USER_LDT 0x01 /* pmap has user-set LDT */ - /* * For each managed physical page we maintain a list of <PMAP,VA>s * which it is mapped at. The list is headed by a pv_head structure. @@ -223,7 +220,6 @@ void pmap_init(void); struct pmap *pmap_create(void); void pmap_destroy(struct pmap *); void pmap_reference(struct pmap *); -void pmap_fork(struct pmap *, struct pmap *); void pmap_remove(struct pmap *, vaddr_t, vaddr_t); void pmap_collect(struct pmap *); void pmap_activate(struct proc *); @@ -458,11 +454,6 @@ pmap_is_curpmap(struct pmap *pmap) return (pmap_is_active(pmap, curcpu())); } -#if defined(USER_LDT) -void pmap_ldt_cleanup(struct proc *); -#define PMAP_FORK -#endif /* USER_LDT */ - #endif /* _KERNEL */ struct pv_entry; diff --git a/sys/arch/i386/include/sysarch.h b/sys/arch/i386/include/sysarch.h index 0cf97b86694..fae1affb4f8 100644 --- a/sys/arch/i386/include/sysarch.h +++ b/sys/arch/i386/include/sysarch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sysarch.h,v 1.12 2012/12/05 23:20:12 deraadt Exp $ */ +/* $OpenBSD: sysarch.h,v 1.13 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: sysarch.h,v 1.8 1996/01/08 13:51:44 mycroft Exp $ */ #ifndef _MACHINE_SYSARCH_H_ @@ -7,8 +7,6 @@ /* * Architecture specific syscalls (i386) */ -#define I386_GET_LDT 0 -#define I386_SET_LDT 1 #define I386_IOPL 2 #define I386_GET_IOPERM 3 #define I386_SET_IOPERM 4 @@ -18,18 +16,6 @@ #define I386_GET_GSBASE 8 #define I386_SET_GSBASE 9 -struct i386_get_ldt_args { - int start; - union descriptor *desc; - int num; -}; - -struct i386_set_ldt_args { - int start; - union descriptor *desc; - int num; -}; - struct i386_iopl_args { int iopl; }; @@ -50,8 +36,6 @@ int i386_set_threadbase(struct proc *, uint32_t, int); #include <sys/cdefs.h> __BEGIN_DECLS -int i386_get_ldt(int, union descriptor *, int); -int i386_set_ldt(int, union descriptor *, int); int i386_iopl(int); int i386_get_ioperm(u_long *); int i386_set_ioperm(u_long *); diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 463c7498c99..ef64548f05b 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.205 2015/12/16 14:22:21 kettenis Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.206 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -3738,10 +3738,6 @@ uvmspace_fork(struct process *pr) shmfork(vm1, vm2); #endif -#ifdef PMAP_FORK - pmap_fork(vm1->vm_map.pmap, vm2->vm_map.pmap); -#endif - return vm2; } diff --git a/sys/uvm/uvm_pmap.h b/sys/uvm/uvm_pmap.h index 81ae92e2c12..1d9fab71aa4 100644 --- a/sys/uvm/uvm_pmap.h +++ b/sys/uvm/uvm_pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pmap.h,v 1.25 2015/11/10 08:21:28 mlarkin Exp $ */ +/* $OpenBSD: uvm_pmap.h,v 1.26 2016/03/03 12:41:30 naddy Exp $ */ /* $NetBSD: uvm_pmap.h,v 1.1 2000/06/27 09:00:14 mrg Exp $ */ /* @@ -173,10 +173,6 @@ void pmap_virtual_space(vaddr_t *, vaddr_t *); vaddr_t pmap_steal_memory(vsize_t, vaddr_t *, vaddr_t *); #endif -#if defined(PMAP_FORK) -void pmap_fork(pmap_t, pmap_t); -#endif - /* nested pmaps are used in i386/amd64 vmm */ #ifndef pmap_nested #define pmap_nested(pm) 0 |