1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

Kernel: Fix GDT and segment selectors to make userland work on x86_64

Userland faulted on the very first instruction before because the
PML4T/PDPT/etc. weren't marked as user-accessible. For some reason
x86 doesn't care about that.

Also, we need to provide an appropriate userspace stack segment
selector to iretq.
This commit is contained in:
Gunnar Beutner 2021-06-28 17:03:08 +02:00 committed by Andreas Kling
parent 04fc7d708c
commit b5aad1c81d
4 changed files with 16 additions and 9 deletions

View file

@ -28,8 +28,9 @@ static_assert(GDT_SELECTOR_CODE0 + 24 == GDT_SELECTOR_DATA3); // SS3 = CS0 + 32
#else
# define GDT_SELECTOR_CODE0 0x08
# define GDT_SELECTOR_CODE3 0x10
# define GDT_SELECTOR_TSS 0x18
# define GDT_SELECTOR_TSS_PART2 0x20
# define GDT_SELECTOR_DATA3 0x18
# define GDT_SELECTOR_TSS 0x20
# define GDT_SELECTOR_TSS_PART2 0x28
#endif
namespace Kernel {