summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/Boot/BootKit/BootKit.h2
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/SATA-DMA.cc170
-rw-r--r--dev/Kernel/src/FS/NeFS.cc115
-rw-r--r--dev/Kernel/src/KernelMain.cc4
4 files changed, 147 insertions, 144 deletions
diff --git a/dev/Boot/BootKit/BootKit.h b/dev/Boot/BootKit/BootKit.h
index ec190724..610cc3e9 100644
--- a/dev/Boot/BootKit/BootKit.h
+++ b/dev/Boot/BootKit/BootKit.h
@@ -375,8 +375,6 @@ namespace Boot
BTextWriter writer;
writer.Write(L"BootZ: Drive has been formatted Successfully.\r");
- this->WriteCatalogList(blob_list, blob_cnt, partBlock);
-
return YES;
}
} // namespace Boot
diff --git a/dev/Kernel/HALKit/AMD64/Storage/SATA-DMA.cc b/dev/Kernel/HALKit/AMD64/Storage/SATA-DMA.cc
index 5d3acd16..a0d65c3a 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/SATA-DMA.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/SATA-DMA.cc
@@ -15,7 +15,6 @@
*
*/
-#include "NewKit/Defines.h"
#include <KernelKit/UserProcessScheduler.h>
#include <KernelKit/LPC.h>
@@ -33,18 +32,13 @@
#define HBA_PxCMD_FR 0x4000
#define HBA_PxCMD_CR 0x8000
-#define kAhciStartAddress mib_cast(4)
-
-#define kAhciLBAMode (1 << 6)
-
-#define kAhciMaxPoll (100000U)
-
-#define kCmdOrCtrlCmd 1
-#define kCmdOrCtrlCtrl 0
+#define kSataLBAMode (1 << 6)
#define kAhciSRBsy 0x80
#define kAhciSRDrq 0x08
+#define kAhciPortCnt 32
+
enum
{
kSATAProgIfAHCI = 0x01,
@@ -52,12 +46,14 @@ enum
kSATABar5 = 0x24,
};
-STATIC Kernel::PCI::Device kAhciDevice;
-STATIC HbaPort* kAhciPort = nullptr;
+STATIC Kernel::PCI::Device kPCIDevice;
+STATIC HbaPort* kSATAPort = nullptr;
STATIC Kernel::Lba kCurrentDiskSectorCount = 0UL;
-template <BOOL ReadWrite, BOOL CommandOrCTRL, BOOL Identify>
-static Kernel::Void drv_std_input_output(Kernel::UInt64 lba, Kernel::UInt8* buffer, Kernel::SizeT sector_cnt, Kernel::SizeT size_buffer);
+template <BOOL Write, BOOL CommandOrCTRL, BOOL Identify>
+static Kernel::Void drv_std_input_output(Kernel::UInt64 lba, Kernel::UInt8* buffer, Kernel::SizeT sector_sz, Kernel::SizeT size_buffer) noexcept;
+
+static Kernel::Int32 drv_find_cmd_slot(HbaPort* port) noexcept;
static Kernel::Void drv_calculate_disk_geometry() noexcept;
@@ -72,11 +68,11 @@ static Kernel::Void drv_calculate_disk_geometry() noexcept
kCurrentDiskSectorCount = (identify_data[61] << 16) | identify_data[60];
kcout << "Disk Size: " << Kernel::number(drv_get_size()) << endl;
- kcout << "Highest AHCI LBA: " << Kernel::number(kCurrentDiskSectorCount) << endl;
+ kcout << "Highest LBA: " << Kernel::number(kCurrentDiskSectorCount) << endl;
}
/// @brief Initializes an AHCI disk.
-/// @param PortsImplemented the amount of kAhciPort that have been detected.
+/// @param PortsImplemented the amount of kSATAPort that have been detected.
/// @return if the disk was successfully initialized or not.
Kernel::Boolean drv_std_init(Kernel::UInt16& PortsImplemented)
{
@@ -86,21 +82,21 @@ Kernel::Boolean drv_std_init(Kernel::UInt16& PortsImplemented)
for (SizeT device_index = 0; device_index < ZKA_BUS_COUNT; ++device_index)
{
- kAhciDevice = iterator[device_index].Leak(); // And then leak the reference.
+ kPCIDevice = iterator[device_index].Leak(); // And then leak the reference.
// if SATA and then interface is AHCI...
- if (kAhciDevice.Subclass() == kSATASubClass &&
- kAhciDevice.ProgIf() == kSATAProgIfAHCI)
+ if (kPCIDevice.Subclass() == kSATASubClass &&
+ kPCIDevice.ProgIf() == kSATAProgIfAHCI)
{
- kAhciDevice.EnableMmio(0x24); // Enable the memory index_byte/o for this ahci device.
- kAhciDevice.BecomeBusMaster(0x24); // Become bus master for this ahci device, so that we can control it.
+ kPCIDevice.EnableMmio(0x24); // Enable the memory index_byte/o for this ahci device.
+ kPCIDevice.BecomeBusMaster(0x24); // Become bus master for this ahci device, so that we can control it.
- HbaMem* mem_ahci = (HbaMem*)kAhciDevice.Bar(0x24);
+ HbaMem* mem_ahci = (HbaMem*)kPCIDevice.Bar(0x24);
Kernel::UInt32 ports_implemented = mem_ahci->Pi;
Kernel::UInt16 ahci_index = 0;
- const Kernel::UInt16 kMaxPortsImplemented = 32;
+ const Kernel::UInt16 kMaxPortsImplemented = kAhciPortCnt;
const Kernel::UInt32 kSATASignature = 0x00000101;
const Kernel::UInt8 kAhciPresent = 0x03;
const Kernel::UInt8 kAhciIPMActive = 0x01;
@@ -111,40 +107,27 @@ Kernel::Boolean drv_std_init(Kernel::UInt16& PortsImplemented)
{
if (ports_implemented)
{
- kcout << "Port is implemented by host.\r";
+ kcout << "Port is implemented.\r";
Kernel::UInt8 ipm = (mem_ahci->Ports[ahci_index].Ssts >> 8) & 0x0F;
Kernel::UInt8 det = mem_ahci->Ports[ahci_index].Ssts & 0x0F;
if (mem_ahci->Ports[ahci_index].Sig == kSATASignature)
{
- kcout << "Port is AHCI controller.\r";
-
- detected = true;
-
- kAhciPort = &mem_ahci->Ports[ahci_index];
-
- kAhciPort->Cmd &= ~HBA_PxCMD_FRE;
-
- // Clear FRE (bit4)
- kAhciPort->Cmd &= ~HBA_PxCMD_ST;
+ kcout << "Port is SATA.\r";
- // Wait until FR (bit14), CR (bit15) are cleared
- while (YES)
- {
- if (kAhciPort->Cmd & HBA_PxCMD_CR)
- continue;
+ kSATAPort = &mem_ahci->Ports[ahci_index];
- if (kAhciPort->Cmd & HBA_PxCMD_FR)
- continue;
- break;
- }
+ while (kSATAPort->Cmd & HBA_PxCMD_CR)
+ ;
- kAhciPort->Cmd |= HBA_PxCMD_FRE;
- kAhciPort->Cmd |= HBA_PxCMD_ST;
+ kSATAPort->Cmd |= HBA_PxCMD_FRE;
+ kSATAPort->Cmd |= HBA_PxCMD_ST;
drv_calculate_disk_geometry();
+ detected = YES;
+
break;
}
}
@@ -162,84 +145,101 @@ Kernel::Boolean drv_std_init(Kernel::UInt16& PortsImplemented)
Kernel::Boolean drv_std_detected(Kernel::Void)
{
- return kAhciDevice.DeviceId() != 0xFFFF;
+ return kPCIDevice.DeviceId() != 0xFFFF;
+}
+
+Kernel::Void drv_std_write(Kernel::UInt64 lba, Kernel::Char* buffer, Kernel::SizeT sector_sz, Kernel::SizeT size_buffer)
+{
+ lba /= sector_sz;
+
+ drv_std_input_output<YES, YES, NO>(lba, (Kernel::UInt8*)buffer, sector_sz, size_buffer);
}
-Kernel::Void drv_std_write(Kernel::UInt64 lba, Kernel::Char* buffer, Kernel::SizeT sector_cnt, Kernel::SizeT size_buffer)
+Kernel::Void drv_std_read(Kernel::UInt64 lba, Kernel::Char* buffer, Kernel::SizeT sector_sz, Kernel::SizeT size_buffer)
{
- lba /= sector_cnt;
+ lba /= sector_sz;
- drv_std_input_output<YES, YES, NO>(lba, (Kernel::UInt8*)buffer, sector_cnt, size_buffer);
+ drv_std_input_output<NO, YES, NO>(lba, (Kernel::UInt8*)buffer, sector_sz, size_buffer);
}
-Kernel::Void drv_std_read(Kernel::UInt64 lba, Kernel::Char* buffer, Kernel::SizeT sector_cnt, Kernel::SizeT size_buffer)
+static Kernel::Int32 drv_find_cmd_slot(HbaPort* port) noexcept
{
- lba /= sector_cnt;
+ Kernel::UInt32 slots = (port->Sact | port->Ci);
- drv_std_input_output<NO, YES, NO>(lba, (Kernel::UInt8*)buffer, sector_cnt, size_buffer);
+ for (Kernel::Int32 i = 0; i < kAhciPortCnt; i++)
+ {
+ if ((slots & 1) == 0)
+ return i;
+
+ slots >>= 1;
+ }
+
+ return -1;
}
template <BOOL Write, BOOL CommandOrCTRL, BOOL Identify>
-static Kernel::Void drv_std_input_output(Kernel::UInt64 lba, Kernel::UInt8* buffer, Kernel::SizeT sector_cnt, Kernel::SizeT size_buffer)
+static Kernel::Void drv_std_input_output(Kernel::UInt64 lba, Kernel::UInt8* buffer, Kernel::SizeT sector_sz, Kernel::SizeT size_buffer) noexcept
{
- volatile HbaCmdHeader* command_header = *(HbaCmdHeader**)&kAhciPort->Clb;
+ if (!CommandOrCTRL)
+ return;
- command_header->Cfl = sizeof(FisRegH2D) / sizeof(Kernel::UInt32);
+ volatile HbaCmdHeader* command_header = (HbaCmdHeader*)kSATAPort->Clb;
+ auto slot = drv_find_cmd_slot(kSATAPort);
+
+ if (slot == -1)
+ return;
+
+ command_header += slot;
+
+ command_header->Cfl = sizeof(FisRegH2D) / sizeof(Kernel::UInt32);
command_header->Write = Write;
command_header->Prdtl = (Kernel::UInt16)((size_buffer - 1) >> 4) + 1;
- HbaCmdTbl* command_table = (HbaCmdTbl*)(command_header->Ctba);
+ volatile HbaCmdTbl* command_table = (HbaCmdTbl*)(command_header->Ctba);
- command_table->PrdtEntries[0].Dba = *(Kernel::UInt32*)&buffer;
- command_table->PrdtEntries[0].Dbc = size_buffer;
+ command_table->PrdtEntries[0].Dba = (*(Kernel::UInt32*)buffer & __UINT32_MAX__);
+ command_table->PrdtEntries[0].Dbau = ((*(Kernel::UInt32*)buffer >> 8) & __UINT32_MAX__);
+ command_table->PrdtEntries[0].Dbc = size_buffer - 1;
command_table->PrdtEntries[0].InterruptBit = 1;
- FisRegH2D* h2d_fis = (FisRegH2D*)(&command_table->Cfis);
+ volatile FisRegH2D* h2d_fis = (FisRegH2D*)(&command_table->Cfis);
+
+ if (CommandOrCTRL)
+ {
+ h2d_fis->Command = Write ? kAHCICmdWriteDmaEx : kAHCICmdReadDmaEx;
+
+ if (Identify)
+ h2d_fis->Command = kAHCICmdIdentify;
+
+ h2d_fis->CmdOrCtrl = 1;
+ }
+
+ h2d_fis->FisType = kFISTypeRegH2D;
- h2d_fis->Command = Write ? kAHCICmdWriteDmaEx : kAHCICmdReadDmaEx;
- h2d_fis->FisType = kFISTypeRegH2D;
- h2d_fis->CmdOrCtrl = CommandOrCTRL;
+ h2d_fis->Device = kSataLBAMode;
h2d_fis->Lba0 = lba & 0xFF;
h2d_fis->Lba1 = lba >> 8;
h2d_fis->Lba2 = lba >> 16;
-
- h2d_fis->Device = 1 << 6;
-
h2d_fis->Lba3 = lba >> 24;
- h2d_fis->Lba4 = lba >> 32;
- h2d_fis->Lba5 = lba >> 40;
- h2d_fis->CountLow = sector_cnt & 0xFF;
- h2d_fis->CountHigh = (sector_cnt >> 8) & 0xFF;
+ h2d_fis->CountLow = sector_sz & 0xFF;
+ h2d_fis->CountHigh = (sector_sz >> 8) & 0xFF;
- kAhciPort->Ci |= (1 << 0); // Command Issue
+ kSATAPort->Ci = (1 << slot);
- while (kAhciPort->Ci & (1 << 0))
+ while ((kSATAPort->Ci & (1 << slot)) != 0)
{
- if (kAhciPort->Is & HBA_ERR_TFE) // Task file error
+ if (kSATAPort->Is & HBA_ERR_TFE)
{
- kcout << "AHCI: Read disk error.\r";
+ kcout << "AHCI: Task file disk error, setting global err...\r";
err_global_get() = Kernel::kErrorUnrecoverableDisk;
return;
}
}
-
- // Check again for the last time.
- if (kAhciPort->Is & HBA_ERR_TFE) // task file error status
- {
- using namespace Kernel;
-
- kcout << "AHCI: Read disk error.\r";
- *buffer = 0;
-
- err_global_get() = kErrorUnrecoverableDisk;
-
- return;
- }
}
/***
diff --git a/dev/Kernel/src/FS/NeFS.cc b/dev/Kernel/src/FS/NeFS.cc
index 6d79be7e..3dcf13da 100644
--- a/dev/Kernel/src/FS/NeFS.cc
+++ b/dev/Kernel/src/FS/NeFS.cc
@@ -190,12 +190,12 @@ _Output NFS_FORK_STRUCT* NeFileSystemParser::FindFork(_Input NFS_CATALOG_STRUCT*
switch (res)
{
case 1:
- err_local_get() = kErrorDiskReadOnly;
+ err_global_get() = kErrorDiskReadOnly;
break;
case 2:
- err_local_get() = kErrorDiskIsFull;
+ err_global_get() = kErrorDiskIsFull;
break;
- err_local_get() = kErrorNoSuchDisk;
+ err_global_get() = kErrorNoSuchDisk;
break;
default:
@@ -258,7 +258,7 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
if (catalog_copy)
{
kcout << "Catalog already exists: " << name << ".\r";
- err_local_get() = kErrorFileExists;
+ err_global_get() = kErrorFileExists;
return catalog_copy;
}
@@ -273,7 +273,7 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
if (*parent_name == 0)
{
kcout << "Parent name is NUL.\r";
- err_local_get() = kErrorFileNotFound;
+ err_global_get() = kErrorFileNotFound;
return nullptr;
}
@@ -284,18 +284,18 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
parent_name[indexFill] = name[indexFill];
}
- SizeT indexReverseCopy = rt_string_len(parent_name);
+ SizeT index_reverse_copy = rt_string_len(parent_name);
// zero character it.
- parent_name[--indexReverseCopy] = 0;
+ parent_name[--index_reverse_copy] = 0;
// mandatory / character, zero it.
- parent_name[--indexReverseCopy] = 0;
+ parent_name[--index_reverse_copy] = 0;
- while (parent_name[indexReverseCopy] != NeFileSystemHelper::Separator())
+ while (parent_name[index_reverse_copy] != NeFileSystemHelper::Separator())
{
- parent_name[indexReverseCopy] = 0;
- --indexReverseCopy;
+ parent_name[index_reverse_copy] = 0;
+ --index_reverse_copy;
}
NFS_CATALOG_STRUCT* catalog = this->FindCatalog(parent_name, out_lba);
@@ -351,8 +351,6 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
while (drive.fPacket.fPacketGood)
{
- auto next_sibling = reinterpret_cast<NFS_CATALOG_STRUCT*>(&temporary_catalog);
-
if (start_free <= kNeFSRootCatalogStartAddress)
{
delete child_catalog;
@@ -361,20 +359,17 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
catalog = nullptr;
child_catalog = nullptr;
- while (YES)
- ;
-
return nullptr;
}
// ========================== //
// Allocate catalog now...
// ========================== //
- if ((next_sibling->Flags & kNeFSFlagCreated) == 0)
+ if ((temporary_catalog.Flags & kNeFSFlagCreated) == 0)
{
- Char sectorBufPartBlock[kNeFSSectorSz] = {0};
+ Char buf_part_block[kNeFSSectorSz] = {0};
- drive.fPacket.fPacketContent = sectorBufPartBlock;
+ drive.fPacket.fPacketContent = buf_part_block;
drive.fPacket.fPacketSize = kNeFSSectorSz;
drive.fPacket.fPacketLba = kNeFSRootCatalogStartAddress;
@@ -382,7 +377,7 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
constexpr auto kNeFSCatalogPadding = 4;
- NFS_ROOT_PARTITION_BLOCK* part_block = (NFS_ROOT_PARTITION_BLOCK*)sectorBufPartBlock;
+ NFS_ROOT_PARTITION_BLOCK* part_block = (NFS_ROOT_PARTITION_BLOCK*)buf_part_block;
if (part_block->FreeCatalog < 1)
{
@@ -397,7 +392,7 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
// Write the new catalog next sibling, if we don't know this parent. //
// This is necessary, so that we don't have to get another lba to allocate. //
- if (!StringBuilder::Equals(parent_name, next_sibling->Name))
+ if (!StringBuilder::Equals(parent_name, temporary_catalog.Name))
{
child_catalog->NextSibling =
start_free + (sizeof(NFS_CATALOG_STRUCT) * kNeFSCatalogPadding);
@@ -411,7 +406,7 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
// Get NeFS partition's block.
- drive.fPacket.fPacketContent = sectorBufPartBlock;
+ drive.fPacket.fPacketContent = buf_part_block;
drive.fPacket.fPacketSize = kNeFSSectorSz;
drive.fPacket.fPacketLba = kNeFSRootCatalogStartAddress;
@@ -431,17 +426,22 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
delete catalog;
catalog = nullptr;
- return child_catalog;
+ NFS_CATALOG_STRUCT* found_catalog = new NFS_CATALOG_STRUCT();
+ rt_copy_memory(&temporary_catalog, found_catalog, sizeof(NFS_CATALOG_STRUCT));
+
+ return found_catalog;
}
- else if ((next_sibling->Flags & kNeFSFlagCreated) &&
- StringBuilder::Equals(next_sibling->Name, name))
+ else if ((temporary_catalog.Flags & kNeFSFlagCreated) &&
+ StringBuilder::Equals(temporary_catalog.Name, name))
{
- return next_sibling;
+ NFS_CATALOG_STRUCT* found_catalog = new NFS_CATALOG_STRUCT();
+ rt_copy_memory(&temporary_catalog, found_catalog, sizeof(NFS_CATALOG_STRUCT));
+
+ return child_catalog;
}
constexpr auto kNeFSCatalogPadding = 4;
- //// @note that's how we find the next catalog in the partition block.
start_free = start_free + (sizeof(NFS_CATALOG_STRUCT) * kNeFSCatalogPadding);
drive.fPacket.fPacketContent = &temporary_catalog;
@@ -457,7 +457,7 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char*
/// @brief Make a EPM+NeFS drive out of the disk.
/// @param drive The drive to write on.
-/// @return If it was sucessful, see err_local_get().
+/// @return If it was sucessful, see err_global_get().
bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const Lba endLba, _Input const Int32 flags, const Char* part_name)
{
if (*part_name == 0 ||
@@ -473,7 +473,7 @@ bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const L
// if disk isn't good, then error out.
if (false == drive->fPacket.fPacketGood)
{
- err_local_get() = kErrorDiskIsCorrupted;
+ err_global_get() = kErrorDiskIsCorrupted;
return false;
}
@@ -658,7 +658,7 @@ bool NeFileSystemParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog
// check the fork, if it's position is valid.
if (fork_data_input->DataOffset <= kNeFSCatalogStartAddress)
{
- err_local_get() = kErrorDiskIsCorrupted;
+ err_global_get() = kErrorDiskIsCorrupted;
kcout << "Invalid fork offset.\r";
@@ -720,7 +720,7 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::FindCatalog(_Input const Char* c
*catalog_name == 0)
return nullptr;
- kcout << "Start finding catalog...\r";
+ kcout << "Start finding catalog: " << catalog_name << "\r";
NFS_ROOT_PARTITION_BLOCK fs_buf{0};
auto drive = kDiskMountpoint.A();
@@ -758,33 +758,36 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::FindCatalog(_Input const Char* c
parent_name[indexFill] = catalog_name[indexFill];
}
- SizeT indexReverseCopy = rt_string_len(parent_name);
+ SizeT index_reverse_copy = rt_string_len(parent_name);
// zero character.
- parent_name[--indexReverseCopy] = 0;
+ parent_name[--index_reverse_copy] = 0;
// mandatory '/' character.
- parent_name[--indexReverseCopy] = 0;
+ parent_name[--index_reverse_copy] = 0;
- while (parent_name[indexReverseCopy] != NeFileSystemHelper::Separator())
+ while (parent_name[index_reverse_copy] != NeFileSystemHelper::Separator())
{
- parent_name[indexReverseCopy] = 0;
- --indexReverseCopy;
+ parent_name[index_reverse_copy] = 0;
+ --index_reverse_copy;
}
- NFS_CATALOG_STRUCT* parentCatalog = this->FindCatalog(parent_name, out_lba);
+ NFS_CATALOG_STRUCT* parent_catalog = this->FindCatalog(parent_name, out_lba);
- if (parentCatalog &&
+ if (parent_catalog &&
!StringBuilder::Equals(parent_name, NeFileSystemHelper::Root()))
{
- start_catalog_lba = parentCatalog->NextSibling;
- delete parentCatalog;
+ start_catalog_lba = parent_catalog->NextSibling;
+ delete parent_catalog;
+
+ parent_catalog = nullptr;
local_search_first = true;
}
- else if (parentCatalog)
+ else if (parent_catalog)
{
- delete parentCatalog;
+ delete parent_catalog;
+ parent_catalog = nullptr;
}
else
{
@@ -808,25 +811,28 @@ kNeFSSearchThroughCatalogList:
if (temporary_catalog.Status == kNeFSStatusLocked &&
!search_hidden)
{
- err_local_get() = kErrorFileLocked;
+ err_global_get() = kErrorFileLocked;
out_lba = 0UL;
return nullptr;
}
+
/// ignore unallocated catalog, break
if (!(temporary_catalog.Flags & kNeFSFlagCreated))
{
+ err_global_get() = kErrorFileNotFound;
+
out_lba = 0UL;
return nullptr;
}
- NFS_CATALOG_STRUCT* catalog_ptr = new NFS_CATALOG_STRUCT();
- rt_copy_memory(&temporary_catalog, catalog_ptr, sizeof(NFS_CATALOG_STRUCT));
-
kcout << "Found available catalog at: " << hex_number(start_catalog_lba) << endl;
kcout << "Found available catalog at: " << temporary_catalog.Name << endl;
+ NFS_CATALOG_STRUCT* catalog_ptr = new NFS_CATALOG_STRUCT();
+ rt_copy_memory(&temporary_catalog, catalog_ptr, sizeof(NFS_CATALOG_STRUCT));
+
out_lba = start_catalog_lba;
return catalog_ptr;
}
@@ -846,7 +852,7 @@ kNeFSSearchThroughCatalogList:
goto kNeFSSearchThroughCatalogList;
}
- err_local_get() = kErrorFileNotFound;
+ err_global_get() = kErrorFileNotFound;
out_lba = 0UL;
@@ -884,7 +890,7 @@ Boolean NeFileSystemParser::RemoveCatalog(_Input const Char* catalog_name)
if (!catalog_name ||
StringBuilder::Equals(catalog_name, NeFileSystemHelper::Root()))
{
- err_local_get() = kErrorInternal;
+ err_global_get() = kErrorInternal;
return false;
}
@@ -952,7 +958,7 @@ VoidPtr NeFileSystemParser::ReadCatalog(_Input _Output NFS_CATALOG_STRUCT* catal
{
if (!catalog)
{
- err_local_get() = kErrorFileNotFound;
+ err_global_get() = kErrorFileNotFound;
return nullptr;
}
@@ -1012,11 +1018,11 @@ bool NeFileSystemParser::Seek(_Input _Output NFS_CATALOG_STRUCT* catalog, SizeT
{
if (!catalog)
{
- err_local_get() = kErrorFileNotFound;
+ err_global_get() = kErrorFileNotFound;
return false;
}
- err_local_get() = kErrorUnimplemented;
+ err_global_get() = kErrorUnimplemented;
return false;
}
@@ -1030,11 +1036,11 @@ SizeT NeFileSystemParser::Tell(_Input _Output NFS_CATALOG_STRUCT* catalog)
{
if (!catalog)
{
- err_local_get() = kErrorFileNotFound;
+ err_global_get() = kErrorFileNotFound;
return 0;
}
- err_local_get() = kErrorUnimplemented;
+ err_global_get() = kErrorUnimplemented;
return 0;
}
@@ -1045,7 +1051,6 @@ namespace Kernel::Detail
/***********************************************************************************/
Boolean fs_init_newfs(Void) noexcept
{
- kcout << "Creating A: drive...\r";
kcout << "Creating A:\r";
kDiskMountpoint.A() = io_construct_main_drive();
diff --git a/dev/Kernel/src/KernelMain.cc b/dev/Kernel/src/KernelMain.cc
index 41cf19ee..58592a10 100644
--- a/dev/Kernel/src/KernelMain.cc
+++ b/dev/Kernel/src/KernelMain.cc
@@ -40,9 +40,9 @@ namespace Kernel::Detail
if (mNeFS)
{
- const SizeT kFolderCount = 7;
+ const SizeT kFolderCount = 8;
const Char* kFolderStr[kFolderCount] = {
- "/Boot/", "/System/", "/Support/", "/Applications/",
+ "/", "/Boot/", "/System/", "/Support/", "/Applications/",
"/Users/", "/Library/", "/Mount/"};
for (Kernel::SizeT dir_index = 0UL; dir_index < kFolderCount; ++dir_index)