Skip to content
This repository was archived by the owner on Jan 4, 2026. It is now read-only.

Commit 274270c

Browse files
authored
Merge pull request #178 from assembler-0/Development
Development
2 parents 5d603a1 + 5f78c61 commit 274270c

File tree

13 files changed

+334
-363
lines changed

13 files changed

+334
-363
lines changed

CMakeLists.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
cmake_minimum_required(VERSION 3.30)
55
set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
66
project(VoidFrame
7-
VERSION 0.0.2
7+
VERSION 0.0.2.4
88
LANGUAGES C CXX ASM_NASM
99
HOMEPAGE_URL "https://github.com/assembler-0/VoidFrame"
10-
DESCRIPTION "A hobbyist operating system kernel written in C and Rust"
10+
DESCRIPTION "A hobbyist operating system kernel written in C/C++ Assembly Rust"
1111
)
1212
enable_language(ASM_NASM)
1313

@@ -52,12 +52,7 @@ if(NOT CMAKE_TOOLCHAIN_FILE)
5252
message(STATUS "Defaulting to Windows x86_64 toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
5353
endif()
5454
else()
55-
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
56-
endif()
57-
58-
if(NOT CMAKE_BUILD_TYPE)
59-
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
60-
message(WARNING "CMAKE_BUILD_TYPE not set. Defaulting to Release.")
55+
message(STATUS "CMake: Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
6156
endif()
6257

6358
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
@@ -131,6 +126,9 @@ endif()
131126
link_rust_library(voidframe.krnl voidframe-spinlock)
132127
link_rust_library(voidframe.krnl voidframe-mm)
133128

129+
add_dependencies(voidframe.krnl voidframe_mm)
130+
add_dependencies(voidframe.krnl cargo-build_voidframe_spinlock)
131+
134132
# Configure the linker to use ld.lld with proper arguments
135133
set_target_properties(voidframe.krnl PROPERTIES
136134
LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/voidframe.ld"

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
## About
1818

19-
VoidFrame is a 64-bit **ring-0** kernel designed for the x86_64 architecture written in C and assembly (nasm).
19+
VoidFrame is a 64-bit **ring-0** kernel designed for the x86_64 architecture written in C/C++, assembly (nasm) and Rust.
2020
This kernel was intended and targeted for people who want to learn about operating systems and want to make a piece of their own.
2121
As the designer of this kernel, I just wanted to make something that is simple, fast, secure and easy to understand.
2222
Which obviously means that it is not a perfect kernel. And it breaks all the time.
@@ -26,12 +26,12 @@ It would be amazing if you could contribute to this project!
2626

2727
## Prerequisites (development)
2828
- x64-compatible cpu (used: Intel i3-12100F)
29-
- POSIX-compliant OS (SysV ABI) (used: Arch Linux 6.16.9-arch1-1)
29+
- POSIX-compliant OS (SysV ABI) (used: Arch Linux 6.17.6-arch1-1)
3030
- cmake >= 3.20 (used: cmake 4.1.2)
31-
- ninja >= 1.11 (used: ninja 1.21.1)
32-
- clang/++ >= 18.0.0 (used: 20.1.8)
31+
- ninja >= 1.11 (used: ninja 1.13.1)
32+
- clang/++ >= 18.0.0 (used: 21.1.4)
3333
- rustup (nightly, bare metal toolchain) >= 1.89.0 (used: 1.92.0-nightly)
34-
- nasm >= 2.16 (used: 2.16.03)
34+
- nasm >= 2.16 (used: 3.01)
3535
- qemu >= 7.0.0 (used: 10.1.0)
3636
- mkfs.fat
3737
- mkfs.ext2
@@ -45,8 +45,10 @@ git clone https://github.com/assembler-0/VoidFrame.git
4545
cd VoidFrame
4646
mkdir build
4747
cd build
48-
ccmake .. -G Ninja # 'c' -> 'e' -> 'q' -- IMPORTATNT!
49-
cmake ..
48+
cmake .. -G Ninja \
49+
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/linux-x64.cmake \
50+
-DCMAKE_BUILD_TYPE=Release
51+
cmake .. # IMPORTANT: for some reason, this command is needed for the first time
5052
ninja -j$(nproc)
5153
ninja run
5254
```

cmake/configuration.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ option(STACK_PROTECTION "Enable stack protection" ON)
88
option(SILENT_BUILD "Enable silent build (suppress warnings)" OFF)
99

1010
option(VF_CONFIG_ENABLE_VMWARE_SVGA_II "Enable VMware SVGA II support" OFF)
11-
option(VF_CONFIG_ENABLE_CERBERUS_VFS_LOGGING "Enable Cerberus VFS logging" OFF)
12-
option(VF_CONFIG_CERBERUS_THREAT_REPORTING "Enable Cerberus threat reporting" OFF)
1311
option(VF_CONFIG_PANIC_OVERRIDE "Enable panic override" OFF)
1412
option(VF_CONFIG_LOAD_MB_MODULES "Enable multiboot module loading" OFF)
1513

cmake/features.cmake

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ if(VF_CONFIG_ENABLE_VMWARE_SVGA_II)
7373
add_compile_definitions(VF_CONFIG_ENABLE_VMWARE_SVGA_II)
7474
endif()
7575

76-
if(VF_CONFIG_ENABLE_CERBERUS_VFS_LOGGING)
77-
add_compile_definitions(VF_CONFIG_ENABLE_CERBERUS_VFS_LOGGING)
78-
endif()
79-
80-
if(VF_CONFIG_CERBERUS_THREAT_REPORTING)
81-
add_compile_definitions(VF_CONFIG_CERBERUS_THREAT_REPORTING)
82-
endif()
83-
8476
if(VF_CONFIG_PANIC_OVERRIDE)
8577
add_compile_definitions(VF_CONFIG_PANIC_OVERRIDE)
8678
endif()

cmake/flags.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ else()
1212
endif()
1313

1414
if(STACK_PROTECTION)
15-
string(APPEND C_FLAGS " -fstack-protector-strong -D_FORTIFY_SOURCE=2")
15+
string(APPEND C_FLAGS " -fstack-protector-all -D_FORTIFY_SOURCE=2")
1616
endif()
1717

1818
if(DEBUG_SYMBOLS)

docs/DEVELOPMENT.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,21 @@ The recommended approach is to use [WSL](https://learn.microsoft.com/en-us/windo
102102

103103
## 3. Building VoidFrame
104104

105-
After installing the dependencies, you can build the kernel using one of the supported build systems. All commands should be run from the root of the VoidFrame repository.
106-
107-
### Using CMake (actively maintained)
105+
After installing the dependencies, you can build the kernel using CMake.
108106

109107
```bash
110108
# 1. Create a build directory
111109
mkdir -p build && cd build
112110

113111
# 2. Configure the project (example for Linux)
114112
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/linux-x64.cmake
113+
cmake ..
114+
115+
# 3. Features configuration
116+
ccmake .
115117

116-
# 3. Build the kernel
117-
ninja
118+
# 4. Build the all targets
119+
ninja -j$(nproc)
118120

119121
# 4. Run the kernel in QEMU
120122
ninja run

kernel/atomic/rust/src/ffi.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ fn panic(_info: &PanicInfo) -> ! {
2020
}
2121

2222
// Static storage for locks (kernel will manage allocation)
23-
static mut SPINLOCK_STORAGE: [SpinLock; 64] = [const { SpinLock::new() }; 64];
24-
static mut SPINLOCK_USED: [bool; 64] = [false; 64];
23+
static mut SPINLOCK_STORAGE: [SpinLock; 256] = [const { SpinLock::new() }; 256];
24+
static mut SPINLOCK_USED: [bool; 256] = [false; 256];
2525

2626
#[no_mangle]
2727
pub extern "C" fn rust_spinlock_new() -> *mut SpinLock {
2828
unsafe {
29-
for i in 0..64 {
29+
for i in 0..256 {
3030
if !SPINLOCK_USED[i] {
3131
SPINLOCK_USED[i] = true;
3232
return &mut SPINLOCK_STORAGE[i] as *mut SpinLock;
@@ -103,7 +103,7 @@ pub extern "C" fn rust_spinlock_owner_cpu(lock: *mut SpinLock) -> u32 {
103103
#[no_mangle]
104104
pub extern "C" fn rust_spinlock_new_with_order(order: u32) -> *mut SpinLock {
105105
unsafe {
106-
for i in 0..64 {
106+
for i in 0..256 {
107107
if !SPINLOCK_USED[i] {
108108
SPINLOCK_USED[i] = true;
109109
SPINLOCK_STORAGE[i] = SpinLock::new_with_order(order);
@@ -115,15 +115,15 @@ pub extern "C" fn rust_spinlock_new_with_order(order: u32) -> *mut SpinLock {
115115
}
116116

117117
// Static storage for MCS locks and nodes
118-
static mut MCS_LOCK_STORAGE: [McsLock; 32] = [const { McsLock::new() }; 32];
119-
static mut MCS_LOCK_USED: [bool; 32] = [false; 32];
120-
static mut MCS_NODE_STORAGE: [McsNode; 128] = [const { McsNode::new() }; 128];
121-
static mut MCS_NODE_USED: [bool; 128] = [false; 128];
118+
static mut MCS_LOCK_STORAGE: [McsLock; 128] = [const { McsLock::new() }; 128];
119+
static mut MCS_LOCK_USED: [bool; 128] = [false; 128];
120+
static mut MCS_NODE_STORAGE: [McsNode; 512] = [const { McsNode::new() }; 512];
121+
static mut MCS_NODE_USED: [bool; 512] = [false; 512];
122122

123123
#[no_mangle]
124124
pub extern "C" fn rust_mcs_lock_new() -> *mut McsLock {
125125
unsafe {
126-
for i in 0..32 {
126+
for i in 0..128 {
127127
if !MCS_LOCK_USED[i] {
128128
MCS_LOCK_USED[i] = true;
129129
return &mut MCS_LOCK_STORAGE[i] as *mut McsLock;
@@ -150,7 +150,7 @@ pub extern "C" fn rust_mcs_lock_free(lock: *mut McsLock) {
150150
#[no_mangle]
151151
pub extern "C" fn rust_mcs_node_new() -> *mut McsNode {
152152
unsafe {
153-
for i in 0..128 {
153+
for i in 0..512 {
154154
if !MCS_NODE_USED[i] {
155155
MCS_NODE_USED[i] = true;
156156
return &mut MCS_NODE_STORAGE[i] as *mut McsNode;

kernel/ipc/Ipc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ IpcResult IpcReceiveMessage(IpcMessage* msg_buffer) {
133133

134134
current->state = PROC_BLOCKED;
135135
rust_spinlock_unlock(queue->lock);
136-
Yield();
137136
}
138137
}
139138

@@ -174,7 +173,6 @@ IpcResult IpcReceiveMessageType(IpcMessage* msg_buffer, IpcMessageType type) {
174173
// Mark blocked while still holding the lock to avoid a wakeup‐before‐block race
175174
current->state = PROC_BLOCKED;
176175
rust_spinlock_unlock(queue->lock);
177-
Yield();
178176
}
179177
}
180178

0 commit comments

Comments
 (0)