summaryrefslogtreecommitdiffhomepage
path: root/Kernel/HALKit
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-15 10:38:58 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-15 10:38:58 +0200
commit98403fe342c8c2795de34e922958ee8d02c94e04 (patch)
tree30624c77cb63fcfc1b606d6264205b415af8fea8 /Kernel/HALKit
parent7a43990192e13a7b32bc1f99a7dd02efe6f71e4e (diff)
[IMP] MHR-28:
+ Fixed VMH allocator, which was hanging because of a unitialized global field. + Working on fixing User save method for authorization purposes. + If .bss -> Zero memory region. Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/HALKit')
-rw-r--r--Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx7
-rw-r--r--Kernel/HALKit/AMD64/HalKernelMain.cxx19
-rw-r--r--Kernel/HALKit/AMD64/HalPageAlloc.cxx7
3 files changed, 26 insertions, 7 deletions
diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
index 9de1b5b4..6018d20f 100644
--- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
+++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
@@ -81,9 +81,12 @@ namespace Kernel::HAL
struct MADT_TABLE final : public SDT
{
UInt32 Address; // Madt address
- UInt8 Flags; // Madt flags
+ UInt32 Flags; // Madt flags
- VoidPtr Records[]; // Records List
+ struct {
+ UInt8 Type;
+ UInt8 Len;
+ } Records[]; // Records List
};
///////////////////////////////////////////////////////////////////////////////////////
diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx
index 1fff99e2..49ddfa6c 100644
--- a/Kernel/HALKit/AMD64/HalKernelMain.cxx
+++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx
@@ -24,6 +24,8 @@
Kernel::Property cKernelVersion;
Kernel::Property cAutoFormatDisk;
+EXTERN Kernel::Boolean kAllocationInProgress;
+
EXTERN_C Kernel::VoidPtr kInterruptVectorTable[];
struct HEAP_ALLOC_INFO final
@@ -84,7 +86,11 @@ EXTERN_C void hal_init_platform(
}
Kernel::Void hal_real_init(Kernel::Void) noexcept
-{ // get page size.
+{
+ // reset kAllocationInProgress field to zero.
+ kAllocationInProgress = false;
+
+ // get page size.
kKernelVirtualSize = kHandoverHeader->f_VirtualSize;
// get virtual address start (for the heap)
@@ -210,15 +216,20 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept
kSyscalls[cShutdownInterrupt].Leak().Leak()->fHooked = true;
kSyscalls[cRebootInterrupt].Leak().Leak()->fHooked = true;
- auto fs = new Kernel::NewFilesystemManager();
+ Kernel::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr);
- Kernel::NewFilesystemManager::Mount(fs);
+ Kernel::kcout << "newoskrnl: Creating filesystem and such.\r";
+ auto fs = new Kernel::NewFilesystemManager();
+
+ MUST_PASS(fs);
MUST_PASS(fs->GetParser());
+ Kernel::NewFilesystemManager::Mount(fs);
+
delete fs->GetParser()->CreateCatalog("\\Users\\", 0, kNewFSCatalogKindDir);
- Kernel::kcout << "newoskrnl: Creating filesystem and " << kSuperUser << "..." << Kernel::endl;
+ Kernel::kcout << "newoskrnl: Created filesystem and now creating " << kSuperUser << "..." << Kernel::endl;
cRoot = new Kernel::User(Kernel::RingKind::kRingSuperUser, kSuperUser);
diff --git a/Kernel/HALKit/AMD64/HalPageAlloc.cxx b/Kernel/HALKit/AMD64/HalPageAlloc.cxx
index b554e211..0e39a0f1 100644
--- a/Kernel/HALKit/AMD64/HalPageAlloc.cxx
+++ b/Kernel/HALKit/AMD64/HalPageAlloc.cxx
@@ -6,6 +6,8 @@
#include <ArchKit/ArchKit.hxx>
+#define cVMHMagic (0xDEEFD00D)
+
#ifdef __NEWOS_AMD64__
#include <HALKit/AMD64/HalPageAlloc.hxx>
#elif defined(__NEWOS_ARM64__)
@@ -19,7 +21,6 @@ Kernel::Boolean kAllocationInProgress = false;
namespace Kernel
{
- constexpr auto cVMHMagic = 0xDEEFD00D;
namespace HAL
{
@@ -99,12 +100,16 @@ namespace Kernel
/// @return
auto hal_alloc_page(Boolean rw, Boolean user, SizeT size) -> VoidPtr
{
+ kcout << "Waiting now...";
+
// Wait for a ongoing allocation to complete.
while (kAllocationInProgress)
{
(void)0;
}
+ kcout << ", done waiting, allocating...\r";
+
if (size == 0)
++size;