summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/KernelKit
diff options
context:
space:
mode:
Diffstat (limited to 'dev/kernel/KernelKit')
-rw-r--r--dev/kernel/KernelKit/CodeMgr.h2
-rw-r--r--dev/kernel/KernelKit/DebugOutput.h17
-rw-r--r--dev/kernel/KernelKit/DeviceMgr.h6
-rw-r--r--dev/kernel/KernelKit/FileMgr.h10
-rw-r--r--dev/kernel/KernelKit/HardwareThreadScheduler.h8
-rw-r--r--dev/kernel/KernelKit/MemoryMgr.h2
-rw-r--r--dev/kernel/KernelKit/PCI/DMA.h6
-rw-r--r--dev/kernel/KernelKit/PCI/DMA.inl2
-rw-r--r--dev/kernel/KernelKit/ProcessScheduler.h22
-rw-r--r--dev/kernel/KernelKit/ThreadLocalStorage.inl2
-rw-r--r--dev/kernel/KernelKit/Timer.h4
-rw-r--r--dev/kernel/KernelKit/UserProcessScheduler.inl (renamed from dev/kernel/KernelKit/ProcessScheduler.inl)2
12 files changed, 38 insertions, 45 deletions
diff --git a/dev/kernel/KernelKit/CodeMgr.h b/dev/kernel/KernelKit/CodeMgr.h
index cff3b4bf..47c05d2e 100644
--- a/dev/kernel/KernelKit/CodeMgr.h
+++ b/dev/kernel/KernelKit/CodeMgr.h
@@ -21,7 +21,7 @@
namespace Kernel
{
/// @brief Main process entrypoint.
- typedef void (*rtl_main_kind)(const SizeT argc, Char** argv, Char** envp, const SizeT envp_len);
+ typedef void (*rtl_main_kind)(SizeT argc, Char** argv, Char** envp, SizeT envp_len);
/// @brief C++ Constructor entrypoint.
typedef void (*rtl_ctor_kind)(void);
diff --git a/dev/kernel/KernelKit/DebugOutput.h b/dev/kernel/KernelKit/DebugOutput.h
index 448e6208..c4174f27 100644
--- a/dev/kernel/KernelKit/DebugOutput.h
+++ b/dev/kernel/KernelKit/DebugOutput.h
@@ -107,7 +107,7 @@ namespace Kernel
return term;
}
- if (y < 0)
+ if (y == ~0UL)
y = -y;
const Char kNumbers[11] = "0123456789";
@@ -135,7 +135,7 @@ namespace Kernel
return term;
}
- if (y < 0)
+ if (y == ~0UL)
y = -y;
const Char kNumbers[17] = "0123456789ABCDEF";
@@ -159,15 +159,6 @@ namespace Kernel
return self;
}
- inline TerminalDevice number(const Char* x)
- {
- TerminalDevice self = TerminalDevice::The();
-
- self << "?";
-
- return self;
- }
-
inline TerminalDevice number(const Long& x)
{
TerminalDevice self = TerminalDevice::The();
@@ -208,6 +199,6 @@ namespace Kernel
#undef kout
#endif // ifdef kout
-#define kout Kernel::TerminalDevice::The()
+#define kout TerminalDevice::The()
-#define kendl Kernel::TerminalDevice::The() << Kernel::end_line()
+#define kendl end_line()
diff --git a/dev/kernel/KernelKit/DeviceMgr.h b/dev/kernel/KernelKit/DeviceMgr.h
index f34001f2..64949162 100644
--- a/dev/kernel/KernelKit/DeviceMgr.h
+++ b/dev/kernel/KernelKit/DeviceMgr.h
@@ -22,7 +22,7 @@
#include <NewKit/ErrorOr.h>
#include <NewKit/Ref.h>
-#define kDeviceMgrRootDirPath "/Devices/"
+#define kDeviceMgrRootDirPath "/dev/"
#define NE_DEVICE : public ::Kernel::IDeviceObject
@@ -52,13 +52,13 @@ namespace Kernel
IDeviceObject(const IDeviceObject<T>&) = default;
public:
- virtual IDeviceObject<T>& operator<<(T Data)
+ virtual IDeviceObject<T>& operator<<(T Data) [[maybe_unused]]
{
fOut(this, Data);
return *this;
}
- virtual IDeviceObject<T>& operator>>(T Data)
+ virtual IDeviceObject<T>& operator>>(T Data) [[maybe_unused]]
{
fIn(this, Data);
return *this;
diff --git a/dev/kernel/KernelKit/FileMgr.h b/dev/kernel/KernelKit/FileMgr.h
index f1475749..a73c4a85 100644
--- a/dev/kernel/KernelKit/FileMgr.h
+++ b/dev/kernel/KernelKit/FileMgr.h
@@ -210,7 +210,7 @@ namespace Kernel
FileStream(const FileStream&);
public:
- ErrorOr<Int64> Write(const SizeT offset, const VoidPtr data, SizeT len) noexcept
+ ErrorOr<Int64> Write(SizeT offset, const VoidPtr data, SizeT len) noexcept
{
if (this->fFileRestrict != kFileMgrRestrictReadWrite &&
this->fFileRestrict != kFileMgrRestrictReadWriteBinary &&
@@ -254,7 +254,7 @@ namespace Kernel
return ErrorOr<Int64>(kErrorInvalidData);
}
- VoidPtr Read(const Char* name, const SizeT sz) noexcept
+ VoidPtr Read(const Char* name, SizeT sz) noexcept
{
if (this->fFileRestrict != kFileMgrRestrictReadWrite &&
this->fFileRestrict != kFileMgrRestrictReadWriteBinary &&
@@ -262,6 +262,8 @@ namespace Kernel
this->fFileRestrict != kFileMgrRestrictReadBinary)
return nullptr;
+ NE_UNUSED(sz);
+
auto man = FSClass::GetMounted();
if (man)
@@ -273,7 +275,7 @@ namespace Kernel
return nullptr;
}
- VoidPtr Read(SizeT offset, const SizeT sz)
+ VoidPtr Read(SizeT offset, SizeT sz)
{
if (this->fFileRestrict != kFileMgrRestrictReadWrite &&
this->fFileRestrict != kFileMgrRestrictReadWriteBinary &&
@@ -345,7 +347,7 @@ namespace Kernel
const Encoding* restrict_type)
: fFile(Class::GetMounted()->Open(path, restrict_type))
{
- const SizeT kRestrictCount = kRestrictMax;
+ SizeT kRestrictCount = kRestrictMax;
const FileRestrictKind kRestrictList[] = {
{
.fRestrict = kRestrictR,
diff --git a/dev/kernel/KernelKit/HardwareThreadScheduler.h b/dev/kernel/KernelKit/HardwareThreadScheduler.h
index 815be306..74d96bd8 100644
--- a/dev/kernel/KernelKit/HardwareThreadScheduler.h
+++ b/dev/kernel/KernelKit/HardwareThreadScheduler.h
@@ -103,21 +103,21 @@ namespace Kernel
HAL::StackFramePtr Leak() noexcept;
public:
- Ref<HardwareThread*> operator[](const SizeT& idx);
+ Ref<HardwareThread*> operator[](SizeT idx);
bool operator!() noexcept;
operator bool() noexcept;
- const Bool IsUser() override
+ Bool IsUser() override
{
return Yes;
}
- const Bool IsKernel() override
+ Bool IsKernel() override
{
return No;
}
- const Bool HasMP() override
+ Bool HasMP() override
{
return kHandoverHeader->f_HardwareTables.f_MultiProcessingEnabled;
}
diff --git a/dev/kernel/KernelKit/MemoryMgr.h b/dev/kernel/KernelKit/MemoryMgr.h
index 061aa182..ac11ac29 100644
--- a/dev/kernel/KernelKit/MemoryMgr.h
+++ b/dev/kernel/KernelKit/MemoryMgr.h
@@ -37,7 +37,7 @@ namespace Kernel
/// @param wr Read Write bit.
/// @param user User enable bit.
/// @return The newly allocated pointer, or nullptr.
- VoidPtr mm_new_heap(const SizeT sz, const Bool wr, const Bool user, const SizeT pad_amount = 0);
+ VoidPtr mm_new_heap(SizeT sz, Bool wr, Bool user, SizeT pad_amount = 0);
/// @brief Protect the heap with a CRC value.
/// @param heap_ptr pointer.
diff --git a/dev/kernel/KernelKit/PCI/DMA.h b/dev/kernel/KernelKit/PCI/DMA.h
index 19170e8f..b2d3cfa8 100644
--- a/dev/kernel/KernelKit/PCI/DMA.h
+++ b/dev/kernel/KernelKit/PCI/DMA.h
@@ -49,19 +49,19 @@ namespace Kernel
T* operator->();
template <class T>
- T* Get(const UIntPtr off = 0);
+ T* Get(UIntPtr off = 0);
public:
operator bool();
bool operator!();
public:
- bool Write(const UIntPtr& bit, const UInt32& offset);
+ bool Write(UIntPtr& bit, const UInt32& offset);
UIntPtr Read(const UInt32& offset);
Boolean Check(UIntPtr offset) const;
public:
- UIntPtr operator[](const UIntPtr& offset);
+ UIntPtr operator[](UIntPtr& offset);
private:
voidPtr fAddress{nullptr};
diff --git a/dev/kernel/KernelKit/PCI/DMA.inl b/dev/kernel/KernelKit/PCI/DMA.inl
index 0b80b208..89381149 100644
--- a/dev/kernel/KernelKit/PCI/DMA.inl
+++ b/dev/kernel/KernelKit/PCI/DMA.inl
@@ -13,7 +13,7 @@ namespace Kernel
}
template <class T>
- T* DMAWrapper::Get(const UIntPtr offset)
+ T* DMAWrapper::Get(UIntPtr offset)
{
return reinterpret_cast<T*>((UIntPtr)this->fAddress + offset);
}
diff --git a/dev/kernel/KernelKit/ProcessScheduler.h b/dev/kernel/KernelKit/ProcessScheduler.h
index d33fe7a5..97589d31 100644
--- a/dev/kernel/KernelKit/ProcessScheduler.h
+++ b/dev/kernel/KernelKit/ProcessScheduler.h
@@ -123,7 +123,7 @@ namespace Kernel
};
using ProcessTime = UInt64;
- using PID = UInt64;
+ using PID = Int64;
/***********************************************************************************/
/// @note For User manager, tells where we run the code.
@@ -245,7 +245,7 @@ namespace Kernel
///! @param pad_amount amount to add after pointer.
///! @return A wrapped pointer, or error code.
/***********************************************************************************/
- ErrorOr<VoidPtr> New(const SizeT& sz, const SizeT& pad_amount = 0);
+ ErrorOr<VoidPtr> New(SizeT sz, SizeT pad_amount = 0);
/***********************************************************************************/
///! @brief TLS free.
@@ -253,12 +253,12 @@ namespace Kernel
///! @param sz the size of it.
/***********************************************************************************/
template <typename T>
- Boolean Delete(ErrorOr<T*> ptr, const SizeT& sz);
+ Boolean Delete(ErrorOr<T*> ptr);
/***********************************************************************************/
///! @brief Wakes up thread.
/***********************************************************************************/
- Void Wake(const Bool wakeup = false);
+ Void Wake(Bool wakeup = false);
public:
/***********************************************************************************/
@@ -337,15 +337,15 @@ namespace Kernel
public:
ProcessID Spawn(const Char* name, VoidPtr code, VoidPtr image);
- const Bool Remove(ProcessID process_id);
+ Void Remove(ProcessID process_id);
- const Bool IsUser() override;
- const Bool IsKernel() override;
- const Bool HasMP() override;
+ Bool IsUser() override;
+ Bool IsKernel() override;
+ Bool HasMP() override;
public:
Ref<UserProcess>& CurrentProcess();
- const SizeT Run() noexcept;
+ SizeT Run() noexcept;
public:
STATIC UserProcessScheduler& The();
@@ -363,7 +363,7 @@ namespace Kernel
class UserProcessHelper final
{
public:
- STATIC Bool Switch(VoidPtr image_ptr, UInt8* stack_ptr, HAL::StackFramePtr frame_ptr, const PID& new_pid);
+ STATIC Bool Switch(VoidPtr image_ptr, UInt8* stack_ptr, HAL::StackFramePtr frame_ptr, PID new_pid);
STATIC Bool CanBeScheduled(const UserProcess& process);
STATIC ErrorOr<PID> TheCurrentPID();
STATIC SizeT StartScheduling();
@@ -373,7 +373,7 @@ namespace Kernel
} // namespace Kernel
#include <KernelKit/ThreadLocalStorage.h>
-#include <KernelKit/ProcessScheduler.inl>
+#include <KernelKit/UserProcessScheduler.inl>
////////////////////////////////////////////////////
// END
diff --git a/dev/kernel/KernelKit/ThreadLocalStorage.inl b/dev/kernel/KernelKit/ThreadLocalStorage.inl
index d017144d..9161b5d0 100644
--- a/dev/kernel/KernelKit/ThreadLocalStorage.inl
+++ b/dev/kernel/KernelKit/ThreadLocalStorage.inl
@@ -42,7 +42,7 @@ inline Kernel::Bool tls_delete_ptr(T* obj) noexcept
ErrorOr<T*> obj_wrapped{obj};
- return ref_process.Leak().Delete(obj_wrapped, sizeof(T));
+ return ref_process.Leak().Delete(obj_wrapped);
}
//! @brief Delete process pointer.
diff --git a/dev/kernel/KernelKit/Timer.h b/dev/kernel/KernelKit/Timer.h
index 86fa1a59..f3fb5ee6 100644
--- a/dev/kernel/KernelKit/Timer.h
+++ b/dev/kernel/KernelKit/Timer.h
@@ -43,7 +43,7 @@ namespace Kernel
BOOL Wait() noexcept override;
private:
- IntPtr* fDigitalTimer{nullptr};
+ UIntPtr* fDigitalTimer{nullptr};
Int64 fWaitFor{0};
};
@@ -60,7 +60,7 @@ namespace Kernel
BOOL Wait() noexcept override;
private:
- IntPtr* fDigitalTimer{nullptr};
+ UIntPtr* fDigitalTimer{nullptr};
Int64 fWaitFor{0};
};
diff --git a/dev/kernel/KernelKit/ProcessScheduler.inl b/dev/kernel/KernelKit/UserProcessScheduler.inl
index 3169682e..39e2aaf0 100644
--- a/dev/kernel/KernelKit/ProcessScheduler.inl
+++ b/dev/kernel/KernelKit/UserProcessScheduler.inl
@@ -17,7 +17,7 @@ namespace Kernel
/***********************************************************************************/
template <typename T>
- Boolean UserProcess::Delete(ErrorOr<T*> ptr, const SizeT& sz)
+ Boolean UserProcess::Delete(ErrorOr<T*> ptr)
{
if (!ptr)
return No;