summaryrefslogtreecommitdiffhomepage
path: root/Kernel/HALKit
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-01 18:25:14 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-01 18:25:14 +0200
commit86e291120d124dec7244202b1766901a59dfb2e6 (patch)
tree1aa92d3b8a05216941986cf2724ff20ad01b3884 /Kernel/HALKit
parentf9579f444b1791d2b73d4d841569728fb203cb29 (diff)
[IMP] newoskrnl: Add symbol for cred_construct_token, reworked
ProcessHeap, new SCI.hxx for SCI and SCM. [IMP] newosldr: Loads the kernel correctly and can launch it, improved erorr handling. [META] newoskrnl, newosldr: Improved code and refactors. Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/HALKit')
-rw-r--r--Kernel/HALKit/AMD64/HalBoot.asm20
-rw-r--r--Kernel/HALKit/AMD64/HalKernelMain.cxx24
-rw-r--r--Kernel/HALKit/ARM64/HalKernelMain.cxx11
3 files changed, 22 insertions, 33 deletions
diff --git a/Kernel/HALKit/AMD64/HalBoot.asm b/Kernel/HALKit/AMD64/HalBoot.asm
index ad1c1987..8cb55a20 100644
--- a/Kernel/HALKit/AMD64/HalBoot.asm
+++ b/Kernel/HALKit/AMD64/HalBoot.asm
@@ -10,8 +10,7 @@
[bits 64]
;; Global symbol of this unit
-[global MainLong]
-[global MainUnsupported]
+[extern hal_init_platform]
%define kTypeKernel 100
%define kArchAmd64 122
@@ -23,19 +22,4 @@ HandoverMagic: dq kHandoverMagic
HandoverType: dw kTypeKernel
HandoverArch: dw kArchAmd64
;; This NewBootStart points to Main.
-HandoverStart: dq __ImageStart
-
-section .text
-
-global __ImageStart
-global __NewBootJumpProc
-
-extern hal_init_platform
-
-;; Just a simple setup, we'd also need to tell some before
-__NewBootJumpProc:
-__ImageStart:
- push rcx
- call hal_init_platform
- pop rcx
- ret
+HandoverStart: dq hal_init_platform
diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx
index d21d2f9c..6e923555 100644
--- a/Kernel/HALKit/AMD64/HalKernelMain.cxx
+++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx
@@ -32,19 +32,19 @@ EXTERN_C void KeMain();
EXTERN_C Kernel::VoidPtr kInterruptVectorTable[];
-struct PACKED HEAP_ALLOC_INFO final
+struct HEAP_ALLOC_INFO final
{
Kernel::VoidPtr fThe;
Kernel::Size fTheSz;
};
-struct PACKED PROCESS_BLOCK_INFO final
+struct PROCESS_BLOCK_INFO final
{
- ThreadInformationBlock* fTIB;
- ThreadInformationBlock* fPIB;
+ THREAD_INFORMATION_BLOCK* fTIB;
+ THREAD_INFORMATION_BLOCK* fGIB;
};
-struct PACKED PROCESS_EXIT_INFO final
+struct PROCESS_EXIT_INFO final
{
STATIC constexpr auto cReasonLen = 512;
@@ -131,11 +131,14 @@ EXTERN_C void hal_init_platform(
kSyscalls[cSerialAlertInterrupt].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void {
const char* msg = (const char*)rdx;
- Kernel::kcout << "Native Log: " << msg << "\r";
+ Kernel::kcout << "Kernel: " << msg << "\r";
};
kSyscalls[cTlsInterrupt].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void {
- tls_check_syscall_impl(rdx);
+ if (tls_check_syscall_impl(rdx) == false)
+ {
+ Kernel::ProcessScheduler::The().Leak().TheCurrent().Leak().Crash();
+ }
};
kSyscalls[cLPCSanitizeMsg].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void {
@@ -170,8 +173,8 @@ EXTERN_C void hal_init_platform(
if (!rdxPb)
return;
- // install the fTIB and fPIB.
- rt_install_tib(rdxPb->fTIB, rdxPb->fPIB);
+ // install the fTIB and fGIB.
+ rt_install_tib(rdxPb->fTIB, rdxPb->fGIB);
};
kSyscalls[cExitInterrupt].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void {
@@ -224,8 +227,7 @@ EXTERN_C void hal_init_platform(
Kernel::StringView strAutoMount(cMaxPropLen);
strAutoMount += "\\Properties\\AutoMountFS?";
- cAutoFormatDisk.GetKey() = strAutoMount;
-
+ cAutoFormatDisk.GetKey() = strAutoMount;
for (size_t i = 0; i < cMaxCmdLine; i++)
{
diff --git a/Kernel/HALKit/ARM64/HalKernelMain.cxx b/Kernel/HALKit/ARM64/HalKernelMain.cxx
index 0d6a8ca5..64e38fcb 100644
--- a/Kernel/HALKit/ARM64/HalKernelMain.cxx
+++ b/Kernel/HALKit/ARM64/HalKernelMain.cxx
@@ -36,8 +36,8 @@ struct PACKED HeapAllocInfo final
struct PACKED ProcessBlockInfo final
{
- ThreadInformationBlock* fTIB;
- ThreadInformationBlock* fPIB;
+ THREAD_INFORMATION_BLOCK* fTIB;
+ THREAD_INFORMATION_BLOCK* fPIB;
};
struct PACKED ProcessExitInfo final
@@ -91,11 +91,14 @@ EXTERN_C void hal_init_platform(
kSyscalls[cSerialAlertInterrupt].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void {
const char* msg = (const char*)rdx;
- Kernel::kcout << "serial: " << msg << "\r";
+ Kernel::kcout << "Kernel: " << msg << "\r";
};
kSyscalls[cTlsInterrupt].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void {
- tls_check_syscall_impl(rdx);
+ if (tls_check_syscall_impl(rdx) == false)
+ {
+ Kernel::ProcessScheduler::The().Leak().TheCurrent().Leak().Crash();
+ }
};
kSyscalls[cLPCSanitizeMsg].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void {