diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-04-22 08:48:07 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-04-22 08:48:07 +0200 |
| commit | 42ae768f08f2ec8a41d2ea2183f30a571f0c432f (patch) | |
| tree | 2a35117f79852db506b316e8f0e68a6bb70db9bd /dev/boot/src | |
| parent | 4f8fb9c70f814de796d61d7d85d4bf133afddafa (diff) | |
dev, kernel: VEPM WiP implementation, and syschk fixes in WiP.
- Currently working on VEPM and adapting it to SysChk.
- Refactor DriveMgr for VEPM.
- Fix warnings in HeFS.cc, ALIGN(8) on HeFS.h
- Update PIO modules to use VEPM.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/boot/src')
| -rw-r--r-- | dev/boot/src/BootThread.cc | 22 | ||||
| -rw-r--r-- | dev/boot/src/HEL/AMD64/BootAPI.S | 45 | ||||
| -rw-r--r-- | dev/boot/src/HEL/AMD64/BootEFI.cc | 2 | ||||
| -rw-r--r-- | dev/boot/src/HEL/AMD64/BootPlatform.cc | 56 | ||||
| -rw-r--r-- | dev/boot/src/HEL/ARM64/BootEFI.cc | 2 |
5 files changed, 65 insertions, 62 deletions
diff --git a/dev/boot/src/BootThread.cc b/dev/boot/src/BootThread.cc index 0a1e74c9..cf303bec 100644 --- a/dev/boot/src/BootThread.cc +++ b/dev/boot/src/BootThread.cc @@ -129,16 +129,16 @@ namespace Boot #ifdef __NE_AMD64__ if (handover_struc->HandoverArch != HEL::kArchAMD64) { - fb_render_string("BootZ: Not an handover header, bad CPU...", 40, 10, RGB(0xFF, 0xFF, 0xFF)); + writer.Write("BootZ: Not an handover header, bad CPU...\r"); } #elif defined(__NE_ARM64__) if (handover_struc->HandoverArch != HEL::kArchARM64) { - fb_render_string("BootZ: Not an handover header, bad CPU...", 40, 10, RGB(0xFF, 0xFF, 0xFF)); + writer.Write("BootZ: Not an handover header, bad CPU...\r"); } #endif - fb_render_string("BootZ: Not an handover header...", 40, 10, RGB(0xFF, 0xFF, 0xFF)); + writer.Write("BootZ: Not an handover header...\r"); ::Boot::Stop(); } } @@ -190,10 +190,24 @@ namespace Boot if (own_stack) { - return rt_jump_to_address(fStartAddress, fHandover, &fStack[mib_cast(16) - 1]); + writer.Write("BootZ: Using own stack.\r"); + writer.Write("BootZ: Stack address: ").Write((UIntPtr)&fStack[mib_cast(16) - 1]).Write("\r"); + writer.Write("BootZ: Stack size: ").Write(mib_cast(16)).Write("\r"); + + rt_jump_to_address(fStartAddress, fHandover, &fStack[mib_cast(16) - 1]); + + return kEfiOk; } else { + delete[] fStack; + fStack = nullptr; + // we don't need the stack anymore. + + BootTextWriter writer; + + writer.Write("BootZ: Using EFI stack.\r"); + return reinterpret_cast<HEL::HandoverProc>(fStartAddress)(fHandover); } diff --git a/dev/boot/src/HEL/AMD64/BootAPI.S b/dev/boot/src/HEL/AMD64/BootAPI.S index 963ef46a..9cc15918 100644 --- a/dev/boot/src/HEL/AMD64/BootAPI.S +++ b/dev/boot/src/HEL/AMD64/BootAPI.S @@ -58,3 +58,48 @@ boot_read_cr3: boot_write_cr3: mov cr3, rcx ret + +.section .text + +.extern rt_wait_400ns + +.global rt_out8 +.global rt_out16 +.global rt_out32 + +.global rt_in8 +.global rt_in16 +.global rt_in32 + +rt_out8: + mov al, dl + mov dx, cx + out dx, al + ret + +rt_out16: + mov ax, dx + mov dx, cx + out dx, ax + ret + +rt_out32: + mov eax, edx + mov edx, ecx + out dx, eax + ret + +rt_in8: + mov dx, cx + in al, dx + ret + +rt_in16: + mov edx, ecx + in ax, dx + ret + +rt_in32: + mov rdx, rcx + in eax, dx + ret
\ No newline at end of file diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc index 8a920e1a..85b7f729 100644 --- a/dev/boot/src/HEL/AMD64/BootEFI.cc +++ b/dev/boot/src/HEL/AMD64/BootEFI.cc @@ -229,7 +229,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor); // Assign to global 'kHandoverHeader'. - WideChar kernel_path[256U] = L"vmkrnl.efi"; + WideChar kernel_path[256U] = L"krnl.efi"; UInt32 kernel_path_sz = 256U; if (ST->RuntimeServices->GetVariable(L"/props/boot_path", kEfiGlobalNamespaceVarGUID, nullptr, &kernel_path_sz, kernel_path) != kEfiOk) diff --git a/dev/boot/src/HEL/AMD64/BootPlatform.cc b/dev/boot/src/HEL/AMD64/BootPlatform.cc index a06b8aa0..1a1f9b89 100644 --- a/dev/boot/src/HEL/AMD64/BootPlatform.cc +++ b/dev/boot/src/HEL/AMD64/BootPlatform.cc @@ -38,62 +38,6 @@ EXTERN_C void rt_std() asm volatile("std"); } -EXTERN_C void rt_out8(UInt16 port, UInt8 value) -{ - asm volatile("outb %%al, %1" - : - : "a"(value), "Nd"(port) - : "memory"); -} - -EXTERN_C void rt_out16(UInt16 port, UInt16 value) -{ - asm volatile("outw %%ax, %1" - : - : "a"(value), "Nd"(port) - : "memory"); -} - -EXTERN_C void rt_out32(UInt16 port, UInt32 value) -{ - asm volatile("outl %%eax, %1" - : - : "a"(value), "Nd"(port) - : "memory"); -} - -EXTERN_C UInt8 rt_in8(UInt16 port) -{ - UInt8 value; - asm volatile("inb %1, %%al" - : "=a"(value) - : "Nd"(port) - : "memory"); - - return value; -} - -EXTERN_C UInt16 rt_in16(UInt16 port) -{ - UInt16 value; - asm volatile("inw %%dx, %%ax" - : "=a"(value) - : "d"(port)); - - return value; -} - -EXTERN_C UInt32 rt_in32(UInt16 port) -{ - UInt32 value; - asm volatile("inl %1, %%eax" - : "=a"(value) - : "Nd"(port) - : "memory"); - - return value; -} - #else #include <HALKit/AMD64/Processor.h> diff --git a/dev/boot/src/HEL/ARM64/BootEFI.cc b/dev/boot/src/HEL/ARM64/BootEFI.cc index e071def1..9132cec1 100644 --- a/dev/boot/src/HEL/ARM64/BootEFI.cc +++ b/dev/boot/src/HEL/ARM64/BootEFI.cc @@ -226,7 +226,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor); - Boot::BootFileReader reader_kernel(L"vmkrnl.efi", image_handle); + Boot::BootFileReader reader_kernel(L"krnl.efi", image_handle); reader_kernel.ReadAll(0); |
