diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-28 16:26:33 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-28 16:26:33 +0100 |
| commit | 06be6d65bb71152be8a28d7bb6b1028b5a588654 (patch) | |
| tree | b47625ad70e5ec6093187f9d454f4edeaffb5ed1 /Private/HALKit | |
| parent | f69bd40d5d97e371451d2e9c27721422141d828f (diff) | |
NewKernel: Final things are getting done for the first prototype.
NewBoot: Add ARM64 to HEL.
SPEC: Update it to include NewFS into it.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/HALKit')
| -rw-r--r-- | Private/HALKit/AMD64/ArchAMD64.cpp | 55 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HardwareInit.cpp | 2 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/PlatformAMD64.cpp | 58 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/StartSequence.asm | 34 | ||||
| -rw-r--r-- | Private/HALKit/PowerPC/Processor.cpp | 2 |
5 files changed, 94 insertions, 57 deletions
diff --git a/Private/HALKit/AMD64/ArchAMD64.cpp b/Private/HALKit/AMD64/ArchAMD64.cpp deleted file mode 100644 index 75d46bb8..00000000 --- a/Private/HALKit/AMD64/ArchAMD64.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ======================================================== - * - * hCore - * Copyright 2024 Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#include <ArchKit/Arch.hpp> - -namespace hCore::HAL -{ - struct RegisterAMD64 - { - UIntPtr base; - UShort limit; - }; - - void GDTLoader::Load(Register64 &gdt) - { - RegisterAMD64* reg = new RegisterAMD64(); - MUST_PASS(reg); - - reg->base = gdt.Base; - reg->limit = gdt.Limit; - - rt_cli(); - load_gdt(reg); - rt_sti(); - } - - void IDTLoader::Load(Register64 &idt) - { - RegisterAMD64* reg = new RegisterAMD64(); - MUST_PASS(reg); - - reg->base = idt.Base; - reg->limit = idt.Limit; - - rt_cli(); - load_idt(reg); - rt_sti(); - } - - void GDTLoader::Load(Ref<Register64> &gdt) - { - GDTLoader::Load(gdt.Leak()); - } - - void IDTLoader::Load(Ref<Register64> &idt) - { - IDTLoader::Load(idt.Leak()); - } -} // namespace hCore::HAL diff --git a/Private/HALKit/AMD64/HardwareInit.cpp b/Private/HALKit/AMD64/HardwareInit.cpp index 18e2a19c..367f083b 100644 --- a/Private/HALKit/AMD64/HardwareInit.cpp +++ b/Private/HALKit/AMD64/HardwareInit.cpp @@ -13,7 +13,7 @@ namespace hCore { - bool initialize_hardware_components() + bool init_hal() { // TODO: Hardware Specific stuff. diff --git a/Private/HALKit/AMD64/PlatformAMD64.cpp b/Private/HALKit/AMD64/PlatformAMD64.cpp new file mode 100644 index 00000000..0bade8dc --- /dev/null +++ b/Private/HALKit/AMD64/PlatformAMD64.cpp @@ -0,0 +1,58 @@ +/* + * ======================================================== + * + * hCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#include <ArchKit/Arch.hpp> + +namespace hCore::HAL +{ +namespace Detail +{ +struct RegisterAMD64 final +{ + UIntPtr base; + UShort limit; +}; +} // namespace Detail + +void GDTLoader::Load(Register64 &gdt) +{ + Detail::RegisterAMD64 *reg = new Detail::RegisterAMD64(); + MUST_PASS(reg); + + reg->base = gdt.Base; + reg->limit = gdt.Limit; + + rt_cli(); + load_gdt(reg); + rt_sti(); +} + +void IDTLoader::Load(Register64 &idt) +{ + Detail::RegisterAMD64 *reg = new Detail::RegisterAMD64(); + MUST_PASS(reg); + + reg->base = idt.Base; + reg->limit = idt.Limit; + + rt_cli(); + load_idt(reg); + rt_sti(); +} + +void GDTLoader::Load(Ref<Register64> &gdt) +{ + GDTLoader::Load(gdt.Leak()); +} + +void IDTLoader::Load(Ref<Register64> &idt) +{ + IDTLoader::Load(idt.Leak()); +} +} // namespace hCore::HAL diff --git a/Private/HALKit/AMD64/StartSequence.asm b/Private/HALKit/AMD64/StartSequence.asm new file mode 100644 index 00000000..533db858 --- /dev/null +++ b/Private/HALKit/AMD64/StartSequence.asm @@ -0,0 +1,34 @@ +;; /* +;; * ======================================================== +;; * +;; * hCore +;; * Copyright 2024 Mahrouss Logic, all rights reserved. +;; * +;; * ======================================================== +;; */ + +[bits 64] +[global Main] +[extern RuntimeMain] + +section .text + +NewBootMagic: dw 0x55FF66 +NewBootKernel: db "h-core", 0 +NewBootVersion: dw 1 + +;; This NewBootStart points to Main. +NewBootStart: +;; Just a simple setup, we'd also need to tell some before +Main: + mov rsp, __SYSTEM_STACK_END + mov ebp, RuntimeMain + jmp RuntimeMain +L0: + cli + hlt + jmp $ + +MainBIOS: + cli hlt + jmp $ diff --git a/Private/HALKit/PowerPC/Processor.cpp b/Private/HALKit/PowerPC/Processor.cpp index b134cf92..dc614fa9 100644 --- a/Private/HALKit/PowerPC/Processor.cpp +++ b/Private/HALKit/PowerPC/Processor.cpp @@ -44,7 +44,7 @@ void rt_hang_thread(HAL::StackFrame* stack) } // @brief main HAL entrypoint -void initialize_hardware_components() +void init_hal() { } |
