From 378972285342f52bb71822d87ba261b76b4a42ed Mon Sep 17 00:00:00 2001 From: Alexey Gavrilov Date: Sat, 28 Mar 2026 14:55:53 +0700 Subject: Cmake build type at the generation stage Fix in *nasm* files - set architecture bitness. Move compiler flags from *toolchain* file to *requirements target* considering cmake files. This solution allows available of multi-configurations generators to pass compiler options without affecting on single-configuration generators. TODO - Debug information - Image creation - Build under window platform (optional) Signed-off-by: Alexey Gavrilov --- arch/x86/boot.nasm | 2 +- arch/x86/cpuid/CMakeLists.txt | 4 ++++ arch/x86/gdt/CMakeLists.txt | 4 ++++ arch/x86/gdt/SwitchToGdt.nasm | 4 +++- 4 files changed, 12 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/x86/boot.nasm b/arch/x86/boot.nasm index 11175af..d250434 100644 --- a/arch/x86/boot.nasm +++ b/arch/x86/boot.nasm @@ -1,3 +1,4 @@ +BITS 32 section .text extern main, _estack, _init global _start:function @@ -13,4 +14,3 @@ _start: cli .hang: hlt jmp .hang -; .end: diff --git a/arch/x86/cpuid/CMakeLists.txt b/arch/x86/cpuid/CMakeLists.txt index e8528e8..f03b2b1 100644 --- a/arch/x86/cpuid/CMakeLists.txt +++ b/arch/x86/cpuid/CMakeLists.txt @@ -22,4 +22,8 @@ target_sources(CPUIDASM PRIVATE ${CMAKE_CURRENT_LIST_DIR}/CpuidCheck.nasm ) +target_link_libraries(CPUIDASM PUBLIC + ASM_NASM_COMPILER_REQUIREMENTS +) + target_sources(ArchitectureAssemblerSources PRIVATE $) diff --git a/arch/x86/gdt/CMakeLists.txt b/arch/x86/gdt/CMakeLists.txt index 57e3c26..ae31792 100644 --- a/arch/x86/gdt/CMakeLists.txt +++ b/arch/x86/gdt/CMakeLists.txt @@ -20,4 +20,8 @@ target_sources(GDTASM PRIVATE ${CMAKE_CURRENT_LIST_DIR}/SwitchToGdt.nasm ) +target_link_libraries(GDTASM PUBLIC + ASM_NASM_COMPILER_REQUIREMENTS +) + target_sources(ArchitectureAssemblerSources PRIVATE $) diff --git a/arch/x86/gdt/SwitchToGdt.nasm b/arch/x86/gdt/SwitchToGdt.nasm index 52ebbc7..5d3d612 100644 --- a/arch/x86/gdt/SwitchToGdt.nasm +++ b/arch/x86/gdt/SwitchToGdt.nasm @@ -1,4 +1,6 @@ -global SWITCHTOGDT +BITS 32 +section .text +global SWITCHTOGDT:function SWITCHTOGDT: lgdt [esp + 4] jmp 0x08:.reloadCS -- cgit v1.2.3