summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/HPFS/Sources/IFSMain.rs12
-rw-r--r--dev/HPFS/X64/EBS.asm27
-rw-r--r--dev/HPFS/hpfs.json2
-rw-r--r--dev/HPFS/hpfs_main.rs10
-rw-r--r--dev/ZBA/BootKit/BootKit.hxx4
-rw-r--r--dev/ZBA/Sources/HEL/AMD64/BootTextWriter.cxx9
-rw-r--r--dev/ZBA/amd64-efi.make2
-rw-r--r--dev/ZKA/FSKit/HPFS.hxx (renamed from dev/ZKA/FSKit/FAT32.hxx)4
-rw-r--r--dev/ZKA/FSKit/NeFS.hxx13
-rw-r--r--dev/ZKA/KernelKit/FileMgr.hxx8
-rw-r--r--dev/ZKA/KernelKit/PEFCodeMgr.hxx4
-rw-r--r--dev/ZKA/NewKit/Macros.hxx2
-rw-r--r--dev/ZKA/Sources/DLLMain.cxx97
-rw-r--r--dev/ZKA/Sources/DriveMgr.cxx10
-rw-r--r--dev/ZKA/Sources/FS/FAT32.cxx4
-rw-r--r--dev/ZKA/Sources/FS/NeFS.cxx28
-rw-r--r--dev/ZKA/Sources/FileMgr.cxx4
-rw-r--r--dev/ZKA/Sources/NeFS+FileMgr.cxx (renamed from dev/ZKA/Sources/NewFS+FileMgr.cxx)4
-rw-r--r--dev/ZKA/Sources/NeFS+IO.cxx (renamed from dev/ZKA/Sources/NewFS+IO.cxx)24
-rw-r--r--dev/ZKA/Sources/NewFS+Journal.cxx22
-rw-r--r--dev/ZKA/Sources/UserProcessScheduler.cxx23
-rw-r--r--dev/ZKA/Sources/compile_flags.txt2
-rw-r--r--dev/ZKA/amd64-efi.make2
-rw-r--r--dev/ZKA/arm64-efi.make2
24 files changed, 114 insertions, 205 deletions
diff --git a/dev/HPFS/Sources/IFSMain.rs b/dev/HPFS/Sources/IFSMain.rs
new file mode 100644
index 00000000..5a49585a
--- /dev/null
+++ b/dev/HPFS/Sources/IFSMain.rs
@@ -0,0 +1,12 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies.
+
+ FILE: IFSMain.rs
+ PURPOSE: HPFS IFS.
+
+------------------------------------------- */
+
+fn IFSStart() {
+
+} \ No newline at end of file
diff --git a/dev/HPFS/X64/EBS.asm b/dev/HPFS/X64/EBS.asm
index f42098a2..3c55825b 100644
--- a/dev/HPFS/X64/EBS.asm
+++ b/dev/HPFS/X64/EBS.asm
@@ -1,25 +1,28 @@
;; FILE: EBS.asm
-;; PURPOSE: EXPLICIT BOOT SECTOR OF HPFS.
+;; PURPOSE: EXPLICIT BOOT SECTOR STRUCTURE (HPFS RELATED).
;; AUTHOR: AMLAL EL MAHROUSS
-;; THIS IS PART OF THE HPFS FOR AMD64 FILESYSTEM PACKAGE.
[bits 64]
-;; WRITE THIS A BLOB TO THEN DUMP INTO DISK.
+;; DUMP THIS BLOB TO DISK, WHEN FORMATTING THE SSD.
HPFS_EBS_HEADER:
- db " HPFS", 0 ;; MAGIC NUMBER OF FILESYSTEM
+ db "HPFS ", 0 ;; MAGIC NUMBER OF FILESYSTEM
+ dq 0 ;; RESERVED 4
dw 1 ;; VERSION
dw 0 ;; PARTITION TYPE
+ dq 0 ;; RESERVED 3
dw 0 ;; DISK TYPE (INVALID = 0, CDROM = 1, SSD = 2, USB = 3)
dw 0 ;; CHECKSUM OF PARTITION
dw 0 ;; IS IT LOCKED? (DISK ENCRYPTION ON?)
dq 0 ;; SECTOR COUNT
- dw 512 ;; SECTOR SZ
- dq 0 ;; KERNEL FILE RECORD LBA
- dq 0 ;; KERNEL FILE RECORD SIZE
-;; READ LAST, WHEN KERNEL LBA IS READ.
-HPFS_EBS_JUMP_FIELD:
- nop
- nop
- jmp 0x4000000 ;; OS JUMP FIELD, OS SHOULD BE AT THAT LOCATION \ No newline at end of file
+ dq 0 ;; RESERVED 2
+ dq 512 ;; SECTOR SZ
+ dq 0 ;; DISK SIZE
+ dq 0 ;; RESERVED 1
+ dq 0 ;; LOCKER ON?
+ dq 0 ;; PARTITION MAP TYPE (GPT, MBR, EPM)
+ dq 0 ;; MASTER FILE TABLE
+ dq 0 ;; MASTER TRACE TABLE
+ dq 0 ;; MASTER DIRECTORY TABLE
+ dw 0xFFFF ;; END OF HEADER WORD \ No newline at end of file
diff --git a/dev/HPFS/hpfs.json b/dev/HPFS/hpfs.json
index 1098dfd3..3a13297b 100644
--- a/dev/HPFS/hpfs.json
+++ b/dev/HPFS/hpfs.json
@@ -1,7 +1,7 @@
{
"compiler_path": "rustc",
"compiler_std": "",
- "sources_path": ["*.rs"],
+ "sources_path": ["Sources/*.rs"],
"output_name": "hpfs.sys",
"compiler_flags": [
],
diff --git a/dev/HPFS/hpfs_main.rs b/dev/HPFS/hpfs_main.rs
deleted file mode 100644
index ed66d175..00000000
--- a/dev/HPFS/hpfs_main.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Created on Thu Sep 05 2024
- *
- * Copyright (c) 2024 ZKA Technologies.
- */
-
-fn main() {
- println!("ZKA High Performance File System Driver for ZKA/OS.");
- println!("Copyright ZKA technologies, all rights reserved.");
-} \ No newline at end of file
diff --git a/dev/ZBA/BootKit/BootKit.hxx b/dev/ZBA/BootKit/BootKit.hxx
index 3732ea8d..3f7b0a96 100644
--- a/dev/ZBA/BootKit/BootKit.hxx
+++ b/dev/ZBA/BootKit/BootKit.hxx
@@ -236,7 +236,7 @@ public:
return false;
}
- writer.Write(L"newosldr: Disk size: ").Write(this->fDiskDev.GetDiskSize()).Write(L"\r");
+ writer.Write(L"newosldr: Disk is ").Write(GIB(this->fDiskDev.GetDiskSize())).Write(L" GB.\r");
if (blockPart->DiskSize != this->fDiskDev.GetDiskSize() ||
blockPart->DiskSize < 1 ||
@@ -251,7 +251,7 @@ public:
return false;
}
- writer.Write(L"newosldr: Partition name: ").Write(blockPart->PartitionName).Write(L" is healthy.\r");
+ writer.Write(L"newosldr: Partition: ").Write(blockPart->PartitionName).Write(L" is healthy.\r");
return true;
}
diff --git a/dev/ZBA/Sources/HEL/AMD64/BootTextWriter.cxx b/dev/ZBA/Sources/HEL/AMD64/BootTextWriter.cxx
index 467f4303..d43be468 100644
--- a/dev/ZBA/Sources/HEL/AMD64/BootTextWriter.cxx
+++ b/dev/ZBA/Sources/HEL/AMD64/BootTextWriter.cxx
@@ -134,7 +134,6 @@ BTextWriter& BTextWriter::WriteCharacter(CharacterTypeUTF16 c)
BTextWriter& BTextWriter::Write(const Long& x)
{
#ifdef __DEBUG__
- this->Write(L"0x");
this->_Write(x);
#endif // ifdef __DEBUG__
@@ -145,14 +144,14 @@ BTextWriter& BTextWriter::Write(const Long& x)
BTextWriter& BTextWriter::_Write(const Long& x)
{
#ifdef __DEBUG__
- UInt64 y = (x > 0 ? x : -x) / 16;
- UInt64 h = (x > 0 ? x : -x) % 16;
+ UInt64 y = (x > 0 ? x : -x) / 10;
+ UInt64 h = (x > 0 ? x : -x) % 10;
if (y)
this->_Write(y);
/* fail if the hex number is not base-16 */
- if (h > 15)
+ if (h > 10)
{
this->WriteCharacter('?');
return *this;
@@ -161,7 +160,7 @@ BTextWriter& BTextWriter::_Write(const Long& x)
if (y < 0)
y = -y;
- const char cNumbers[17] = "0123456789ABCDEF";
+ const char cNumbers[] = "0123456789";
this->WriteCharacter(cNumbers[h]);
#endif // ifdef __DEBUG__
diff --git a/dev/ZBA/amd64-efi.make b/dev/ZBA/amd64-efi.make
index 5d5071e0..1f8bf1b1 100644
--- a/dev/ZBA/amd64-efi.make
+++ b/dev/ZBA/amd64-efi.make
@@ -36,7 +36,7 @@ EMU_FLAGS=-net none -m 8G -M q35 \
file=fat:rw:Sources/Root/,index=2,format=raw \
-drive id=disk_2,file=$(IMG_2),if=none \
-device ahci,id=ahci \
- -device ide-hd,drive=disk_2,bus=ahci.0 -d int
+ -device ide-hd,drive=disk_2,bus=ahci.0 -serial stdio -no-reboot
LD_FLAGS=-e Main --subsystem=10
diff --git a/dev/ZKA/FSKit/FAT32.hxx b/dev/ZKA/FSKit/HPFS.hxx
index 04fa0c6d..6f5ff3f4 100644
--- a/dev/ZKA/FSKit/FAT32.hxx
+++ b/dev/ZKA/FSKit/HPFS.hxx
@@ -8,5 +8,5 @@
#include <NewKit/Defines.hxx>
-/// @file FAT32.hxx
-/// @brief FAT32 support. \ No newline at end of file
+/// @file HPFS.hxx
+/// @brief HPFS support. \ No newline at end of file
diff --git a/dev/ZKA/FSKit/NeFS.hxx b/dev/ZKA/FSKit/NeFS.hxx
index d1c0c9c7..2bf17863 100644
--- a/dev/ZKA/FSKit/NeFS.hxx
+++ b/dev/ZKA/FSKit/NeFS.hxx
@@ -3,7 +3,7 @@
Copyright ZKA Technologies.
FILE: NeFS.hxx
- PURPOSE: NeFS (New FileSystem) kernel support.
+ PURPOSE: NeFS (New FileSystem) support, can be used with kernel, HPFS is preferred.
Revision History:
@@ -31,11 +31,11 @@ default.
#define kNeFSNodeNameLen (256)
#define kNeFSSectorSz (512)
-#define kNeFSForkDataSz (gib_cast(16))
+#define kNeFSForkDataSz (kib_cast(8))
#define kNeFSIdentLen (8)
-#define kNeFSIdent " NewFS"
-#define kNeFSPadLen (400)
+#define kNeFSIdent " NeFS"
+#define kNeFSPadLen (392)
#define kNeFSMetaFilePrefix '$'
@@ -69,8 +69,9 @@ default.
#define kNeFSCatalogKindLock (10)
#define kNeFSCatalogKindRLE (11)
-
#define kNeFSCatalogKindMetaFile (12)
+#define kNeFSCatalogKindTTF (13)
+#define kNeFSCatalogKindRIFF (14)
#define kNeFSSeparator '\\'
#define kNeFSSeparatorAlt '/'
@@ -193,7 +194,7 @@ struct PACKED NFS_ROOT_PARTITION_BLOCK final
Kernel::Lba EpmBlock;
- Kernel::Char Pad[kNeFSPadLen - sizeof(Kernel::Lba)];
+ Kernel::Char Pad[kNeFSPadLen];
};
namespace Kernel
diff --git a/dev/ZKA/KernelKit/FileMgr.hxx b/dev/ZKA/KernelKit/FileMgr.hxx
index a46216db..86eade6a 100644
--- a/dev/ZKA/KernelKit/FileMgr.hxx
+++ b/dev/ZKA/KernelKit/FileMgr.hxx
@@ -19,9 +19,9 @@
#pragma once
-#ifdef __FSKIT_USE_NEWFS__
+#ifdef __FSKIT_USE_NEFS__
#include <FSKit/NeFS.hxx>
-#endif // __FSKIT_USE_NEWFS__
+#endif // __FSKIT_USE_NEFS__
#include <CompilerKit/CompilerKit.hxx>
#include <HintKit/CompilerHint.hxx>
@@ -135,7 +135,7 @@ namespace Kernel
virtual bool Rewind(_Input NodePtr node) = 0;
};
-#ifdef __FSKIT_USE_NEWFS__
+#ifdef __FSKIT_USE_NEFS__
/**
* @brief Based of FilesystemMgrInterface, takes care of managing NeFS
* disks.
@@ -184,7 +184,7 @@ namespace Kernel
NeFSParser* fImpl{nullptr};
};
-#endif // ifdef __FSKIT_USE_NEWFS__
+#endif // ifdef __FSKIT_USE_NEFS__
/**
* Usable FileStream
diff --git a/dev/ZKA/KernelKit/PEFCodeMgr.hxx b/dev/ZKA/KernelKit/PEFCodeMgr.hxx
index 74cc8eb0..c2938fae 100644
--- a/dev/ZKA/KernelKit/PEFCodeMgr.hxx
+++ b/dev/ZKA/KernelKit/PEFCodeMgr.hxx
@@ -46,11 +46,11 @@ namespace Kernel
bool IsLoaded() noexcept;
private:
-#ifdef __FSKIT_USE_NEWFS__
+#ifdef __FSKIT_USE_NEFS__
OwnPtr<FileStream<Char, NewFilesystemMgr>> fFile;
#else
OwnPtr<FileStream<Char>> fFile;
-#endif // __FSKIT_USE_NEWFS__
+#endif // __FSKIT_USE_NEFS__
Ref<StringView> fPath;
VoidPtr fCachedBlob;
diff --git a/dev/ZKA/NewKit/Macros.hxx b/dev/ZKA/NewKit/Macros.hxx
index 0de25216..b20ddb8a 100644
--- a/dev/ZKA/NewKit/Macros.hxx
+++ b/dev/ZKA/NewKit/Macros.hxx
@@ -126,5 +126,3 @@
/// @brief The main kernel file.
#define kSysChime "\\System\\startup.wav"
-/// @brief The main kernel file.
-#define kSysKrnl "\\System\\newoskrnl.exe"
diff --git a/dev/ZKA/Sources/DLLMain.cxx b/dev/ZKA/Sources/DLLMain.cxx
index 0fa3a181..2aed9bf7 100644
--- a/dev/ZKA/Sources/DLLMain.cxx
+++ b/dev/ZKA/Sources/DLLMain.cxx
@@ -79,8 +79,8 @@ namespace Kernel::Detail
if (catalogDir)
{
- CG::CGDrawStringToWnd(cKernelWnd, "Catalog directory already exists: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0));
- CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Catalog directory already exists: ")), RGB(0, 0, 0));
+ CG::CGDrawStringToWnd(cKernelWnd, "Directory already exists: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0));
+ CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory already exists: ")), RGB(0, 0, 0));
delete catalogDir;
continue;
@@ -89,101 +89,12 @@ namespace Kernel::Detail
catalogDir = fNeFS->GetParser()->CreateCatalog(cDirStr[dirIndx], 0,
kNeFSCatalogKindDir);
- CG::CGDrawStringToWnd(cKernelWnd, "Catalog directory has been created: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0));
- CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Catalog directory has been created: ")), RGB(0, 0, 0));
+ CG::CGDrawStringToWnd(cKernelWnd, "Directory has been created: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0));
+ CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory has been created: ")), RGB(0, 0, 0));
delete catalogDir;
}
}
-
- constexpr auto cFileToFormatCnt = 5;
-
- struct
- {
- VoidPtr fBlob;
- Size fBlobSz;
- Int32 fFlags;
- Char fName[kNeFSNodeNameLen];
- } cFiles[cFileToFormatCnt] = {
- {
- .fBlob = kHandoverHeader->f_KernelImage,
- .fBlobSz = kHandoverHeader->f_KernelSz,
- .fFlags = kNeFSCatalogKindExecutable,
- .fName = kSysKrnl,
- },
- {
- .fBlob = kHandoverHeader->f_StartupImage,
- .fBlobSz = kHandoverHeader->f_StartupSz,
- .fFlags = kNeFSCatalogKindExecutable,
- .fName = kSysDrv,
- },
- {
- .fBlob = 0,
- .fBlobSz = mib_cast(32),
- .fFlags = kNeFSCatalogKindPage,
- .fName = kSysPage,
- },
- {
- .fBlob = kHandoverHeader->f_TTFallbackFont,
- .fBlobSz = kHandoverHeader->f_FontSz,
- .fFlags = kNeFSCatalogKindResource,
- .fName = kSysTTF,
- },
- {
- .fBlob = kHandoverHeader->f_StartupChime,
- .fBlobSz = kHandoverHeader->f_ChimeSz,
- .fFlags = kNeFSCatalogKindResource,
- .fName = kSysChime,
- }
-
- };
-
- for (size_t i = 0; i < cFileToFormatCnt; i++)
- {
- NFS_CATALOG_STRUCT* catalogDisk =
- this->fNeFS->GetParser()->GetCatalog(cFiles[i].fName);
-
- const Kernel::Char* cSrcName = cFiles[i].fName;
-
- if (catalogDisk)
- {
- CG::CGDrawStringToWnd(cKernelWnd, "File already exists: ", 10 + (10 * (cDirCount + i + 1)), 10, RGB(0, 0, 0));
- CG::CGDrawStringToWnd(cKernelWnd, cFiles[i].fName, 10 + (10 * (cDirCount + i+ 1)), 10 + (FONT_SIZE_X * rt_string_len("File already exists: ")), RGB(0, 0, 0));
-
- delete catalogDisk;
- }
- else
- {
- CG::CGDrawStringToWnd(cKernelWnd, "File created: ", 10 + (10 * (cDirCount + i+ 1)), 10, RGB(0, 0, 0));
- CG::CGDrawStringToWnd(cKernelWnd, cFiles[i].fName, 10 + (10 * (cDirCount + i + 1)), 10 + (FONT_SIZE_X * rt_string_len("File created: ")), RGB(0, 0, 0));
-
- catalogDisk =
- (NFS_CATALOG_STRUCT*)this->Leak()->CreateSwapFile(cFiles[i].fName);
-
- NFS_FORK_STRUCT theDiskFork{0};
-
- Kernel::rt_copy_memory((Kernel::VoidPtr)(cSrcName), theDiskFork.ForkName,
- Kernel::rt_string_len(cSrcName));
-
- Kernel::rt_copy_memory((Kernel::VoidPtr)(catalogDisk->Name),
- theDiskFork.CatalogName,
- Kernel::rt_string_len(catalogDisk->Name));
-
- theDiskFork.DataSize = cFiles[i].fBlobSz;
- theDiskFork.ResourceId = cFiles[i].fFlags;
- theDiskFork.ResourceKind = Kernel::kNeFSDataForkKind;
- theDiskFork.Kind = Kernel::kNeFSDataForkKind;
-
- fNeFS->GetParser()->CreateFork(catalogDisk, theDiskFork);
-
- if (theDiskFork.ResourceId != kNeFSCatalogKindPage)
- {
- fNeFS->GetParser()->WriteCatalog(catalogDisk, false, cFiles[i].fBlob, cFiles[i].fBlobSz, theDiskFork.ForkName);
- }
-
- delete catalogDisk;
- }
- }
}
~FilesystemInstaller() = default;
diff --git a/dev/ZKA/Sources/DriveMgr.cxx b/dev/ZKA/Sources/DriveMgr.cxx
index e39c9c33..5d0f7fc3 100644
--- a/dev/ZKA/Sources/DriveMgr.cxx
+++ b/dev/ZKA/Sources/DriveMgr.cxx
@@ -6,17 +6,20 @@
#include <KernelKit/DebugOutput.hxx>
#include <KernelKit/DriveMgr.hxx>
+#include <NewKit/Utils.hxx>
+
+
#include <Modules/ATA/ATA.hxx>
#include <Modules/AHCI/AHCI.hxx>
-#include <NewKit/Utils.hxx>
+#include <Modules/NVME/Defines.hxx>
/// @file DriveMgr.cxx
/// @brief Kernel drive manager.
namespace Kernel
{
- static UInt16 kATAIO = 0U;
- static UInt8 kATAMaster = 0U;
+ STATIC UInt16 kATAIO = 0U;
+ STATIC UInt8 kATAMaster = 0U;
/// @brief reads from an ATA drive.
/// @param pckt
@@ -106,6 +109,7 @@ namespace Kernel
/// @return
Void io_drv_unimplemented(DriveTrait::DrivePacket* pckt)
{
+ ZKA_UNUSED(pckt);
}
/// @brief Makes a new drive.
diff --git a/dev/ZKA/Sources/FS/FAT32.cxx b/dev/ZKA/Sources/FS/FAT32.cxx
index 1f5e194b..9e22e2a8 100644
--- a/dev/ZKA/Sources/FS/FAT32.cxx
+++ b/dev/ZKA/Sources/FS/FAT32.cxx
@@ -4,9 +4,9 @@
------------------------------------------- */
-#ifdef __FSKIT_INCLUDES_FAT32__
+#ifdef __FSKIT_INCLUDES_HPFS__
#include <FirmwareKit/GPT.hxx>
#include <FirmwareKit/EPM.hxx>
-#endif // ifdef __FSKIT_INCLUDES_FAT32__
+#endif // ifdef __FSKIT_INCLUDES_HPFS__
diff --git a/dev/ZKA/Sources/FS/NeFS.cxx b/dev/ZKA/Sources/FS/NeFS.cxx
index 5bae8d4a..68078ec3 100644
--- a/dev/ZKA/Sources/FS/NeFS.cxx
+++ b/dev/ZKA/Sources/FS/NeFS.cxx
@@ -4,7 +4,7 @@
------------------------------------------- */
-#ifdef __FSKIT_USE_NEWFS__
+#ifdef __FSKIT_USE_NEFS__
#include <Modules/AHCI/AHCI.hxx>
#include <Modules/ATA/ATA.hxx>
@@ -143,9 +143,9 @@ _Output NFS_FORK_STRUCT* NeFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catal
4; /// this value gives us space for the data offset.
theFork.Flags = kNeFSFlagCreated;
- theFork.DataOffset = lba - sizeof(NFS_FORK_STRUCT) * cForkPadding;
+ theFork.DataOffset = lba - sizeof(NFS_FORK_STRUCT) - theFork.DataSize;
theFork.PreviousSibling = lbaOfPreviousFork;
- theFork.NextSibling = theFork.DataOffset - theFork.DataSize;
+ theFork.NextSibling = theFork.DataOffset + sizeof(NFS_FORK_STRUCT) + theFork.DataSize;
drv.fPacket.fLba = lba;
drv.fPacket.fPacketSize = sizeof(NFS_FORK_STRUCT);
@@ -635,9 +635,13 @@ bool NeFSParser::Format(_Input _Output DriveTrait* drive, _Input const Lba endLb
/// @return if the catalog w rote the contents successfully.
bool NeFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Bool isRsrcFork, _Input VoidPtr data, _Input SizeT sizeOfData, _Input const Char* forkName)
{
- if (sizeOfData > kNeFSForkDataSz)
+ if (sizeOfData > kNeFSForkDataSz ||
+ sizeOfData == 0)
return No;
+ auto buf = new UInt8[kNeFSForkDataSz];
+ rt_copy_memory(data, buf, sizeOfData);
+
auto drive = sMountpointInterface.A();
rt_copy_memory((VoidPtr) "fs/newfs-packet", drive.fPacket.fPacketMime,
@@ -671,31 +675,31 @@ bool NeFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Bool i
if (forkDataIn->Flags != kNeFSFlagUnallocated &&
forkDataIn->Flags != kNeFSFlagDeleted &&
StringBuilder::Equals(forkDataIn->ForkName, forkName) &&
- StringBuilder::Equals(forkDataIn->CatalogName, catalog->Name))
+ StringBuilder::Equals(forkDataIn->CatalogName, catalog->Name) &&
+ forkDataIn->DataSize == sizeOfData)
{
// ===================================================== //
// Store the blob now.
// ===================================================== //
forkDataIn->Flags = kNeFSFlagCreated;
- forkDataIn->DataOffset = startFork - sizeof(NFS_FORK_STRUCT);
- forkDataIn->DataSize = sizeOfData;
- drive.fPacket.fPacketContent = data;
- drive.fPacket.fPacketSize = sizeOfData;
+ drive.fPacket.fPacketContent = buf;
+ drive.fPacket.fPacketSize = kNeFSForkDataSz;
drive.fPacket.fLba = forkDataIn->DataOffset;
kcout << "data offset: " << hex_number(forkDataIn->DataOffset) << endl;
drive.fOutput(&drive.fPacket);
- drive.fPacket.fPacketContent = &forkDataIn;
+ drive.fPacket.fPacketContent = forkDataIn;
drive.fPacket.fPacketSize = sizeof(NFS_FORK_STRUCT);
- drive.fPacket.fLba = startFork;
+ drive.fPacket.fLba = startFork - sizeof(NFS_FORK_STRUCT);
drive.fOutput(&drive.fPacket);
kcout << "wrote fork at offset: " << hex_number(forkDataIn->DataOffset) << endl;
+ kcout << "wrote fork at offset: " << hex_number(startFork - sizeof(NFS_FORK_STRUCT)) << endl;
delete catalog;
@@ -1042,4 +1046,4 @@ namespace Kernel::Detail
}
} // namespace Kernel::Detail
-#endif // ifdef __FSKIT_USE_NEWFS__
+#endif // ifdef __FSKIT_USE_NEFS__
diff --git a/dev/ZKA/Sources/FileMgr.cxx b/dev/ZKA/Sources/FileMgr.cxx
index cbd2a4f4..3e3977ab 100644
--- a/dev/ZKA/Sources/FileMgr.cxx
+++ b/dev/ZKA/Sources/FileMgr.cxx
@@ -50,7 +50,7 @@ namespace Kernel
return false;
}
-#ifdef __FSKIT_USE_NEWFS__
+#ifdef __FSKIT_USE_NEFS__
/// @brief Opens a new file.
/// @param path
/// @param r
@@ -186,5 +186,5 @@ namespace Kernel
{
return fImpl;
}
-#endif // __FSKIT_USE_NEWFS__
+#endif // __FSKIT_USE_NEFS__
} // namespace Kernel
diff --git a/dev/ZKA/Sources/NewFS+FileMgr.cxx b/dev/ZKA/Sources/NeFS+FileMgr.cxx
index 29beda45..b3ad381f 100644
--- a/dev/ZKA/Sources/NewFS+FileMgr.cxx
+++ b/dev/ZKA/Sources/NeFS+FileMgr.cxx
@@ -7,7 +7,7 @@
#include <KernelKit/FileMgr.hxx>
#include <KernelKit/Heap.hxx>
-#ifdef __FSKIT_USE_NEWFS__
+#ifdef __FSKIT_USE_NEFS__
/// @brief NeFS File manager.
/// BUGS: 0
@@ -106,4 +106,4 @@ namespace Kernel
}
} // namespace Kernel
-#endif // ifdef __FSKIT_USE_NEWFS__
+#endif // ifdef __FSKIT_USE_NEFS__
diff --git a/dev/ZKA/Sources/NewFS+IO.cxx b/dev/ZKA/Sources/NeFS+IO.cxx
index 7917c1bb..a86e9c29 100644
--- a/dev/ZKA/Sources/NewFS+IO.cxx
+++ b/dev/ZKA/Sources/NeFS+IO.cxx
@@ -17,14 +17,14 @@
*
*************************************************************/
-#ifdef __FSKIT_USE_NEWFS__
+#ifdef __FSKIT_USE_NEFS__
#include <FirmwareKit/EPM.hxx>
/// Useful macros.
-#define NEWFS_WRITE(DRV, TRAITS, MP) (MP->DRV()).fOutput(&TRAITS)
-#define NEWFS_READ(DRV, TRAITS, MP) (MP->DRV()).fInput(&TRAITS)
+#define NEFS_WRITE(DRV, TRAITS, MP) (MP->DRV()).fOutput(&TRAITS)
+#define NEFS_READ(DRV, TRAITS, MP) (MP->DRV()).fInput(&TRAITS)
using namespace Kernel;
@@ -43,19 +43,19 @@ Int32 fs_newfs_read(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvInd
switch (DrvIndex)
{
case kNeFSSubDriveA: {
- NEWFS_READ(A, DrvTrait.fPacket, Mnt);
+ NEFS_READ(A, DrvTrait.fPacket, Mnt);
break;
}
case kNeFSSubDriveB: {
- NEWFS_READ(B, DrvTrait.fPacket, Mnt);
+ NEFS_READ(B, DrvTrait.fPacket, Mnt);
break;
}
case kNeFSSubDriveC: {
- NEWFS_READ(C, DrvTrait.fPacket, Mnt);
+ NEFS_READ(C, DrvTrait.fPacket, Mnt);
break;
}
case kNeFSSubDriveD: {
- NEWFS_READ(D, DrvTrait.fPacket, Mnt);
+ NEFS_READ(D, DrvTrait.fPacket, Mnt);
break;
}
}
@@ -78,19 +78,19 @@ Int32 fs_newfs_write(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIn
switch (DrvIndex)
{
case kNeFSSubDriveA: {
- NEWFS_WRITE(A, DrvTrait.fPacket, Mnt);
+ NEFS_WRITE(A, DrvTrait.fPacket, Mnt);
break;
}
case kNeFSSubDriveB: {
- NEWFS_WRITE(B, DrvTrait.fPacket, Mnt);
+ NEFS_WRITE(B, DrvTrait.fPacket, Mnt);
break;
}
case kNeFSSubDriveC: {
- NEWFS_WRITE(C, DrvTrait.fPacket, Mnt);
+ NEFS_WRITE(C, DrvTrait.fPacket, Mnt);
break;
}
case kNeFSSubDriveD: {
- NEWFS_WRITE(D, DrvTrait.fPacket, Mnt);
+ NEFS_WRITE(D, DrvTrait.fPacket, Mnt);
break;
}
}
@@ -98,4 +98,4 @@ Int32 fs_newfs_write(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIn
return DrvTrait.fPacket.fPacketGood;
}
-#endif // ifdef __FSKIT_USE_NEWFS__
+#endif // ifdef __FSKIT_USE_NEFS__
diff --git a/dev/ZKA/Sources/NewFS+Journal.cxx b/dev/ZKA/Sources/NewFS+Journal.cxx
deleted file mode 100644
index f8d82fcd..00000000
--- a/dev/ZKA/Sources/NewFS+Journal.cxx
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies.
-
-------------------------------------------- */
-
-#include <KernelKit/DebugOutput.hxx>
-#include <KernelKit/FileMgr.hxx>
-
-#ifdef __FSKIT_USE_NEWFS__
-
-///! BUGS: 0
-///! @file NeFS+Journal.cxx
-///! @brief Journaling for NeFS.
-
-namespace Kernel::Journal
-{
-} // namespace Kernel::Journal
-
-using namespace Kernel;
-
-#endif // ifdef __FSKIT_USE_NEWFS__
diff --git a/dev/ZKA/Sources/UserProcessScheduler.cxx b/dev/ZKA/Sources/UserProcessScheduler.cxx
index 4e0c8902..8c46b1cf 100644
--- a/dev/ZKA/Sources/UserProcessScheduler.cxx
+++ b/dev/ZKA/Sources/UserProcessScheduler.cxx
@@ -2,6 +2,9 @@
Copyright ZKA Technologies.
+ FILE: UserProcessScheduler.cxx
+ PURPOSE: User sided process scheduler.
+
------------------------------------------- */
/***********************************************************************************/
@@ -34,7 +37,7 @@ namespace Kernel
/// @brief User Process scheduler global object.
/***********************************************************************************/
- STATIC UserProcessScheduler* cProcessScheduler = nullptr;
+ UserProcessScheduler* cProcessScheduler = nullptr;
/// @brief Gets the last exit code.
/// @note Not thread-safe.
@@ -264,6 +267,7 @@ namespace Kernel
{
if (process.Kind != UserProcess::kDLLKind)
{
+ process.Crash();
return -kErrorProcessFault;
}
}
@@ -273,6 +277,9 @@ namespace Kernel
++mTeam.mProcessAmount;
+ while (1)
+ ;
+
mTeam.AsArray()[process.ProcessId] = process;
return process.ProcessId;
@@ -297,7 +304,7 @@ namespace Kernel
// check if process is within range.
if (process_id > mTeam.AsArray().Count())
return false;
-
+
mTeam.AsArray()[process_id].Status = ProcessStatusKind::kDead;
--mTeam.mProcessAmount;
@@ -373,10 +380,12 @@ namespace Kernel
Void UserProcessHelper::Init()
{
- if (!cProcessScheduler)
- {
- cProcessScheduler = new UserProcessScheduler();
- }
+ if (mm_is_valid_heap(cProcessScheduler))
+ delete cProcessScheduler;
+
+ cProcessScheduler = nullptr;
+ cProcessScheduler = new UserProcessScheduler();
+ MUST_PASS(cProcessScheduler);
}
/// @brief Check if process can be schedulded.
@@ -435,7 +444,7 @@ namespace Kernel
HardwareThreadScheduler::The()[index].Leak()->Kind() !=
ThreadKind::kHartSystemReserved)
{
- PID prev_pid = UserProcessHelper::TheCurrentPID();
+ PID prev_pid = UserProcessHelper::TheCurrentPID();
UserProcessHelper::TheCurrentPID() = new_pid;
bool ret = HardwareThreadScheduler::The()[index].Leak()->Switch(image_ptr, stack, frame_ptr);
diff --git a/dev/ZKA/Sources/compile_flags.txt b/dev/ZKA/Sources/compile_flags.txt
index 33aadad4..a22ed881 100644
--- a/dev/ZKA/Sources/compile_flags.txt
+++ b/dev/ZKA/Sources/compile_flags.txt
@@ -3,5 +3,5 @@
-std=c++20
-I../
-I$(HOME)/
--D__FSKIT_USE_NEWFS__
+-D__FSKIT_USE_NEFS__
-D__ZKA_AMD64__
diff --git a/dev/ZKA/amd64-efi.make b/dev/ZKA/amd64-efi.make
index 4d1f9403..00c2664e 100644
--- a/dev/ZKA/amd64-efi.make
+++ b/dev/ZKA/amd64-efi.make
@@ -6,7 +6,7 @@
CC = x86_64-w64-mingw32-g++
LD = x86_64-w64-mingw32-ld
CCFLAGS = -fshort-wchar -c -D__ZKA_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \
- -std=c++20 -D__ZKA_SUPPORT_NX__ -I../Vendor -D__FSKIT_USE_NEWFS__ \
+ -std=c++20 -D__ZKA_SUPPORT_NX__ -I../Vendor -D__FSKIT_USE_NEFS__ \
-D__NEWOSKRNL__ -D__HAVE_ZKA_APIS__ -D__FREESTANDING__ -D__ZKA__ -I./ -I../ -I../ZBA
ASM = nasm
diff --git a/dev/ZKA/arm64-efi.make b/dev/ZKA/arm64-efi.make
index 65f3a0ae..a801ed3e 100644
--- a/dev/ZKA/arm64-efi.make
+++ b/dev/ZKA/arm64-efi.make
@@ -7,7 +7,7 @@ CC = clang++
LD = lld-link
CCFLAGS = -fshort-wchar -c -ffreestanding -MMD -mno-red-zone -D__ZKA_ARM64__ -fno-rtti -fno-exceptions -I./ \
-target aarch64-unknown-windows \
- -std=c++20 -D__FSKIT_USE_NEWFS__ -D__ZETA_MACHINE__ -D__NEWOSKRNL__ -D__HAVE_ZKA_APIS__ -D__ZKA__ -I../
+ -std=c++20 -D__FSKIT_USE_NEFS__ -D__ZETA_MACHINE__ -D__NEWOSKRNL__ -D__HAVE_ZKA_APIS__ -D__ZKA__ -I../
ASM = clang++