mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +00:00
Kernel: Detect APs and boot them into protected mode
This isn't fully working, the APs pretend like they're fully initialized and are just halted permanently for now.
This commit is contained in:
parent
93b9832fac
commit
0bc92c259d
9 changed files with 463 additions and 108 deletions
|
@ -46,12 +46,6 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
struct [[gnu::packed]] DescriptorTablePointer
|
||||
{
|
||||
u16 limit;
|
||||
void* address;
|
||||
};
|
||||
|
||||
static DescriptorTablePointer s_idtr;
|
||||
static DescriptorTablePointer s_gdtr;
|
||||
static Descriptor s_idt[256];
|
||||
|
@ -391,6 +385,16 @@ void flush_gdt()
|
|||
: "memory");
|
||||
}
|
||||
|
||||
const DescriptorTablePointer& get_gdtr()
|
||||
{
|
||||
return s_gdtr;
|
||||
}
|
||||
|
||||
const DescriptorTablePointer& get_idtr()
|
||||
{
|
||||
return s_idtr;
|
||||
}
|
||||
|
||||
void gdt_init()
|
||||
{
|
||||
s_gdt_length = 5;
|
||||
|
@ -819,6 +823,14 @@ void cpu_setup()
|
|||
}
|
||||
}
|
||||
|
||||
u32 read_cr0()
|
||||
{
|
||||
u32 cr0;
|
||||
asm("movl %%cr0, %%eax"
|
||||
: "=a"(cr0));
|
||||
return cr0;
|
||||
}
|
||||
|
||||
u32 read_cr3()
|
||||
{
|
||||
u32 cr3;
|
||||
|
@ -833,6 +845,14 @@ void write_cr3(u32 cr3)
|
|||
: "memory");
|
||||
}
|
||||
|
||||
u32 read_cr4()
|
||||
{
|
||||
u32 cr4;
|
||||
asm("movl %%cr4, %%eax"
|
||||
: "=a"(cr4));
|
||||
return cr4;
|
||||
}
|
||||
|
||||
u32 read_dr6()
|
||||
{
|
||||
u32 dr6;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue