- Created apps/hello-world/hello-world.S: AT&T assembly user program that calls SYS_WRITE to print 'Hello, World' then SYS_EXIT(0) - Created apps/user.ld: linker script for user apps at 0x08048000 - Created scripts/build_apps.sh: builds each app dir into flat binary - Updated CMakeLists.txt: added apps build target in ISO pipeline - Updated gen_initrd.sh: packs built binaries from build/apps_bin/ - Updated kernel.c: replaced inline machine code with VFS-based loading of hello-world from /initrd/hello-world via cpio_find() Verified: hello-world binary (49 bytes) loads from CPIO initrd, prints 'Hello, World', and exits with code 0.
29 lines
786 B
ArmAsm
29 lines
786 B
ArmAsm
# hello-world.S - ClaudeOS user-mode hello world application
|
|
# Assembled as flat binary, loaded at USER_CODE_START (0x08048000)
|
|
#
|
|
# Uses INT 0x80 system calls:
|
|
# SYS_WRITE(1): EAX=1, EBX=fd, ECX=buf, EDX=len
|
|
# SYS_EXIT(0): EAX=0, EBX=code
|
|
|
|
.code32
|
|
.section .text
|
|
.globl _start
|
|
_start:
|
|
/* SYS_WRITE(stdout, "Hello, World\n", 13) */
|
|
movl $1, %eax /* SYS_WRITE */
|
|
movl $1, %ebx /* fd = stdout */
|
|
movl $msg, %ecx /* buf = absolute address of message */
|
|
movl $13, %edx /* len = 13 */
|
|
int $0x80
|
|
|
|
/* SYS_EXIT(0) */
|
|
movl $0, %eax /* SYS_EXIT */
|
|
movl $0, %ebx /* exit code = 0 */
|
|
int $0x80
|
|
|
|
/* Safety: infinite loop (should never reach here) */
|
|
jmp .
|
|
|
|
msg:
|
|
.ascii "Hello, World\n"
|