1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:58:11 +00:00
serenity/Kernel/Arch/i386
Andreas Kling 9eef39d68a Kernel: Start implementing x86 SMAP support
Supervisor Mode Access Prevention (SMAP) is an x86 CPU feature that
prevents the kernel from accessing userspace memory. With SMAP enabled,
trying to read/write a userspace memory address while in the kernel
will now generate a page fault.

Since it's sometimes necessary to read/write userspace memory, there
are two new instructions that quickly switch the protection on/off:
STAC (disables protection) and CLAC (enables protection.)
These are exposed in kernel code via the stac() and clac() helpers.

There's also a SmapDisabler RAII object that can be used to ensure
that you don't forget to re-enable protection before returning to
userspace code.

THis patch also adds copy_to_user(), copy_from_user() and memset_user()
which are the "correct" way of doing things. These functions allow us
to briefly disable protection for a specific purpose, and then turn it
back on immediately after it's done. Going forward all kernel code
should be moved to using these and all uses of SmapDisabler are to be
considered FIXME's.

Note that we're not realizing the full potential of this feature since
I've used SmapDisabler quite liberally in this initial bring-up patch.
2020-01-05 18:14:51 +01:00
..
Boot Kernel: Enable PAE (Physical Address Extension) 2019-12-25 13:35:57 +01:00
APIC.cpp APIC: Enable APIC and start APs 2019-10-16 19:14:02 +02:00
APIC.h APIC: Enable APIC and start APs 2019-10-16 19:14:02 +02:00
CPU.cpp Kernel: Start implementing x86 SMAP support 2020-01-05 18:14:51 +01:00
CPU.h Kernel: Start implementing x86 SMAP support 2020-01-05 18:14:51 +01:00
PIC.cpp Kernel: Disable interrupts while modifying the PIC IMR 2019-12-14 16:16:37 +01:00
PIC.h Kernel: Move PIC.cpp into Arch/i386/ 2019-07-09 15:04:43 +02:00
PIT.cpp Kernel: Make separate kernel entry points for each PIC IRQ 2019-12-15 12:47:53 +01:00
PIT.h Kernel: Move i8253.cpp => Arch/i386/PIT.cpp 2019-07-09 15:04:45 +02:00