From a13e1c0911c0627184bc38f18c7fdda64447b3ad Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 23 Mar 2025 19:13:48 +0100 Subject: meta(kernel): Reworked repository's filesystem structure. Removing useless parts of the project too. Signed-off-by: Amlal El Mahrouss --- .../AMD64/HalApplicationProcessorStartup.asm | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 dev/kernel/HALKit/AMD64/HalApplicationProcessorStartup.asm (limited to 'dev/kernel/HALKit/AMD64/HalApplicationProcessorStartup.asm') diff --git a/dev/kernel/HALKit/AMD64/HalApplicationProcessorStartup.asm b/dev/kernel/HALKit/AMD64/HalApplicationProcessorStartup.asm new file mode 100644 index 00000000..c64e0a09 --- /dev/null +++ b/dev/kernel/HALKit/AMD64/HalApplicationProcessorStartup.asm @@ -0,0 +1,77 @@ +;; /* +;; * ======================================================== +;; * +;; * NeKernel +;; * Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. +;; * +;; * ======================================================== +;; */ + +[bits 16] +[org 0x7c000] + +hal_ap_start: + mov ax, 0x0 + mov ss, ax + mov esp, 0x7000 + + cli + mov eax, cr0 + or eax, 1 + mov cr0, eax + jmp .hal_ap_start_flush +.hal_ap_start_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 +hal_ap_end: + +hal_ap_length: + dq hal_ap_end - hal_ap_start + +[bits 64] + +hal_ap_64bit_entry: + mov ax, 0x23 + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + mov rsp, [hal_ap_64bit_entry_stack_end] + + push 0x33 + push qword [hal_ap_64bit_entry_loop] + o64 pushf + push rsp + push 0x33 + + o64 iret + +hal_ap_64bit_entry_loop: + jmp $ + +hal_ap_64bit_entry_stack: + resb 8196*2 +hal_ap_64bit_entry_stack_end: \ No newline at end of file -- cgit v1.2.3