diff --git a/kernel/core/Kernel.c b/kernel/core/Kernel.c index 7d91b4a..fad77c3 100644 --- a/kernel/core/Kernel.c +++ b/kernel/core/Kernel.c @@ -584,7 +584,7 @@ static InitResultT PXS2(void) { // Initialize IDE driver PrintKernel("Info: Initializing IDE driver...\n"); - int ide_result = IdeInit(); + const int ide_result = IdeInit(); if (ide_result == IDE_OK) { PrintKernelSuccess("System: IDE driver initialized\n"); @@ -690,6 +690,5 @@ void KernelMainHigherHalf(void) { while (1) { // redundant but added for worst case scenario, should not reach here Yield(); - __asm__ volatile("hlt"); } } \ No newline at end of file diff --git a/kernel/process/Process.c b/kernel/process/Process.c index 6ab41e6..314ff90 100644 --- a/kernel/process/Process.c +++ b/kernel/process/Process.c @@ -94,7 +94,7 @@ static uint64_t CalculateSecureChecksum(const SecurityToken* token, uint32_t pid } static inline int FindFreeSlotFast(void) { - if (UNLIKELY(active_process_bitmap == ~1ULL)) { // All slots except 0 taken + if (UNLIKELY(active_process_bitmap == ~1ULL)) { // All slots except 0 taken return -1; } @@ -126,7 +126,7 @@ static void AddToTerminationQueueAtomic(uint32_t slot) { } termination_queue[tail] = slot; - __sync_synchronize(); // Memory barrier + __atomic_thread_fence(__ATOMIC_SEQ_CST); term_queue_tail = new_tail; AtomicInc(&term_queue_count); } @@ -258,7 +258,7 @@ void TerminateProcess(uint32_t pid, TerminationReason reason, uint32_t exit_code } proc->state = PROC_ZOMBIE; // Set state FIRST - __sync_synchronize(); // Full memory barrier + __atomic_thread_fence(__ATOMIC_SEQ_CST); AddToTerminationQueueAtomic(slot); // Then add to queue SpinLock(&pid_lock); int idx = proc->pid / 64;