summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Kernel')
-rw-r--r--dev/Kernel/FSKit/NeFS.h8
-rw-r--r--dev/Kernel/FirmwareKit/EFI/EFI.h28
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/DMA.cc4
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/PIO.cc4
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/SATA.cc2
-rw-r--r--dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc6
-rw-r--r--dev/Kernel/KernelKit/HardwareThreadScheduler.h2
-rw-r--r--dev/Kernel/KernelKit/LoaderInterface.h6
-rw-r--r--dev/Kernel/KernelKit/PCI/DMA.h2
-rw-r--r--dev/Kernel/KernelKit/UserProcessScheduler.h2
-rw-r--r--dev/Kernel/NewKit/KString.h2
-rw-r--r--dev/Kernel/NewKit/Macros.h8
-rw-r--r--dev/Kernel/src/DriveMgr.cc20
-rw-r--r--dev/Kernel/src/FS/NeFS.cc26
-rw-r--r--dev/Kernel/src/KString.cc4
15 files changed, 66 insertions, 58 deletions
diff --git a/dev/Kernel/FSKit/NeFS.h b/dev/Kernel/FSKit/NeFS.h
index 87633b76..0b690553 100644
--- a/dev/Kernel/FSKit/NeFS.h
+++ b/dev/Kernel/FSKit/NeFS.h
@@ -279,8 +279,8 @@ namespace Kernel
/// @param name the fork name.
/// @return the fork.
_Output NEFS_FORK_STRUCT* FindFork(_Input NEFS_CATALOG_STRUCT* catalog,
- _Input const Char* name,
- Boolean data);
+ _Input const Char* name,
+ Boolean data);
_Output Void RemoveFork(_Input NEFS_FORK_STRUCT* fork);
@@ -290,7 +290,7 @@ namespace Kernel
_Output NEFS_CATALOG_STRUCT* GetCatalog(_Input const Char* name);
- _Output NEFS_CATALOG_STRUCT* CreateCatalog(_Input const Char* name,
+ _Output NEFS_CATALOG_STRUCT* CreateCatalog(_Input const Char* name,
_Input const Int32& flags,
_Input const Int32& kind);
@@ -305,7 +305,7 @@ namespace Kernel
_Output VoidPtr ReadCatalog(_Input _Output NEFS_CATALOG_STRUCT* catalog,
_Input Bool isRsrcFork,
_Input SizeT dataSz,
- _Input const Char* forkName);
+ _Input const Char* forkName);
_Output Bool Seek(_Input _Output NEFS_CATALOG_STRUCT* catalog, SizeT off);
diff --git a/dev/Kernel/FirmwareKit/EFI/EFI.h b/dev/Kernel/FirmwareKit/EFI/EFI.h
index 1e18da58..23a20a9f 100644
--- a/dev/Kernel/FirmwareKit/EFI/EFI.h
+++ b/dev/Kernel/FirmwareKit/EFI/EFI.h
@@ -52,7 +52,7 @@ typedef Char16 EfiChar16Type;
/// Self is like NT's Win32 HANDLE type.
typedef struct EfiHandle
{
-} * EfiHandlePtr;
+}* EfiHandlePtr;
/* UEFI uses wide characters by default. */
typedef WideChar EfiCharType;
@@ -582,15 +582,15 @@ typedef struct
typedef EfiStatusType(EFI_API* EfiInputReadKey)(
IN EfiSimpleTextInputProtocol* This,
- OUT EfiInputKey* Key);
+ OUT EfiInputKey* Key);
typedef EfiStatusType(EFI_API* EfiInputReset)(
IN EfiSimpleTextInputProtocol* This,
IN Boolean ExtendedChk);
typedef EfiStatusType(EFI_API* EfiWaitForEvent)(
- IN UInt32 NumberOfEvents,
- IN VoidPtr Event,
+ IN UInt32 NumberOfEvents,
+ IN VoidPtr Event,
OUT UInt32* Index);
typedef struct EfiSimpleTextInputProtocol
@@ -646,7 +646,7 @@ typedef struct EfiSystemTable
{
EfiGUID VendorGUID;
VoidPtr VendorTable;
- } * ConfigurationTable;
+ }* ConfigurationTable;
} EfiSystemTable;
#define kEfiOk 0
@@ -878,11 +878,11 @@ typedef struct _EfiProcessorInformation
typedef EfiStatusType EFI_API (*EfiMpServicesGetNumberOfProcessors)(
IN struct _EfiMpServicesProtocol* Self,
- OUT UInt32* NumberOfProcessors,
- OUT UInt32* NumberOfEnabledProcessors);
+ OUT UInt32* NumberOfProcessors,
+ OUT UInt32* NumberOfEnabledProcessors);
typedef EfiStatusType EFI_API (*EfiMpServicesGetProcessorInfo)(
- IN struct _EfiMpServicesProtocol* Self,
+ IN struct _EfiMpServicesProtocol* Self,
IN UInt32* ProcessorNumber,
OUT struct _EfiProcessorInformation* NumberOfEnabledProcessors);
@@ -895,8 +895,8 @@ typedef EfiStatusType EFI_API (*EfiMpServicesStartupAllAPS)(
IN Boolean SingleThread,
IN VoidPtr WaitEvent OPTIONAL, // EFI_EVENT first, but unused here.
IN UInt32 TimeoutInMicroSeconds,
- IN Void* ProcedureArgument OPTIONAL,
- OUT UInt32** FailedCpuList OPTIONAL);
+ IN Void* ProcedureArgument OPTIONAL,
+ OUT UInt32** FailedCpuList OPTIONAL);
typedef EfiStatusType EFI_API (*EfiMpServicesSwitchBSP)(
IN struct _EfiMpServicesProtocol* Self,
@@ -909,18 +909,18 @@ typedef EfiStatusType EFI_API (*EfiMpServicesStartupThisAP)(
IN UInt32 ProcessorNumber,
IN VoidPtr WaitEvent OPTIONAL,
IN UInt32 TimeoutInMicroseconds,
- IN Void* ProcedureArgument OPTIONAL,
- OUT Boolean* Finished OPTIONAL);
+ IN Void* ProcedureArgument OPTIONAL,
+ OUT Boolean* Finished OPTIONAL);
typedef EfiStatusType EFI_API (*EfiMpServicesDisableThisAP)(
IN struct _EfiMpServicesProtocol* Self,
IN UInt32 ProcessorNumber,
IN Boolean EnableAP,
- IN UInt32* HealthFlag OPTIONAL);
+ IN UInt32* HealthFlag OPTIONAL);
typedef EfiStatusType EFI_API (*EfiMpServicesWhoAmI)(
IN struct _EfiMpServicesProtocol* Self,
- OUT UInt32* ProcessorNumber);
+ OUT UInt32* ProcessorNumber);
typedef struct _EfiMpServicesProtocol
{
diff --git a/dev/Kernel/HALKit/AMD64/Storage/DMA.cc b/dev/Kernel/HALKit/AMD64/Storage/DMA.cc
index 93d1db31..646af906 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/DMA.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/DMA.cc
@@ -163,7 +163,7 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + SectorSz - 1) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba)&0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
@@ -205,7 +205,7 @@ Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorS
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + (SectorSz - 1)) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba)&0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
diff --git a/dev/Kernel/HALKit/AMD64/Storage/PIO.cc b/dev/Kernel/HALKit/AMD64/Storage/PIO.cc
index 3ca1e403..73a2690d 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/PIO.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/PIO.cc
@@ -127,7 +127,7 @@ Void drv_std_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorSz
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + SectorSz) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba)&0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
@@ -157,7 +157,7 @@ Void drv_std_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf, SizeT SectorS
rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + (SectorSz)) / SectorSz));
- rt_out8(IO + ATA_REG_LBA0, (Lba)&0xFF);
+ rt_out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
diff --git a/dev/Kernel/HALKit/AMD64/Storage/SATA.cc b/dev/Kernel/HALKit/AMD64/Storage/SATA.cc
index 8f68b734..34acb0a7 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/SATA.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/SATA.cc
@@ -46,7 +46,7 @@
#define kSATABar5 (0x24)
STATIC Kernel::PCI::Device kDevice;
-STATIC HbaMem* kSATA = nullptr;
+STATIC HbaMem* kSATA = nullptr;
STATIC Kernel::SizeT kSATAPortIdx = 0UL;
STATIC Kernel::Lba kCurrentDiskSectorCount = 0UL;
STATIC Kernel::Char kCurrentDiskModel[50] = {"UNKNOWN SATA DRIVE"};
diff --git a/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc b/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc
index 2abf04b5..f5553f3e 100644
--- a/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc
+++ b/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc
@@ -22,9 +22,9 @@ namespace Kernel
constexpr auto kFlashBridgeMagic = "FLSH";
constexpr auto kFlashBridgeRevision = 1;
- STATIC BOOL kFlashEnabled = NO;
- STATIC SizeT kFlashSize[kMaxFlashSlots] = {};
- STATIC SizeT kFlashSectorSz[kMaxFlashSlots] = {};
+ STATIC BOOL kFlashEnabled = NO;
+ STATIC SizeT kFlashSize[kMaxFlashSlots] = {};
+ STATIC SizeT kFlashSectorSz[kMaxFlashSlots] = {};
STATIC IMBCIHost* kFlashMetaPackets[kMaxFlashSlots] = {};
STATIC IMBCIHost* kFlashDataPackets[kMaxFlashSlots] = {};
diff --git a/dev/Kernel/KernelKit/HardwareThreadScheduler.h b/dev/Kernel/KernelKit/HardwareThreadScheduler.h
index a5b43ea8..3615d570 100644
--- a/dev/Kernel/KernelKit/HardwareThreadScheduler.h
+++ b/dev/Kernel/KernelKit/HardwareThreadScheduler.h
@@ -105,7 +105,7 @@ namespace Kernel
public:
Ref<HardwareThread*> operator[](const SizeT& idx);
bool operator!() noexcept;
- operator bool() noexcept;
+ operator bool() noexcept;
const Bool IsUser() override
{
diff --git a/dev/Kernel/KernelKit/LoaderInterface.h b/dev/Kernel/KernelKit/LoaderInterface.h
index 9d28d050..c2cbb93c 100644
--- a/dev/Kernel/KernelKit/LoaderInterface.h
+++ b/dev/Kernel/KernelKit/LoaderInterface.h
@@ -25,9 +25,9 @@ namespace Kernel
public:
virtual _Output ErrorOr<VoidPtr> GetBlob() = 0;
- virtual _Output const Char* AsString() = 0;
- virtual _Output const Char* MIME() = 0;
- virtual _Output const Char* Path() = 0;
+ virtual _Output const Char* AsString() = 0;
+ virtual _Output const Char* MIME() = 0;
+ virtual _Output const Char* Path() = 0;
virtual _Output ErrorOr<VoidPtr> FindStart() = 0;
virtual _Output VoidPtr FindSymbol(_Input const Char* name, _Input Int32 kind) = 0;
};
diff --git a/dev/Kernel/KernelKit/PCI/DMA.h b/dev/Kernel/KernelKit/PCI/DMA.h
index bcdfd250..ab740d01 100644
--- a/dev/Kernel/KernelKit/PCI/DMA.h
+++ b/dev/Kernel/KernelKit/PCI/DMA.h
@@ -52,7 +52,7 @@ namespace Kernel
T* Get(const UIntPtr off = 0);
public:
- operator bool();
+ operator bool();
bool operator!();
public:
diff --git a/dev/Kernel/KernelKit/UserProcessScheduler.h b/dev/Kernel/KernelKit/UserProcessScheduler.h
index ef08a660..6c96c8e5 100644
--- a/dev/Kernel/KernelKit/UserProcessScheduler.h
+++ b/dev/Kernel/KernelKit/UserProcessScheduler.h
@@ -290,7 +290,7 @@ namespace Kernel
NE_COPY_DEFAULT(UserProcessScheduler)
- operator bool();
+ operator bool();
bool operator!();
public:
diff --git a/dev/Kernel/NewKit/KString.h b/dev/Kernel/NewKit/KString.h
index c0e48d72..dc327f3b 100644
--- a/dev/Kernel/NewKit/KString.h
+++ b/dev/Kernel/NewKit/KString.h
@@ -16,7 +16,7 @@
namespace Kernel
{
- /// @brief KString static string class.
+ /// @brief Kernel string class, not dynamic.
class KString final
{
public:
diff --git a/dev/Kernel/NewKit/Macros.h b/dev/Kernel/NewKit/Macros.h
index 8673bad1..15d5f2bd 100644
--- a/dev/Kernel/NewKit/Macros.h
+++ b/dev/Kernel/NewKit/Macros.h
@@ -11,7 +11,7 @@
#endif
#ifndef kib_cast
-#define kib_cast(X) (Kernel::UInt64)((X)*1024)
+#define kib_cast(X) (Kernel::UInt64)((X) * 1024)
#endif
#ifndef MIB
@@ -92,9 +92,9 @@
#define END_STRING_ENUM() }
#endif
-#ifndef rtl_alloca
-#define rtl_alloca(sz) __builtin_alloca(sz)
-#endif // #ifndef rtl_alloca
+#ifndef RTL_ALLOCA
+#define RTL_ALLOCA(sz) __builtin_alloca(sz)
+#endif // #ifndef RTL_ALLOCA
#ifndef CANT_REACH
#define CANT_REACH() __builtin_unreachable()
diff --git a/dev/Kernel/src/DriveMgr.cc b/dev/Kernel/src/DriveMgr.cc
index bc3caeac..4240f158 100644
--- a/dev/Kernel/src/DriveMgr.cc
+++ b/dev/Kernel/src/DriveMgr.cc
@@ -24,6 +24,10 @@ namespace Kernel
STATIC UInt8 kATAMaster = 0U;
#endif
+#if defined(__AHCI__)
+ STATIC UInt16 kAHCIPortsImplemented = 0UL;
+#endif
+
/// @brief reads from an ATA drive.
/// @param pckt Packet structure (fPacketContent must be non null)
/// @return
@@ -42,7 +46,10 @@ namespace Kernel
Void io_drv_output(DriveTrait::DrivePacket pckt)
{
if (pckt.fPacketReadOnly)
+ {
+ pckt.fPacketGood = NO;
return;
+ }
#ifdef __AHCI__
drv_std_write(pckt.fPacketLba, (Char*)pckt.fPacketContent, kAHCISectorSize, pckt.fPacketSize);
@@ -59,10 +66,8 @@ namespace Kernel
#if defined(__ATA_PIO__) || defined(__ATA_DMA__)
kATAMaster = 0;
kATAIO = 0;
-#endif
-#if defined(__ATA_PIO__) || defined(__ATA_DMA__)
- kATAMaster = true;
+ kATAMaster = YES;
kATAIO = ATA_PRIMARY_IO;
if (drv_std_init(kATAIO, kATAMaster, kATAIO, kATAMaster))
@@ -71,22 +76,25 @@ namespace Kernel
return;
}
- kATAMaster = false;
+ kATAMaster = NO;
kATAIO = ATA_SECONDARY_IO;
if (!drv_std_init(kATAIO, kATAMaster, kATAIO, kATAMaster))
{
+ pckt.fPacketGood = YES;
return;
}
pckt.fPacketGood = YES;
#elif defined(__AHCI__)
- UInt16 pi = 0;
+ kAHCIPortsImplemented = 0;
- if (!drv_std_init(pi))
+ if (!drv_std_init(kAHCIPortsImplemented))
{
return;
}
+
+ pckt.fPacketGood = YES;
#endif // if defined(__ATA_PIO__) || defined (__ATA_DMA__)
}
diff --git a/dev/Kernel/src/FS/NeFS.cc b/dev/Kernel/src/FS/NeFS.cc
index bde2daa0..24a03704 100644
--- a/dev/Kernel/src/FS/NeFS.cc
+++ b/dev/Kernel/src/FS/NeFS.cc
@@ -79,7 +79,7 @@ _Output BOOL NeFileSystemParser::CreateFork(_Input NEFS_FORK_STRUCT& the_fork)
if (lba < kNeFSCatalogStartAddress)
return NO;
- auto drv = kMountpoint.A();
+ auto& drv = kMountpoint.A();
Lba lba_prev = lba;
@@ -165,10 +165,10 @@ _Output BOOL NeFileSystemParser::CreateFork(_Input NEFS_FORK_STRUCT& the_fork)
/// @return the fork.
/***********************************************************************************/
_Output NEFS_FORK_STRUCT* NeFileSystemParser::FindFork(_Input NEFS_CATALOG_STRUCT* catalog,
- _Input const Char* name,
- Boolean isDataFork)
+ _Input const Char* name,
+ Boolean isDataFork)
{
- auto drive = kMountpoint.A();
+ auto& drive = kMountpoint.A();
NEFS_FORK_STRUCT* the_fork = nullptr;
Lba lba = isDataFork ? catalog->DataFork : catalog->ResourceFork;
@@ -231,7 +231,7 @@ _Output NEFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char
/// @param kind the catalog kind.
/// @return catalog pointer.
/***********************************************************************************/
-_Output NEFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char* name,
+_Output NEFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char* name,
_Input const Int32& flags,
_Input const Int32& kind)
{
@@ -301,7 +301,7 @@ _Output NEFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char
NEFS_CATALOG_STRUCT* catalog = this->FindCatalog(parent_name, out_lba);
- auto drive = kMountpoint.A();
+ auto& drive = kMountpoint.A();
constexpr auto kNeFSCatalogPadding = 4;
@@ -553,13 +553,13 @@ bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const L
part_block->Version = kNeFSVersionInteger;
- const auto cUntitledHD = part_name;
+ const auto kNeFSUntitledHD = part_name;
rt_copy_memory((VoidPtr)kNeFSIdent, (VoidPtr)part_block->Ident,
kNeFSIdentLen);
- rt_copy_memory((VoidPtr)cUntitledHD, (VoidPtr)part_block->PartitionName,
- rt_string_len(cUntitledHD));
+ rt_copy_memory((VoidPtr)kNeFSUntitledHD, (VoidPtr)part_block->PartitionName,
+ rt_string_len(kNeFSUntitledHD));
SizeT catalogCount = 0UL;
@@ -623,7 +623,7 @@ bool NeFileSystemParser::WriteCatalog(_Input const Char* catalog_name, Bool is_r
rt_copy_memory(data, buf, size_of_data);
- auto drive = kMountpoint.A();
+ auto& drive = kMountpoint.A();
rt_copy_memory((VoidPtr) "fs/nefs-packet", drive.fPacket.fPacketMime,
rt_string_len("fs/nefs-packet"));
@@ -885,7 +885,7 @@ _Output Boolean NeFileSystemParser::RemoveCatalog(_Input const Char* catalog_nam
catalog->Flags &= (~kNeFSFlagCreated);
catalog->Flags |= kNeFSFlagDeleted;
- auto drive = kMountpoint.A();
+ auto& drive = kMountpoint.A();
rt_copy_memory((VoidPtr) "fs/nefs-packet", drive.fPacket.fPacketMime,
rt_string_len("fs/nefs-packet"));
@@ -936,7 +936,7 @@ _Output Boolean NeFileSystemParser::RemoveCatalog(_Input const Char* catalog_nam
VoidPtr NeFileSystemParser::ReadCatalog(_Input _Output NEFS_CATALOG_STRUCT* catalog,
_Input Bool is_rsrc_fork,
_Input SizeT dataSz,
- _Input const Char* forkName)
+ _Input const Char* forkName)
{
if (!catalog)
{
@@ -951,7 +951,7 @@ VoidPtr NeFileSystemParser::ReadCatalog(_Input _Output NEFS_CATALOG_STRUCT* cata
<< ", fork: " << hex_number(dataForkLba) << endl;
NEFS_FORK_STRUCT* fs_buf = new NEFS_FORK_STRUCT();
- auto drive = kMountpoint.A();
+ auto& drive = kMountpoint.A();
rt_copy_memory((VoidPtr) "fs/nefs-packet", drive.fPacket.fPacketMime,
rt_string_len("fs/nefs-packet"));
diff --git a/dev/Kernel/src/KString.cc b/dev/Kernel/src/KString.cc
index e30d6fe1..590db984 100644
--- a/dev/Kernel/src/KString.cc
+++ b/dev/Kernel/src/KString.cc
@@ -100,7 +100,7 @@ namespace Kernel
return ("?");
const Char* boolean_expr = i ? "YES" : "NO";
- Char* ret = (Char*)rtl_alloca((sizeof(char) * i) ? 4 : 5 + rt_string_len(fmt));
+ Char* ret = (Char*)RTL_ALLOCA((sizeof(char) * i) ? 4 : 5 + rt_string_len(fmt));
if (!ret)
return ("?");
@@ -160,7 +160,7 @@ namespace Kernel
return ("?");
Char* ret =
- (Char*)rtl_alloca(sizeof(char) * rt_string_len(fmt2) + rt_string_len(fmt));
+ (Char*)RTL_ALLOCA(sizeof(char) * rt_string_len(fmt2) + rt_string_len(fmt));
if (!ret)
return ("?");