History log of /haiku/src/system/kernel/arch/x86/paging/64bit/X86PagingMethod64Bit.cpp
Revision Date Author Comments
# 58353b38 02-Oct-2020 Jérôme Duval <jerome.duval@gmail.com>

kernel/x86_64: LA57 aka 5-level paging

this enables the kernel to correctly take over when the bootloader prepares
the paging in 4-level or 5-level.

Change-Id: I0444486d8e17aade574e2afe255a3c2cfc49f21f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3551
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# 9dd4d2dd 03-Jan-2018 Jérôme Duval <jerome.duval@gmail.com>

kernel: support for Intel SMAP and SMEP on x86_64.

SMAP will generated page faults when the kernel tries to access user pages unless overriden.
If SMAP is enabled, the override instructions are written where needed in memory with
binary "altcodepatches".
Support is enabled by default, might be disabled per safemode setting.

Change-Id: Ife26cd765056aeaf65b2ffa3cadd0dcf4e273a96


# 278f66b6 13-Sep-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86[_64]: Enable NX on non-boot CPUs as soon as possible


# b8dc812f 13-Sep-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86[_64]: Enable NX on non-boot CPUs as soon as possible


# be573dcd 22-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

arch: make sure not to set NX-bit when it is reserved


# 103977d0 17-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

arch: NX is initialized too early on non-boot CPUs


# 966f2076 06-Mar-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: enable data execution prevention

Set execute disable bit for any page that belongs to area with neither
B_EXECUTE_AREA nor B_KERNEL_EXECUTE_AREA set.

In order to take advanage of NX bit in 32 bit protected mode PAE must be
enabled. Thus, from now on it is also enabled when the CPU supports NX bit.

vm_page_fault() takes additional argument which indicates whether page fault
was caused by an illegal instruction fetch.


# 5e0c3db2 22-Mar-2013 Alex Smith <alex@alex-smith.me.uk>

Account for the physical map area in the kernel VM space. Fixes #9547.

The physical memory map area was not included in the kernel virtual
address space range (it was below KERNEL_BASE). This caused problems
if an I/O operation took place on physical memory mapped there (the
bad address error seen in #9547 was occurring in lock_memory_etc()).
Changed KERNEL_BASE and KERNEL_SIZE to cover the area and add a null
area that covers all of it. Also changed X86VMTranslationMap64Bit to
handle large pages in Query(), as the physical map area uses large
pages.


# 59ae45c1 21-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed commpage for x86_64.

Since the commpage is at a kernel address, changed 64-bit paging code
to match x86's behaviour of allowing user-accessible mappings to be
created in the kernel portion of the address space. This is also
required by some drivers.


# 93cba1da 08-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed a bug resulting from a mistake in the boot 64-bit paging setup.

This was an interesting bug to find. Was getting spurious triple faults
in the slab allocator. The problem was that the boot paging setup code
was mapping all page tables it created into the virtual address space,
but in the kernel no areas were being created to cover them, so during
arch_vm_init_end() the pages for them ended up being freed and then
overwritten later on. Fixed by unmapping page tables after populating
them in long_mmu_init().


# e276cc04 05-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Finished implementation of x86_64 paging.

* vm_init now runs up until create_preloaded_image_areas(), which needs
fixing to handle ELF64.
* Not completely tested. I know Map(), Unmap() and Query() work fine, the
other methods have not been tested as the kernel doesn't boot far enough
for any of them to be called yet. As far as I know they're correct, though.
* Not yet implemented the destructor for X86VMTranslationMap64Bit or Init()
for a user address space.


# 950b24e3 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Begun work on VMTranslationMap implementation for x86_64.

* Added empty source files for all the 64-bit paging method code, and a
stub implementation of X86PagingMethod64Bit.
* arch_vm_translation_map.cpp has been modified to use X86PagingMethod64Bit
on x86_64.


# 278f66b6b1dd47b3834c768308fa3d21a5eadb88 13-Sep-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86[_64]: Enable NX on non-boot CPUs as soon as possible


# b8dc812f3e99db27af1d4e6495a305bfb830a507 13-Sep-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86[_64]: Enable NX on non-boot CPUs as soon as possible


# be573dcd88b099c4ba98dcf3c63300231f207a37 22-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

arch: make sure not to set NX-bit when it is reserved


# 103977d0a94f8218b2df110ee2f8a8157edf692f 17-Apr-2013 Pawel Dziepak <pdziepak@quarnos.org>

arch: NX is initialized too early on non-boot CPUs


# 966f207668d19610dae34d5331150e3742815bcf 06-Mar-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: enable data execution prevention

Set execute disable bit for any page that belongs to area with neither
B_EXECUTE_AREA nor B_KERNEL_EXECUTE_AREA set.

In order to take advanage of NX bit in 32 bit protected mode PAE must be
enabled. Thus, from now on it is also enabled when the CPU supports NX bit.

vm_page_fault() takes additional argument which indicates whether page fault
was caused by an illegal instruction fetch.


# 5e0c3db2867defa76df0e83fd74a9a39e0dd622b 22-Mar-2013 Alex Smith <alex@alex-smith.me.uk>

Account for the physical map area in the kernel VM space. Fixes #9547.

The physical memory map area was not included in the kernel virtual
address space range (it was below KERNEL_BASE). This caused problems
if an I/O operation took place on physical memory mapped there (the
bad address error seen in #9547 was occurring in lock_memory_etc()).
Changed KERNEL_BASE and KERNEL_SIZE to cover the area and add a null
area that covers all of it. Also changed X86VMTranslationMap64Bit to
handle large pages in Query(), as the physical map area uses large
pages.


# 59ae45c1ab32476f1fa428dae22989f8387a1f9e 21-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed commpage for x86_64.

Since the commpage is at a kernel address, changed 64-bit paging code
to match x86's behaviour of allowing user-accessible mappings to be
created in the kernel portion of the address space. This is also
required by some drivers.


# 93cba1da96275eb617fcdc581ec4522e0b107adf 08-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed a bug resulting from a mistake in the boot 64-bit paging setup.

This was an interesting bug to find. Was getting spurious triple faults
in the slab allocator. The problem was that the boot paging setup code
was mapping all page tables it created into the virtual address space,
but in the kernel no areas were being created to cover them, so during
arch_vm_init_end() the pages for them ended up being freed and then
overwritten later on. Fixed by unmapping page tables after populating
them in long_mmu_init().


# e276cc0457a4ddb3f137504e220ee5e839f132d4 05-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Finished implementation of x86_64 paging.

* vm_init now runs up until create_preloaded_image_areas(), which needs
fixing to handle ELF64.
* Not completely tested. I know Map(), Unmap() and Query() work fine, the
other methods have not been tested as the kernel doesn't boot far enough
for any of them to be called yet. As far as I know they're correct, though.
* Not yet implemented the destructor for X86VMTranslationMap64Bit or Init()
for a user address space.


# 950b24e32d8ddbc0d2a4e46de77c0fb4cc18b128 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Begun work on VMTranslationMap implementation for x86_64.

* Added empty source files for all the 64-bit paging method code, and a
stub implementation of X86PagingMethod64Bit.
* arch_vm_translation_map.cpp has been modified to use X86PagingMethod64Bit
on x86_64.