History log of /openbsd-current/sys/arch/i386/include/segments.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.28 24-Sep-2020 deraadt

When operating in NX mode, GUCODE_SEL can cover the entire userland
address space permanently, and the line-in-the-sand manipulation
T_PROTFLT|T_USER fixup handling can be skipped. This change was written
to side-step the segment-descriptor mismanagement issues, commited recently
for the "go on i386"
tested by sthen
ok kettenis guenther


# 1.27 24-Sep-2020 kettenis

Make sure we fetch the CS limit of the CPU the trap happened on. It is
possible to switch CPUs when handling a trap since we need to lock the vm_map
of the process. In that case the CS limit would be wrong an we incorrectly
decide that there has been an execute privilige violation.
Also make sure we only modify the variables that keep track of the CS
limit and segment descriptor while holding the kernel lock.

Fixes builds of go ports on i386.

tested by sthen@
ok deraadt@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE
# 1.26 09-Jul-2018 guenther

Delete the VM86 kernel option and i386_vm86(3) API: it's required
a custom kernel for over 20 years.

testing mlarkin@
ok deraadt@ phessler@ jca@ matthieu@


# 1.25 22-Jun-2018 bluhm

Finish the last missing piece for the i386 meltdown fix:
- handle protection fault on iret properly
- handle NMI
- actually enable U-K in pmap_switch()
from hshoexer@; input guenther@; OK mlarkin@ deraadt@


# 1.24 31-Mar-2018 bluhm

Recommit preparation for i386 Meltdown fix after OpenBSD 6.3 release.

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.23 22-Mar-2018 bluhm

iBackout the preparations for fixing Meltdown on i386. The task was
only halfway done and the current state does not help anybody. For
OpenBSD 6.3 release go back to the original code before 2018/03/13.
This gives us a stable release and the changes will come back later.
discussed with guenther@ deraadt@ hshoexer@


# 1.22 13-Mar-2018 bluhm

Preparation for i386 Meltdown fix:

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.21 15-Mar-2016 guenther

Burn more LDT deadwood: stop allocating one for each idle thread,
load the ldt register with the null selector (disabling use of it),
stop reloading it on every context switch, and blow away the table
itself, as well as the pcb and pmap bits that were used to track
it (making sure to keep pcb_savefpu correctly aligned).

testing naddy@
ok kettenis@ mpi@ mlarkin@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.20 23-Mar-2011 pirofti

Normalize sentinel. Use _MACHINE_*_H_ and _<ARCH>_*_H_ properly and consitently.

Discussed and okay drahn@. Okay deraadt@.


# 1.19 12-Mar-2011 guenther

Provide distinct segments for the %fs and %gs selectors to use by
default, with per-rthread base offsets and with sysarch() functions,
I386_{GET,SET}_{FS,GS}BASE, for fetching and setting those base
offsets. This is necessary for both rthread and Linux compat support.

suggestions from kettenis@, prodding from pirofti@ and deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.18 24-Dec-2010 tedu

the bsdi ldt entry is no longer interesting. from valdimir kirillov


Revision tags: OPENBSD_4_8_BASE
# 1.17 01-Jul-2010 tedu

another day, another compat gets removed. today is ibcs2's turn


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.16 14-Nov-2008 weingart

Garbage collect the LDT segments, and simply use the GDT segments.
The beginning of i386 segment review/cleanup.

Tested by various people.


# 1.15 01-Sep-2008 deraadt

Avoid #pragma pack(1) and unify everything towards using __packed.
This requires that structures defined within __packed structures must
independently request that they themselves become __packed, too.
worked on with toby
CVS: ----------------------------------------------------------------------


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.14 12-Jan-2006 weingart

Move to using gdt only (no more ldt in general case) but with a variable
limit selector, so that the w^x line can float much more dynamically.
Much work done by tom. Tested by various people. Addresses concerns of
(Julien Tinnes) <julien ATHOST cr0.org>


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.13 13-Jun-2004 niklas

branches: 1.13.4; 1.13.6;
debranch SMP, have fun


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.12 16-Nov-2003 avsm

convert __attribute__((__packed__)) to __packed so that parsers unaware
of gcc extensions have more of a chance.
ok mcbride@, no objections from millert@, deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.10 31-Jul-2002 mickey

support for changing stack execution protection through mprotect()
by emulating the page execution protection bit and accounting
for pages mapped executable on the stack and swapping the
global user code descriptors for the process accordingly.
this is tested w/ the regress test and art@ looked over it.

there is still a mistery how executable mappings on fault
works on i386 since no prot_exec faults ever happen.


Revision tags: OPENBSD_3_1_BASE
# 1.9 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE UBC_BASE
# 1.8 06-Dec-2000 deraadt

branches: 1.8.6;
use __x__ formats for __attribute__ arguments; guenther@gac.edu


Revision tags: OPENBSD_2_8_BASE
# 1.7 05-Aug-2000 niklas

$OpenBSD$


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE SMP_BASE kame_19991208
# 1.6 09-Dec-1997 deraadt

branches: 1.6.10;
Intel P5 f00f workaround; weingart & who knows who else


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.5 17-Apr-1997 tholo

Do interrupt time accounting by running interrupt handlers with a seperate
code segment selector (otherwise identical to the standard kernel code
selector); idea by Dave Richards <richards@zso.dec.com>


Revision tags: OPENBSD_2_0_BASE
# 1.4 29-Apr-1996 hvozda

Pull in John Kohl's [jtk@netbsd.org] most recent (15Apr96) APM and PCMCIA work
(original PCMCIA framework by Stefan Grefen [grefen@convex.com]).


# 1.3 19-Mar-1996 mickey

Merging w/ NetBSD 021796.
speaker upgraded to the current.
some changes to the VM stuff (ie kern_thread.c added and so).


# 1.2 21-Dec-1995 deraadt

from netbsd; use __attribute__((packed)) if it is available


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.26 09-Jul-2018 guenther

Delete the VM86 kernel option and i386_vm86(3) API: it's required
a custom kernel for over 20 years.

testing mlarkin@
ok deraadt@ phessler@ jca@ matthieu@


# 1.25 22-Jun-2018 bluhm

Finish the last missing piece for the i386 meltdown fix:
- handle protection fault on iret properly
- handle NMI
- actually enable U-K in pmap_switch()
from hshoexer@; input guenther@; OK mlarkin@ deraadt@


# 1.24 31-Mar-2018 bluhm

Recommit preparation for i386 Meltdown fix after OpenBSD 6.3 release.

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.23 22-Mar-2018 bluhm

iBackout the preparations for fixing Meltdown on i386. The task was
only halfway done and the current state does not help anybody. For
OpenBSD 6.3 release go back to the original code before 2018/03/13.
This gives us a stable release and the changes will come back later.
discussed with guenther@ deraadt@ hshoexer@


# 1.22 13-Mar-2018 bluhm

Preparation for i386 Meltdown fix:

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.21 15-Mar-2016 guenther

Burn more LDT deadwood: stop allocating one for each idle thread,
load the ldt register with the null selector (disabling use of it),
stop reloading it on every context switch, and blow away the table
itself, as well as the pcb and pmap bits that were used to track
it (making sure to keep pcb_savefpu correctly aligned).

testing naddy@
ok kettenis@ mpi@ mlarkin@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.20 23-Mar-2011 pirofti

Normalize sentinel. Use _MACHINE_*_H_ and _<ARCH>_*_H_ properly and consitently.

Discussed and okay drahn@. Okay deraadt@.


# 1.19 12-Mar-2011 guenther

Provide distinct segments for the %fs and %gs selectors to use by
default, with per-rthread base offsets and with sysarch() functions,
I386_{GET,SET}_{FS,GS}BASE, for fetching and setting those base
offsets. This is necessary for both rthread and Linux compat support.

suggestions from kettenis@, prodding from pirofti@ and deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.18 24-Dec-2010 tedu

the bsdi ldt entry is no longer interesting. from valdimir kirillov


Revision tags: OPENBSD_4_8_BASE
# 1.17 01-Jul-2010 tedu

another day, another compat gets removed. today is ibcs2's turn


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.16 14-Nov-2008 weingart

Garbage collect the LDT segments, and simply use the GDT segments.
The beginning of i386 segment review/cleanup.

Tested by various people.


# 1.15 01-Sep-2008 deraadt

Avoid #pragma pack(1) and unify everything towards using __packed.
This requires that structures defined within __packed structures must
independently request that they themselves become __packed, too.
worked on with toby
CVS: ----------------------------------------------------------------------


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.14 12-Jan-2006 weingart

Move to using gdt only (no more ldt in general case) but with a variable
limit selector, so that the w^x line can float much more dynamically.
Much work done by tom. Tested by various people. Addresses concerns of
(Julien Tinnes) <julien ATHOST cr0.org>


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.13 13-Jun-2004 niklas

branches: 1.13.4; 1.13.6;
debranch SMP, have fun


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.12 16-Nov-2003 avsm

convert __attribute__((__packed__)) to __packed so that parsers unaware
of gcc extensions have more of a chance.
ok mcbride@, no objections from millert@, deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.10 31-Jul-2002 mickey

support for changing stack execution protection through mprotect()
by emulating the page execution protection bit and accounting
for pages mapped executable on the stack and swapping the
global user code descriptors for the process accordingly.
this is tested w/ the regress test and art@ looked over it.

there is still a mistery how executable mappings on fault
works on i386 since no prot_exec faults ever happen.


Revision tags: OPENBSD_3_1_BASE
# 1.9 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE UBC_BASE
# 1.8 06-Dec-2000 deraadt

branches: 1.8.6;
use __x__ formats for __attribute__ arguments; guenther@gac.edu


Revision tags: OPENBSD_2_8_BASE
# 1.7 05-Aug-2000 niklas

$OpenBSD$


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE SMP_BASE kame_19991208
# 1.6 09-Dec-1997 deraadt

branches: 1.6.10;
Intel P5 f00f workaround; weingart & who knows who else


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.5 17-Apr-1997 tholo

Do interrupt time accounting by running interrupt handlers with a seperate
code segment selector (otherwise identical to the standard kernel code
selector); idea by Dave Richards <richards@zso.dec.com>


Revision tags: OPENBSD_2_0_BASE
# 1.4 29-Apr-1996 hvozda

Pull in John Kohl's [jtk@netbsd.org] most recent (15Apr96) APM and PCMCIA work
(original PCMCIA framework by Stefan Grefen [grefen@convex.com]).


# 1.3 19-Mar-1996 mickey

Merging w/ NetBSD 021796.
speaker upgraded to the current.
some changes to the VM stuff (ie kern_thread.c added and so).


# 1.2 21-Dec-1995 deraadt

from netbsd; use __attribute__((packed)) if it is available


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.25 22-Jun-2018 bluhm

Finish the last missing piece for the i386 meltdown fix:
- handle protection fault on iret properly
- handle NMI
- actually enable U-K in pmap_switch()
from hshoexer@; input guenther@; OK mlarkin@ deraadt@


# 1.24 31-Mar-2018 bluhm

Recommit preparation for i386 Meltdown fix after OpenBSD 6.3 release.

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.23 22-Mar-2018 bluhm

iBackout the preparations for fixing Meltdown on i386. The task was
only halfway done and the current state does not help anybody. For
OpenBSD 6.3 release go back to the original code before 2018/03/13.
This gives us a stable release and the changes will come back later.
discussed with guenther@ deraadt@ hshoexer@


# 1.22 13-Mar-2018 bluhm

Preparation for i386 Meltdown fix:

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.21 15-Mar-2016 guenther

Burn more LDT deadwood: stop allocating one for each idle thread,
load the ldt register with the null selector (disabling use of it),
stop reloading it on every context switch, and blow away the table
itself, as well as the pcb and pmap bits that were used to track
it (making sure to keep pcb_savefpu correctly aligned).

testing naddy@
ok kettenis@ mpi@ mlarkin@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.20 23-Mar-2011 pirofti

Normalize sentinel. Use _MACHINE_*_H_ and _<ARCH>_*_H_ properly and consitently.

Discussed and okay drahn@. Okay deraadt@.


# 1.19 12-Mar-2011 guenther

Provide distinct segments for the %fs and %gs selectors to use by
default, with per-rthread base offsets and with sysarch() functions,
I386_{GET,SET}_{FS,GS}BASE, for fetching and setting those base
offsets. This is necessary for both rthread and Linux compat support.

suggestions from kettenis@, prodding from pirofti@ and deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.18 24-Dec-2010 tedu

the bsdi ldt entry is no longer interesting. from valdimir kirillov


Revision tags: OPENBSD_4_8_BASE
# 1.17 01-Jul-2010 tedu

another day, another compat gets removed. today is ibcs2's turn


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.16 14-Nov-2008 weingart

Garbage collect the LDT segments, and simply use the GDT segments.
The beginning of i386 segment review/cleanup.

Tested by various people.


# 1.15 01-Sep-2008 deraadt

Avoid #pragma pack(1) and unify everything towards using __packed.
This requires that structures defined within __packed structures must
independently request that they themselves become __packed, too.
worked on with toby
CVS: ----------------------------------------------------------------------


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.14 12-Jan-2006 weingart

Move to using gdt only (no more ldt in general case) but with a variable
limit selector, so that the w^x line can float much more dynamically.
Much work done by tom. Tested by various people. Addresses concerns of
(Julien Tinnes) <julien ATHOST cr0.org>


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.13 13-Jun-2004 niklas

branches: 1.13.4; 1.13.6;
debranch SMP, have fun


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.12 16-Nov-2003 avsm

convert __attribute__((__packed__)) to __packed so that parsers unaware
of gcc extensions have more of a chance.
ok mcbride@, no objections from millert@, deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.10 31-Jul-2002 mickey

support for changing stack execution protection through mprotect()
by emulating the page execution protection bit and accounting
for pages mapped executable on the stack and swapping the
global user code descriptors for the process accordingly.
this is tested w/ the regress test and art@ looked over it.

there is still a mistery how executable mappings on fault
works on i386 since no prot_exec faults ever happen.


Revision tags: OPENBSD_3_1_BASE
# 1.9 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE UBC_BASE
# 1.8 06-Dec-2000 deraadt

branches: 1.8.6;
use __x__ formats for __attribute__ arguments; guenther@gac.edu


Revision tags: OPENBSD_2_8_BASE
# 1.7 05-Aug-2000 niklas

$OpenBSD$


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE SMP_BASE kame_19991208
# 1.6 09-Dec-1997 deraadt

branches: 1.6.10;
Intel P5 f00f workaround; weingart & who knows who else


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.5 17-Apr-1997 tholo

Do interrupt time accounting by running interrupt handlers with a seperate
code segment selector (otherwise identical to the standard kernel code
selector); idea by Dave Richards <richards@zso.dec.com>


Revision tags: OPENBSD_2_0_BASE
# 1.4 29-Apr-1996 hvozda

Pull in John Kohl's [jtk@netbsd.org] most recent (15Apr96) APM and PCMCIA work
(original PCMCIA framework by Stefan Grefen [grefen@convex.com]).


# 1.3 19-Mar-1996 mickey

Merging w/ NetBSD 021796.
speaker upgraded to the current.
some changes to the VM stuff (ie kern_thread.c added and so).


# 1.2 21-Dec-1995 deraadt

from netbsd; use __attribute__((packed)) if it is available


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.24 31-Mar-2018 bluhm

Recommit preparation for i386 Meltdown fix after OpenBSD 6.3 release.

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_3_BASE
# 1.23 22-Mar-2018 bluhm

iBackout the preparations for fixing Meltdown on i386. The task was
only halfway done and the current state does not help anybody. For
OpenBSD 6.3 release go back to the original code before 2018/03/13.
This gives us a stable release and the changes will come back later.
discussed with guenther@ deraadt@ hshoexer@


# 1.22 13-Mar-2018 bluhm

Preparation for i386 Meltdown fix:

- provide a cpu_softc for cpu_attach() etc.
- replace per PCB TSS with per CPU TSS

The first change prepares for cpu_info being embedded in a
cpu_full_info. Therefore during autoconf/cpu_attach we hand down
a softc.

The second change removes the per PCB TSS. We now have one TSS per
CPU, thus in cpu_switchto() we only have to patch the ring 0 stack
pointer instead of loading a new TSS. This also allows for cleaning
up the GDT, so we only have a single slot for the TSS.

from hshoexer@; OK deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.21 15-Mar-2016 guenther

Burn more LDT deadwood: stop allocating one for each idle thread,
load the ldt register with the null selector (disabling use of it),
stop reloading it on every context switch, and blow away the table
itself, as well as the pcb and pmap bits that were used to track
it (making sure to keep pcb_savefpu correctly aligned).

testing naddy@
ok kettenis@ mpi@ mlarkin@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.20 23-Mar-2011 pirofti

Normalize sentinel. Use _MACHINE_*_H_ and _<ARCH>_*_H_ properly and consitently.

Discussed and okay drahn@. Okay deraadt@.


# 1.19 12-Mar-2011 guenther

Provide distinct segments for the %fs and %gs selectors to use by
default, with per-rthread base offsets and with sysarch() functions,
I386_{GET,SET}_{FS,GS}BASE, for fetching and setting those base
offsets. This is necessary for both rthread and Linux compat support.

suggestions from kettenis@, prodding from pirofti@ and deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.18 24-Dec-2010 tedu

the bsdi ldt entry is no longer interesting. from valdimir kirillov


Revision tags: OPENBSD_4_8_BASE
# 1.17 01-Jul-2010 tedu

another day, another compat gets removed. today is ibcs2's turn


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.16 14-Nov-2008 weingart

Garbage collect the LDT segments, and simply use the GDT segments.
The beginning of i386 segment review/cleanup.

Tested by various people.


# 1.15 01-Sep-2008 deraadt

Avoid #pragma pack(1) and unify everything towards using __packed.
This requires that structures defined within __packed structures must
independently request that they themselves become __packed, too.
worked on with toby
CVS: ----------------------------------------------------------------------


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.14 12-Jan-2006 weingart

Move to using gdt only (no more ldt in general case) but with a variable
limit selector, so that the w^x line can float much more dynamically.
Much work done by tom. Tested by various people. Addresses concerns of
(Julien Tinnes) <julien ATHOST cr0.org>


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.13 13-Jun-2004 niklas

branches: 1.13.4; 1.13.6;
debranch SMP, have fun


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.12 16-Nov-2003 avsm

convert __attribute__((__packed__)) to __packed so that parsers unaware
of gcc extensions have more of a chance.
ok mcbride@, no objections from millert@, deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.10 31-Jul-2002 mickey

support for changing stack execution protection through mprotect()
by emulating the page execution protection bit and accounting
for pages mapped executable on the stack and swapping the
global user code descriptors for the process accordingly.
this is tested w/ the regress test and art@ looked over it.

there is still a mistery how executable mappings on fault
works on i386 since no prot_exec faults ever happen.


Revision tags: OPENBSD_3_1_BASE
# 1.9 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE UBC_BASE
# 1.8 06-Dec-2000 deraadt

branches: 1.8.6;
use __x__ formats for __attribute__ arguments; guenther@gac.edu


Revision tags: OPENBSD_2_8_BASE
# 1.7 05-Aug-2000 niklas

$OpenBSD$


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE SMP_BASE kame_19991208
# 1.6 09-Dec-1997 deraadt

branches: 1.6.10;
Intel P5 f00f workaround; weingart & who knows who else


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.5 17-Apr-1997 tholo

Do interrupt time accounting by running interrupt handlers with a seperate
code segment selector (otherwise identical to the standard kernel code
selector); idea by Dave Richards <richards@zso.dec.com>


Revision tags: OPENBSD_2_0_BASE
# 1.4 29-Apr-1996 hvozda

Pull in John Kohl's [jtk@netbsd.org] most recent (15Apr96) APM and PCMCIA work
(original PCMCIA framework by Stefan Grefen [grefen@convex.com]).


# 1.3 19-Mar-1996 mickey

Merging w/ NetBSD 021796.
speaker upgraded to the current.
some changes to the VM stuff (ie kern_thread.c added and so).


