feat: basic modules:

This commit is contained in:
karina
2026-05-03 17:59:46 +04:00
parent 08248e3f3c
commit bedb03fc37
5 changed files with 43 additions and 13 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ Address ExceptionsHandler(ExceptionsContext* frame, ExceptionsType type) {
} }
if (class == 0x15 && syndrome == 0) { if (class == 0x15 && syndrome == 0) {
OSPanic("Wow! We are inside EL0! Syscall caught successfully! :D"); OSPanic("Hi from userspace!!");
} }
} }
OSPanicException(frame); OSPanicException(frame);
+23
View File
@@ -0,0 +1,23 @@
ENTRY(_start)
SECTIONS
{
. = 0x400000;
.text : ALIGN(4K) {
*(.text .text.*)
}
.rodata : ALIGN(4K) {
*(.rodata .rodata.*)
}
.data : ALIGN(4K) {
*(.data .data.*)
}
.bss : ALIGN(4K) {
*(.bss .bss.*)
*(COMMON)
}
}
+15 -8
View File
@@ -2,7 +2,8 @@
# Copyright (c) 2026 0xKSor # Copyright (c) 2026 0xKSor
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
project(ksOS_init LANGUAGES C) project(ksOS_init LANGUAGES C ASM)
file(GLOB_RECURSE INIT_SOURCES CMAKE_CONFIGURE_DEPENDS file(GLOB_RECURSE INIT_SOURCES CMAKE_CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/Source/*.S ${CMAKE_CURRENT_SOURCE_DIR}/Source/*.S
@@ -17,21 +18,27 @@ target_include_directories(init PRIVATE
) )
target_compile_options(init PRIVATE target_compile_options(init PRIVATE
$<$<COMPILE_LANGUAGE:C>:
-std=c23 -std=c23
-ffreestanding
-fno-stack-protector -fno-stack-protector
-fno-builtin -fno-builtin
-Wall -Wextra -Wall
-Wextra
>
-ffreestanding
-g -g
-mgeneral-regs-only -mgeneral-regs-only
) )
# Передаем "голые" аргументы напрямую для ld.lld
target_link_options(init PRIVATE target_link_options(init PRIVATE
"-Ttext=0x400000" -nostdlib
"-e" "_start" -static
"-z" "max-page-size=0x1000" -no-pie
"--no-dynamic-linker" -T "${CMAKE_CURRENT_SOURCE_DIR}/../../Common/linker.ld"
-Ttext=0x400000
-e _start
-z max-page-size=0x1000
--no-dynamic-linker
) )
set_target_properties(init PROPERTIES set_target_properties(init PROPERTIES
+1 -1
View File
@@ -20,7 +20,7 @@ _default:
echo " 🛠️ CMake build: ${TARGET_SUBPATH}" echo " 🛠️ CMake build: ${TARGET_SUBPATH}"
TOOLCHAIN_FILE="{{ justfile_directory() }}/cmake/aarch64.cmake" TOOLCHAIN_FILE="{{ justfile_directory() }}/Common/aarch64.cmake"
TOOLCHAIN="" TOOLCHAIN=""
if [ -f "${TOOLCHAIN_FILE}" ]; then if [ -f "${TOOLCHAIN_FILE}" ]; then
TOOLCHAIN="-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}" TOOLCHAIN="-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}"