summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Boot/Sources/HEL/AMD64/BootMain.cxx4
-rw-r--r--Boot/Sources/ProgramLoader.cxx13
-rw-r--r--Boot/Sources/Root/bootloader.json2
-rw-r--r--Boot/amd64-efi.make6
-rw-r--r--CRTKit/__mpcc_alloca.hxx (renamed from Kernel/CRT/__mpcc_alloca.hxx)0
-rw-r--r--CRTKit/__mpcc_defines.hxx (renamed from Kernel/CRT/__mpcc_defines.hxx)0
-rw-r--r--CRTKit/__mpcc_exception.hxx35
-rw-r--r--CRTKit/__mpcc_malloc.hxx (renamed from Kernel/CRT/__mpcc_malloc.hxx)0
-rw-r--r--Kernel/CRT/__mpcc_exception.hxx46
-rw-r--r--Kernel/FSKit/NewFS.hxx8
-rw-r--r--Kernel/FirmwareKit/EPM.hxx16
-rw-r--r--Kernel/HALKit/AMD64/HalBoot.asm7
-rw-r--r--Kernel/KernelKit/ProcessScheduler.hxx2
-rw-r--r--Kernel/KernelRsrc.rsrc2
-rw-r--r--Kernel/Linker/16x0.json2
-rw-r--r--Kernel/Linker/32x0.json2
-rw-r--r--Kernel/Linker/64x0.json2
-rw-r--r--Kernel/Linker/arm64.json2
-rw-r--r--Kernel/Modules/GL/.keepme0
-rw-r--r--Kernel/NewKit/Defines.hxx2
-rw-r--r--Kernel/Sources/FS/NewFS.cxx137
-rw-r--r--Kernel/Sources/ProcessScheduler.cxx2
-rw-r--r--Kernel/amd64-efi.make8
-rw-r--r--Kernel/arm64-efi.make4
24 files changed, 172 insertions, 130 deletions
diff --git a/Boot/Sources/HEL/AMD64/BootMain.cxx b/Boot/Sources/HEL/AMD64/BootMain.cxx
index efd18ef5..3f71d995 100644
--- a/Boot/Sources/HEL/AMD64/BootMain.cxx
+++ b/Boot/Sources/HEL/AMD64/BootMain.cxx
@@ -228,7 +228,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
diskFormatter.Format(kMachineModel, &rootDesc, 1);
}
- BFileReader readerKernel(L"newoskrnl.exe", ImageHandle);
+ BFileReader readerKernel(L"newoskrnl.dll", ImageHandle);
readerKernel.ReadAll(0);
@@ -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.exe\" (64-bit SMP)");
+ loader->SetName("\"newoskrnl.dll\" (64-bit SMP)");
}
writer.Write("newosldr: Running: ").Write(loader->GetName()).Write("\r");
diff --git a/Boot/Sources/ProgramLoader.cxx b/Boot/Sources/ProgramLoader.cxx
index 2103414a..be2650dc 100644
--- a/Boot/Sources/ProgramLoader.cxx
+++ b/Boot/Sources/ProgramLoader.cxx
@@ -70,18 +70,13 @@ namespace Boot
// if this is a code header, then we can look for the entrypoint.
if (sect->mCharacteristics & eUserSection)
{
- BS->AllocatePages(EfiAllocateType::AllocateAddress, EfiMemoryType::EfiLoaderCode, 1, &address_to_alloc);
-
if (!fStartAddress)
{
- fStartAddress = (VoidPtr)((UIntPtr)firstBytes + optHdr->mAddressOfEntryPoint);
+ fStartAddress = (VoidPtr)((VoidPtr)((UIntPtr)fBlob + 184 + (sect->mVirtualAddress - optHdr->mAddressOfEntryPoint)));
+
writer.Write("newosldr: Start Address set: ").Write((UIntPtr)fStartAddress).Write("\r");
}
}
- else
- {
- BS->AllocatePages(EfiAllocateType::AllocateAddress, EfiMemoryType::EfiLoaderData, 1, &address_to_alloc);
- }
}
}
else if (firstBytes[0] == kPefMagic[0] &&
@@ -125,9 +120,7 @@ namespace Boot
err_fn(handover);
}
- volatile HEL::HandoverProc start = reinterpret_cast<HEL::HandoverProc>((UIntPtr)fStartAddress);
-
- start(handover);
+ rt_jump_to_address(reinterpret_cast<HEL::HandoverProc>(fStartAddress), handover, fStackPtr);
err_fn(handover);
}
diff --git a/Boot/Sources/Root/bootloader.json b/Boot/Sources/Root/bootloader.json
index e8bc99fd..fe1a57d4 100644
--- a/Boot/Sources/Root/bootloader.json
+++ b/Boot/Sources/Root/bootloader.json
@@ -1,4 +1,4 @@
{
- "newoskrnl.exe": "kernel",
+ "newoskrnl.dll": "kernel",
"ZETA/fonts.json": "rsrc"
}
diff --git a/Boot/amd64-efi.make b/Boot/amd64-efi.make
index b866e650..c33ccc96 100644
--- a/Boot/amd64-efi.make
+++ b/Boot/amd64-efi.make
@@ -47,10 +47,10 @@ REM_FLAG=-f
FLAG_ASM=-f win64
FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -D__NEWOS_OTA__ -mno-red-zone -D__KERNEL__ -D__NEWBOOT__ \
-DEFI_FUNCTION_WRAPPER -I./ -I../Vendor -I../Kernel -c -nostdlib -fno-rtti -fno-exceptions \
- -std=c++20 -D__HAVE_MAHROUSS_APIS__ -D__NEWOS_AMD64__ -D__MAHROUSS__ -D__BOOTLOADER__
+ -std=c++20 -D__HAVE_MAHROUSS_APIS__ -D__NEWOS_AMD64__ -D__MAHROUSS__ -D__BOOTLOADER__ -I../
BOOT_LOADER=newosldr.exe
-KERNEL=newoskrnl.exe
+KERNEL=newoskrnl.dll
DDK=libDDK.lib
SCI=libSCI.lib
@@ -97,7 +97,7 @@ download-edk:
$(HTTP_GET) https://retrage.github.io/edk2-nightly/bin/DEBUGX64_OVMF.fd -O OVMF.fd
BINS=*.bin
-EXECUTABLES=newosldr.exe newoskrnl.exe OVMF.fd
+EXECUTABLES=newosldr.exe newoskrnl.dll OVMF.fd
TARGETS=$(REM_FLAG) $(OBJ) $(BIN) $(IMG) $(IMG_2) $(EXECUTABLES)
diff --git a/Kernel/CRT/__mpcc_alloca.hxx b/CRTKit/__mpcc_alloca.hxx
index 02b31230..02b31230 100644
--- a/Kernel/CRT/__mpcc_alloca.hxx
+++ b/CRTKit/__mpcc_alloca.hxx
diff --git a/Kernel/CRT/__mpcc_defines.hxx b/CRTKit/__mpcc_defines.hxx
index 9dfe51af..9dfe51af 100644
--- a/Kernel/CRT/__mpcc_defines.hxx
+++ b/CRTKit/__mpcc_defines.hxx
diff --git a/CRTKit/__mpcc_exception.hxx b/CRTKit/__mpcc_exception.hxx
new file mode 100644
index 00000000..012ff43f
--- /dev/null
+++ b/CRTKit/__mpcc_exception.hxx
@@ -0,0 +1,35 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies
+
+------------------------------------------- */
+
+#pragma once
+
+extern "C" int __exit(int code);
+/// @brief Standard C++ namespace
+namespace std
+{
+ class ofstream;
+
+ extern ofstream cout;
+
+ inline void __throw_general(void)
+ {
+ __exit(33);
+ }
+
+ inline void __throw_domain_error(const char* error)
+ {
+ cout << "ZKA C++: Domain error: " << error << "\r";
+ __throw_general();
+ __builtin_unreachable(); // prevent from continuing.
+ }
+
+ inline void __throw_bad_array_new_length(void)
+ {
+ cout << "ZKAC C++: Bad array length.\r";
+ __throw_general();
+ __builtin_unreachable(); // prevent from continuing.
+ }
+} // namespace std
diff --git a/Kernel/CRT/__mpcc_malloc.hxx b/CRTKit/__mpcc_malloc.hxx
index 95a27f86..95a27f86 100644
--- a/Kernel/CRT/__mpcc_malloc.hxx
+++ b/CRTKit/__mpcc_malloc.hxx
diff --git a/Kernel/CRT/__mpcc_exception.hxx b/Kernel/CRT/__mpcc_exception.hxx
deleted file mode 100644
index 0cf9fb23..00000000
--- a/Kernel/CRT/__mpcc_exception.hxx
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies
-
-------------------------------------------- */
-
-#pragma once
-
-#include <KernelKit/DebugOutput.hxx>
-
-/// @brief Standard C++ namespace
-namespace std
-{
-#ifdef __x86_64__
-#ifdef __KERNEL__
- inline void __throw_general(void)
- {
- __asm__("int $0xD");
- }
-#else
- inline void __throw_general(void)
- {
- __exit(33);
- }
-#endif
-#else
- inline void __throw_general(void)
- {
- __exit(33);
- }
-#endif // if __x86_64__
-
- inline void __throw_domain_error(const char* error)
- {
- Kernel::kcout << "MPCC C++: Domain error: " << error << "\r";
- __throw_general();
- CANT_REACH(); // prevent from continuing.
- }
-
- inline void __throw_bad_array_new_length(void)
- {
- Kernel::kcout << "MPCC C++: Bad array length.\r";
- __throw_general();
- CANT_REACH(); // prevent from continuing.
- }
-} // namespace std
diff --git a/Kernel/FSKit/NewFS.hxx b/Kernel/FSKit/NewFS.hxx
index b0530e0e..566904ef 100644
--- a/Kernel/FSKit/NewFS.hxx
+++ b/Kernel/FSKit/NewFS.hxx
@@ -186,7 +186,9 @@ struct PACKED NFS_ROOT_PARTITION_BLOCK final
Kernel::UInt64 Version;
- Kernel::Char Pad[kNewFSPadLen];
+ Kernel::Lba EpmBlock;
+
+ Kernel::Char Pad[kNewFSPadLen-sizeof(Kernel::Lba)];
};
namespace Kernel
@@ -252,7 +254,7 @@ namespace Kernel
_Output NFS_CATALOG_STRUCT* CreateCatalog(_Input const char* name);
- bool WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog,
+ Bool WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog,
voidPtr data,
SizeT sizeOfData,
_Input const char* forkName);
@@ -272,7 +274,7 @@ namespace Kernel
/// @brief Make a EPM+NewFS drive out of the disk.
/// @param drive The drive to write on.
/// @return If it was sucessful, see ErrLocal().
- bool Format(_Input _Output DriveTrait* drive);
+ bool Format(_Input _Output DriveTrait* drive, _Input const Lba endLba, _Input const Int32 flags, const Char* part_name);
public:
Int32 fDriveIndex{kNewFSSubDriveC};
diff --git a/Kernel/FirmwareKit/EPM.hxx b/Kernel/FirmwareKit/EPM.hxx
index d7038ff7..2605ec24 100644
--- a/Kernel/FirmwareKit/EPM.hxx
+++ b/Kernel/FirmwareKit/EPM.hxx
@@ -63,13 +63,18 @@
///! Anything below is reserved for Data backup by the Main OS.
#define kEPMStartPartitionBlk (sizeof(_BOOT_BLOCK_STRUCT))
-///! @brief Current EPM revision
+///! @brief Current EPM revision.
#define kEPMRevision (0xAD)
-///! @brief Current EPM revision
+
+///! @brief Current EPM revision.
#define kEPMRevisionUEFI (0xAF)
-/// !@brief EPM base address
+
+/// !@brief EPM base address.
#define kEpmBase (0U)
+struct _BLOCK_GUID_STRUCT;
+struct _BOOT_BLOCK_STRUCT;
+
/* The first 0 > 128 addresses of a disk contains these headers. */
/// @brief EPM GUID structure.
@@ -93,11 +98,12 @@ struct PACKED _BOOT_BLOCK_STRUCT
Kernel::Int32 Version;
Kernel::Int64 NumBlocks;
Kernel::Int64 SectorSz;
- Kernel::Int64 LbaStart;
+ Kernel::Int64 LbaStart; // base offset
+ Kernel::Int64 LbaEnd; // addition of lba_start to get the end of partition.
Kernel::Int16 Kind;
Kernel::Int32 FsVersion;
Kernel::Char Fs[kEPMFilesystemLength]; /* NewFS, ffs2... */
- Kernel::Char Reserved[409]; // to fill a full sector.
+ Kernel::Char Reserved[401]; // to fill a full sector.
};
///! @brief Version kind enum.
diff --git a/Kernel/HALKit/AMD64/HalBoot.asm b/Kernel/HALKit/AMD64/HalBoot.asm
index 8cb55a20..f03982e6 100644
--- a/Kernel/HALKit/AMD64/HalBoot.asm
+++ b/Kernel/HALKit/AMD64/HalBoot.asm
@@ -23,3 +23,10 @@ HandoverType: dw kTypeKernel
HandoverArch: dw kArchAmd64
;; This NewBootStart points to Main.
HandoverStart: dq hal_init_platform
+
+section .text
+
+[global ke_startup_platform]
+
+ke_startup_platform:
+ ret \ No newline at end of file
diff --git a/Kernel/KernelKit/ProcessScheduler.hxx b/Kernel/KernelKit/ProcessScheduler.hxx
index a6d55c24..4b149a52 100644
--- a/Kernel/KernelKit/ProcessScheduler.hxx
+++ b/Kernel/KernelKit/ProcessScheduler.hxx
@@ -208,7 +208,7 @@ namespace Kernel
//! @return Int32 local error code.
Int32& GetLocalCode() noexcept;
- const ProcessLevelRing& GetSelector() noexcept;
+ const ProcessLevelRing& GetLevelRing() noexcept;
const ProcessStatus& GetStatus() noexcept;
const AffinityKind& GetAffinity() noexcept;
diff --git a/Kernel/KernelRsrc.rsrc b/Kernel/KernelRsrc.rsrc
index 5a6f41ee..4cf7e352 100644
--- a/Kernel/KernelRsrc.rsrc
+++ b/Kernel/KernelRsrc.rsrc
@@ -15,7 +15,7 @@ BEGIN
VALUE "FileVersion", KERNEL_VERSION
VALUE "InternalName", "newoskrnl"
VALUE "LegalCopyright", "(c) ZKA Technologies, all rights reserved."
- VALUE "OriginalFilename", "newoskrnl.exe"
+ VALUE "OriginalFilename", "newoskrnl.dll"
VALUE "ProductName", "newoskrnl"
VALUE "ProductVersion", KERNEL_VERSION
END
diff --git a/Kernel/Linker/16x0.json b/Kernel/Linker/16x0.json
index fd7f167a..9c284b53 100644
--- a/Kernel/Linker/16x0.json
+++ b/Kernel/Linker/16x0.json
@@ -1,7 +1,7 @@
{
"linker": "link.exe",
"executable_type": "kernel",
- "output_name": "newoskrnl.exe",
+ "output_name": "newoskrnl.dll",
"start_proc": "__ImageStart",
"arch": "16x0",
"format": "PEF"
diff --git a/Kernel/Linker/32x0.json b/Kernel/Linker/32x0.json
index a827de05..05a3db9b 100644
--- a/Kernel/Linker/32x0.json
+++ b/Kernel/Linker/32x0.json
@@ -1,7 +1,7 @@
{
"linker": "link.exe",
"executable_type": "kernel",
- "output_name": "newoskrnl.exe",
+ "output_name": "newoskrnl.dll",
"start_proc": "__ImageStart",
"arch": "32x0",
"format": "PEF"
diff --git a/Kernel/Linker/64x0.json b/Kernel/Linker/64x0.json
index f1a6611e..c1d0e388 100644
--- a/Kernel/Linker/64x0.json
+++ b/Kernel/Linker/64x0.json
@@ -1,7 +1,7 @@
{
"linker": "link.exe",
"executable_type": "kernel",
- "output_name": "newoskrnl.exe",
+ "output_name": "newoskrnl.dll",
"start_proc": "__ImageStart",
"arch": "64x0",
"format": "PEF"
diff --git a/Kernel/Linker/arm64.json b/Kernel/Linker/arm64.json
index eb7ff4d2..99c190bf 100644
--- a/Kernel/Linker/arm64.json
+++ b/Kernel/Linker/arm64.json
@@ -1,7 +1,7 @@
{
"linker": "link.exe",
"executable_type": "kernel",
- "output_name": "newoskrnl.exe",
+ "output_name": "newoskrnl.dll",
"start_proc": "__ImageStart",
"arch": "arm64",
"format": "PEF"
diff --git a/Kernel/Modules/GL/.keepme b/Kernel/Modules/GL/.keepme
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Kernel/Modules/GL/.keepme
diff --git a/Kernel/NewKit/Defines.hxx b/Kernel/NewKit/Defines.hxx
index a934494d..54bf55a2 100644
--- a/Kernel/NewKit/Defines.hxx
+++ b/Kernel/NewKit/Defines.hxx
@@ -11,7 +11,7 @@
#define NEWKIT_VERSION "1.01"
#if !defined(_INC_NO_STDC_HEADERS) && defined(__GNUC__)
-#include <CRT/__mpcc_defines.hxx>
+#include <CRTKit/__mpcc_defines.hxx>
#endif
#ifdef __has_feature
diff --git a/Kernel/Sources/FS/NewFS.cxx b/Kernel/Sources/FS/NewFS.cxx
index f9b08bcf..c5b9c1e3 100644
--- a/Kernel/Sources/FS/NewFS.cxx
+++ b/Kernel/Sources/FS/NewFS.cxx
@@ -23,7 +23,7 @@ using namespace Kernel;
#ifdef __ED__
/**
- Define those external symbols, to make the editor shutup
+ Define those external symbols, to make the editor shutup
*/
/// @brief get sector count.
@@ -34,7 +34,6 @@ Kernel::SizeT drv_std_get_drv_size();
#endif
-
///! BUGS: 0
/***********************************************************************************/
@@ -53,7 +52,7 @@ STATIC MountpointInterface sMountpointInterface;
/// @param theFork the fork itself.
/// @return the fork
_Output NFS_FORK_STRUCT* NewFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catalog,
- _Input NFS_FORK_STRUCT& theFork)
+ _Input NFS_FORK_STRUCT& theFork)
{
if (!sMountpointInterface.GetAddressOf(this->fDriveIndex))
return nullptr;
@@ -77,7 +76,7 @@ _Output NFS_FORK_STRUCT* NewFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* cata
NFS_FORK_STRUCT curFork{0};
NFS_FORK_STRUCT prevFork{0};
- Lba lbaOfPreviousFork = lba;
+ Lba lbaOfPreviousFork = lba;
/// do not check for anything. Loop until we get what we want, that is a free fork zone.
while (true)
@@ -160,10 +159,10 @@ _Output NFS_FORK_STRUCT* NewFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* cata
/// @param name the fork name.
/// @return the fork.
_Output NFS_FORK_STRUCT* NewFSParser::FindFork(_Input NFS_CATALOG_STRUCT* catalog,
- _Input const Char* name,
- Boolean isDataFork)
+ _Input const Char* name,
+ Boolean isDataFork)
{
- auto drv = sMountpointInterface.GetAddressOf(this->fDriveIndex);
+ auto drv = sMountpointInterface.GetAddressOf(this->fDriveIndex);
NFS_FORK_STRUCT* theFork = nullptr;
Lba lba = isDataFork ? catalog->DataFork : catalog->ResourceFork;
@@ -223,8 +222,8 @@ _Output NFS_CATALOG_STRUCT* NewFSParser::CreateCatalog(_Input const char* name)
/// @param kind the catalog kind.
/// @return catalog pointer.
_Output NFS_CATALOG_STRUCT* NewFSParser::CreateCatalog(_Input const char* name,
- _Input const Int32& flags,
- _Input const Int32& kind)
+ _Input const Int32& flags,
+ _Input const Int32& kind)
{
if (!sMountpointInterface.GetAddressOf(this->fDriveIndex))
return nullptr;
@@ -447,8 +446,12 @@ _Output NFS_CATALOG_STRUCT* NewFSParser::CreateCatalog(_Input const char* name,
/// @brief Make a EPM+NewFS drive out of the disk.
/// @param drive The drive to write on.
/// @return If it was sucessful, see ErrLocal().
-bool NewFSParser::Format(_Input _Output DriveTrait* drive)
+bool NewFSParser::Format(_Input _Output DriveTrait* drive, _Input const Lba endLba, _Input const Int32 flags, const Char* part_name)
{
+ if (*part_name == 0 ||
+ endLba == 0)
+ return false;
+
// verify disk.
drive->fVerify(&drive->fPacket);
@@ -464,14 +467,78 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive)
Char sectorBuf[kNewFSSectorSz] = {0};
+ Lba start = kNewFSStartLba;
+
drive->fPacket.fPacketContent = sectorBuf;
drive->fPacket.fPacketSize = kNewFSSectorSz;
- drive->fPacket.fLba = kNewFSStartLba;
+ drive->fPacket.fLba = start;
drive->fInput(&drive->fPacket);
+ if (flags & kNewFSPartitionTypeBoot)
+ {
+ // make it bootable when needed.
+ Char bufEpmHdr[kNewFSSectorSz] = {0};
+
+ BOOT_BLOCK_STRUCT* epmBoot = (BOOT_BLOCK_STRUCT*)bufEpmHdr;
+
+ constexpr auto cFsName = "NewFS";
+ constexpr auto cBlockName = "ZKA:";
+
+ rt_copy_memory(reinterpret_cast<VoidPtr>(const_cast<Char*>(cFsName)), epmBoot->Fs, rt_string_len(cFsName));
+
+ epmBoot->FsVersion = kNewFSVersionInteger;
+ epmBoot->LbaStart = 0;
+ epmBoot->SectorSz = kNewFSSectorSz;
+
+ rt_copy_memory(reinterpret_cast<VoidPtr>(const_cast<Char*>(cBlockName)), epmBoot->Name, rt_string_len(cBlockName));
+ rt_copy_memory(reinterpret_cast<VoidPtr>(const_cast<Char*>(kEPMMagic)), epmBoot->Magic, rt_string_len(kEPMMagic));
+
+ Lba outEpmLba = kEpmBase;
+
+ Char buf[kNewFSSectorSz];
+
+ Lba prevStart = 0;
+ SizeT cnt = 0;
+
+ while (drive->fPacket.fPacketGood)
+ {
+ drive->fPacket.fPacketContent = buf;
+ drive->fPacket.fPacketSize = kNewFSSectorSz;
+ drive->fPacket.fLba = outEpmLba;
+
+ drive->fInput(&drive->fPacket);
+
+ if (buf[0] == 0)
+ {
+ epmBoot->LbaStart = prevStart;
+
+ if (epmBoot->LbaStart)
+ epmBoot->LbaStart = outEpmLba;
+
+ epmBoot->LbaEnd = endLba;
+ epmBoot->NumBlocks = cnt;
+
+ drive->fPacket.fPacketContent = bufEpmHdr;
+ drive->fPacket.fPacketSize = kNewFSSectorSz;
+ drive->fPacket.fLba = outEpmLba;
+
+ drive->fOutput(&drive->fPacket);
+
+ break;
+ }
+ else
+ {
+ prevStart = ((BOOT_BLOCK_STRUCT*)buf)->LbaStart + ((BOOT_BLOCK_STRUCT*)buf)->LbaEnd;
+ }
+
+ outEpmLba += sizeof(BOOT_BLOCK_STRUCT);
+ ++cnt;
+ }
+ }
+
// disk isnt faulty and data has been fetched.
- if (drive->fPacket.fPacketGood)
+ while (drive->fPacket.fPacketGood)
{
NFS_ROOT_PARTITION_BLOCK* partBlock = (NFS_ROOT_PARTITION_BLOCK*)sectorBuf;
@@ -483,7 +550,7 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive)
partBlock->Version = kNewFSVersionInteger;
- const auto cUntitledHD = "Untitled HD\0";
+ const auto cUntitledHD = part_name;
rt_copy_memory((VoidPtr)kNewFSIdent, (VoidPtr)partBlock->Ident,
kNewFSIdentLen);
@@ -522,40 +589,18 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive)
// write the root catalog.
this->CreateCatalog(kNewFSRoot, 0, kNewFSCatalogKindDir);
- if (partBlock->Flags & kNewFSPartitionTypeBoot)
- {
- // make it bootable when needed.
- Char bufEpmHdr[kNewFSSectorSz] = {0};
-
- BOOT_BLOCK_STRUCT* epmBoot = (BOOT_BLOCK_STRUCT*)bufEpmHdr;
-
- constexpr auto cFsName = "NewFS";
- constexpr auto cBlockName = "Zeta:";
-
- rt_copy_memory(reinterpret_cast<VoidPtr>(const_cast<Char*>(cFsName)), epmBoot->Fs, rt_string_len(cFsName));
-
- epmBoot->FsVersion = kNewFSVersionInteger;
- epmBoot->LbaStart = kNewFSStartLba;
- epmBoot->SectorSz = partBlock->SectorSize;
- epmBoot->NumBlocks = partBlock->CatalogCount;
-
- rt_copy_memory(reinterpret_cast<VoidPtr>(const_cast<Char*>(cBlockName)), epmBoot->Name, rt_string_len(cBlockName));
- rt_copy_memory(reinterpret_cast<VoidPtr>(const_cast<Char*>(kEPMMagic)), epmBoot->Magic, rt_string_len(kEPMMagic));
-
- drive->fPacket.fPacketContent = bufEpmHdr;
- drive->fPacket.fPacketSize = (epmBoot->SectorSz);
- drive->fPacket.fLba = kEpmBase;
-
- drive->fOutput(&drive->fPacket);
- }
-
return true;
}
kcout << "newoskrnl: partition block already exists.\r";
- // return success as well, do not ignore that partition.
- return true;
+ start += partBlock->DiskSize;
+
+ drive->fPacket.fPacketContent = sectorBuf;
+ drive->fPacket.fPacketSize = kNewFSSectorSz;
+ drive->fPacket.fLba = start;
+
+ drive->fInput(&drive->fPacket);
}
return false;
@@ -650,7 +695,7 @@ bool NewFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, voidP
/// @param catalogName the catalog name.
/// @return the newly found catalog.
_Output NFS_CATALOG_STRUCT* NewFSParser::FindCatalog(_Input const char* catalogName,
- Lba& outLba)
+ Lba& outLba)
{
if (!sMountpointInterface.GetAddressOf(this->fDriveIndex))
return nullptr;
@@ -823,7 +868,7 @@ Boolean NewFSParser::RemoveCatalog(_Input const Char* catalogName)
drive->fPacket.fLba = outLba; // the catalog position.
drive->fPacket.fPacketSize =
- sizeof(NFS_CATALOG_STRUCT); // size of catalog. roughly the sector size.
+ sizeof(NFS_CATALOG_STRUCT); // size of catalog. roughly the sector size.
drive->fPacket.fPacketContent = catalog; // the catalog itself.
drive->fOutput(&drive->fPacket); // send packet.
@@ -863,8 +908,8 @@ Boolean NewFSParser::RemoveCatalog(_Input const Char* catalogName)
/***********************************************************************************/
VoidPtr NewFSParser::ReadCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog,
- _Input SizeT dataSz,
- _Input const char* forkName)
+ _Input SizeT dataSz,
+ _Input const char* forkName)
{
if (!catalog)
{
diff --git a/Kernel/Sources/ProcessScheduler.cxx b/Kernel/Sources/ProcessScheduler.cxx
index 55017c83..c004e932 100644
--- a/Kernel/Sources/ProcessScheduler.cxx
+++ b/Kernel/Sources/ProcessScheduler.cxx
@@ -151,7 +151,7 @@ namespace Kernel
}
/// @brief process selector getter.
- const ProcessSelector& PROCESS_HEADER_BLOCK::GetSelector() noexcept
+ const ProcessLevelRing& PROCESS_HEADER_BLOCK::GetLevelRing() noexcept
{
return this->Selector;
}
diff --git a/Kernel/amd64-efi.make b/Kernel/amd64-efi.make
index 22e958b7..6546d12d 100644
--- a/Kernel/amd64-efi.make
+++ b/Kernel/amd64-efi.make
@@ -5,9 +5,9 @@
CC = x86_64-w64-mingw32-g++
LD = x86_64-w64-mingw32-ld
-CCFLAGS = -fshort-wchar -c -fPIC -ffreestanding -D__NEWOS_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \
+CCFLAGS = -fshort-wchar -c -shared -ffreestanding -fPIC -D__NEWOS_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \
-std=c++20 -D__NEWOS_SUPPORT_NX__ -I../Vendor -D__FSKIT_USE_NEWFS__ \
- -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I./
+ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I./ -I../
ASM = nasm
@@ -35,11 +35,11 @@ COPY = cp
ASMFLAGS = -f win64
# Kernel subsystem is 17 and entrypoint is __ImageStart
-LDFLAGS = -e hal_init_platform --subsystem=17
+LDFLAGS = -e ke_startup_platform --subsystem=17
LDOBJ = Objects/*.obj
# This file is the kernel, responsible of task management and memory.
-KERNEL = newoskrnl.exe
+KERNEL = newoskrnl.dll
.PHONY: error
error:
diff --git a/Kernel/arm64-efi.make b/Kernel/arm64-efi.make
index 310ffcdd..6518356f 100644
--- a/Kernel/arm64-efi.make
+++ b/Kernel/arm64-efi.make
@@ -7,7 +7,7 @@ CC = clang++
LD = lld-link
CCFLAGS = -fshort-wchar -c -ffreestanding -MMD -mno-red-zone -D__NEWOS_ARM64__ -fno-rtti -fno-exceptions -I./ \
-target aarch64-unknown-windows \
- -std=c++20 -D__FSKIT_USE_NEWFS__ -D__ZETA_MACHINE__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__
+ -std=c++20 -D__FSKIT_USE_NEWFS__ -D__ZETA_MACHINE__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../
ASM = clang++
@@ -27,7 +27,7 @@ LDFLAGS = -subsystem:efi_application -entry:hal_init_platform /nodefaultlib
LDOBJ = Objects/*.obj
# This file is the kernel, responsible of task management and memory.
-KERNEL = newoskrnl.exe
+KERNEL = newoskrnl.dll
.PHONY: error
error: