1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:27:34 +00:00

Kernel: Add getter and setter for the X86 CR3 register

This gets rid of a bunch of inline assembly.
This commit is contained in:
Andreas Kling 2020-02-10 20:00:32 +01:00
parent 7323d085dd
commit 27f0102bbe
3 changed files with 25 additions and 31 deletions

View file

@ -278,15 +278,6 @@ void handle_crash(RegisterDump&, const char* description, int signal);
: "memory")
#define memory_barrier() asm volatile("" :: \
: "memory")
inline u32 cpu_cr3()
{
u32 cr3;
asm volatile("movl %%cr3, %%eax"
: "=a"(cr3));
return cr3;
}
inline u32 cpu_flags()
{
u32 flags;
@ -473,6 +464,9 @@ inline uintptr_t offset_in_page(const void* address)
return offset_in_page((uintptr_t)address);
}
u32 read_cr3();
void write_cr3(u32);
class CPUID {
public:
CPUID(u32 function) { asm volatile("cpuid"