summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Kernel')
-rw-r--r--dev/Kernel/FirmwareKit/EFI/EFI.h2
-rw-r--r--dev/Kernel/HALKit/AMD64/HalDebugOutput.cc17
-rw-r--r--dev/Kernel/KernelKit/DebugOutput.h2
-rw-r--r--dev/Kernel/KernelKit/DriveMgr.h12
-rw-r--r--dev/Kernel/NewKit/Utils.h5
-rw-r--r--dev/Kernel/src/DriveMgr.cc11
-rw-r--r--dev/Kernel/src/FS/NeFS.cc16
-rw-r--r--dev/Kernel/src/KernelMain.cc3
-rw-r--r--dev/Kernel/src/Utils.cc9
9 files changed, 50 insertions, 27 deletions
diff --git a/dev/Kernel/FirmwareKit/EFI/EFI.h b/dev/Kernel/FirmwareKit/EFI/EFI.h
index cca7747e..1e18da58 100644
--- a/dev/Kernel/FirmwareKit/EFI/EFI.h
+++ b/dev/Kernel/FirmwareKit/EFI/EFI.h
@@ -539,7 +539,7 @@ typedef struct EfiBootServices
VoidPtr Stall;
EfiStatusType(EFI_API* SetWatchdogTimer)(UInt32 Timeout, UInt64 WatchdogCode, UInt32 DataSize, EfiCharType* Data);
VoidPtr ConnectController;
- VoidPtr DisconnectController;
+ VoidPtr DriveonnectController;
EfiOpenProtocol OpenProtocol;
VoidPtr CloseProtocol;
VoidPtr OpenProtocolInformation;
diff --git a/dev/Kernel/HALKit/AMD64/HalDebugOutput.cc b/dev/Kernel/HALKit/AMD64/HalDebugOutput.cc
index d984e087..cb8aef59 100644
--- a/dev/Kernel/HALKit/AMD64/HalDebugOutput.cc
+++ b/dev/Kernel/HALKit/AMD64/HalDebugOutput.cc
@@ -83,7 +83,8 @@ namespace Kernel
len = rt_string_len(bytes, 255);
static int x = kFontSizeX, y = kFontSizeY;
- auto log_txt = RGB(0xff, 0xff, 0xff);
+
+ static BOOL not_important = NO;
while (index < len)
{
@@ -96,7 +97,19 @@ namespace Kernel
tmp_str[0] = bytes[index];
tmp_str[1] = 0;
- fb_render_string(tmp_str, y, x, log_txt);
+ if (bytes[index] == '*')
+ {
+ if (not_important)
+ not_important = NO;
+ else
+ not_important = YES;
+
+ ++index;
+
+ continue;
+ }
+
+ fb_render_string(tmp_str, y, x, not_important ? RGB(0xff, 0xff, 0xff) : RGB(0x00, 0x00, 0xff));
if (bytes[index] == '\r')
{
diff --git a/dev/Kernel/KernelKit/DebugOutput.h b/dev/Kernel/KernelKit/DebugOutput.h
index 7f0ff3cf..f57575ac 100644
--- a/dev/Kernel/KernelKit/DebugOutput.h
+++ b/dev/Kernel/KernelKit/DebugOutput.h
@@ -206,6 +206,6 @@ namespace Kernel
#undef kout
#endif // ifdef kout
-#define kout Kernel::TerminalDevice::The() << "[NeKernel] " << __FILE__ << ": "
+#define kout Kernel::TerminalDevice::The() << "[NeKernel] *" << __FILE__ << "*: "
#define endl Kernel::TerminalDevice::The() << Kernel::end_line()
diff --git a/dev/Kernel/KernelKit/DriveMgr.h b/dev/Kernel/KernelKit/DriveMgr.h
index 5d82a54a..28c2fdad 100644
--- a/dev/Kernel/KernelKit/DriveMgr.h
+++ b/dev/Kernel/KernelKit/DriveMgr.h
@@ -27,14 +27,14 @@ namespace Kernel
{
enum
{
- kInvalidDisc = -1,
+ kInvalidDrive = -1,
/// Storage types, combine with flags.
kBlockDevice = 0xAD,
- kMassStorageDisc = 0xDA,
- kFloppyDisc = 0xCD,
- kOpticalDisc = 0xDC, // CD-ROM/DVD-ROM/Blu-Ray
- kTapeDisc = 0xD7,
+ kMassStorageDrive = 0xDA,
+ kFloppyDrive = 0xCD,
+ kOpticalDrive = 0xDC, // CD-ROM/DVD-ROM/Blu-Ray
+ kTapeDrive = 0xD7,
/// Storage flags, combine with types.
kReadOnlyDrive = 0x10, // Read only drive
@@ -50,7 +50,7 @@ namespace Kernel
struct DriveTrait final
{
Char fName[kDriveNameLen]; // /System, /Boot, //./Devices/USB...
- Int32 fKind; // fMassStorage, fFloppy, fOpticalDisc.
+ Int32 fKind; // fMassStorage, fFloppy, fOpticalDrive.
Int32 fFlags; // fReadOnly, fEPMDrive...
/// @brief Packet drive (StorageKit compilant.)
diff --git a/dev/Kernel/NewKit/Utils.h b/dev/Kernel/NewKit/Utils.h
index d36fda03..e9a3f9a7 100644
--- a/dev/Kernel/NewKit/Utils.h
+++ b/dev/Kernel/NewKit/Utils.h
@@ -20,8 +20,9 @@ namespace Kernel
Size rt_string_len(const Char* str);
Size rt_string_len(const Char* str, SizeT _len);
Boolean rt_to_string(Char* buf, UInt64 base, Int32 limit);
- Boolean is_newln(Char chr);
- Boolean is_space(Char chr);
+ Boolean rt_is_newln(Char chr);
+ Boolean rt_is_space(Char chr);
+ Int32 rt_is_alnum(Int32 character);
Int rt_to_uppercase(Int c);
Int rt_to_lower(Int c);
voidPtr rt_string_in_string(const Char* in, const Char* needle);
diff --git a/dev/Kernel/src/DriveMgr.cc b/dev/Kernel/src/DriveMgr.cc
index 5d1868da..53b22a58 100644
--- a/dev/Kernel/src/DriveMgr.cc
+++ b/dev/Kernel/src/DriveMgr.cc
@@ -134,7 +134,7 @@ namespace Kernel
constexpr auto kBlankDrive = "/media/blank/";
rt_copy_memory((VoidPtr)kBlankDrive, trait.fName, rt_string_len(kBlankDrive));
- trait.fKind = kInvalidDisc;
+ trait.fKind = kInvalidDrive;
trait.fInput = io_drv_unimplemented;
trait.fOutput = io_drv_unimplemented;
@@ -169,7 +169,7 @@ namespace Kernel
if (rt_string_cmp(((BOOT_BLOCK_STRUCT*)trait.fPacket.fPacketContent)->Magic, kEPMMagic, kEPMMagicLength) == 0)
{
trait.fPacket.fPacketReadOnly = NO;
- trait.fKind = kMassStorageDisc | kEPMDrive;
+ trait.fKind = kMassStorageDrive | kEPMDrive;
kout << "Disk is EPM.\r";
@@ -187,12 +187,15 @@ namespace Kernel
else
{
trait.fPacket.fPacketReadOnly = YES;
- trait.fKind = kMassStorageDisc | kUnformattedDrive | kReadOnlyDrive;
+ trait.fKind = kMassStorageDrive | kUnformattedDrive | kReadOnlyDrive;
kout << "Scheme Found: " << block_struct.Name << endl;
- if (block_struct.Name[0] == 0)
+ if (block_struct.Name[0] == 0 ||
+ !rt_is_alnum(block_struct.Name[0]))
+ {
kout << "Disk partition is empty (Read Only)\r";
+ }
}
rt_copy_memory((VoidPtr) "*/*", trait.fPacket.fPacketMime,
diff --git a/dev/Kernel/src/FS/NeFS.cc b/dev/Kernel/src/FS/NeFS.cc
index f8938444..91c6820e 100644
--- a/dev/Kernel/src/FS/NeFS.cc
+++ b/dev/Kernel/src/FS/NeFS.cc
@@ -449,13 +449,12 @@ _Output NEFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char
/// @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)
{
-#ifdef NE_EPM_SUPPORT
if (*part_name == 0 ||
endLba == 0)
return false;
// verify disk.
- drive->fVerify(&drive->fPacket);
+ drive->fVerify(drive->fPacket);
rt_copy_memory((VoidPtr) "fs/nefs-packet", drive->fPacket.fPacketMime,
rt_string_len("fs/nefs-packet"));
@@ -475,7 +474,7 @@ bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const L
drive->fPacket.fPacketSize = sizeof(NEFS_ROOT_PARTITION_BLOCK);
drive->fPacket.fPacketLba = start;
- drive->fInput(&drive->fPacket);
+ drive->fInput(drive->fPacket);
if (flags & kNeFSPartitionTypeBoot)
{
@@ -511,7 +510,7 @@ bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const L
drive->fPacket.fPacketSize = sizeof(EPM_PART_BLOCK);
drive->fPacket.fPacketLba = outEpmLba;
- drive->fInput(&drive->fPacket);
+ drive->fInput(drive->fPacket);
if (buf[0] == 0)
{
@@ -527,7 +526,7 @@ bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const L
drive->fPacket.fPacketSize = sizeof(EPM_PART_BLOCK);
drive->fPacket.fPacketLba = outEpmLba;
- drive->fOutput(&drive->fPacket);
+ drive->fOutput(drive->fPacket);
break;
}
@@ -579,7 +578,7 @@ bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const L
drive->fPacket.fPacketSize = sizeof(NEFS_ROOT_PARTITION_BLOCK);
drive->fPacket.fPacketLba = kNeFSRootCatalogStartAddress;
- drive->fOutput(&drive->fPacket);
+ drive->fOutput(drive->fPacket);
kout << "drive kind: " << drive->fDriveKind() << endl;
@@ -604,9 +603,8 @@ bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const L
drive->fPacket.fPacketSize = sizeof(NEFS_ROOT_PARTITION_BLOCK);
drive->fPacket.fPacketLba = start;
- drive->fInput(&drive->fPacket);
+ drive->fInput(drive->fPacket);
}
-#endif // NE_EPM_SUPPORT
return false;
}
@@ -785,7 +783,7 @@ _Output NEFS_CATALOG_STRUCT* NeFileSystemParser::FindCatalog(_Input const Char*
NEFS_CATALOG_STRUCT temporary_catalog{};
kNeFSSearchThroughCatalogList:
- while (YES)
+ while (drive.fPacket.fPacketGood || !drive.fPacket.fPacketReadOnly)
{
drive.fPacket.fPacketLba = start_catalog_lba;
drive.fPacket.fPacketContent = &temporary_catalog;
diff --git a/dev/Kernel/src/KernelMain.cc b/dev/Kernel/src/KernelMain.cc
index d4a9e126..c9b8a629 100644
--- a/dev/Kernel/src/KernelMain.cc
+++ b/dev/Kernel/src/KernelMain.cc
@@ -99,4 +99,7 @@ EXTERN_C Kernel::Void rtl_kernel_main(Kernel::SizeT argc, char** argv, char** en
Kernel::NeFS::fs_init_nefs();
Kernel::Detail::NeFilesystemInstaller installer{};
#endif // __NE_AUTO_FORMAT__
+
+ while (YES)
+ ;
}
diff --git a/dev/Kernel/src/Utils.cc b/dev/Kernel/src/Utils.cc
index c09d82fb..07090e91 100644
--- a/dev/Kernel/src/Utils.cc
+++ b/dev/Kernel/src/Utils.cc
@@ -124,6 +124,11 @@ namespace Kernel
return character;
}
+ Int32 rt_is_alnum(Int32 character)
+ {
+ return (character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') || (character >= '0' && character <= '9');
+ }
+
Int32 rt_to_lower(Int32 character)
{
if (character >= 'A' && character <= 'Z')
@@ -132,12 +137,12 @@ namespace Kernel
return character;
}
- Boolean is_space(Char chr)
+ Boolean rt_is_space(Char chr)
{
return chr == ' ';
}
- Boolean is_newln(Char chr)
+ Boolean rt_is_newln(Char chr)
{
return chr == '\n';
}