You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate the remaining NASM assembly files (.s extension) to GAS (GNU Assembler) format (.S extension), enabling full integration with the GCC toolchain and C preprocessor.
Context
Currently, MeniOS uses both NASM and GAS for assembly code:
NASM files (.s): Legacy stand-alone stubs with no C preprocessor usage
GAS files (.S): Modern assembly that integrates with GCC, using CPP and sharing headers/macros with C code
We lean on GAS for the .S sources because they depend on the C preprocessor and share headers/macros with the C toolchain; letting GCC drive GAS keeps those files in the same compilation flow as the rest of the kernel and avoids re-implementing the macro plumbing in NASM.
The few stand-alone .s files that NASM still handles (referenced in Makefile:733-735) are legacy stubs with no CPP usage, so it's been simpler to leave them there until we either convert them to .S or drop NASM entirely.
Goal
Migrate the remaining NASM assembly files (
.sextension) to GAS (GNU Assembler) format (.Sextension), enabling full integration with the GCC toolchain and C preprocessor.Context
Currently, MeniOS uses both NASM and GAS for assembly code:
.s): Legacy stand-alone stubs with no C preprocessor usage.S): Modern assembly that integrates with GCC, using CPP and sharing headers/macros with C codeWe lean on GAS for the
.Ssources because they depend on the C preprocessor and share headers/macros with the C toolchain; letting GCC drive GAS keeps those files in the same compilation flow as the rest of the kernel and avoids re-implementing the macro plumbing in NASM.The few stand-alone
.sfiles that NASM still handles (referenced in Makefile:733-735) are legacy stubs with no CPP usage, so it's been simpler to leave them there until we either convert them to.Sor drop NASM entirely.Current NASM Files
Three files remain in NASM format:
src/kernel/lgdt.s- Load GDT (Global Descriptor Table)src/kernel/lidt.s- Load IDT (Interrupt Descriptor Table)src/kernel/pit.s- Programmable Interval TimerThese are compiled explicitly in the Makefile:
Benefits of Migration
#include,#define, and shared kernel macros.SfilesImplementation Plan
1. Convert lgdt.s to lgdt.S
lgdt [rdi]→lgdt (%rdi)).intel_syntax noprefixdirective if needed to minimize changes2. Convert lidt.s to lidt.S
3. Convert pit.s to pit.S
4. Update Build System
ARCH_NASM_OBJECTSvariable (line 141)KERNEL_OBJ_FILESto use standard compilationBUILD_REQUIRED_TOOLScheck (line 726)5. Update Documentation
Testing & Validation
Related Issues
Notes
.intel_syntaxdirective.Sfiles use AT&T syntax for consistency with GCC conventions.Sfiles (recommend AT&T for consistency)Definition of Done
.sfiles converted to.SformatPriority
HIGH - Critical for GCC/self-hosting milestone
Justification
This issue is essential for the Road to GCC milestone:
Impact
Estimated Effort: 2-3 weeks part-time
Related Issues: