Home | History | Annotate | Download | only in include
History log of /src/sys/arch/i386/include/pte.h
RevisionDateAuthorComments
 1.36  21-Aug-2022  riastradh x86 Move VA_SIGN_POS/NEG to machine/pte.h.

It's used by pl[1-4]_pi, also defined in machine/pte.h, and used in
libkvm without pmap_private.h.
 1.35  20-Aug-2022  riastradh x86: Forbid using x86/pte.h directly; use machine/pte.h.

machine/pte.h already used outside sys/arch, so let's make it the
primary thing and make sure to use x86/pte.h only as a subroutine.
 1.34  20-Aug-2022  riastradh amd64/pte.h, i386/pte.h: Need sys/stdint.h for uintN_t.
 1.33  25-Apr-2020  bouyer Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor
 1.32  25-Apr-2020  maxv Switch to the new PTE naming. The old naming is now unused, remove it.
 1.31  09-Mar-2019  maxv branches: 1.31.10;
Start replacing the x86 PTE bits.
 1.30  07-Mar-2019  maxv Introduce a new set of PTE bits, with a different naming convention.

PG_V -> PTE_P /* Present */
PG_RW -> PTE_W /* Write */
PG_u -> PTE_U /* User */
PG_WT -> PTE_PWT /* Write-Through */
PG_N -> PTE_PCD /* Cache-Disable */
PG_U -> PTE_A /* Accessed */
PG_M -> PTE_D /* Dirty */
PG_PAT -> PTE_PAT /* PAT on 4KB Pages */
PG_PS -> PTE_PS /* Large Page Size */
PG_G -> PTE_G /* Global Translation */
PG_AVAIL1 -> PTE_AVL1 /* Ignored by Hardware */
PG_AVAIL2 -> PTE_AVL2 /* Ignored by Hardware */
PG_AVAIL3 -> PTE_AVL3 /* Ignored by Hardware */
PG_LGPAT -> PTE_LGPAT /* PAT on Large Pages */
PG_NX -> PTE_NX /* No Execute */

Until now we were using "PG_BIT". The "BIT" part of the naming did not
follow the x86 naming convention in the spec, and was very confusing. We
don't want the "PG_" part of it either, because UVM has similar flags
(ie PG_BUSY).
 1.29  07-Mar-2019  maxv Drop PG_RO, PG_KR and PG_PROT, they are useless and create confusion.
 1.28  07-Mar-2019  maxv Style, and remove useless comments.
 1.27  01-Feb-2011  chuck branches: 1.27.56;
udpate license clauses on my code to match the new-style BSD licenses.
based on diff that rmind@ sent me.

no functional change with this commit.
 1.26  02-Oct-2010  jym branches: 1.26.2; 1.26.4;
Update the comment for PG_PS when used with PAE.
 1.25  14-Sep-2010  jym Add ULL suffix to PG_NX when it is defined.
 1.24  06-Jul-2010  cegger Turn PMAP_NOCACHE into MI flag.
Add MI flags PMAP_WRITE_COMBINE, PMAP_WRITE_BACK, PMAP_NOCACHE_OVR.
Update pmap(9) manpage.

hppa: Remove MD PMAP_NOCACHE flag as it exists as MI flag
mips: Rename MD PMAP_NOCACHE to PGC_NOCACHE.

x86: Implement new MI flags using Page-Attribute Tables.
x86: Implement BUS_SPACE_MAP_PREFETCHABLE.

Patch presented on tech-kern@:
http://mail-index.netbsd.org/tech-kern/2010/06/30/msg008458.html

No comments on this last version.
 1.23  04-May-2010  jym Enable the NX bit feature for Xen i386pae and amd64 kernels.

Tested with Xen 3.1 and Xen 3.3, dom0 and domU, by bouyer@ and jym@.

Ok bouyer@.
 1.22  06-Apr-2010  jld Fix typos in PAE comment.
 1.21  26-Feb-2010  jym branches: 1.21.2;
Fixes regarding paddr_t/pd_entry_t types in MD x86 code, exposed by PAE:

- NBPD_* macros are set to the types that better match their architecture
(UL for i386 and amd64, ULL for i386 PAE) - will revisit when paddr_t is
set to 64 bits for i386 non-PAE.

- type fixes in printf/printk messages (Use PRIxPADDR when printing paddr_t
values, instead of %lx - paddr_t/pd_entry_t being 64 bits with PAE)

- remove casts that are no more needed now that Xen2 support has been dropped

Some fixes are from jmorse@ patches for PAE.

Compile + tested for i386 GENERIC and XEN3 kernels. Only compile tested for
amd64.

Reviewed by bouyer@.

See also http://mail-index.netbsd.org/tech-kern/2010/02/22/msg007373.html
 1.20  17-Nov-2009  dyoung branches: 1.20.2;
Fix spelling in comments, s/extention/extension/.
 1.19  15-Apr-2009  cegger No Execute bit is available in PAE-paging mode.
However to use it, NXE bit in EFER register must be set.
 1.18  21-Dec-2008  ad branches: 1.18.2;
Fix a comment.
 1.17  23-Jan-2008  bouyer branches: 1.17.6; 1.17.10; 1.17.18;
Merge the bouyer-xeni386 branch. This brings in PAE support to NetBSD xeni386
(domU only). PAE support is enabled by 'options PAE', see the new XEN3PAE_DOMU
and INSTALL_XEN3PAE_DOMU kernel config files.

See the comments in arch/i386/include/{pte.h,pmap.h} to see how it works.
In short, we still handle it as a 2-level MMU, with the second level page
directory being 4 pages in size. pmap switching is done by switching the
L2 pages in the L3 entries, instead of loading %cr3. This is almost required
by Xen, which handle the last L2 page (the one mapping 0xc0000000 - 0xffffffff)
in a very special way. But this approach should also work for native PAE
support if ever supported (in fact, the pmap should almost suport native
PAE, what's missing is bootstrap code in locore.S).
 1.16  18-Oct-2007  yamt branches: 1.16.2; 1.16.8;
merge yamt-x86pmap branch.

- reduce differences between amd64 and i386. notably, share pmap.c
between them. it makes several i386 pmap improvements available to
amd64, including tlb shootdown reduction and bug fixes from Stephan Uphoff.
- implement deferred pmap switching for amd64.
- remove LARGEPAGES option. always use large pages if available.
also, make it work on amd64.
 1.15  26-Dec-2005  perry branches: 1.15.30; 1.15.48; 1.15.50; 1.15.52; 1.15.54;
u_intN_t -> uintN_t
 1.14  24-Aug-2003  chs branches: 1.14.16;
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.
 1.13  02-Apr-2003  thorpej branches: 1.13.2;
Use PAGE_SIZE rather than NBPG.
 1.12  05-Sep-2000  thorpej branches: 1.12.2;
Define PG_LGFRAME, which is the page frame mask for large (4MB) pages.
 1.11  06-Feb-1998  thorpej branches: 1.11.14;
Allow userland access to pd_entry_t and pt_entry_t, like the old pte.h
used to do. Also, RCS ID police.
 1.10  06-Feb-1998  mrg add the i386 MD portions for UVM.
 1.9  01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.8  28-Mar-1995  jtc KERNEL -> _KERNEL
 1.7  27-Oct-1994  cgd new RCS ID format.
 1.6  09-Oct-1994  mycroft Nuke dirty().
 1.5  15-Aug-1994  mycroft Eliminate struct pte and struct pde.
 1.4  14-Dec-1993  mycroft branches: 1.4.2; 1.4.4;
Fold in most of the magnum vm changes.
 1.3  27-Jun-1993  andrew branches: 1.3.4;
Re-entrancy protection.
 1.2  22-May-1993  cgd add rcsids to everything and clean up headers
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.3.4.5  13-Dec-1993  mycroft Stylistic changes.
 1.3.4.4  09-Nov-1993  mycroft Rearrange bits to match hardware.
 1.3.4.3  09-Nov-1993  mycroft Change comment on PG_W to reflect that it is in fact used.
 1.3.4.2  08-Nov-1993  mycroft Garbage collect some constants, and the entire 286 nonsense. (Like we even
get to start() on a 286? NOT!)
 1.3.4.1  15-Oct-1993  mycroft Major cleanup of include files and constants.
 1.4.4.2  11-Oct-1994  mycroft Update from trunk.
 1.4.4.1  15-Aug-1994  mycroft update from trunk
 1.4.2.2  14-Dec-1993  mycroft Fold in most of the magnum vm changes.
 1.4.2.1  14-Dec-1993  mycroft file pte.h was added on branch magnum on 1993-12-14 05:31:41 +0000
 1.11.14.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.12.2.2  05-Sep-2000  thorpej Define PG_LGFRAME, which is the page frame mask for large (4MB) pages.
 1.12.2.1  05-Sep-2000  thorpej file pte.h was added on branch sommerfeld_i386mp_1 on 2000-09-05 21:52:17 +0000
 1.13.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.13.2.1  03-Aug-2004  skrll Sync with HEAD
 1.14.16.3  04-Feb-2008  yamt sync with head.
 1.14.16.2  27-Oct-2007  yamt sync with head.
 1.14.16.1  21-Jun-2006  yamt sync with head.
 1.15.54.1  25-Oct-2007  bouyer Sync with HEAD.
 1.15.52.1  23-Sep-2007  yamt - sync with amd64.
- pmap_alloc_level: remove fast call special case.
- tweak some printf to work for both of LP64 and LP32.
- remove machdep.nkpde sysctl.
- remove automatic adjustment of nkpde for now. will revisit later.
 1.15.50.2  23-Mar-2008  matt sync with HEAD
 1.15.50.1  06-Nov-2007  matt sync with HEAD
 1.15.48.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.15.30.1  23-Oct-2007  ad Sync with head.
 1.16.8.3  17-Jan-2008  bouyer - Fix L2_SLOT_APTE value (not sure how I got this value but it was definitively
wrong)
- Use global variable for the PAE L3 page adresses, so that pmap.c can get it
from the bootstrap code
- Extent the size of our virtual PDP from 3 to 4 pages, so that pmap->pm_pdir[]
is contigous for the whole VA range. The last page is a shadow of
the kernel's real PDP (L3[3]).
- make pm_pdirpa an array of 4 paddr_t if using PAE. introduce a
pmap_pdirpa macro to get the physical address of a given PD entry.
- fix pmap_map_pte

The kernel now boots single-user. fsck will cause a kernel fault in
pmap_pdes_invalid() on exit.
 1.16.8.2  13-Jan-2008  bouyer Update system macros for PAE. Because the L3 page directory has only 4 entries,
and because of the way Xen handles it, it's better to have it has static as
possible. So we claim to have only 2 levels, with level 2 being a
"super" PD of 4 pages. pmap switches will be handled by changing the
L3 entries instead of %cr3. Only the first 3 entries will have to be changed,
the last one mapping KVA space only.
 1.16.8.1  13-Jan-2008  bouyer Work in progress on xeni386 PAE support:
Make xeni386 build with a 64bit paddr_t. For this vaddr_t vs paddr_t vs
pointers usages had to be clarified.
If 'options PAE' is present in a Xen3 kernel, switch paddr_t, pd_entry_t
and pt_entry_t to 64bits, and add the PAE entry in the __xen_guest ELF section.
 1.16.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.17.18.2  28-Apr-2009  skrll Sync with HEAD.
 1.17.18.1  19-Jan-2009  skrll Sync with HEAD.
 1.17.10.4  09-Oct-2010  yamt sync with head
 1.17.10.3  11-Aug-2010  yamt sync with head.
 1.17.10.2  11-Mar-2010  yamt sync with head
 1.17.10.1  04-May-2009  yamt sync with head.
 1.17.6.1  17-Jan-2009  mjf Sync with HEAD.
 1.18.2.4  28-Mar-2011  jym Cure sync hiccups. Code with compile errors is not really useful, heh.
 1.18.2.3  28-Mar-2011  jym Sync with HEAD. TODO before merge:
- shortcut for suspend code in sysmon, when powerd(8) is not running.
Borrow ``xs_watch'' thread context?
- bug hunting in xbd + xennet resume. Rings are currently thrashed upon
resume, so current implementation force flush them on suspend. It's not
really needed.
 1.18.2.2  01-Nov-2009  jym Sync with HEAD.
 1.18.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.2.3  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.20.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.20.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.21.2.2  05-Mar-2011  rmind sync with head
 1.21.2.1  30-May-2010  rmind sync with head
 1.26.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.26.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.27.56.1  10-Jun-2019  christos Sync with HEAD
 1.31.10.1  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)

RSS XML Feed