summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKA/HALKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-22 23:03:29 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-22 23:04:42 +0200
commit8c9091c24fe976d358ae0209bc1a48e15b277d76 (patch)
treee19ac39ac70bb9cf5525fd3fb2d9f1b168e22568 /dev/ZKA/HALKit
parent10099e99847307fae60aebdf2292002d359d45b4 (diff)
[FIX] NewFS and builtin PIO support have been fixed.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA/HALKit')
-rw-r--r--dev/ZKA/HALKit/AMD64/HalKernelMain.cxx15
-rw-r--r--dev/ZKA/HALKit/AMD64/Storage/ATA-PIO.cxx20
2 files changed, 13 insertions, 22 deletions
diff --git a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx
index de5ea494..43c2248d 100644
--- a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx
+++ b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx
@@ -227,22 +227,11 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept
Kernel::NewFilesystemManager::Mount(fs);
- if (auto node = fs->GetParser()->GetCatalog("\\Users\\");
- !node)
- {
- delete fs->GetParser()->CreateCatalog("\\Users\\", 0, kNewFSCatalogKindDir);
- delete fs->GetParser()->CreateCatalog(kUsersFile, 0, kNewFSCatalogKindFile);
- }
-
#ifdef __DEBUG__
- const auto cPassword = "debug_usr";
+ const auto cPassword = "debug_usr";
const auto cPasswordIncorrect = "debug_usr_invalid";
- Kernel::User user{Kernel::RingKind::kRingSuperUser, kSuperUser};
- if (!user.TrySave(cPassword))
- {
- Kernel::ke_stop(RUNTIME_CHECK_UNEXCPECTED);
- }
+ Kernel::User user{Kernel::RingKind::kRingSuperUser, kSuperUser};
Kernel::UserManager::The()->TryLogIn(user, cPassword);
#endif
diff --git a/dev/ZKA/HALKit/AMD64/Storage/ATA-PIO.cxx b/dev/ZKA/HALKit/AMD64/Storage/ATA-PIO.cxx
index c1cdd013..acca5dd4 100644
--- a/dev/ZKA/HALKit/AMD64/Storage/ATA-PIO.cxx
+++ b/dev/ZKA/HALKit/AMD64/Storage/ATA-PIO.cxx
@@ -67,7 +67,7 @@ Boolean drv_std_init(UInt16 Bus, UInt8 Drive, UInt16& OutBus, UInt8& OutMaster)
UInt16 IO = Bus;
drv_std_select(IO);
-
+
Kernel::kcout << "newoskrnl: Initializing drive...\r";
ATAInit_Retry:
@@ -114,9 +114,9 @@ ATAInit_Retry:
Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz, SizeT Size)
{
- UInt8 Command = ((!Master) ? 0xE0 : 0xF0);
+ Lba /= SectorSz;
- Lba /= SectorSz;
+ UInt8 Command = ((!Master) ? 0xE0 : 0xF0);
drv_std_wait_io(IO);
drv_std_select(IO);
@@ -124,11 +124,12 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz
Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0x0F));
/// Compute sector count.
- Out8(IO + ATA_REG_SEC_COUNT0, SectorSz / (SectorSz / 2));
+ Out8(IO + ATA_REG_SEC_COUNT0, 2);
- Out8(IO + ATA_REG_LBA0, (Lba));
+ Out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
+ Out8(IO + ATA_REG_LBA3, (Lba) >> 24);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
@@ -146,9 +147,9 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz
Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz, SizeT Size)
{
- UInt8 Command = ((!Master) ? 0xE0 : 0xF0);
+ Lba /= SectorSz;
- Lba /= SectorSz;
+ UInt8 Command = ((!Master) ? 0xE0 : 0xF0);
drv_std_wait_io(IO);
drv_std_select(IO);
@@ -156,11 +157,12 @@ Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorS
/// Compute sector count.
Out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0x0F));
- Out8(IO + ATA_REG_SEC_COUNT0, SectorSz / (SectorSz / 2));
+ Out8(IO + ATA_REG_SEC_COUNT0, 2);
- Out8(IO + ATA_REG_LBA0, (Lba));
+ Out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
+ Out8(IO + ATA_REG_LBA3, (Lba) >> 24);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);