summaryrefslogtreecommitdiffhomepage
path: root/Kernel/HALKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-19 19:08:17 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-19 19:08:17 +0200
commitdd643d1266229e5b7e81ae9ace988921e9c2c3b0 (patch)
tree9e1ff454a1334e3c33b97bf8853bb6c687816513 /Kernel/HALKit
parent19d0857d84cbc0267a8b222368e143bdcdaaf9a7 (diff)
unstable: AMD64 fixes, finish AMD64 HAL after release of phone.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Kernel/HALKit')
-rw-r--r--Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp7
-rw-r--r--Kernel/HALKit/AMD64/HalInterruptAPI.asm15
-rw-r--r--Kernel/HALKit/AMD64/HalKernelMain.cxx23
3 files changed, 14 insertions, 31 deletions
diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
index 4e9d2ff6..c8eb094c 100644
--- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
+++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp
@@ -163,7 +163,8 @@ namespace NewOS::HAL
EXTERN_C Void hal_apic_acknowledge_cont(Void)
{
- _hal_spin_core();
+ kcout << "newoskrnl: stopping core...\r";
+ ke_stop(RUNTIME_CHECK_BOOTSTRAP);
}
EXTERN_C StackFramePtr _hal_leak_current_context(Void)
@@ -211,12 +212,12 @@ namespace NewOS::HAL
for (SizeT coreAt = cStartAt; coreAt < cMaxProbableCores; ++coreAt)
{
- if (madt->MadtRecords[coreAt].Flags != kThreadBoot) // if local apic.
+ if (madt->MadtRecords[coreAt].Flags < kThreadBoot) // if local apic.
{
MadtType::MadtAddress& madtRecord = madt->MadtRecords[coreAt];
// then register as a core for scheduler.
- kcout << "newoskrnl: Register Local APIC.\r";
+ kcout << "newoskrnl: Register APIC.\r";
kApicMadtAddresses[kApicMadtAddressesCount].fAddress = madtRecord.Address;
kApicMadtAddresses[kApicMadtAddressesCount].fKind = madt->MadtRecords[coreAt].Flags;
diff --git a/Kernel/HALKit/AMD64/HalInterruptAPI.asm b/Kernel/HALKit/AMD64/HalInterruptAPI.asm
index 4832ecf3..9c5b0d6a 100644
--- a/Kernel/HALKit/AMD64/HalInterruptAPI.asm
+++ b/Kernel/HALKit/AMD64/HalInterruptAPI.asm
@@ -32,7 +32,6 @@ __NEW_INT_%1:
; This file handles the core interrupt table
; Last edited 31/01/24
-global _ke_power_on_self_test
global ke_handle_irq
global kInterruptVectorTable
@@ -250,20 +249,6 @@ IntNormal 60
%assign i i+1
%endrep
-;; this one is doing a POST for us.
-;; testing interrupts.
-_ke_power_on_self_test:
- mov rcx, 0x10
- mov rdx, _ke_string_post
-
- int 0x32
-
- ret
-
-section .data
-_ke_string_post:
- db "POST has been successful.", 0
-
section .text
[global hal_load_gdt]
diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx
index 8efe94b7..855b769e 100644
--- a/Kernel/HALKit/AMD64/HalKernelMain.cxx
+++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx
@@ -62,7 +62,7 @@ EXTERN_C void hal_init_platform(
NewOS::HEL::HandoverInformationHeader* HandoverHeader)
{
/* Setup globals. */
-
+
kHandoverHeader = HandoverHeader;
if (kHandoverHeader->f_Magic != kHandoverMagic &&
@@ -95,9 +95,9 @@ EXTERN_C void hal_init_platform(
idt.Load(idtBase);
/**
- register basic syscalls.
+ register basic syscalls.
*/
-
+
constexpr auto cSerialWriteInterrupt = 0x10; // 16
constexpr auto cTlsInterrupt = 0x11; // 17
constexpr auto cTlsInstallInterrupt = 0x12; // 18
@@ -111,7 +111,7 @@ EXTERN_C void hal_init_platform(
constexpr auto cCatalogClose = 0x20;
constexpr auto cCatalogRemove = 0x21;
constexpr auto cCatalogCreate = 0x22;
-
+
kSyscalls[cSerialWriteInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx) -> void {
const char* msg = (const char*)rdx;
NewOS::kcout << "newoskrnl: " << msg << "\r";
@@ -124,7 +124,7 @@ EXTERN_C void hal_init_platform(
kSyscalls[cNewInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void {
/// get HAC struct.
HeapAllocInfo* rdxInf = reinterpret_cast<HeapAllocInfo*>(rdx);
-
+
/// assign the fThe field with the pointer.
rdxInf->fThe = NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().New(rdxInf->fTheSz);
};
@@ -132,18 +132,18 @@ EXTERN_C void hal_init_platform(
kSyscalls[cDeleteInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void {
/// get HAC struct.
HeapAllocInfo* rdxInf = reinterpret_cast<HeapAllocInfo*>(rdx);
-
+
/// delete ptr with sz in mind.
NewOS::ProcessScheduler::The().Leak().TheCurrent().Leak().Delete(rdxInf->fThe, rdxInf->fTheSz);
};
-
+
kSyscalls[cTlsInstallInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void {
ProcessBlockInfo* rdxPb = reinterpret_cast<ProcessBlockInfo*>(rdx);
/// install the process's fTIB and fPIB.
rt_install_tib(rdxPb->fTIB, rdxPb->fPIB);
};
-
+
kSyscalls[cExitInterrupt].Leak().Leak()->fProc = [](NewOS::VoidPtr rdx)->void {
ProcessExitInfo* rdxEi = reinterpret_cast<ProcessExitInfo*>(rdx);
@@ -164,12 +164,9 @@ EXTERN_C void hal_init_platform(
kSyscalls[cExitInterrupt].Leak().Leak()->fHooked = true;
kSyscalls[cLastExitInterrupt].Leak().Leak()->fHooked = true;
- NewOS::HAL::Detail::_ke_power_on_self_test();
+ KeMain();
- /**
- call kernel entrypoint.
- */
- KeMain();
+ NewOS::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_RsdPtr);
NewOS::ke_stop(RUNTIME_CHECK_BOOTSTRAP);
}