Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions kernel/core/Kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,17 @@ static void ValidateMemoryLayout(void) {

if ((stack_start >= kernel_start && stack_start < kernel_end) ||
(stack_end > kernel_start && stack_end <= kernel_end)) {
PrintKernelWarning("[WARNING] Stack overlaps with kernel code\n");
}
PrintKernelWarning("Stack overlaps with kernel code\n");
}

// NEW: Check multiboot info location
if (g_multiboot_info_addr >= kernel_start && g_multiboot_info_addr < kernel_end) {
PrintKernelWarning("[WARNING] Multiboot info overlaps with kernel\n");
PrintKernelWarning("Multiboot info overlaps with kernel\n");
}

// NEW: Validate virtual address space boundaries
if (VIRT_ADDR_SPACE_START >= KERNEL_SPACE_START) {
PrintKernelError("[ERROR] Virtual address space overlaps with kernel space\n");
PrintKernelError("Virtual address space overlaps with kernel space\n");
}

PrintKernelSuccess("System: Memory layout validated\n");
Expand Down Expand Up @@ -690,4 +690,5 @@ void KernelMainHigherHalf(void) {
while (1) { // redundant but added for worst case scenario, should not reach here
Yield();
}
}
__builtin_unreachable();
}
6 changes: 0 additions & 6 deletions kernel/etc/Console.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// kernel/etc/Console.c - PATCHED VERSION WITH VBE SUPPORT
#include "Console.h"

#include "Format.h"
#include "Io.h"
#include "LPT/LPT.h"
#include "Serial.h"
#include "Spinlock.h"
#include "VBEConsole.h"
Expand Down Expand Up @@ -34,9 +31,6 @@ ConsoleT console = {

static volatile int lock = 0;

static uint32_t vbe_fg_color = 0xFFFFFF; // White
static uint32_t vbe_bg_color = 0x000000; // Black

// Initialize console - auto-detect VBE or VGA
void ConsoleInit(void) {
if (VBEIsInitialized()) {
Expand Down
10 changes: 6 additions & 4 deletions kernel/etc/Console.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#define VGA_COLOR_ERROR VGA_COLOR_LIGHT_RED
#define VGA_COLOR_WARNING VGA_COLOR_LIGHT_YELLOW



#include "stdint.h"
// Console state
typedef struct {
Expand All @@ -43,7 +41,6 @@ typedef enum {
INIT_SUCCESS = 0,
INIT_ERROR_GDT,
INIT_ERROR_IDT,
// INIT_ERROR_SYSCALL removed -- syscall-less kernel
INIT_ERROR_PIC,
INIT_ERROR_MEMORY,
INIT_ERROR_PROCESS,
Expand All @@ -57,7 +54,7 @@ void PrintKernelError(const char* str);
void PrintKernelWarning(const char* str);
void PrintKernelHex(uint64_t num);
void PrintKernel(const char* str);
void PrintKernelChar(const char c);
void PrintKernelChar(char c);
void PrintKernelInt(int64_t num);
void PrintKernelAt(const char* str, uint32_t line, uint32_t col);
void ClearScreen();
Expand All @@ -69,4 +66,9 @@ void SerialWriteF(const char* format, ...);
void PrintKernelErrorF(const char* format, ...);
void PrintKernelWarningF(const char* format, ...);

// save a bit of time
static inline __attribute__((always_inline)) void PrintNewline(void) {
PrintKernel("\n");
}

#endif // VOIDFRAME_CONSOLE_H
Loading