summaryrefslogtreecommitdiffhomepage
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/FirmwareKit/Handover.h5
-rw-r--r--src/kernel/HALKit/AMD64/HalKernelMain.cpp8
-rw-r--r--src/kernel/KernelKit/Semaphore.h8
-rw-r--r--src/kernel/src/HeapMgr.cpp11
4 files changed, 16 insertions, 16 deletions
diff --git a/src/kernel/FirmwareKit/Handover.h b/src/kernel/FirmwareKit/Handover.h
index 8515cfa6..f3382f75 100644
--- a/src/kernel/FirmwareKit/Handover.h
+++ b/src/kernel/FirmwareKit/Handover.h
@@ -10,7 +10,7 @@
#include <NeKit/Config.h>
#define kHandoverMagic (0xBADCC)
-#define kHandoverVersion (0x0117)
+#define kHandoverVersion (0x0118)
/* Initial bitmap pointer location and size. */
#define kHandoverStructSz sizeof(HEL::BootInfoHeader)
@@ -79,7 +79,8 @@ struct BootInfoHeader final {
UInt32 f_PixelPerLine;
} f_GOP;
- UInt64 f_FirmwareSpecific[8];
+ UInt64 f_NumberOfProcessors;
+ UInt64 f_FirmwareSpecific[7];
};
enum {
diff --git a/src/kernel/HALKit/AMD64/HalKernelMain.cpp b/src/kernel/HALKit/AMD64/HalKernelMain.cpp
index 4c527572..97102865 100644
--- a/src/kernel/HALKit/AMD64/HalKernelMain.cpp
+++ b/src/kernel/HALKit/AMD64/HalKernelMain.cpp
@@ -157,9 +157,11 @@ EXTERN_C Kernel::Void hal_real_init(Kernel::Void) {
NeFileSystemMgr::Mount(new NeFileSystemMgr());
#endif
- cg_init();
- FBDrawBitMapInRegion(kBootLogo, BOOT_LOGO_WIDTH, BOOT_LOGO_HEIGHT, 10, 10);
- cg_clear();
+ for (SizeT idxCore{0}; idxCore < kHandoverHeader->f_NumberOfProcessors; ++idxCore) {
+ cg_init();
+ FBDrawBitMapInRegion(kBootLogo, BOOT_LOGO_WIDTH, BOOT_LOGO_HEIGHT, 10, 12 + BOOT_LOGO_WIDTH * idxCore);
+ cg_clear();
+ }
UserProcessScheduler::The().SwitchTeam(kRTUserTeam);
diff --git a/src/kernel/KernelKit/Semaphore.h b/src/kernel/KernelKit/Semaphore.h
index 4dc9a454..13f3eadb 100644
--- a/src/kernel/KernelKit/Semaphore.h
+++ b/src/kernel/KernelKit/Semaphore.h
@@ -29,7 +29,7 @@ using SemaphoreArr = UInt64[kSemaphoreCount];
/// @brief Checks if the semaphore is valid.
inline bool rtl_sem_is_valid(const SemaphoreArr& sem, const UInt64& owner = 0) {
- if (!sem) return false;
+ //if (!sem) return false;
return sem[kSemaphoreOwnerIndex] == owner && sem[kSemaphoreCountIndex] > 0;
}
@@ -37,7 +37,7 @@ inline bool rtl_sem_is_valid(const SemaphoreArr& sem, const UInt64& owner = 0) {
/// @param sem
/// @return
inline bool rtl_sem_release(SemaphoreArr& sem) {
- if (!sem) return false;
+ //if (!sem) return false;
sem[kSemaphoreOwnerIndex] = 0;
sem[kSemaphoreCountIndex] = 0;
@@ -50,7 +50,7 @@ inline bool rtl_sem_release(SemaphoreArr& sem) {
/// @param owner the owner to set, could be anything identifitable.
/// @return
inline bool rtl_sem_acquire(SemaphoreArr& sem, const UInt64& owner) {
- if (!sem) return false;
+ //if (!sem) return false;
if (!owner) {
err_global_get() = kErrorInvalidData;
@@ -70,7 +70,7 @@ inline bool rtl_sem_acquire(SemaphoreArr& sem, const UInt64& owner) {
/// @return
inline bool rtl_sem_wait(SemaphoreArr& sem, const UInt64& owner, const UInt64& timeout,
bool& condition) {
- if (!sem) return false;
+ //if (!sem) return false;
if (!rtl_sem_is_valid(sem, owner)) {
return false;
diff --git a/src/kernel/src/HeapMgr.cpp b/src/kernel/src/HeapMgr.cpp
index a7430824..eea230e1 100644
--- a/src/kernel/src/HeapMgr.cpp
+++ b/src/kernel/src/HeapMgr.cpp
@@ -28,6 +28,8 @@
#define kHeapMgrMagic (0xD4D75)
#define kHeapMgrAlignSz (4U)
+#define kHeapMgrSpinMax (255'000)
+
namespace Kernel {
/// @brief Implementation details.
@@ -63,8 +65,8 @@ namespace Detail {
};
/// @brief Check for heap address validity.
- /// @param heap_ptr The address_ptr to check.
/// @return Bool if the pointer is valid or not.
+ /// @param heap_ptr The address_ptr to check.
_Output auto mm_check_ptr_address(VoidPtr heap_ptr) -> Bool {
if (!heap_ptr) return false;
@@ -85,7 +87,7 @@ STATIC PageMgr kPageMgr;
/// @return The newly allocated pointer.
_Output VoidPtr mm_alloc_ptr(SizeT sz, Bool wr, Bool user, SizeT pad_amount) {
static Bool locked = false;
- LockDelegate<255> lock{&locked};
+ LockDelegate<kHeapMgrSpinMax> lock{&locked};
auto sz_fix = sz;
@@ -101,11 +103,6 @@ _Output VoidPtr mm_alloc_ptr(SizeT sz, Bool wr, Bool user, SizeT pad_amount) {
reinterpret_cast<Detail::MM_INFORMATION_BLOCK_PTR>(wrapper.VirtualAddress() +
sizeof(Detail::MM_INFORMATION_BLOCK));
- if (!heap_info_ptr) {
- locked = false;
- return nullptr;
- }
-
heap_info_ptr->fSize = sz_fix;
heap_info_ptr->fMagic = kHeapMgrMagic;
heap_info_ptr->fCRC32 = 0U; // dont fill it for now.