From 39415bb759f7eb67fb393385c28c3d2e5d7f6857 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 2 Jun 2024 09:25:18 +0200 Subject: MHR-23: Porting to ARM64 now. Signed-off-by: Amlal El Mahrouss --- Kernel/Sources/FS/NewFS.cxx | 53 ++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'Kernel/Sources/FS/NewFS.cxx') diff --git a/Kernel/Sources/FS/NewFS.cxx b/Kernel/Sources/FS/NewFS.cxx index 6f19c8ed..5e07fef8 100644 --- a/Kernel/Sources/FS/NewFS.cxx +++ b/Kernel/Sources/FS/NewFS.cxx @@ -73,11 +73,11 @@ _Output NewFork* NewFSParser::CreateFork(_Input NewCatalog* catalog, drv->fInput(&drv->fPacket); - kcout << "New OS: Next-Fork: " << hex_number(curFork.NextSibling) << endl; + kcout << "newoskrnl: Next-Fork: " << hex_number(curFork.NextSibling) << endl; if (curFork.Flags == kNewFSFlagCreated) { - kcout << "New OS: Fork already exists.\r"; + kcout << "newoskrnl: Fork already exists.\r"; /// sanity check. if (StringBuilder::Equals(curFork.ForkName, theFork.ForkName) && @@ -126,10 +126,10 @@ _Output NewFork* NewFSParser::CreateFork(_Input NewCatalog* catalog, drv->fOutput(&drv->fPacket); /// log what we have now. - kcout << "New OS: Wrote fork data at: " << hex_number(theFork.DataOffset) + kcout << "newoskrnl: Wrote fork data at: " << hex_number(theFork.DataOffset) << endl; - kcout << "New OS: Wrote fork at: " << hex_number(lba) << endl; + kcout << "newoskrnl: Wrote fork at: " << hex_number(lba) << endl; return &theFork; } @@ -372,9 +372,9 @@ _Output NewCatalog* NewFSParser::CreateCatalog(_Input const char* name, drive->fOutput(&drive->fPacket); - kcout << "New OS: Create new catalog, status: " + kcout << "newoskrnl: Create new catalog, status: " << hex_number(catalogChild->Flags) << endl; - kcout << "New OS: Create new catalog, status: " << catalogChild->Name + kcout << "newoskrnl: Create new catalog, status: " << catalogChild->Name << endl; drive->fPacket.fPacketContent = sectorBufPartBlock; @@ -449,7 +449,7 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive) partBlock->Version = kNewFSVersionInteger; - const auto cUntitledHD = "New OS HD\0"; + const auto cUntitledHD = "newoskrnl HD\0"; rt_copy_memory((VoidPtr)kNewFSIdent, (VoidPtr)partBlock->Ident, kNewFSIdentLen); @@ -475,14 +475,14 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive) drive->fOutput(&drive->fPacket); - kcout << "Drive-Kind: " << drive->fDriveKind() << endl; + kcout << "newoskrnl: drive kind: " << drive->fDriveKind() << endl; - kcout << "Partition-Name: " << partBlock->PartitionName << endl; - kcout << "Start-Catalog: " << hex_number(partBlock->StartCatalog) << endl; - kcout << "Catalog-Count: " << hex_number(partBlock->CatalogCount) << endl; - kcout << "Free-Catalog: " << hex_number(partBlock->FreeCatalog) << endl; - kcout << "Free-Sectors: " << hex_number(partBlock->FreeSectors) << endl; - kcout << "Sector-Size: " << hex_number(partBlock->SectorSize) << endl; + kcout << "newoskrnl: partition name: " << partBlock->PartitionName << endl; + kcout << "newoskrnl: start: " << hex_number(partBlock->StartCatalog) << endl; + kcout << "newoskrnl: number of catalogs: " << hex_number(partBlock->CatalogCount) << endl; + kcout << "newoskrnl: free catalog: " << hex_number(partBlock->FreeCatalog) << endl; + kcout << "newoskrnl: free sectors: " << hex_number(partBlock->FreeSectors) << endl; + kcout << "newoskrnl: sector size: " << hex_number(partBlock->SectorSize) << endl; /// write the root catalog. this->CreateCatalog(kNewFSRoot, 0, kNewFSCatalogKindDir); @@ -490,7 +490,7 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive) return true; } - kcout << "New OS: PartitionBlock already exists.\r"; + kcout << "newoskrnl: PartitionBlock already exists.\r"; /// return success as well, do not ignore that partition. return true; @@ -531,14 +531,14 @@ bool NewFSParser::WriteCatalog(_Input _Output NewCatalog* catalog, voidPtr data, drive->fInput(&drive->fPacket); - kcout << "Fork-Name: " << forkData->ForkName << endl; + kcout << "newoskrnl: forkName: " << forkData->ForkName << endl; /// sanity check the fork. if (forkData->DataOffset <= kNewFSCatalogStartAddress) { DbgLastError() = kErrorDiskIsCorrupted; - kcout << "New OS: Invalid fork offset.\r"; + kcout << "newoskrnl: Invalid fork offset.\r"; delete forkData; return false; @@ -552,7 +552,8 @@ bool NewFSParser::WriteCatalog(_Input _Output NewCatalog* catalog, voidPtr data, drive->fPacket.fPacketContent = data; drive->fPacket.fPacketSize = sizeOfData; drive->fPacket.fLba = forkData->DataOffset; - kcout << "Fork-Offset: " << hex_number(forkData->DataOffset) << endl; + + kcout << "newoskrnl: data offset: " << hex_number(forkData->DataOffset) << endl; drive->fOutput(&drive->fPacket); @@ -563,10 +564,12 @@ bool NewFSParser::WriteCatalog(_Input _Output NewCatalog* catalog, voidPtr data, catalog == nullptr) { delete catalog; + drive->fPacket.fPacketContent = data; drive->fPacket.fPacketSize = sizeOfData; drive->fPacket.fLba = forkData->DataOffset; - kcout << "Fork-Offset: " << hex_number(forkData->DataOffset) << endl; + + kcout << "newoskrnl: data offset: " << hex_number(forkData->DataOffset) << endl; drive->fOutput(&drive->fPacket); @@ -670,7 +673,7 @@ _NewFSSearchThroughCatalogList: NewCatalog* catalogPtr = new NewCatalog(); rt_copy_memory(catalog, catalogPtr, sizeof(NewCatalog)); - kcout << "New OS: Found catalog at: " << hex_number(startCatalogList) << endl; + kcout << "newoskrnl: found catalog at: " << hex_number(startCatalogList) << endl; outLba = startCatalogList; delete[] sectorBuf; @@ -809,8 +812,8 @@ VoidPtr NewFSParser::ReadCatalog(_Input _Output NewCatalog* catalog, Lba dataForkLba = catalog->DataFork; Size dataForkSize = catalog->DataForkSize; - kcout << "Found-Catalog: " << catalog->Name - << ", Data-Fork: " << hex_number(dataForkLba) << endl; + kcout << "newoskrnl: catalog " << catalog->Name + << ", fork: " << hex_number(dataForkLba) << endl; Char* sectorBuf = new Char[sizeof(NewFork)]; auto drive = sMountpointInterface.GetAddressOf(this->fDriveIndex); @@ -830,7 +833,7 @@ VoidPtr NewFSParser::ReadCatalog(_Input _Output NewCatalog* catalog, forkData = (NewFork*)sectorBuf; - kcout << "Fork-Name: " << forkData->ForkName << endl; + kcout << "newoskrnl: name: " << forkData->ForkName << endl; if (forkData->DataOffset <= kNewFSCatalogStartAddress) { @@ -930,11 +933,11 @@ namespace NewOS::Detail if (!StringBuilder::Equals(partBlock->Ident, kNewFSIdent)) { - kcout << "New OS: New FS Partition is corrupt.\r"; + kcout << "newoskrnl: New FS Partition is corrupt.\r"; return false; } - kcout << "New OS: Read partition: " << partBlock->PartitionName << ", with success!\r"; + kcout << "newoskrnl: Read partition: " << partBlock->PartitionName << ", with success!\r"; return true; } -- cgit v1.2.3 From 9994b8f3f88131f41be1061fb0947177e66dc7b0 Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Wed, 5 Jun 2024 08:28:39 +0200 Subject: MHR-23: Add EPM PDF, add docs in KernelCall.c and fix log in NewFS.cxx Signed-off-by: Amlal EL Mahrouss --- DDK/KernelCall.c | 5 +++++ Kernel/Docs/Explicit Partition Map.pdf | Bin 0 -> 12326 bytes Kernel/KernelKit/PEF.hpp | 2 +- Kernel/Sources/FS/NewFS.cxx | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 Kernel/Docs/Explicit Partition Map.pdf (limited to 'Kernel/Sources/FS/NewFS.cxx') diff --git a/DDK/KernelCall.c b/DDK/KernelCall.c index 17e0b5d5..26a0b83b 100644 --- a/DDK/KernelCall.c +++ b/DDK/KernelCall.c @@ -11,6 +11,11 @@ DK_EXTERN __attribute__((naked)) void __kernelDispatchCall(int32_t cnt, ...); +/// @brief Execute a function on the kernel. +/// @param kernelRpcName the name of the function. +/// @param cnt number of arguments. +/// @param +/// @return DK_EXTERN void* kernelCall(const char* kernelRpcName, int32_t cnt, ...) { if (!kernelRpcName || cnt == 0) diff --git a/Kernel/Docs/Explicit Partition Map.pdf b/Kernel/Docs/Explicit Partition Map.pdf new file mode 100644 index 00000000..1e2f5318 Binary files /dev/null and b/Kernel/Docs/Explicit Partition Map.pdf differ diff --git a/Kernel/KernelKit/PEF.hpp b/Kernel/KernelKit/PEF.hpp index 1874aa4e..98a413aa 100644 --- a/Kernel/KernelKit/PEF.hpp +++ b/Kernel/KernelKit/PEF.hpp @@ -44,7 +44,7 @@ namespace NewOS { kPefSubArchAMD, kPefSubArchIntel, - kPefSubArchARM, + kPefSubArchGeneric, kPefSubArchIBM, }; diff --git a/Kernel/Sources/FS/NewFS.cxx b/Kernel/Sources/FS/NewFS.cxx index 5e07fef8..a60fc228 100644 --- a/Kernel/Sources/FS/NewFS.cxx +++ b/Kernel/Sources/FS/NewFS.cxx @@ -46,7 +46,7 @@ _Output NewFork* NewFSParser::CreateFork(_Input NewCatalog* catalog, Lba lba = (theFork.Kind == kNewFSDataForkKind) ? catalog->DataFork : catalog->ResourceFork; - kcout << "Fork Lba: " << hex_number(lba) << endl; + kcout << "newoskrnl: fork lba: " << hex_number(lba) << endl; if (lba <= kNewFSCatalogStartAddress) return nullptr; -- cgit v1.2.3