summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Boot/BootKit/BootKit.hxx4
-rw-r--r--Boot/Sources/HEL/AMD64/BootMain.cxx8
-rw-r--r--Boot/Sources/HEL/AMD64/compile_flags.txt6
-rw-r--r--Boot/Sources/ProgramLoader.cxx88
-rw-r--r--Boot/Sources/compile_flags.txt4
-rw-r--r--Boot/amd64-efi.make2
-rw-r--r--Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx9
-rw-r--r--Kernel/HALKit/AMD64/HalKernelMain.cxx4
-rw-r--r--Kernel/HALKit/ARM64/HalKernelMain.cxx4
-rw-r--r--Kernel/KernelKit/ProcessHeap.hxx (renamed from Kernel/KernelKit/ProcessHeap.hpp)2
-rw-r--r--Kernel/KernelKit/ProcessScheduler.hxx2
-rw-r--r--Kernel/Modules/ACPI/ACPIFactoryInterface.hxx4
-rw-r--r--Kernel/NewKit/Json.hxx (renamed from Kernel/NewKit/Json.hpp)0
-rw-r--r--Kernel/NewKit/NewKit.hpp4
-rw-r--r--Kernel/Sources/Json.cxx2
-rw-r--r--Kernel/Sources/KeMain.cxx4
-rw-r--r--Kernel/Sources/ProcessHeap.cxx2
-rw-r--r--newoskrnl.files4
18 files changed, 90 insertions, 63 deletions
diff --git a/Boot/BootKit/BootKit.hxx b/Boot/BootKit/BootKit.hxx
index 3c0ea09c..b95d635f 100644
--- a/Boot/BootKit/BootKit.hxx
+++ b/Boot/BootKit/BootKit.hxx
@@ -235,7 +235,7 @@ public:
return false;
}
- writer.Write(L"Device Size: ").Write(this->fDiskDev.GetDiskSize()).Write(L"\r");
+ writer.Write(L"newosldr: disk size: ").Write(this->fDiskDev.GetDiskSize()).Write(L"\r");
if (blockPart->DiskSize != this->fDiskDev.GetDiskSize() ||
blockPart->DiskSize < 1 ||
@@ -249,7 +249,7 @@ public:
EFI::ThrowError(L"Invalid-Partition-Name", L"Invalid disk partition.");
}
- writer.Write(L"Device Partition: ").Write(blockPart->PartitionName).Write(L" is healthy.\r");
+ writer.Write(L"newosldr: partition name: ").Write(blockPart->PartitionName).Write(L" is healthy.\r");
return true;
}
diff --git a/Boot/Sources/HEL/AMD64/BootMain.cxx b/Boot/Sources/HEL/AMD64/BootMain.cxx
index ce4074b2..e971abc0 100644
--- a/Boot/Sources/HEL/AMD64/BootMain.cxx
+++ b/Boot/Sources/HEL/AMD64/BootMain.cxx
@@ -241,7 +241,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
if (readerKernel.Blob())
{
loader = new Boot::ProgramLoader(readerKernel.Blob());
- loader->SetName("NewOSKrnl (Patched)");
+ loader->SetName("'newoskrnl.exe'");
}
#endif // ifdef __NEWOS_CAN_PATCH__
@@ -256,12 +256,10 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
if (loader)
loader->Start(handoverHdrPtr);
- else
- hal_init_platform(handoverHdrPtr);
-#else
- hal_init_platform(handoverHdrPtr);
#endif // ifdef __NEWOS_CAN_PATCH__
+ hal_init_platform(handoverHdrPtr);
+
EFI::Stop();
CANT_REACH();
diff --git a/Boot/Sources/HEL/AMD64/compile_flags.txt b/Boot/Sources/HEL/AMD64/compile_flags.txt
index e4515efe..d7a2b538 100644
--- a/Boot/Sources/HEL/AMD64/compile_flags.txt
+++ b/Boot/Sources/HEL/AMD64/compile_flags.txt
@@ -1,3 +1,7 @@
-std=c++20
-I../../../
--I../../../../
+-I../../../../Kernel
+-D__NEWOS_AMD64__
+-std=c++20
+-D__x86_64__
+-D__NEWOS_CAN_PATCH__
diff --git a/Boot/Sources/ProgramLoader.cxx b/Boot/Sources/ProgramLoader.cxx
index 90175bef..0603fb9c 100644
--- a/Boot/Sources/ProgramLoader.cxx
+++ b/Boot/Sources/ProgramLoader.cxx
@@ -7,60 +7,72 @@
#include <BootKit/ProgramLoader.hxx>
#include <BootKit/Vendor/Support.hxx>
#include <BootKit/BootKit.hxx>
+
+EXTERN_C
+{
#include <string.h>
+}
namespace Boot
{
ProgramLoader::ProgramLoader(VoidPtr blob)
: fBlob(blob), fStartAddress(nullptr)
{
- // detect the format.
- const char* firstBytes = reinterpret_cast<char*>(fBlob);
+ // detect the format.
+ const Char* firstBytes = reinterpret_cast<char*>(fBlob);
- BTextWriter writer;
- writer.WriteCharacter(firstBytes[0]).WriteCharacter(firstBytes[1]).WriteCharacter('\r').WriteCharacter('\n');
+ BTextWriter writer;
- if (!firstBytes)
- {
- // failed to provide a valid pointer.
- return;
- }
+ if (!firstBytes)
+ {
+ // failed to provide a valid pointer.
+ return;
+ }
- if (firstBytes[0] == 'M' &&
- firstBytes[1] == 'Z')
- {
- // Parse PE32+
- fStartAddress = nullptr;
- }
- else if (firstBytes[0] == 'J' &&
- firstBytes[1] == 'o' &&
- firstBytes[2] == 'y' &&
- firstBytes[3] == '!')
- {
- // Parse Non FAT PEF.
- fStartAddress = nullptr;
- }
- else
- {
- // probably a binary blob.
- fStartAddress = fBlob;
- }
- }
+ if (firstBytes[0] == 'M' &&
+ firstBytes[1] == 'Z')
+ {
+ // Parse PE32+
+ fStartAddress = nullptr;
+ writer.Write("newosldr: MZ executable detected.\r");
+ }
+ else if (firstBytes[0] == 'J' &&
+ firstBytes[1] == 'o' &&
+ firstBytes[2] == 'y' &&
+ firstBytes[3] == '!')
+ {
+ // Parse Non FAT PEF.
+ fStartAddress = nullptr;
+ writer.Write("newosldr: PEF executable detected.\r");
+ }
+ else
+ {
+ // probably a binary blob.
+ fStartAddress = fBlob;
+ }
+ }
Void ProgramLoader::Start(HEL::HandoverInformationHeader* handover)
{
- if (!fStartAddress) return;
+ BTextWriter writer;
+ writer.Write("newosldr: running: ").Write(fBlobName).Write("\r");
+
+ if (!fStartAddress)
+ {
+ writer.Write("newosldr: exec error.\r");
+ return;
+ }
- ((HEL::HandoverProc)fStartAddress)(handover);
+ ((HEL::HandoverProc)fStartAddress)(handover);
}
const Char* ProgramLoader::GetName()
- {
- return fBlobName;
- }
+ {
+ return fBlobName;
+ }
Void ProgramLoader::SetName(const Char* name)
- {
- CopyMem(fBlobName, name, StrLen(name));
- }
-} // namespace Boot \ No newline at end of file
+ {
+ CopyMem(fBlobName, name, StrLen(name));
+ }
+} // namespace Boot
diff --git a/Boot/Sources/compile_flags.txt b/Boot/Sources/compile_flags.txt
index c74d22b2..b42b9a4f 100644
--- a/Boot/Sources/compile_flags.txt
+++ b/Boot/Sources/compile_flags.txt
@@ -1,4 +1,8 @@
-std=c++20
-I../
-I../../
+-I../../Kernel
-D__NEWOS_AMD64__
+-std=c++20
+-D__x86_64__
+-D__NEWOS_CAN_PATCH__
diff --git a/Boot/amd64-efi.make b/Boot/amd64-efi.make
index 294bfb9e..5e14908e 100644
--- a/Boot/amd64-efi.make
+++ b/Boot/amd64-efi.make
@@ -53,7 +53,7 @@ REM_FLAG=-f
FLAG_ASM=-f win64
FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mno-red-zone -D__KERNEL__ -D__NEWBOOT__ \
-DEFI_FUNCTION_WRAPPER -I./ -I../Vendor -I../Kernel -I./ -c -nostdlib -fno-rtti -fno-exceptions \
- -std=c++20 -D__HAVE_MAHROUSS_APIS__ -D__NEWOS_AMD64__ -D__MAHROUSS__ -D__BOOTLOADER__ -I./
+ -std=c++20 -D__NEWOS_CAN_PATCH__ -D__HAVE_MAHROUSS_APIS__ -D__NEWOS_AMD64__ -D__MAHROUSS__ -D__BOOTLOADER__ -I./
BOOT_LOADER=newosldr.exe
KERNEL=newoskrnl.exe
diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
index 86bf635c..76e447be 100644
--- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
+++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
@@ -24,7 +24,7 @@
/// @brief assembly routine. internal use only.
EXTERN_C void _hal_enable_smp(void);
-/// @note: _hal_switch_context
+/// @note: _hal_switch_context is internal
///////////////////////////////////////////////////////////////////////////////////////
@@ -169,10 +169,13 @@ namespace Kernel::HAL
return cFramePtr;
}
+ /// @internal
EXTERN_C Void hal_apic_acknowledge(Void)
{
+ kcout << "newoskrnl: acknowledge APIC.\r";
}
+ /// @internal
EXTERN_C Void _hal_switch_context(HAL::StackFramePtr stackFrame)
{
hal_switch_context(stackFrame);
@@ -182,7 +185,9 @@ namespace Kernel::HAL
{
Semaphore sem;
- HardwareTimer timer(Seconds(5));
+ constexpr auto cSeconds = 1U;
+
+ HardwareTimer timer(Seconds(cSeconds));
sem.LockOrWait(&ProcessScheduler::The().Leak().TheCurrent().Leak(), &timer);
cFramePtr = stackFrame;
diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx
index a279b776..dc3ae4d0 100644
--- a/Kernel/HALKit/AMD64/HalKernelMain.cxx
+++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx
@@ -12,8 +12,8 @@
#include <KernelKit/KernelHeap.hpp>
#include <KernelKit/PEFCodeManager.hxx>
#include <KernelKit/ProcessScheduler.hxx>
-#include <KernelKit/ProcessHeap.hpp>
-#include <NewKit/Json.hpp>
+#include <KernelKit/ProcessHeap.hxx>
+#include <NewKit/Json.hxx>
#include <Modules/CoreCG/Accessibility.hxx>
#include <KernelKit/CodeManager.hpp>
#include <Modules/ACPI/ACPIFactoryInterface.hxx>
diff --git a/Kernel/HALKit/ARM64/HalKernelMain.cxx b/Kernel/HALKit/ARM64/HalKernelMain.cxx
index 3fb18737..1d82aeba 100644
--- a/Kernel/HALKit/ARM64/HalKernelMain.cxx
+++ b/Kernel/HALKit/ARM64/HalKernelMain.cxx
@@ -12,8 +12,8 @@
#include <KernelKit/KernelHeap.hpp>
#include <KernelKit/PEFCodeManager.hxx>
#include <KernelKit/ProcessScheduler.hxx>
-#include <KernelKit/ProcessHeap.hpp>
-#include <NewKit/Json.hpp>
+#include <KernelKit/ProcessHeap.hxx>
+#include <NewKit/Json.hxx>
#include <Modules/CoreCG/Accessibility.hxx>
#include <KernelKit/CodeManager.hpp>
#include <Modules/ACPI/ACPIFactoryInterface.hxx>
diff --git a/Kernel/KernelKit/ProcessHeap.hpp b/Kernel/KernelKit/ProcessHeap.hxx
index 0682d969..6fa397b3 100644
--- a/Kernel/KernelKit/ProcessHeap.hpp
+++ b/Kernel/KernelKit/ProcessHeap.hxx
@@ -14,7 +14,7 @@
#include <NewKit/Pmm.hpp>
/// @version 5/11/23
-/// @file ProcessHeap.hpp
+/// @file ProcessHeap.hxx
/// @brief memory heap for user processes.
#define kUserHeapMaxSz (4096)
diff --git a/Kernel/KernelKit/ProcessScheduler.hxx b/Kernel/KernelKit/ProcessScheduler.hxx
index 578dc163..5e7a6e55 100644
--- a/Kernel/KernelKit/ProcessScheduler.hxx
+++ b/Kernel/KernelKit/ProcessScheduler.hxx
@@ -10,7 +10,7 @@
#include <ArchKit/ArchKit.hpp>
#include <KernelKit/LockDelegate.hpp>
#include <KernelKit/PermissionSelector.hxx>
-#include <KernelKit/ProcessHeap.hpp>
+#include <KernelKit/ProcessHeap.hxx>
#include <NewKit/MutableArray.hpp>
#define kSchedMinMicroTime (AffinityKind::kHartStandard)
diff --git a/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx b/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx
index e5def104..fc49c2b9 100644
--- a/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx
+++ b/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx
@@ -14,6 +14,10 @@
namespace Kernel
{
+ class ACPIFactoryInterface;
+
+ typedef ACPIFactoryInterface PowerFactoryInterface;
+
class ACPIFactoryInterface final
{
public:
diff --git a/Kernel/NewKit/Json.hpp b/Kernel/NewKit/Json.hxx
index b2a0d872..b2a0d872 100644
--- a/Kernel/NewKit/Json.hpp
+++ b/Kernel/NewKit/Json.hxx
diff --git a/Kernel/NewKit/NewKit.hpp b/Kernel/NewKit/NewKit.hpp
index 8ca19ec8..90c0cf6e 100644
--- a/Kernel/NewKit/NewKit.hpp
+++ b/Kernel/NewKit/NewKit.hpp
@@ -10,7 +10,7 @@
#include <NewKit/Array.hpp>
#include <NewKit/ArrayList.hpp>
#include <NewKit/ErrorOr.hpp>
-#include <NewKit/Json.hpp>
+#include <NewKit/Json.hxx>
#include <NewKit/KernelCheck.hpp>
#include <KernelKit/LockDelegate.hpp>
#include <NewKit/MutableArray.hpp>
@@ -18,5 +18,5 @@
#include <NewKit/OwnPtr.hpp>
#include <NewKit/Ref.hpp>
#include <NewKit/Stream.hpp>
-#include <KernelKit/ProcessHeap.hpp>
+#include <KernelKit/ProcessHeap.hxx>
#include <NewKit/Utils.hpp>
diff --git a/Kernel/Sources/Json.cxx b/Kernel/Sources/Json.cxx
index 16a74765..f27c1486 100644
--- a/Kernel/Sources/Json.cxx
+++ b/Kernel/Sources/Json.cxx
@@ -4,7 +4,7 @@
------------------------------------------- */
-#include <NewKit/Json.hpp>
+#include <NewKit/Json.hxx>
using namespace Kernel;
diff --git a/Kernel/Sources/KeMain.cxx b/Kernel/Sources/KeMain.cxx
index 011e59a4..ddcdb6f9 100644
--- a/Kernel/Sources/KeMain.cxx
+++ b/Kernel/Sources/KeMain.cxx
@@ -17,8 +17,8 @@
#include <KernelKit/PEF.hpp>
#include <KernelKit/PEFCodeManager.hxx>
#include <KernelKit/ProcessScheduler.hxx>
-#include <KernelKit/ProcessHeap.hpp>
-#include <NewKit/Json.hpp>
+#include <KernelKit/ProcessHeap.hxx>
+#include <NewKit/Json.hxx>
#include <NewKit/KernelCheck.hpp>
#include <NewKit/String.hpp>
#include <NewKit/Utils.hpp>
diff --git a/Kernel/Sources/ProcessHeap.cxx b/Kernel/Sources/ProcessHeap.cxx
index b5988c5f..5efe8fd4 100644
--- a/Kernel/Sources/ProcessHeap.cxx
+++ b/Kernel/Sources/ProcessHeap.cxx
@@ -5,7 +5,7 @@
------------------------------------------- */
#include <KernelKit/ProcessScheduler.hxx>
-#include <KernelKit/ProcessHeap.hpp>
+#include <KernelKit/ProcessHeap.hxx>
#include <NewKit/PageManager.hpp>
#define kHeapHeaderPaddingSz (16U)
diff --git a/newoskrnl.files b/newoskrnl.files
index 8ad46350..c1c2ddf4 100644
--- a/newoskrnl.files
+++ b/newoskrnl.files
@@ -180,7 +180,7 @@ Kernel/KernelKit/SMPManager.hpp
Kernel/KernelKit/Semaphore.hpp
Kernel/KernelKit/ThreadLocalStorage.hxx
Kernel/KernelKit/Timer.hpp
-Kernel/KernelKit/ProcessHeap.hpp
+Kernel/KernelKit/ProcessHeap.hxx
Kernel/KernelKit/XCOFF.hxx
Kernel/KernelKit/compile_flags.txt
Kernel/Modules/ACPI/ACPI.hxx
@@ -223,7 +223,7 @@ Kernel/NewKit/CxxAbi.hpp
Kernel/NewKit/Defines.hpp
Kernel/NewKit/ErrorOr.hpp
Kernel/NewKit/Function.hpp
-Kernel/NewKit/Json.hpp
+Kernel/NewKit/Json.hxx
Kernel/NewKit/KernelCheck.hpp
Kernel/NewKit/Macros.hpp
Kernel/NewKit/MutableArray.hpp