summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Private/ArchKit/ArchKit.hpp4
-rw-r--r--Private/Builtins/IEEE802/.gitkeep (renamed from Private/Builtins/RJ45/.gitkeep)0
-rw-r--r--Private/Builtins/IEEE802/compile_flags.txt (renamed from Private/Builtins/RJ45/compile_flags.txt)0
-rw-r--r--Private/KernelKit/DriveManager.hxx2
-rw-r--r--Private/KernelKit/HError.hpp1
-rw-r--r--Private/Source/DriveManager.cxx9
-rw-r--r--Private/Source/FS/NewFS.cxx13
-rw-r--r--Private/makefile2
8 files changed, 25 insertions, 6 deletions
diff --git a/Private/ArchKit/ArchKit.hpp b/Private/ArchKit/ArchKit.hpp
index c7130353..ce22d70c 100644
--- a/Private/ArchKit/ArchKit.hpp
+++ b/Private/ArchKit/ArchKit.hpp
@@ -10,11 +10,11 @@
#include <NewKit/Defines.hpp>
#include <NewKit/Function.hpp>
-#ifdef __x86_64__
+#ifdef __NEWOS_AMD64__
#include <HALKit/AMD64/HalPageAlloc.hpp>
#include <HALKit/AMD64/Hypervisor.hpp>
#include <HALKit/AMD64/Processor.hpp>
-#elif defined(__powerpc64__)
+#elif defined(__NEWOS_PPC__)
#include <HALKit/PowerPC/Processor.hpp>
#else
#error Unknown architecture
diff --git a/Private/Builtins/RJ45/.gitkeep b/Private/Builtins/IEEE802/.gitkeep
index e69de29b..e69de29b 100644
--- a/Private/Builtins/RJ45/.gitkeep
+++ b/Private/Builtins/IEEE802/.gitkeep
diff --git a/Private/Builtins/RJ45/compile_flags.txt b/Private/Builtins/IEEE802/compile_flags.txt
index 545816fc..545816fc 100644
--- a/Private/Builtins/RJ45/compile_flags.txt
+++ b/Private/Builtins/IEEE802/compile_flags.txt
diff --git a/Private/KernelKit/DriveManager.hxx b/Private/KernelKit/DriveManager.hxx
index aa94b08d..e66dedc8 100644
--- a/Private/KernelKit/DriveManager.hxx
+++ b/Private/KernelKit/DriveManager.hxx
@@ -121,7 +121,7 @@ DriveTrait construct_drive(void) noexcept;
/// @brief Fetches the main drive.
/// @return the new drive.
-DriveTrait main_drive(void) noexcept;
+DriveTrait construct_main_drive(void) noexcept;
} // namespace NewOS
#endif /* ifndef __DRIVE_MANAGER__ */
diff --git a/Private/KernelKit/HError.hpp b/Private/KernelKit/HError.hpp
index a0105d64..a3ea5d61 100644
--- a/Private/KernelKit/HError.hpp
+++ b/Private/KernelKit/HError.hpp
@@ -34,6 +34,7 @@ inline constexpr HError kErrorForkAlreadyExists = 50;
inline constexpr HError kErrorOutOfTeamSlot = 51;
inline constexpr HError kErrorHeapNotPresent = 52;
inline constexpr HError kErrorNoEntrypoint = 53;
+inline constexpr HError kErrorDiskIsCorrupted = 54;
inline constexpr HError kErrorUnimplemented = 0;
Boolean ke_bug_check(void) noexcept;
diff --git a/Private/Source/DriveManager.cxx b/Private/Source/DriveManager.cxx
index 45b3c09a..46c6f150 100644
--- a/Private/Source/DriveManager.cxx
+++ b/Private/Source/DriveManager.cxx
@@ -8,6 +8,7 @@
#include <KernelKit/DriveManager.hxx>
#include <Builtins/ATA/Defines.hxx>
#include <Builtins/AHCI/Defines.hxx>
+#include <NewKit/Utils.hpp>
/// @file DriveManager.cxx
/// @brief Kernel drive manager.
@@ -91,6 +92,9 @@ Void ke_drv_unimplemented(DriveTrait::DrivePacket* pckt) {}
DriveTrait construct_drive() noexcept {
DriveTrait trait;
+ rt_copy_memory((VoidPtr)"/Mount/Null", trait.fName, rt_string_len("/Mount/Null"));
+ trait.fKind = kInvalidDrive;
+
trait.fInput = ke_drv_unimplemented;
trait.fOutput = ke_drv_unimplemented;
trait.fVerify = ke_drv_unimplemented;
@@ -100,9 +104,12 @@ DriveTrait construct_drive() noexcept {
/// @brief Fetches the main drive.
/// @return the new drive.
-DriveTrait main_drive() noexcept {
+DriveTrait construct_main_drive() noexcept {
DriveTrait trait;
+ rt_copy_memory((VoidPtr)"/Mount/Disk/0", trait.fName, rt_string_len("/Mount/Disk/0"));
+ trait.fKind = kMassStorage | kEPMDrive;
+
trait.fInput = ke_drv_input;
trait.fOutput = ke_drv_output;
trait.fVerify = ke_drv_check_disk;
diff --git a/Private/Source/FS/NewFS.cxx b/Private/Source/FS/NewFS.cxx
index 012cb3d2..1d7d3621 100644
--- a/Private/Source/FS/NewFS.cxx
+++ b/Private/Source/FS/NewFS.cxx
@@ -151,7 +151,18 @@ _Output NewCatalog* NewFSParser::CreateCatalog(_Input const char* name,
/// @brief Make a EPM+NewFS drive out of the disk.
/// @param drive The drive to write on.
/// @return If it was sucessful, see DbgLastError().
-bool NewFSParser::Format(_Input _Output DriveTrait* drive) { return false; }
+bool NewFSParser::Format(_Input _Output DriveTrait* drive) {
+ /// verify disk.
+ drive->fVerify(&drive->fPacket);
+
+ /// if disk isn't good, then error out.
+ if (false == drive->fPacket.fPacketGood) {
+ DbgLastError() = kErrorDiskIsCorrupted;
+ return false;
+ }
+
+ return true;
+}
/// @brief
/// @param catalog
diff --git a/Private/makefile b/Private/makefile
index b73bcb02..08eeed4e 100644
--- a/Private/makefile
+++ b/Private/makefile
@@ -5,7 +5,7 @@
CC = x86_64-w64-mingw32-gcc
LD = x86_64-w64-mingw32-ld
-CCFLAGS = -c -ffreestanding -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./
+CCFLAGS = -c -ffreestanding -D__NEWOS_AMD64__ -mgeneral-regs-only -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./
ASM = nasm
ifneq ($(ATA_PIO_SUPPORT), )