diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-31 09:42:54 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-31 09:42:54 +0100 |
| commit | fc55f0d69d24fb4908cbd811681f2c3fac53614d (patch) | |
| tree | ba09a2cdbb225df7ba1a9ec5a12bcbb90b673ead /Private/HALKit | |
| parent | 7bed9287589293bd9d712d152539591dee0b28c0 (diff) | |
kernel: add GKit, improve AMD64 HAL.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/HALKit')
| -rw-r--r-- | Private/HALKit/AMD64/HalHardwareAPIC.cpp (renamed from Private/HALKit/AMD64/HardwareAPIC.cpp) | 0 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalHardwareInit.cpp (renamed from Private/HALKit/AMD64/HardwareInit.cpp) | 0 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalPlatformAMD64.cpp (renamed from Private/HALKit/AMD64/PlatformAMD64.cpp) | 4 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalProcessPrimitives.cxx (renamed from Private/HALKit/AMD64/ProcessPrimitives.cxx) | 0 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalProcessor.cpp (renamed from Private/HALKit/AMD64/Processor.cpp) | 0 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalRoutines.s | 8 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/Processor.hpp | 24 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/HalHardware.cpp (renamed from Private/HALKit/PowerPC/Processor.cpp) | 0 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/StartSequence.s | 6 |
9 files changed, 26 insertions, 16 deletions
diff --git a/Private/HALKit/AMD64/HardwareAPIC.cpp b/Private/HALKit/AMD64/HalHardwareAPIC.cpp index 6d77a8b5..6d77a8b5 100644 --- a/Private/HALKit/AMD64/HardwareAPIC.cpp +++ b/Private/HALKit/AMD64/HalHardwareAPIC.cpp diff --git a/Private/HALKit/AMD64/HardwareInit.cpp b/Private/HALKit/AMD64/HalHardwareInit.cpp index 1856cc2d..1856cc2d 100644 --- a/Private/HALKit/AMD64/HardwareInit.cpp +++ b/Private/HALKit/AMD64/HalHardwareInit.cpp diff --git a/Private/HALKit/AMD64/PlatformAMD64.cpp b/Private/HALKit/AMD64/HalPlatformAMD64.cpp index 1c0d560d..f72be01f 100644 --- a/Private/HALKit/AMD64/PlatformAMD64.cpp +++ b/Private/HALKit/AMD64/HalPlatformAMD64.cpp @@ -25,7 +25,7 @@ void GDTLoader::Load(Register64 &gdt) { reg->limit = gdt.Limit; rt_cli(); - load_gdt(reg); + rt_load_gdt(reg); rt_sti(); } @@ -37,7 +37,7 @@ void IDTLoader::Load(Register64 &idt) { reg->limit = idt.Limit; rt_cli(); - load_idt(reg); + rt_load_idt(reg); rt_sti(); } diff --git a/Private/HALKit/AMD64/ProcessPrimitives.cxx b/Private/HALKit/AMD64/HalProcessPrimitives.cxx index 8d0554f3..8d0554f3 100644 --- a/Private/HALKit/AMD64/ProcessPrimitives.cxx +++ b/Private/HALKit/AMD64/HalProcessPrimitives.cxx diff --git a/Private/HALKit/AMD64/Processor.cpp b/Private/HALKit/AMD64/HalProcessor.cpp index 3d509f79..3d509f79 100644 --- a/Private/HALKit/AMD64/Processor.cpp +++ b/Private/HALKit/AMD64/HalProcessor.cpp diff --git a/Private/HALKit/AMD64/HalRoutines.s b/Private/HALKit/AMD64/HalRoutines.s index 78b9e503..7965c8a8 100644 --- a/Private/HALKit/AMD64/HalRoutines.s +++ b/Private/HALKit/AMD64/HalRoutines.s @@ -1,14 +1,14 @@ -.globl load_idt -.globl load_gdt +.globl rt_load_idt +.globl rt_load_gdt .globl rt_wait_for_io .globl rt_get_current_context .section .text -load_gdt: +rt_load_gdt: lgdt (%rdi) ret -load_idt: +rt_load_idt: lidt (%rdi) sti ret diff --git a/Private/HALKit/AMD64/Processor.hpp b/Private/HALKit/AMD64/Processor.hpp index dc258bcc..bab1d518 100644 --- a/Private/HALKit/AMD64/Processor.hpp +++ b/Private/HALKit/AMD64/Processor.hpp @@ -86,15 +86,24 @@ using InterruptDescriptorArray = Array<InterruptDescriptor, 256>; class SegmentDescriptor final { public: - UIntPtr Base; - UIntPtr BaseMiddle; - UIntPtr BaseHigh; + UInt16 Base; + UInt8 BaseMiddle; + UInt8 BaseHigh; UShort Limit; UChar Gran; - UChar AB; + UChar AccessByte; +}; - operator bool() { return Base > Limit; } +/*** + * @brief Segment Boolean operations + */ +class SegmentDescriptorComparator final { + public: + bool IsValid(SegmentDescriptor &seg) { return seg.Base > seg.Limit; } + bool Equals(SegmentDescriptor &seg, SegmentDescriptor &segRight) { + return seg.Base == segRight.Base && seg.Limit == segRight.Limit; + } }; using SegmentArray = Array<SegmentDescriptor, 6>; @@ -116,8 +125,9 @@ void system_get_cores(voidPtr rsdPtr); extern "C" void idt_handle_system_call(HCore::UIntPtr rsp); extern "C" void idt_handle_generic(HCore::UIntPtr rsp); -extern "C" void load_idt(HCore::voidPtr ptr); -extern "C" void load_gdt(HCore::voidPtr ptr); extern "C" void idt_handle_gpf(HCore::UIntPtr rsp); extern "C" void idt_handle_math(HCore::UIntPtr rsp); extern "C" void idt_handle_pf(HCore::UIntPtr rsp); + +extern "C" void rt_load_idt(HCore::voidPtr ptr); +extern "C" void rt_load_gdt(HCore::voidPtr ptr); diff --git a/Private/HALKit/PowerPC/Processor.cpp b/Private/HALKit/PowerPC/HalHardware.cpp index 04676eff..04676eff 100644 --- a/Private/HALKit/PowerPC/Processor.cpp +++ b/Private/HALKit/PowerPC/HalHardware.cpp diff --git a/Private/HALKit/PowerPC/StartSequence.s b/Private/HALKit/PowerPC/StartSequence.s index 0b9807d0..112ac73f 100644 --- a/Private/HALKit/PowerPC/StartSequence.s +++ b/Private/HALKit/PowerPC/StartSequence.s @@ -1,6 +1,6 @@ -.globl __AssemblerStart +.globl Main .align 4 .text -__AssemblerStart: - b __AssemblerStart +Main: + b Main |
