diff options
| author | Amlal <amlal@nekernel.org> | 2025-05-08 10:17:30 +0200 |
|---|---|---|
| committer | Amlal <amlal@nekernel.org> | 2025-05-08 10:17:30 +0200 |
| commit | 902bafa5dc8c3ac5fcbf13a5af73e016e9c64685 (patch) | |
| tree | 01aa45950fa825ad616ee3f8e8a19c7156708aab | |
| parent | 8c0d7efb90585bf53b9f7496c2883af5ffa6ee68 (diff) | |
meta(kernel): saving changes to avoid loss.
Signed-off-by: Amlal <amlal@nekernel.org>
22 files changed, 219 insertions, 118 deletions
diff --git a/dev/generic_kits/BenchKit/Chrono.h b/dev/generic_kits/BenchKit/Chrono.h new file mode 100644 index 00000000..98f3d980 --- /dev/null +++ b/dev/generic_kits/BenchKit/Chrono.h @@ -0,0 +1,16 @@ +/* ------------------------------------------- + +Copyright (C) 2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#ifndef BENCHKIT_CHRONO_H +#define BENCHKIT_CHRONO_H + +#include <NewKit/Defines.h> + +namespace Kernel { +class ChronoInterface; +} // namespace Kernel + +#endif // BENCHKIT_CHRONO_H diff --git a/dev/kernel/FSKit/HeFS.h b/dev/kernel/FSKit/HeFS.h index f5f42b47..f6f2d1dd 100644 --- a/dev/kernel/FSKit/HeFS.h +++ b/dev/kernel/FSKit/HeFS.h @@ -37,7 +37,7 @@ struct HEFS_BOOT_NODE; struct HEFS_INDEX_NODE;
struct HEFS_INDEX_NODE_DIRECTORY;
struct HEFS_JOURNAL_NODE;
-struct HEFS_INODE_SLICE;
+struct HEFS_SLICE_NODE;
enum : UInt8 {
kHeFSHardDrive = 0xC0, // Hard Drive
@@ -100,44 +100,57 @@ namespace Kernel { /// @brief Access time type.
/// @details Used to keep track of the INode, INodeDir allocation status.
typedef UInt64 ATime;
-} // namespace Kernel
/// @brief HeFS Boot node.
/// @details Acts like a superblock, it contains the information about the filesystem.
/// @note The boot node is the first block of the filesystem.
struct PACKED HEFS_BOOT_NODE final {
- Kernel::Char fMagic[kHeFSMagicLen]; /// @brief Magic number of the filesystem.
- Kernel::Utf8Char fVolName[kHeFSPartNameLen]; /// @brief Volume name.
- Kernel::UInt32 fVersion; /// @brief Version of the filesystem.
- Kernel::UInt64 fBadSectors; /// @brief Number of bad sectors in the filesystem.
- Kernel::UInt64 fSectorCount; /// @brief Number of sectors in the filesystem.
- Kernel::UInt64 fSectorSize; /// @brief Size of the sector.
- Kernel::UInt32 fChecksum; /// @brief Checksum of the boot node.
- Kernel::UInt8 fDiskKind; /// @brief Kind of the drive. (Hard Drive, Solid State Drive, Optical
- /// Drive, etc).
- Kernel::UInt8 fEncoding; /// @brief Encoding of the filesystem. (UTF-8, UTF-16, etc).
- Kernel::UInt64 fStartIND; /// @brief Start of the INode directory tree.
- Kernel::UInt64 fEndIND; /// @brief End of the INode directory tree.
- Kernel::UInt64 fINDCount; /// @brief Number of leafs in the INode tree.
- Kernel::UInt64 fDiskSize; /// @brief Size of the disk. (Could be a virtual size, that is not the
- /// real size of the disk.)
- Kernel::UInt16 fDiskStatus; /// @brief Status of the disk. (locked, unlocked, error, invalid).
- Kernel::UInt16 fDiskFlags; /// @brief Flags of the disk. (read-only, read-write, etc).
- Kernel::UInt16
- fVID; /// @brief Virtual Identification Number within an EPM disk. (0xFFFF if not used).
- Kernel::UInt64 fStartIN; /// @brief Start INodes range
- Kernel::UInt64 fEndIN; /// @brief End INodes range
- Kernel::UInt64 fStartBlock; /// @brief Start Blocks range
- Kernel::UInt64 fEndBlock; /// @brief End Blocks range
- Kernel::Char fPad[272];
+ Char fMagic[kHeFSMagicLen]; /// @brief Magic number of the filesystem.
+ Utf8Char fVolName[kHeFSPartNameLen]; /// @brief Volume name.
+ UInt32 fVersion; /// @brief Version of the filesystem.
+ UInt64 fBadSectors; /// @brief Number of bad sectors in the filesystem.
+ UInt64 fSectorCount; /// @brief Number of sectors in the filesystem.
+ UInt64 fSectorSize; /// @brief Size of the sector.
+ UInt32 fChecksum; /// @brief Checksum of the boot node.
+ UInt8 fDiskKind; /// @brief Kind of the drive. (Hard Drive, Solid State Drive, Optical
+ /// Drive, etc).
+ UInt8 fEncoding; /// @brief Encoding of the filesystem. (UTF-8, UTF-16, etc).
+ UInt64 fStartIND; /// @brief Start of the INode directory tree.
+ UInt64 fEndIND; /// @brief End of the INode directory tree.
+ UInt64 fINDCount; /// @brief Number of leafs in the INode tree.
+ UInt64 fDiskSize; /// @brief Size of the disk. (Could be a virtual size, that is not the
+ /// real size of the disk.)
+ UInt16 fDiskStatus; /// @brief Status of the disk. (locked, unlocked, error, invalid).
+ UInt16 fDiskFlags; /// @brief Flags of the disk. (read-only, read-write, etc).
+ UInt16 fVID; /// @brief Virtual Identification Number within an EPM disk. (0xFFFF if not used).
+ UInt64 fStartIN; /// @brief Start INodes range
+ UInt64 fEndIN; /// @brief End INodes range
+ UInt64 fStartBlock; /// @brief Start Blocks range
+ UInt64 fEndBlock; /// @brief End Blocks range
+ UInt64 fJournalLBA; /// @brief Boot Node's COW journal LBA.
+ Char fPad[264];
};
-inline constexpr Kernel::ATime kHeFSTimeInvalid = 0x0000000000000000;
-inline constexpr Kernel::ATime kHeFSTimeMax = 0xFFFFFFFFFFFFFFFF - 1;
+inline constexpr ATime kHeFSTimeInvalid = 0x0000000000000000;
+inline constexpr ATime kHeFSTimeMax = 0xFFFFFFFFFFFFFFFF - 1;
+
+/// @brief INode Slice structure, organized like a range container.
+struct PACKED HEFS_SLICE_NODE {
+ UInt32 fBase;
+ UInt32 fLength;
+};
-struct PACKED HEFS_INODE_SLICE {
- Kernel::UInt32 fBase;
- Kernel::UInt32 fLength;
+/// @brief Journal Node structure
+/// @param fHashPath target hash path
+/// @param fStatus target status
+/// @param fCopyElem copy of element
+/// @param fCopyKind kind of element
+struct PACKED HEFS_JOURNAL_NODE {
+ UInt64 fHashPath;
+ UInt64 fStatus;
+ UInt64 fCopyElem;
+ UInt8 fCopyKind;
+ UInt8 fPad[487];
};
/// @brief HeFS index node.
@@ -145,27 +158,27 @@ struct PACKED HEFS_INODE_SLICE { /// @note The index node is a special type of INode that contains the file information.
/// @note The index node is used to store the file information of a file.
struct PACKED HEFS_INDEX_NODE final {
- Kernel::UInt64 fHashPath; /// @brief File name.
- Kernel::UInt32 fFlags; /// @brief File flags.
- Kernel::UInt16 fKind; /// @brief File kind. (Regular, Directory, Block, Character, FIFO, Socket,
- /// Symbolic Link, Unknown).
- Kernel::UInt32 fSize; /// @brief File size.
- Kernel::UInt32 fChecksum; /// @brief Checksum.
+ UInt64 fHashPath; /// @brief File name.
+ UInt32 fFlags; /// @brief File flags.
+ UInt16 fKind; /// @brief File kind. (Regular, Directory, Block, Character, FIFO, Socket,
+ /// Symbolic Link, Unknown).
+ UInt32 fSize; /// @brief File size.
+ UInt32 fChecksum; /// @brief Checksum.
- Kernel::Boolean fSymLink; /// @brief Is this a symbolic link? (if yes, the fName is the path to
- /// the file and blocklinkstart and end contains it's inodes.)
+ Boolean fSymLink; /// @brief Is this a symbolic link? (if yes, the fName is the path to
+ /// the file and blocklinkstart and end contains it's inodes.)
- Kernel::ATime fCreated, fAccessed, fModified, fDeleted; /// @brief File timestamps.
- Kernel::UInt32 fUID, fGID; /// @brief User ID and Group ID of the file.
- Kernel::UInt32 fMode; /// @brief File mode. (read, write, execute, etc).
+ ATime fCreated, fAccessed, fModified, fDeleted; /// @brief File timestamps.
+ UInt32 fUID, fGID; /// @brief User ID and Group ID of the file.
+ UInt32 fMode; /// @brief File mode. (read, write, execute, etc).
/// @brief Extents system by using blocks
/// @details Using an offset to ask fBase, and fLength to compute each slice's length.
- Kernel::UInt64 fOffsetSlices;
+ UInt64 fOffsetSlices;
- HEFS_INODE_SLICE fSlices[kHeFSSliceCount]; /// @brief block slice
+ HEFS_SLICE_NODE fSlices[kHeFSSliceCount]; /// @brief block slice
- Kernel::Char fPad[309];
+ Char fPad[309];
};
enum {
@@ -179,69 +192,70 @@ enum { /// @details This structure is used to store the directory information of a file.
/// @note The directory node is a special type of INode that contains the directory entries.
struct PACKED HEFS_INDEX_NODE_DIRECTORY final {
- Kernel::UInt64 fHashPath; /// @brief Directory path as FNV hash.
+ UInt64 fHashPath; /// @brief Directory path as FNV hash.
- Kernel::UInt32 fFlags; /// @brief File flags.
- Kernel::UInt16 fKind; /// @brief File kind. (Regular, Directory, Block, Character, FIFO, Socket,
- /// Symbolic Link, Unknown).
- Kernel::UInt32 fEntryCount; /// @brief Entry Count of this directory inode.
- Kernel::UInt32 fChecksum; /// @brief Checksum of the file, index node checksum.
+ UInt32 fFlags; /// @brief File flags.
+ UInt16 fKind; /// @brief File kind. (Regular, Directory, Block, Character, FIFO, Socket,
+ /// Symbolic Link, Unknown).
+ UInt32 fEntryCount; /// @brief Entry Count of this directory inode.
+ UInt32 fChecksum; /// @brief Checksum of the file, index node checksum.
- Kernel::ATime fCreated, fAccessed, fModified,
- fDeleted; /// @brief File timestamps and allocation status.
- Kernel::UInt32 fUID, fGID; /// @brief User ID and Group ID of the file.
- Kernel::UInt32 fMode; /// @brief File mode. (read, write, execute, etc).
+ ATime fCreated, fAccessed, fModified,
+ fDeleted; /// @brief File timestamps and allocation status.
+ UInt32 fUID, fGID; /// @brief User ID and Group ID of the file.
+ UInt32 fMode; /// @brief File mode. (read, write, execute, etc).
/// @note These slices are organized as:
/// [0] = OFFSET
/// [1] = SIZE
/// @note Thus the += 2 when iterating over them.
- Kernel::UInt64 fINSlices[kHeFSSliceCount]; /// @brief Start of the index node.
+ UInt64 fINSlices[kHeFSSliceCount]; /// @brief Start of the index node.
- Kernel::UInt8 fColor; /// @brief Color of the node. (Red or Black).
- Kernel::Lba fNext, fPrev, fChild, fParent; /// @brief Red-black tree pointers.
+ UInt8 fColor; /// @brief Color of the node. (Red or Black).
+ Lba fNext, fPrev, fChild, fParent; /// @brief Red-black tree pointers.
- Kernel::Char fPad[285];
+ Char fPad[285];
};
+} // namespace Kernel
namespace Kernel::Detail {
-/// @brief HeFS get year from Kernel::ATime.
-/// @param raw_atime the raw Kernel::ATime value.
+/// @brief HeFS get year from ATime.
+/// @param raw_atime the raw ATime value.
/// @return the year value.
-/// @note The year is stored in the upper 32 bits of the Kernel::ATime value.
-inline UInt32 hefs_year_get(Kernel::ATime raw_atime) noexcept {
+/// @note The year is stored in the upper 32 bits of the ATime value.
+inline UInt32 hefs_year_get(ATime raw_atime) noexcept {
return (raw_atime) >> 32;
}
-/// @brief HeFS get month from Kernel::ATime.
-/// @param raw_atime the raw Kernel::ATime value.
+/// @brief HeFS get month from ATime.
+/// @param raw_atime the raw ATime value.
/// @return the month value.
-/// @note The month is stored in the upper 24 bits of the Kernel::ATime value.
-inline UInt32 hefs_month_get(Kernel::ATime raw_atime) noexcept {
+/// @note The month is stored in the upper 24 bits of the ATime value.
+inline UInt32 hefs_month_get(ATime raw_atime) noexcept {
return (raw_atime) >> 24;
}
-/// @brief HeFS get day from Kernel::ATime.
-/// @param raw_atime the raw Kernel::ATime value.
+/// @brief HeFS get day from ATime.
+/// @param raw_atime the raw ATime value.
/// @return the day value.
-/// @note The day is stored in the upper 16 bits of the Kernel::ATime value.
-inline UInt32 hefs_day_get(Kernel::ATime raw_atime) noexcept {
+/// @note The day is stored in the upper 16 bits of the ATime value.
+inline UInt32 hefs_day_get(ATime raw_atime) noexcept {
return (raw_atime) >> 16;
}
-/// @brief HeFS get hour from Kernel::ATime.
-/// @param raw_atime the raw Kernel::ATime value.
+/// @brief HeFS get hour from ATime.
+/// @param raw_atime the raw ATime value.
/// @return the hour value.
-/// @note The hour is stored in the upper 8 bits of the Kernel::ATime value.
-inline UInt32 hefs_hour_get(Kernel::ATime raw_atime) noexcept {
+/// @note The hour is stored in the upper 8 bits of the ATime value.
+inline UInt32 hefs_hour_get(ATime raw_atime) noexcept {
return (raw_atime) >> 8;
}
-/// @brief HeFS get minute from Kernel::ATime.
-/// @param raw_atime the raw Kernel::ATime value.
+/// @brief HeFS get minute from ATime.
+/// @param raw_atime the raw ATime value.
/// @return the minute value.
-/// @note The minute is stored in the lower 8 bits of the Kernel::ATime value.
-inline UInt32 hefs_minute_get(Kernel::ATime raw_atime) noexcept {
+/// @note The minute is stored in the lower 8 bits of the ATime value.
+inline UInt32 hefs_minute_get(ATime raw_atime) noexcept {
return (raw_atime) & 0xFF;
}
diff --git a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc index 4b0270ab..2b7aec14 100644 --- a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc +++ b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc @@ -71,6 +71,10 @@ STATIC Int32 drv_find_cmd_slot_ahci(HbaPort* port) noexcept; STATIC Void drv_compute_disk_ahci() noexcept; +STATIC SizeT drv_get_size_ahci(); + +STATIC SizeT drv_get_sector_count_ahci(); + /***********************************************************************************/ /// @brief Identify device and read LBA info, Disk OEM vendor. /***********************************************************************************/ @@ -292,13 +296,13 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz @brief Gets the number of sectors inside the drive. @return Sector size in bytes. */ -SizeT drv_get_sector_count_ahci() { +STATIC SizeT drv_get_sector_count_ahci() { return kSATASectorCount; } /// @brief Get the drive size. /// @return Disk size in bytes. -SizeT drv_get_size_ahci() { +STATIC SizeT drv_get_size_ahci() { return drv_std_get_sector_count() * kAHCISectorSize; } diff --git a/dev/kernel/KernelKit/KernelProcessScheduler.h b/dev/kernel/KernelKit/KernelProcessScheduler.h deleted file mode 100644 index 24d40a36..00000000 --- a/dev/kernel/KernelKit/KernelProcessScheduler.h +++ /dev/null @@ -1,7 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2025, Amlal El Mahrouss, all rights reserved. - -------------------------------------------- */ - -#pragma once
\ No newline at end of file diff --git a/dev/kernel/KernelKit/KernelTaskScheduler.h b/dev/kernel/KernelKit/KernelTaskScheduler.h new file mode 100644 index 00000000..ca10003f --- /dev/null +++ b/dev/kernel/KernelKit/KernelTaskScheduler.h @@ -0,0 +1,15 @@ +/* ------------------------------------------- + + Copyright (C) 2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#pragma once + +/// @file KernelTaskScheduler.h +/// @brief Kernel Task Scheduler header file. +/// @author Amlal El Mahrouss (amlal@nekernel.org) + +#include <ArchKit/ArchKit.h> +#include <KernelKit/CoreProcessScheduler.h> +#include <KernelKit/LockDelegate.h>
\ No newline at end of file diff --git a/dev/kernel/KernelKit/ProcessScheduler.h b/dev/kernel/KernelKit/ProcessScheduler.h index 6da176b3..6bdc8b1c 100644 --- a/dev/kernel/KernelKit/ProcessScheduler.h +++ b/dev/kernel/KernelKit/ProcessScheduler.h @@ -6,5 +6,5 @@ #pragma once -#include <KernelKit/KernelProcessScheduler.h> +#include <KernelKit/KernelTaskScheduler.h> #include <KernelKit/UserProcessScheduler.h>
\ No newline at end of file diff --git a/dev/kernel/KernelKit/UserProcessScheduler.h b/dev/kernel/KernelKit/UserProcessScheduler.h index 1e8719ca..b64e5ce1 100644 --- a/dev/kernel/KernelKit/UserProcessScheduler.h +++ b/dev/kernel/KernelKit/UserProcessScheduler.h @@ -8,7 +8,7 @@ #define INC_PROCESS_SCHEDULER_H /// @file UserProcessScheduler.h -/// @brief User USER_PROCESS scheduler code and definitions. +/// @brief User Process Scheduler header file. /// @author Amlal El Mahrouss (amlal@nekernel.org) #include <ArchKit/ArchKit.h> diff --git a/dev/kernel/src/BinaryMutex.cc b/dev/kernel/src/BinaryMutex.cc index 8bf1432e..bbf7a477 100644 --- a/dev/kernel/src/BinaryMutex.cc +++ b/dev/kernel/src/BinaryMutex.cc @@ -12,7 +12,7 @@ namespace Kernel { /// @brief Unlocks the binary mutex. /***********************************************************************************/ Bool BinaryMutex::Unlock() noexcept { - if (fLockingProcess) { + if (fLockingProcess.Status == ProcessStatusKind::kRunning) { fLockingProcess = USER_PROCESS(); fLockingProcess.Status = ProcessStatusKind::kFrozen; diff --git a/dev/kernel/src/DriveMgr+IO.cc b/dev/kernel/src/DriveMgr+IO.cc index 4c9b20e0..9137c91e 100644 --- a/dev/kernel/src/DriveMgr+IO.cc +++ b/dev/kernel/src/DriveMgr+IO.cc @@ -17,10 +17,10 @@ * *************************************************************/ -/// Useful macros. +/// Useful macros regarding the IFS. -#define rtl_nefs_write(DRV, TRAITS, MP) (MP->DRV()).fOutput(TRAITS) -#define rtl_nefs_read(DRV, TRAITS, MP) (MP->DRV()).fInput(TRAITS) +#define fsi_ifs_write(DRV, TRAITS, MP) (MP->DRV()).fOutput(TRAITS) +#define fsi_ifs_read(DRV, TRAITS, MP) (MP->DRV()).fInput(TRAITS) namespace Kernel { /// @brief Read from newfs disk. @@ -35,19 +35,19 @@ Int32 fs_ifs_read(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex switch (DrvIndex) { case MountpointInterface::kDriveIndexA: { - rtl_nefs_read(A, DrvTrait.fPacket, Mnt); + fsi_ifs_read(A, DrvTrait.fPacket, Mnt); break; } case MountpointInterface::kDriveIndexB: { - rtl_nefs_read(B, DrvTrait.fPacket, Mnt); + fsi_ifs_read(B, DrvTrait.fPacket, Mnt); break; } case MountpointInterface::kDriveIndexC: { - rtl_nefs_read(C, DrvTrait.fPacket, Mnt); + fsi_ifs_read(C, DrvTrait.fPacket, Mnt); break; } case MountpointInterface::kDriveIndexD: { - rtl_nefs_read(D, DrvTrait.fPacket, Mnt); + fsi_ifs_read(D, DrvTrait.fPacket, Mnt); break; } } @@ -67,19 +67,19 @@ Int32 fs_ifs_write(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvInde switch (DrvIndex) { case MountpointInterface::kDriveIndexA: { - rtl_nefs_write(A, DrvTrait.fPacket, Mnt); + fsi_ifs_write(A, DrvTrait.fPacket, Mnt); break; } case MountpointInterface::kDriveIndexB: { - rtl_nefs_write(B, DrvTrait.fPacket, Mnt); + fsi_ifs_write(B, DrvTrait.fPacket, Mnt); break; } case MountpointInterface::kDriveIndexC: { - rtl_nefs_write(C, DrvTrait.fPacket, Mnt); + fsi_ifs_write(C, DrvTrait.fPacket, Mnt); break; } case MountpointInterface::kDriveIndexD: { - rtl_nefs_write(D, DrvTrait.fPacket, Mnt); + fsi_ifs_write(D, DrvTrait.fPacket, Mnt); break; } } diff --git a/dev/kernel/src/FS/HeFS+FileSystemParser.cc b/dev/kernel/src/FS/HeFS+FileSystemParser.cc index a324da2a..d66c4a53 100644 --- a/dev/kernel/src/FS/HeFS+FileSystemParser.cc +++ b/dev/kernel/src/FS/HeFS+FileSystemParser.cc @@ -422,6 +422,8 @@ namespace Detail { else --root->fINDCount; + root->fChecksum = ke_calculate_crc32((Char*) root, sizeof(HEFS_BOOT_NODE)); + mnt->fPacket.fPacketLba = mnt->fLbaStart; mnt->fPacket.fPacketSize = sizeof(HEFS_BOOT_NODE); mnt->fPacket.fPacketContent = root; @@ -584,9 +586,9 @@ namespace Detail { SizeT cnt = 0ULL; while (cnt < kHeFSSliceCount) { - HEFS_INODE_SLICE& slice = node->fSlices[cnt]; - slice.fBase = offset; - slice.fLength = kHeFSBlockLen; + HEFS_SLICE_NODE& slice = node->fSlices[cnt]; + slice.fBase = offset; + slice.fLength = kHeFSBlockLen; offset += kHeFSBlockLen; ++cnt; @@ -601,10 +603,14 @@ namespace Detail { root->fStartIN += sizeof(HEFS_INDEX_NODE); root->fStartBlock += (kHeFSSliceCount * kHeFSBlockLen); + root->fChecksum = ke_calculate_crc32((Char*) root, sizeof(HEFS_BOOT_NODE)); + mnt->fPacket.fPacketLba = mnt->fLbaStart; mnt->fPacket.fPacketSize = sizeof(HEFS_BOOT_NODE); mnt->fPacket.fPacketContent = root; + mnt->fOutput(mnt->fPacket); + mm_delete_heap(dir); return YES; @@ -626,6 +632,8 @@ namespace Detail { root->fStartIN -= sizeof(HEFS_INDEX_NODE); root->fStartBlock -= (kHeFSSliceCount * kHeFSBlockLen); + root->fChecksum = ke_calculate_crc32((Char*) root, sizeof(HEFS_BOOT_NODE)); + mnt->fPacket.fPacketLba = mnt->fLbaStart; mnt->fPacket.fPacketSize = sizeof(HEFS_BOOT_NODE); mnt->fPacket.fPacketContent = root; @@ -1004,11 +1012,9 @@ _Output Bool HeFileSystemParser::INodeManip(_Input DriveTrait* mnt, VoidPtr bloc if (!KStringBuilder::Equals(root->fMagic, kHeFSMagic) || root->fVersion != kHeFSVersion) { err_global_get() = kErrorDisk; - return YES; + return NO; } - if (root->fStartBlock > root->fEndBlock) return NO; - SizeT cnt = block_sz / sizeof(HEFS_INDEX_NODE); auto nodes = Detail::hefsi_fetch_in(root, mnt, dir, name, kind, &cnt); @@ -1021,7 +1027,7 @@ _Output Bool HeFileSystemParser::INodeManip(_Input DriveTrait* mnt, VoidPtr bloc SizeT cnt_slice = 0; while (cnt_slice < kHeFSSliceCount) { - struct HEFS_INODE_SLICE& slice = start.fSlices[cnt_slice]; + HEFS_SLICE_NODE& slice = start.fSlices[cnt_slice]; mnt->fPacket.fPacketLba = slice.fBase + start.fOffsetSlices; mnt->fPacket.fPacketSize = kHeFSBlockLen; @@ -1175,6 +1181,9 @@ Boolean fs_init_hefs(Void) { Utf8Char contents_1[kHeFSBlockLen] = u8"ロケットにはジエットエンジン\r"; MUST_PASS(parser.INodeManip(&kMountPoint, contents_1, kHeFSBlockLen, u8"/boot", + kHeFSFileKindRegular, u8"ジェット警察.txt", NO)); + + MUST_PASS(parser.INodeManip(&kMountPoint, contents_1, kHeFSBlockLen, u8"/boot", kHeFSFileKindRegular, u8"ジェット警察.txt", YES)); return YES; diff --git a/dev/kernel/src/KernelProcessScheduler.cc b/dev/kernel/src/KernelTaskScheduler.cc index d0abfce0..1997c175 100644 --- a/dev/kernel/src/KernelProcessScheduler.cc +++ b/dev/kernel/src/KernelTaskScheduler.cc @@ -2,16 +2,16 @@ Copyright (C) 2025, Amlal El Mahrouss, all rights reserved. - FILE: KernelProcessScheduler.cc - PURPOSE: Privileged/Ring-0 process scheduler. + FILE: KernelTaskScheduler.cc + PURPOSE: Kernel Task scheduler. ------------------------------------------- */ -#include <KernelKit/ProcessScheduler.h> +#include <KernelKit/KernelTaskScheduler.h> /***********************************************************************************/ -/// @file KernelProcessScheduler.cc -/// @brief Privileged/Ring-0 process scheduler. +/// @file KernelTaskScheduler.cc +/// @brief Kernel Task scheduler. /// @author Amlal El Mahrouss (amlal@nekernel.org) /***********************************************************************************/ diff --git a/docs/tex/hefs.tex b/docs/tex/hefs.tex index c8b5a79b..6daf5d87 100644 --- a/docs/tex/hefs.tex +++ b/docs/tex/hefs.tex @@ -4,7 +4,7 @@ \usepackage{longtable} \usepackage{listings} \geometry{margin=1in} -\title{HeFS Filesystem Specification (v0x0103)} +\title{HeFS Filesystem Specification (v1.3)} \author{Amlal El Mahrouss} \date{2025} diff --git a/public/tools/mgmt.hefs/.keep b/public/tools/mgmt.hefs/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/public/tools/mgmt.hefs/.keep diff --git a/public/tools/mgmt.hefs/mgmt.hefs.json b/public/tools/mgmt.hefs/mgmt.hefs.json new file mode 100644 index 00000000..dc1181c3 --- /dev/null +++ b/public/tools/mgmt.hefs/mgmt.hefs.json @@ -0,0 +1,19 @@ +{ + "compiler_path": "clang++", + "compiler_std": "c++20", + "headers_path": [ + "./", + "../../../dev/kernel", + "../../../public/frameworks/", + "../../../dev/", + "./" + ], + "sources_path": [], + "output_name": "./dist/mgmt.hefs", + "cpp_macros": [ + "kSampleFWVersion=0x0100", + "kSampleFWVersionHighest=0x0100", + "kSampleFWVersionLowest=0x0100", + "__NE_SDK__" + ] +}
\ No newline at end of file diff --git a/public/tools/mgmt.hefs/src/.keep b/public/tools/mgmt.hefs/src/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/public/tools/mgmt.hefs/src/.keep diff --git a/public/tools/mgmt.hefs/vendor/.keep b/public/tools/mgmt.hefs/vendor/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/public/tools/mgmt.hefs/vendor/.keep diff --git a/public/tools/mgmt/.keep b/public/tools/mgmt/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/public/tools/mgmt/.keep diff --git a/public/tools/mgmt/mgmt.json b/public/tools/mgmt/mgmt.json new file mode 100644 index 00000000..5cdd0ec7 --- /dev/null +++ b/public/tools/mgmt/mgmt.json @@ -0,0 +1,19 @@ +{ + "compiler_path": "clang++", + "compiler_std": "c++20", + "headers_path": [ + "./", + "../../../dev/kernel", + "../../../public/frameworks/", + "../../../dev/", + "./" + ], + "sources_path": [], + "output_name": "./dist/mgmt", + "cpp_macros": [ + "kSampleFWVersion=0x0100", + "kSampleFWVersionHighest=0x0100", + "kSampleFWVersionLowest=0x0100", + "__NE_SDK__" + ] +}
\ No newline at end of file diff --git a/public/tools/mgmt/src/.keep b/public/tools/mgmt/src/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/public/tools/mgmt/src/.keep diff --git a/public/tools/mgmt/src/CommandLine.cc b/public/tools/mgmt/src/CommandLine.cc new file mode 100644 index 00000000..d269c894 --- /dev/null +++ b/public/tools/mgmt/src/CommandLine.cc @@ -0,0 +1,3 @@ +int main() { + return 0; +}
\ No newline at end of file diff --git a/public/tools/mgmt/vendor/.keep b/public/tools/mgmt/vendor/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/public/tools/mgmt/vendor/.keep diff --git a/tooling/mk_fwrk.py b/tooling/mk_fwrk.py index e0302754..36cc4e8e 100755 --- a/tooling/mk_fwrk.py +++ b/tooling/mk_fwrk.py @@ -13,7 +13,8 @@ def create_directory_structure(base_path, project_name): ".keep": None }, "src": { - ".keep": None + ".keep": None, + "CommandLine.cc": None, }, "vendor": { ".keep": None @@ -40,7 +41,8 @@ def create_directory_structure(base_path, project_name): create_structure(base_path, structure) # Create the JSON file - diutil_json_path = os.path.join(base_path, project_name, f"{project_name}.json") + proj_json_path = os.path.join(base_path, project_name, f"{project_name}.json") + manifest = { "compiler_path": "clang++", "compiler_std": "c++20", @@ -57,9 +59,16 @@ def create_directory_structure(base_path, project_name): ] } - with open(diutil_json_path, 'w') as json_file: + with open(proj_json_path, 'w') as json_file: json.dump(manifest, json_file, indent=4) + proj_cpp_path = os.path.join(base_path, project_name, f"src/CommandLine.cc") + + cpp_file = "int main() {\n\treturn 0;\n}" + + with open(proj_cpp_path, 'w') as cpp_file_io: + cpp_file_io.write(cpp_file) + if __name__ == "__main__": if len(sys.argv) != 2: print("Usage: mk_fwrk.py <project_name>") |
