diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-02 07:48:20 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-02 07:48:20 +0200 |
| commit | b5db67d19105b958f59a683a81a00a8cbf91a0e1 (patch) | |
| tree | a85f3bf12ea68380391cc7050bd3deb37cb73b66 | |
| parent | d2b31db9d2c9a70592ebed05cd73352f9b9d194b (diff) | |
Kernel: See below.
- Check for partition as well when initializing disk. (New FS)
- Return kErrorProcessFault when process crashes, as well as do a bug
check when a driver crashes.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | Private/Source/FS/NewFS.cxx | 44 | ||||
| -rw-r--r-- | Private/Source/ProcessScheduler.cxx | 12 |
2 files changed, 47 insertions, 9 deletions
diff --git a/Private/Source/FS/NewFS.cxx b/Private/Source/FS/NewFS.cxx index fdbbda6d..870c1b69 100644 --- a/Private/Source/FS/NewFS.cxx +++ b/Private/Source/FS/NewFS.cxx @@ -643,16 +643,16 @@ Boolean NewFSParser::RemoveCatalog(_Input const Char* catalogName) { drive->fOutput(&drive->fPacket); // send packet. - Char partitonBlockBuf[sizeof(NewPartitionBlock)] = {0}; + Char partitionBlockBuf[sizeof(NewPartitionBlock)] = {0}; drive->fPacket.fLba = kNewFSAddressAsLba; - drive->fPacket.fPacketContent = partitonBlockBuf; + drive->fPacket.fPacketContent = partitionBlockBuf; drive->fPacket.fPacketSize = sizeof(NewPartitionBlock); drive->fInput(&drive->fPacket); NewPartitionBlock* partBlock = - reinterpret_cast<NewPartitionBlock*>(partitonBlockBuf); + reinterpret_cast<NewPartitionBlock*>(partitionBlockBuf); ++partBlock->FreeCatalog; --partBlock->CatalogCount; @@ -670,10 +670,13 @@ Boolean NewFSParser::RemoveCatalog(_Input const Char* catalogName) { /// Reading,Seek,Tell are unimplemented on catalogs, refer to forks I/O instead. /// ***************************************************************** /// +/***********************************************************************************/ /// @brief Read the catalog data fork. /// @param catalog /// @param dataSz /// @return +/***********************************************************************************/ + VoidPtr NewFSParser::ReadCatalog(_Input _Output NewCatalog* catalog, _Input SizeT dataSz, _Input const char* forkName) { @@ -740,32 +743,43 @@ VoidPtr NewFSParser::ReadCatalog(_Input _Output NewCatalog* catalog, return forkBuf; } +/***********************************************************************************/ /// @brief Seek in the data fork. /// @param catalog the catalog offset. /// @param off where to seek. -/// @return +/// @return if the seeking was successful. +/***********************************************************************************/ + bool NewFSParser::Seek(_Input _Output NewCatalog* catalog, SizeT off) { if (!catalog) { DbgLastError() = kErrorFileNotFound; return false; } - return true; + DbgLastError() = kErrorUnimplemented; + return false; } +/***********************************************************************************/ /// @brief Tell where we are inside the data fork. /// @param catalog -/// @return +/// @return The position on the file. +/***********************************************************************************/ + SizeT NewFSParser::Tell(_Input _Output NewCatalog* catalog) { if (!catalog) { DbgLastError() = kErrorFileNotFound; return 0; } + DbgLastError() = kErrorUnimplemented; return 0; } namespace NewOS::Detail { +/***********************************************************************************/ +/// @brief Construct NewFS drives. +/***********************************************************************************/ Boolean fs_init_newfs(Void) noexcept { sMountpointInterface.A() = construct_main_drive(); sMountpointInterface.B() = construct_drive(); @@ -774,6 +788,24 @@ Boolean fs_init_newfs(Void) noexcept { sMountpointInterface.A().fVerify(&sMountpointInterface.A().fPacket); + Char partitionBlockBuf[sizeof(NewPartitionBlock)] = { 0 }; + + sMountpointInterface.A().fPacket.fLba = kNewFSAddressAsLba; + sMountpointInterface.A().fPacket.fPacketContent = partitionBlockBuf; + sMountpointInterface.A().fPacket.fPacketSize = sizeof(NewPartitionBlock); + + sMountpointInterface.A().fInput(&sMountpointInterface.A().fPacket); + + NewPartitionBlock* partBlock = + reinterpret_cast<NewPartitionBlock*>(partitionBlockBuf); + + if (!StringBuilder::Equals(partBlock->Ident, kNewFSIdent)) { + kcout << "New OS: New FS Partition is corrupt.\r"; + return false; + } + + kcout << "New OS: Read partition: " << partBlock->PartitionName << ", with success!\r"; + return true; } } // namespace NewOS::Detail diff --git a/Private/Source/ProcessScheduler.cxx b/Private/Source/ProcessScheduler.cxx index 5ac253cb..22222f9e 100644 --- a/Private/Source/ProcessScheduler.cxx +++ b/Private/Source/ProcessScheduler.cxx @@ -33,12 +33,18 @@ STATIC Int32 kLastExitCode = 0U; const Int32 &rt_get_exit_code() noexcept { return kLastExitCode; } /***********************************************************************************/ +/// @brief crash current process. +/***********************************************************************************/ void ProcessHeader::Crash() { - kcout << "ProcessScheduler: Crashed, ExitCode: -1.\r"; - MUST_PASS(ke_bug_check()); + kcout << this->Name << ": crashed. (id = " << number(39); + kcout << ")\r"; + + if (this->Ring != kRingUserKind) { + MUST_PASS(ke_bug_check()); + } - this->Exit(-1); + this->Exit(kErrorProcessFault); } void ProcessHeader::Wake(const bool should_wakeup) { |
