feat(core): implement spinlocks, GC and keyboard safety
* Implemented Spinlocks and applied to VM/Scheduler * Added Garbage Collector for tasks * Moved Getchar to IOKeyboard with locking * Cleanup panic messages
This commit is contained in:
@@ -29,7 +29,6 @@ IOGraphicsSize IOConsoleGetDimensions();
|
||||
void IOConsoleSetForegroundColor(IOGraphicsColor color);
|
||||
void IOConsoleSetDefaultForegroundColor(UInt32 color);
|
||||
void IOConsoleSetCursorPosition(IOGraphicsPoint* point);
|
||||
char IOConsoleGetCharacter();
|
||||
void IOConsoleReadLine(char* buffer, UInt32 limit);
|
||||
void IOConsolePutcharacter(char character);
|
||||
void IOConsolePrint(const char *string);
|
||||
|
||||
@@ -3,17 +3,20 @@
|
||||
|
||||
#pragma once
|
||||
#include <types.h>
|
||||
#include <OS/OSSpinlock.h>
|
||||
|
||||
enum {
|
||||
kIOKeyboardBufferSize = 256,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
OSSpinlock lock;
|
||||
char buffer[kIOKeyboardBufferSize];
|
||||
UInt16 head;
|
||||
UInt16 tail;
|
||||
} IOKeyboardBuffer;
|
||||
volatile UInt16 head;
|
||||
volatile UInt16 tail;
|
||||
} IOKeyboardController;
|
||||
|
||||
extern IOKeyboardBuffer gIOKeyboardInputBuffer;
|
||||
extern IOKeyboardController gIOKeyboardController;
|
||||
|
||||
void IOKeyboardInterruptsHandler();
|
||||
char IOKeyboardGetCharacter();
|
||||
@@ -29,6 +29,7 @@ typedef struct OSTask {
|
||||
UInt32 sleepTicks;
|
||||
OSProcessState taskState; // reusing process_state cuz wn
|
||||
UInt64 kernelStackTop;
|
||||
void* kernelStackBase;
|
||||
OSProcess* process;
|
||||
Int32 waitingForProcess;
|
||||
} OSTask;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (c) 2026 0xKarinyash
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef struct OSSpinlock {
|
||||
volatile UInt32 lockValue;
|
||||
} OSSpinlock;
|
||||
|
||||
typedef struct OSSpinlockState {
|
||||
Boolean interruptsEnabled;
|
||||
} OSSpinlockState;
|
||||
|
||||
void OSSpinlockLock(OSSpinlock* lock);
|
||||
void OSSpinlockUnlock(OSSpinlock* lock);
|
||||
void OSSpinlockLockIRQ(OSSpinlock* lock, OSSpinlockState* state);
|
||||
void OSSpinlockUnlockIRQ(OSSpinlock *lock, OSSpinlockState* state);
|
||||
Reference in New Issue
Block a user