# 1.2 21-Dec-1995 deraadt

from netbsd; use __attribute__((packed)) if it is available


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.21 15-Mar-2016 guenther

Burn more LDT deadwood: stop allocating one for each idle thread,
load the ldt register with the null selector (disabling use of it),
stop reloading it on every context switch, and blow away the table
itself, as well as the pcb and pmap bits that were used to track
it (making sure to keep pcb_savefpu correctly aligned).

testing naddy@
ok kettenis@ mpi@ mlarkin@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.20 23-Mar-2011 pirofti

Normalize sentinel. Use _MACHINE_*_H_ and _<ARCH>_*_H_ properly and consitently.

Discussed and okay drahn@. Okay deraadt@.


# 1.19 12-Mar-2011 guenther

Provide distinct segments for the %fs and %gs selectors to use by
default, with per-rthread base offsets and with sysarch() functions,
I386_{GET,SET}_{FS,GS}BASE, for fetching and setting those base
offsets. This is necessary for both rthread and Linux compat support.

suggestions from kettenis@, prodding from pirofti@ and deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.18 24-Dec-2010 tedu

the bsdi ldt entry is no longer interesting. from valdimir kirillov


Revision tags: OPENBSD_4_8_BASE
# 1.17 01-Jul-2010 tedu

another day, another compat gets removed. today is ibcs2's turn


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.16 14-Nov-2008 weingart

Garbage collect the LDT segments, and simply use the GDT segments.
The beginning of i386 segment review/cleanup.

Tested by various people.


# 1.15 01-Sep-2008 deraadt

Avoid #pragma pack(1) and unify everything towards using __packed.
This requires that structures defined within __packed structures must
independently request that they themselves become __packed, too.
worked on with toby
CVS: ----------------------------------------------------------------------


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.14 12-Jan-2006 weingart

Move to using gdt only (no more ldt in general case) but with a variable
limit selector, so that the w^x line can float much more dynamically.
Much work done by tom. Tested by various people. Addresses concerns of
(Julien Tinnes) <julien ATHOST cr0.org>


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.13 13-Jun-2004 niklas

branches: 1.13.4; 1.13.6;
debranch SMP, have fun


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.12 16-Nov-2003 avsm

convert __attribute__((__packed__)) to __packed so that parsers unaware
of gcc extensions have more of a chance.
ok mcbride@, no objections from millert@, deraadt@


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.10 31-Jul-2002 mickey

support for changing stack execution protection through mprotect()
by emulating the page execution protection bit and accounting
for pages mapped executable on the stack and swapping the
global user code descriptors for the process accordingly.
this is tested w/ the regress test and art@ looked over it.

there is still a mistery how executable mappings on fault
works on i386 since no prot_exec faults ever happen.


Revision tags: OPENBSD_3_1_BASE
# 1.9 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE UBC_BASE
# 1.8 06-Dec-2000 deraadt

branches: 1.8.6;
use __x__ formats for __attribute__ arguments; guenther@gac.edu


Revision tags: OPENBSD_2_8_BASE
# 1.7 05-Aug-2000 niklas

$OpenBSD$


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE SMP_BASE kame_19991208
# 1.6 09-Dec-1997 deraadt

branches: 1.6.10;
Intel P5 f00f workaround; weingart & who knows who else


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.5 17-Apr-1997 tholo

Do interrupt time accounting by running interrupt handlers with a seperate
code segment selector (otherwise identical to the standard kernel code
selector); idea by Dave Richards <richards@zso.dec.com>


Revision tags: OPENBSD_2_0_BASE
# 1.4 29-Apr-1996 hvozda

Pull in John Kohl's [jtk@netbsd.org] most recent (15Apr96) APM and PCMCIA work
(original PCMCIA framework by Stefan Grefen [grefen@convex.com]).


# 1.3 19-Mar-1996 mickey

Merging w/ NetBSD 021796.
speaker upgraded to the current.
some changes to the VM stuff (ie kern_thread.c added and so).


# 1.2 21-Dec-1995 deraadt

from netbsd; use __attribute__((packed)) if it is available


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision