Skip to content
This repository was archived by the owner on Jan 4, 2026. It is now read-only.
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
1 change: 0 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DVF_SCHEDULER=EEVDF \
-DVF_CONFIG_HEAP_LANG=RUST \
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/linux-x64.cmake \
-DCMAKE_ASM_NASM_COMPILER=$(which nasm)
cd ..
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ else()
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
message(WARNING "CMAKE_BUILD_TYPE not set. Defaulting to Release.")
endif()

if(CMAKE_GENERATOR STREQUAL "Ninja")
message(STATUS "CMake: Generator: ${CMAKE_GENERATOR}")
else()
Expand All @@ -63,7 +68,6 @@ message(STATUS "CMake Current Binary Directory: ${CMAKE_CURRENT_BINARY_DIR}")
message(STATUS "CMake Host System Name: ${CMAKE_HOST_SYSTEM_NAME}")
message(STATUS "CMake Host System Processor: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
message(STATUS "VoidFrame Scheduler: ${VF_SCHEDULER}")
message(STATUS "VoidFrame Heap Management Language: ${VF_CONFIG_HEAP_LANG}")
message(STATUS "CMake sources configured.")

# ============================================================================
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/<linux/windows/macos>-x64.cmake \
-G Ninja \
-DVF_SCHEDULER=<MLFQ/EEVDF> \
-DVF_CONFIG_HEAP_LANG=<C/RUST>
-DVF_SCHEDULER=<MLFQ/EEVDF>
ccmake . # Optinal, tune as needed
Comment on lines 62 to 66
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Docs: reflect default build type and expose HYBRID heap option.

  • CMake now defaults to Release; you can drop the explicit -DCMAKE_BUILD_TYPE in the quickstart.
  • Consider documenting the optional HYBRID path (e.g., -DVF_CONFIG_HEAP_HYBRID=ON) since code gates on it.
🤖 Prompt for AI Agents
In README.md around lines 62 to 66, the quickstart still shows an explicit
-DCMAKE_BUILD_TYPE=Release and doesn't mention the optional HYBRID heap flag;
update the instructions to remove the explicit -DCMAKE_BUILD_TYPE since CMake
now defaults to Release, and add a short note showing the optional HYBRID heap
toggle (e.g., -DVF_CONFIG_HEAP_HYBRID=ON) with brief placement guidance so users
know the code paths are gated by that option.

ninja -j$(nproc)
ninja run
Expand Down
3 changes: 0 additions & 3 deletions cmake/cache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@
# ============================================================================
set(VF_SCHEDULER "EEVDF" CACHE STRING "Scheduler type: MLFQ or EEVDF")
set_property(CACHE VF_SCHEDULER PROPERTY STRINGS MLFQ EEVDF)

set(VF_CONFIG_HEAP_LANG "C" CACHE STRING "Heap language: RUST or C")
set_property(CACHE VF_CONFIG_HEAP_LANG PROPERTY STRINGS RUST C)
12 changes: 2 additions & 10 deletions cmake/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ add_compile_definitions(
VF_CONFIG_ENABLE_NVME
VF_CONFIG_ENABLE_GENERIC_SOUND
VF_CONFIG_RTC_CENTURY
VF_CONFIG_LOAD_MB_MODULES
VF_CONFIG_ENFORCE_MEMORY_PROTECTION
VF_CONFIG_VM_HOST
VF_CONFIG_SNOOZE_ON_BOOT
Expand All @@ -34,6 +33,7 @@ add_compile_definitions(
# VF_CONFIG_CERBERUS_THREAT_REPORTING
# VF_CONFIG_PROCINFO_AUTO_CLEANUP
# VF_CONFIG_PANIC_OVERRIDE
# VF_CONFIG_LOAD_MB_MODULES
)

if(EXCLUDE_EXTRA_OBJECTS)
Expand All @@ -50,12 +50,4 @@ elseif(VF_SCHEDULER STREQUAL "EEVDF")
add_compile_definitions(VF_CONFIG_SCHED_EEVDF)
else()
message(FATAL_ERROR "Invalid scheduler: ${VF_SCHEDULER}. Did you pass: -DVF_SCHEDULER=<MLFQ/EEVDF>?")
endif()

if(VF_CONFIG_HEAP_LANG STREQUAL "RUST")
add_compile_definitions(VF_CONFIG_HEAP_RUST)
elseif(VF_CONFIG_HEAP_LANG STREQUAL "C")
add_compile_definitions(VF_CONFIG_HEAP_C)
else()
message(FATAL_ERROR "Invalid heap language: ${VF_CONFIG_HEAP_LANG}. Did you pass: -DVF_CONFIG_HEAP_LANG=<RUST/C>?")
endif()
endif()
16 changes: 9 additions & 7 deletions cmake/source.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ set(ASM_SOURCES
set(KERNEL_CORE_SOURCES
kernel/core/Kernel.c
kernel/core/Panic.c
vfcompositor/Compositor.c
kernel/core/InitRD.c
)

set(VFC_SOURCES
vfcompositor/Compositor.c
vfcompositor/app/GUIShell.c
)

set(SCHED_SOURCES
kernel/sched/MLFQ.c
kernel/sched/EEVDF.c
Expand Down Expand Up @@ -57,6 +61,7 @@ set(MM_SOURCES
mm/MemPool.c
mm/trace/StackTrace.c
mm/security/Cerberus.c
mm/dynamic/c/Magazine.c
mm/PageFaultHandler.c
)

Expand Down Expand Up @@ -128,7 +133,6 @@ set(OBJ_SOURCES)
# ============================================================================
include_directories(
.
vfcompositor
include
kernel/atomic
kernel/core
Expand Down Expand Up @@ -175,16 +179,13 @@ include_directories(
arch/x86_64/idt
arch/x86_64/interrupts
arch/x86_64/syscall
vfcompositor
vfcompositor/app
)

# ============================================================================
# Sources Configuration
# ============================================================================
if (VF_CONFIG_HEAP_LANG STREQUAL "C")
list(APPEND MM_SOURCES
mm/dynamic/c/Magazine.c
)
endif()

if(NOT EXCLUDE_EXTRA_OBJECTS)
set(OBJ_SOURCES
Expand All @@ -207,4 +208,5 @@ set(C_SOURCES
${DRIVER_SOURCES}
${ARCH_SOURCES}
${INCLUDE_SOURCES}
${VFC_SOURCES}
)
12 changes: 11 additions & 1 deletion docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ Here are the commands to install the required dependencies on various platforms.

```bash
# Update package list and install dependencies
sudo pacman -Syu cmake ninja clang nasm qemu-full dosfstools e2fsprogs grub xorriso mtools
sudo pacman -Syu cmake ninja clang nasm qemu-full dosfstools e2fsprogs grub xorriso mtools rustup
rustup target add x86_64-unknown-none
rustup toolchain install nightly
```

</details>
Expand All @@ -41,6 +43,10 @@ sudo pacman -Syu cmake ninja clang nasm qemu-full dosfstools e2fsprogs grub xorr
# Update package list and install dependencies
sudo apt update
sudo apt install -y cmake ninja-build clang nasm qemu-system-x86 dosfstools e2fsprogs grub-pc-bin xorriso mtools
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y
source ~/.cargo/env
rustup toolchain install nightly
rustup target add x86_64-unknown-none
```

</details>
Expand All @@ -51,6 +57,10 @@ sudo apt install -y cmake ninja-build clang nasm qemu-system-x86 dosfstools e2fs
```bash
# Install dependencies
sudo dnf install -y cmake ninja-build clang nasm qemu-system-x86 dosfstools e2fsprogs grub2-tools-extra xorriso mtools
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y
source ~/.cargo/env
rustup toolchain install nightly
rustup target add x86_64-unknown-none
```

</details>
Expand Down
11 changes: 11 additions & 0 deletions include/Scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
///@brief Unified wrapper for multiple scheduler implementations
#ifndef VOIDFRAME_SCHEDULER_H
#define VOIDFRAME_SCHEDULER_H
#include "MLFQ.h"

#if defined(VF_CONFIG_SCHED_MLFQ)
#include "MLFQ.h"
Expand Down Expand Up @@ -39,6 +40,16 @@ static inline __attribute__((always_inline)) uint32_t CreateProcess(const char *
#endif
}

static inline __attribute__((always_inline)) uint32_t CreateSecureProcess(const char * name, void (*entry_point)(), uint8_t priv, uint8_t flag) {
#if defined(VF_CONFIG_SCHED_MLFQ)
return MLFQCreateSecureProcess(name, entry_point, priv, flag);
#elif defined(VF_CONFIG_SCHED_EEVDF)
return EEVDFCreateSecureProcess(name, entry_point, priv, flag);
#elif defined(VF_CONFIG_SCHED_CFS)
return 0; // not implemented
#endif
}

static inline __attribute__((always_inline)) CurrentProcessControlBlock* GetCurrentProcess() {
#if defined(VF_CONFIG_SCHED_MLFQ)
return MLFQGetCurrentProcess();
Expand Down
1 change: 1 addition & 0 deletions include/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct Window {

// Window state
bool minimized;
uint32_t owner_pid; // PID of the process that created this window
};

#endif // WINDOW_H
3 changes: 0 additions & 3 deletions kernel/core/InitRD.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
#include "Multiboot2.h"
#include "Console.h"
#include "VFS.h"
#include "KernelHeap.h"
#include "MemOps.h"

extern uint32_t g_multiboot_info_addr;

void InitRDLoad(void) {
Expand Down
4 changes: 2 additions & 2 deletions kernel/core/Pallete.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define WINDOW_BG_1 0x151515 // Very dark gray
#define TITLE_BAR_1 0x1A1A2E // Dark blue-gray
#define BORDER_1 0x2A2A3A // Subtle border
#define ACCENT_1 0x6B73FF // Bright blue accent
#define ACCENT_1 0x1D234A // Bright blue accent
#define ERROR_1 0xFF6B6B // Soft red
#define SUCCESS_1 0x51CF66 // Muted green

Expand Down Expand Up @@ -101,7 +101,7 @@
// Easy palette switching system
// =============================================================================
#ifndef CURRENT_PALETTE
#define CURRENT_PALETTE 2
#define CURRENT_PALETTE 1
#endif

#if CURRENT_PALETTE == 1
Expand Down
13 changes: 11 additions & 2 deletions kernel/etc/Console.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "Console.h"
#include "Format.h"
#include "Io.h"
#include "Pallete.h"
#include "Scheduler.h"
#include "Compositor.h"
#include "Serial.h"
#include "SpinlockRust.h"
#include "VBEConsole.h"
Expand Down Expand Up @@ -76,6 +75,13 @@ void Unsnooze() {
__atomic_store_n(&snooze, 0, __ATOMIC_RELEASE);
}

extern CompositorContext g_compositor_ctx;
static Window* console_window = NULL;

void ConsoleSetWindowPrint(Window* w) {
console_window = w;
}

// Initialize console - auto-detect VBE or VGA
void ConsoleInit(void) {
console_lock = rust_spinlock_new();
Expand Down Expand Up @@ -120,6 +126,7 @@ static void ConsolePutcharAt(char c, uint32_t x, uint32_t y, uint8_t color) {

void ClearScreen(void) {
// Snooze mode: skip physical console updates
if (console_window) WindowClearText(&g_compositor_ctx, console_window);
if (snooze) return;
rust_spinlock_lock(console_lock);
if (!console.buffer) console.buffer = (volatile uint16_t*)VGA_BUFFER_ADDR;
Expand All @@ -128,6 +135,7 @@ void ClearScreen(void) {
}

static void ConsoleScroll(void) {
if (console_window) WindowScrollUp(&g_compositor_ctx, console_window);
if (use_vbe) return; // VBE handles scrolling internally

for (uint32_t i = 0; i < (VGA_HEIGHT - 1) * VGA_WIDTH; i++) {
Expand Down Expand Up @@ -190,6 +198,7 @@ void ConsoleSetColor(uint8_t color) {
void PrintKernel(const char* str) {
if (!str) return;
SerialWrite(str);
if (console_window) WindowPrintString(&g_compositor_ctx, console_window, str);
if (snooze) return;

rust_spinlock_lock(console_lock);
Expand Down
3 changes: 3 additions & 0 deletions kernel/etc/Console.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void SerialWriteF(const char* format, ...);
void PrintKernelErrorF(const char* format, ...);
void PrintKernelWarningF(const char* format, ...);
void PrintKernelSuccessF(const char* format, ...);
// void ConsoleSetWindowPrint(Window* w);
#ifdef __cplusplus
}
#endif
Expand All @@ -82,4 +83,6 @@ static inline __attribute__((always_inline)) void PrintNewline(void) {
PrintKernel("\n");
}

#define LOG() PrintKernelF("[%s:%d]:[%s]\n", __FILE__, __LINE__, __FUNCTION__)

#endif // VOIDFRAME_CONSOLE_H
11 changes: 11 additions & 0 deletions kernel/etc/POST.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "Serial.h"
#include "VMem.h"
#include "stdbool.h"
#include "x64.h"

#define N 512
void * ptrs[N] = {0};
Expand All @@ -21,23 +22,32 @@ bool SerialTest() {
}

bool MemoryTest() {
uint64_t start = rdtsc();
for (int i = 1; i < 1000; i++) {
size_t sz = (i % 7 == 0) ? 4096 : (i % 100 + 1);
void *ptr = KernelMemoryAlloc(sz);
if (!ptr) return false;
KernelFree(ptr);
}
PrintKernelF("Loop 1 took: %llu sycles\n", rdtsc() - start);

start = rdtsc();
for (int i = 0; i < N; i++) ptrs[i] = KernelMemoryAlloc(128);
PrintKernelF("Loop 2 took: %llu sycles\n", rdtsc() - start);

start = rdtsc();
// free every other block
for (int i = 0; i < N; i += 2) KernelFree(ptrs[i]);
PrintKernelF("Loop 3 took: %llu sycles\n", rdtsc() - start);

start = rdtsc();
// re-allocate in different sizes
for (int i = 0; i < N/2; i++) {
ptrs[i] = KernelMemoryAlloc((i % 2) ? 64 : 256);
}
PrintKernelF("Loop 4 took: %llu sycles\n", rdtsc() - start);

start = rdtsc();
for (int i = 0; i < 1000; i++) {
size_t sz = (i % 500) + 1;
uint8_t *p = (uint8_t*)KernelMemoryAlloc(sz);
Expand All @@ -46,6 +56,7 @@ bool MemoryTest() {
if (p[j] != (uint8_t)(i ^ j)) PANIC("Memory corruption!");
KernelFree(p);
}
PrintKernelF("Loop 5 took: %llu sycles\n", rdtsc() - start);

return true;
}
Expand Down
3 changes: 2 additions & 1 deletion kernel/etc/Shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

static char command_buffer[256];
static int cmd_pos = 0;
static char current_dir[256] = "/";
char current_dir[256] = "/";

extern uint8_t _kernel_phys_start[];
extern uint8_t _kernel_phys_end[];
Expand Down Expand Up @@ -186,6 +186,7 @@ static const HelpEntry system_cmds[] = {
{"memstat", "Show memory statistics"},
{"stacksize", "Show stack usage"},
{"lscpu", "List CPU features"},
{"vfc NULL/fork", "Start VFCompositor as another process or on the currently session"},
{"snoozer <on/off>", "Snooze messages from PrintKernel"},
{"acpi sd/rb", "Shutdown (sd) or reboot (rb) via ACPI"},
};
Expand Down
Loading