Files
claude-os/apps/libc/crt0.S
AI c25ba1fccd feat: shell (sh) with keyboard driver, SYS_READ, SYS_EXEC
- PS/2 keyboard driver: IRQ1 handler, scancode set 1 translation,
  ring buffer, shift key support
- SYS_READ (fd=0): non-blocking keyboard read for stdin
- SYS_YIELD: calls schedule_tick directly (no nested INT 0x80)
- SYS_EXEC: loads binary from CPIO initrd, replaces process image
- User-space libc: crt0.S (C runtime startup), syscalls.h (inline
  syscall wrappers, basic string functions)
- Shell app (sh): readline with echo/backspace, builtins (cd, env,
  help, exit), fork+exec for external commands
- Updated build_apps.sh: C app support with crt0 linking, libc
  include path, .bss section in objcopy

Tested: shell boots, keyboard input works, hello-world runs via
fork+exec, env shows CWD, exit cleanly terminates.
2026-02-23 13:08:06 +00:00

22 lines
449 B
ArmAsm

/**
* @file crt0.S
* @brief C runtime startup for user-mode applications.
*
* Calls the C main() function and then exits with the return value.
*/
.section .text
.global _start
.extern main
_start:
/* Call main() */
call main
/* Exit with main's return value (in EAX) */
movl %eax, %ebx /* exit code = return value */
movl $0, %eax /* SYS_EXIT = 0 */
int $0x80
/* Should never reach here */
1: jmp 1b