History log of /haiku/src/system/kernel/arch/x86/paging/pae/X86PagingMethodPAE.cpp
Revision Date Author Comments
# dde876f9 14-Apr-2018 Jérôme Duval <jerome.duval@gmail.com>

kernel: pae paging: align *TableEntry() with 64bit paging

use SetTableEntry() in PutPageTableInPageDir() and PutPageTableEntryInTable().


# 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


# 819824e0 26-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/{x86, vm}: Add more error checks in VM initialization


# 02749e24 10-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86/paging: Do not use array placement new

Array placement new has implementation defined memory overhead what
makes it pretty useless.


# 5f379892 05-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86/paging: Use ROUNUP() to compute the number of initial slots


# 2e3cbcfa 01-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Allocate as much initial physical page pools as needed


# 6dee6653 17-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

When switching to PAE don't copy not needed PTEs

Now we check whether the virtual address corresponding to the PTE lies
in an allocated virtual address range. This fixes a cause of #8345:
The assertion would trigger when such an entry was encountered. There
might be other causes that trigger the same assertion, though.


# 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.


# d1f280c8 01-Apr-2012 Hamish Morrison <hamishm53@gmail.com>

Add support for pthread_attr_get/setguardsize()

* Added the aforementioned functions.
* create_area_etc() now takes a guard size parameter.
* The thread_info::stack_base/end range now refers to the usable range
only.


# 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.


# 4e8fbfb2 03-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

x86_{read,write}_cr{0,4} can just be implemented as macros, put an x86_ prefix on the other read/write macros for consistency.


# e5fc2bfc 26-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented long mode setup/switch code, the bootloader can now start the 64-bit kernel!

The setup procedure is fairly simple: create a 64-bit GDT and 64-bit page
tables that include all kernel mappings from the 32-bit address space, but at
the correct 64-bit address, then go through kernel_args and changes all virtual
addresses to 64-bit addresses, and finally switch to long mode and jump to the
kernel.


# 403ad054 19-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Fixed warnings that occur with GCC4.4.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37597 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45bd7bb3 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unnecessary inclusions of <boot/kernel_args.h> in private kernel
headers and respectively added includes in source files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37259 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 58bdffb9 23-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Disabled tracing and removed a bit of debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37229 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8ad734f 14-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced structures {virtual,physical}_address_restrictions, which specify
restrictions for virtual/physical addresses.
* vm_page_allocate_page_run():
- Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not
taken into account.
- Takes a physical_address_restrictions instead of base/limit and also
supports alignment and boundary restrictions, now.
* map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/
ReserveAddressRange() take a virtual_address_restrictions parameter, now. They
also support an alignment independent from the range size.
* create_area_etc(), vm_create_anonymous_area(): Take
{virtual,physical}_address_restrictions parameters, now.
* Removed no longer needed B_PHYSICAL_BASE_ADDRESS.
* DMAResources:
- Fixed potential overflows of uint32 when initializing from device node
attributes.
- Fixed bounce buffer creation TODOs: By using create_area_etc() with the
new restrictions parameters we can directly support physical high address,
boundary, and alignment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8d257216 13-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

X86PagingMethodPAE::PutPageTableEntryInTable(): Incorrectly used 32 bit type,
which caused the upper 32 bit of the address to be ignored, thus mapping to
the wrong page.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37130 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4d2b2dc4 11-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Enable PAE on all CPUs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37106 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4bdc89aa 11-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented X86PagingMethodPAE::PhysicalPageSlotPool::AllocatePool().
* Implemented X86PagingMethodPAE::IsKernelPageAccessible().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37104 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d896949 10-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added methods {Allocate,Free}32BitPage(), which allocate+map/unmap+free a
page with a 32 bit physical address (needed for the PDPTs). A small set of
free pages is cached, so the rather expensive vm_page_allocate_page_run() can
be avoided most of the time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37088 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c4c918a 10-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fleshed out most of the unimplemented methods. The kernel boots up to the
creation of the initial shell, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37085 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d6d1935 09-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented X86PagingMethodPAE::Init() and all of its direct dependencies:
* The 32 bit paging structures inherited from the boot loader are translated
to PAE structures and PAE is enabled.
* Implemented the initialization of the initial PhysicalPageSlotPool, so that
the physical page mapper can be initialized.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37076 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5b4d62a2 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Skeleton classes for PAE support.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37066 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 819824e020bf6ab001077b4ae48de9f33d778349 26-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/{x86, vm}: Add more error checks in VM initialization


# 02749e2429d9ccc09f94febaf316da7803ecb922 10-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86/paging: Do not use array placement new

Array placement new has implementation defined memory overhead what
makes it pretty useless.


