diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-01-10 23:40:15 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-01-10 23:40:15 +0100 |
| commit | 5fedb726774eb46d2aed9378b13bc296baf89333 (patch) | |
| tree | 7d8170999fa3db72fd7794110824b6e6d0299914 /dev/Kernel/HALKit/AMD64/HalCommonAPI.asm | |
| parent | 6b63380f5f45891c5c27715cb290037d072ad212 (diff) | |
ADD: SMP tweaks on AMD64.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/HALKit/AMD64/HalCommonAPI.asm')
| -rw-r--r-- | dev/Kernel/HALKit/AMD64/HalCommonAPI.asm | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/dev/Kernel/HALKit/AMD64/HalCommonAPI.asm b/dev/Kernel/HALKit/AMD64/HalCommonAPI.asm index dd3901e8..4a516d33 100644 --- a/dev/Kernel/HALKit/AMD64/HalCommonAPI.asm +++ b/dev/Kernel/HALKit/AMD64/HalCommonAPI.asm @@ -78,3 +78,64 @@ mp_system_call_handler: pop r8 o64 sysret + +[bits 16] + +section .text +global hal_ap_start + +hal_ap_start: + mov ax, 0x0 + mov ss, ax + mov esp, 0x7000 + + cli + mov eax, cr0 + or eax, 1 + mov cr0, eax + jmp .flush +.flush: + mov ax, 0x10 + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + + mov eax, cr4 + or eax, 1 << 5 + mov cr4, eax + + mov eax, cr3 + mov cr3, eax + + mov ecx, 0xC0000080 + rdmsr + or eax, 1 + wrmsr + + mov eax, cr0 + or eax, (1 << 31) + mov cr0, eax + + jmp 0x08:hal_ap_64bit_entry + +[bits 64] + +; 64-bit entry point +section .text +global hal_ap_64bit_entry +hal_ap_64bit_entry: + mov ax, 0x10 + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + + mov rsp, 0x8001000 ; Stack Address for scheduler AP. + + jmp hal_ap_64bit_entry_loop + +hal_ap_64bit_entry_loop: + jmp $
\ No newline at end of file |
