Commit Graph

36 Commits

Author SHA1 Message Date
tsutsui 112c91d583 Use #if defined(_KERNEL_OPT) to protect #include "opt_xxx.h"
from building LKM etc. Suggested by mrg.
2003-11-09 05:29:59 +00:00
chs 939df36e55 add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default.  the changes
fall into two basic catagories:

 - pmap and trap-handler changes.  these are all MD:
   = alpha: we already track per-page execute permission with the (software)
	PG_EXEC bit, so just have the trap handler pay attention to it.
   = i386: use a new GDT segment for %cs for processes that have no
	executable mappings above a certain threshold (currently the
	bottom of the stack).  track per-page execute permission with
	the last unused PTE bit.
   = powerpc/ibm4xx: just use the hardware exec bit.
   = powerpc/oea: we already track per-page exec bits, but the hardware only
	implements non-exec mappings at the segment level.  so track the
	number of executable mappings in each segment and turn on the no-exec
	segment bit iff the count is 0.  adjust the trap handler to deal.
   = sparc (sun4m): fix our use of the hardware protection bits.
	fix the trap handler to recognize text faults.
   = sparc64: split the existing unified TSB into data and instruction TSBs,
	and only load TTEs into the appropriate TSB(s) for the permissions.
	fix the trap handler to check for execute permission.
   = not yet implemented: amd64, hppa, sh5

 - changes in all the emulations that put a signal trampoline on the stack.
   instead, we now put the trampoline into a uvm_aobj and map that into
   the process separately.

originally from openbsd, adapted for netbsd by me.
2003-08-24 17:52:28 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
fvdl 1e51cd72a0 Delete pcb_flags. 2002-10-08 20:24:58 +00:00
fvdl 26ab868e68 Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
2002-10-01 12:56:36 +00:00
matt 075e474458 Eliminate commons. 2002-05-12 23:16:52 +00:00
christos c8e246669c save cr2 for the benefit of linux emulation, and normalize use of pcb
in trap(), i.e. always initialize *pcb and use it instead of doing it
sometimes.
2002-02-16 16:22:03 +00:00
thorpej 99a7f640fe Add support for saving/restoring SSE/SSE2 state using FXSAVE/FXRSTOR.
Reviewed by Frank.
2001-08-02 21:04:43 +00:00
sommerfeld 7e7d262c34 Add %fs/%gs to trap frame and save/restore them on
trap/interrupt/syscall entry from userspace.

Remove special-case "by hand" validation of fs/gs register values as
well as special handling of them in various signal handling paths.

Now, like %ds and %es, they are validated by the hardware on return to
userland.

This paves the way for the use of %fs for per-cpu data on
multiprocessor systems, and fixes an otherwise difficult-to-fix
interaction between threads/clone(2) and USER_LDT.

Discussed in advance with Frank van der Linden.
2001-06-17 21:01:32 +00:00
thorpej b0dc085df7 Move the TSS selector out of the PCB and put it into mdproc. We
need to access this when we have the proclist locked for reading,
and thus cannot store it in the PCB (which may be swapped out).

As part of this, call pmap_activate() from cpu_switch() to switch
to the new address space, and refresh the PCB's copy of the LDT
selector from the pmap structure (see above paragraph).  We need
to do this for MP support anyhow.

Fixes a "panic: spinlock_switchcheck: CPU 0 has 1 spin locks" via
gdt_compact() reported by Nathan Williams.
2000-08-16 04:44:35 +00:00
chs f3a668ed84 eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
1999-09-12 01:16:55 +00:00
thorpej 5f3034757f Move the user-set LDT out of the PCB and into the pmap. Applications
which set the LDT and share VM space (e.g. new versions of WINE) expect
the LDT to be logically coupled to the address space.  Use the new pmap_fork()
interface to copy non-shared user-set LDTs when the address space is forked.
1999-05-12 19:28:28 +00:00
mycroft c9a799adf6 Assign my copyrights to TNF. 1998-08-15 04:57:50 +00:00
mrg d90485202c - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
1998-02-10 14:08:44 +00:00
mrg 29e93b8bea add the i386 MD portions for UVM. 1998-02-06 07:21:42 +00:00
mycroft 7149c5ff14 VM86 support, by John Kohl, touched up a bit by me. 1996-01-08 13:51:30 +00:00
mycroft 72805df917 Various changes from John Kohl and me:
Map kernel stacks only at unique addresses.
Use one TSS per process.
Add sysarch calls for modifying IOPL and the I/O permission bitmap.
Add a compacting GDT entry allocator, for TSS and LDT selectors.
Enable modifying %fs and %gs with PT_SETREGS.
Sanitize various bits of code.
1995-10-11 04:19:29 +00:00
mycroft ce7cc0c18a Move the `used fpu' flag into mdproc, so it can be referenced when a process
is swapped out.  Implement process_{read,write}_fpregs.
1995-08-06 05:32:59 +00:00
mycroft 029176e96b Add PCB_USEDFPU. 1995-05-03 00:08:19 +00:00
mycroft ae11bd216c Remove historical garbage. 1995-05-01 08:14:25 +00:00
mycroft b8d3de2758 Add pcb_cr0. 1995-05-01 04:49:28 +00:00
jtc 71ab4ed9dc KERNEL -> _KERNEL 1995-03-28 18:13:48 +00:00
mycroft 1c5ac2e88c pcb.h requires segments.h now. 1994-11-08 23:09:21 +00:00
mycroft 34c4570d61 Only use ssdtosd() when creating, expanding, or copying the LDT. Keep a copy
of the result in the PCB so it can be loaded quickly on context switches.
1994-11-05 03:17:33 +00:00
cgd 022ee8f7fe new RCS ID format. 1994-10-27 04:14:23 +00:00
cgd 9e66548df2 struct md_coredump 1994-05-21 06:48:05 +00:00
mycroft 6c32b87568 Remove two unused fields. 1993-12-21 09:47:45 +00:00
mycroft fccc819b20 Fold in most of the magnum vm changes. 1993-12-14 05:31:17 +00:00
brezak a3e9fd6947 Add per-process LDT slot. 1993-09-19 18:59:17 +00:00
brezak cb098b5eb0 Changes to use a trap frame for syscalls. 1993-09-16 03:24:13 +00:00
andrew a9f16886f9 Re-entrancy protection. 1993-06-27 04:50:12 +00:00
cgd f9518c61da get rid of last bit of signal-trampoline-in-pcb hackery 1993-06-02 04:28:37 +00:00
cgd 6738d12182 set things up so that the signal trampoline code is on the stack,
like it normally is in BSD systems.  still has a bit of hair...
1993-06-02 04:11:48 +00:00
cgd 30177b538f add rcsids to everything and clean up headers 1993-05-22 07:56:12 +00:00
deraadt 9948c39839 npx patches from Bruce Evans. patchkit 10002 1993-05-09 23:02:34 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00