# 5f3798921f1bde57a28d7a1704dd22314bbf9c24 05-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86/paging: Use ROUNUP() to compute the number of initial slots


# 2e3cbcfa8a455f6d0ac65f51e795e42ccfbf9eb3 01-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Allocate as much initial physical page pools as needed


# 6dee6653c26736f534abdda6886219ab56503533 17-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

When switching to PAE don't copy not needed PTEs

Now we check whether the virtual address corresponding to the PTE lies
in an allocated virtual address range. This fixes a cause of #8345:
The assertion would trigger when such an entry was encountered. There
might be other causes that trigger the same assertion, though.


# 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.


# d1f280c80529d5f0bc55030c2934f9255bc7f6a2 01-Apr-2012 Hamish Morrison <hamishm53@gmail.com>

Add support for pthread_attr_get/setguardsize()

* Added the aforementioned functions.
* create_area_etc() now takes a guard size parameter.
* The thread_info::stack_base/end range now refers to the usable range
only.


# 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.


# 4e8fbfb2d158de7b1cadd1c060acee51a7d67309 03-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

x86_{read,write}_cr{0,4} can just be implemented as macros, put an x86_ prefix on the other read/write macros for consistency.


# e5fc2bfcab8c15a3ff7d33c358f9aa82ed73c823 26-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented long mode setup/switch code, the bootloader can now start the 64-bit kernel!

The setup procedure is fairly simple: create a 64-bit GDT and 64-bit page
tables that include all kernel mappings from the 32-bit address space, but at
the correct 64-bit address, then go through kernel_args and changes all virtual
addresses to 64-bit addresses, and finally switch to long mode and jump to the
kernel.


# 403ad05453e57f7ef338f2caa1d2325a5a5e6245 19-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Fixed warnings that occur with GCC4.4.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37597 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45bd7bb3db9d9e4dcb02b89a3e7c2bf382c0a88c 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unnecessary inclusions of <boot/kernel_args.h> in private kernel
headers and respectively added includes in source files.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37259 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 58bdffb9676382b213c7c600908ed6a780c19e64 23-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Disabled tracing and removed a bit of debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37229 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8ad734f1c698917badb15e1641e0f38b3e9a013 14-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced structures {virtual,physical}_address_restrictions, which specify
restrictions for virtual/physical addresses.
* vm_page_allocate_page_run():
- Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not
taken into account.
- Takes a physical_address_restrictions instead of base/limit and also
supports alignment and boundary restrictions, now.
* map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/
ReserveAddressRange() take a virtual_address_restrictions parameter, now. They
also support an alignment independent from the range size.
* create_area_etc(), vm_create_anonymous_area(): Take
{virtual,physical}_address_restrictions parameters, now.
* Removed no longer needed B_PHYSICAL_BASE_ADDRESS.
* DMAResources:
- Fixed potential overflows of uint32 when initializing from device node
attributes.
- Fixed bounce buffer creation TODOs: By using create_area_etc() with the
new restrictions parameters we can directly support physical high address,
boundary, and alignment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8d2572165b60b1138320effd9c69c0585b954092 13-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

X86PagingMethodPAE::PutPageTableEntryInTable(): Incorrectly used 32 bit type,
which caused the upper 32 bit of the address to be ignored, thus mapping to
the wrong page.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37130 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4d2b2dc4d2b9308d784ce2c1e90e4c0d04cd3d92 11-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Enable PAE on all CPUs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37106 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4bdc89aa14ec9a9ed0e35cfa1413470300c50813 11-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented X86PagingMethodPAE::PhysicalPageSlotPool::AllocatePool().
* Implemented X86PagingMethodPAE::IsKernelPageAccessible().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37104 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d89694992e4c05f2296ad711ebd35905efeb152 10-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Added methods {Allocate,Free}32BitPage(), which allocate+map/unmap+free a
page with a 32 bit physical address (needed for the PDPTs). A small set of
free pages is cached, so the rather expensive vm_page_allocate_page_run() can
be avoided most of the time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37088 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0c4c918a3da495a74d756206a8b7c3dbf1286109 10-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fleshed out most of the unimplemented methods. The kernel boots up to the
creation of the initial shell, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37085 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5d6d1935d6cf1b294dc40f43ba977e82ea38b704 09-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Implemented X86PagingMethodPAE::Init() and all of its direct dependencies:
* The 32 bit paging structures inherited from the boot loader are translated
to PAE structures and PAE is enabled.
* Implemented the initialization of the initial PhysicalPageSlotPool, so that
the physical page mapper can be initialized.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37076 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5b4d62a2618dd2ae37b975e4ca283b410f39f9c7 08-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Skeleton classes for PAE support.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37066 a95241bf-73f2-0310-859d-f6bbb57e9c96