mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
Kernel: Disable x86 RDTSC instruction in userspace
It's still possible to read the TSC via the read_tsc() syscall, but we will now clear some of the bottom bits for unprivileged users.
This commit is contained in:
parent
dfd759f75a
commit
38f93ef13b
6 changed files with 25 additions and 1 deletions
|
@ -266,6 +266,14 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables)
|
|||
kprintf("x86: UMIP support enabled\n");
|
||||
}
|
||||
|
||||
if (g_cpu_supports_tsc) {
|
||||
asm volatile(
|
||||
"mov %cr4, %eax\n"
|
||||
"orl $0x4, %eax\n"
|
||||
"mov %eax, %cr4\n");
|
||||
kprintf("x86: RDTSC support restricted\n");
|
||||
}
|
||||
|
||||
RTC::initialize();
|
||||
PIC::initialize();
|
||||
gdt_init();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue