Files
os-in-1000-lines/user.c
2025-07-29 08:47:34 +03:00

23 lines
380 B
C

#include "user.h"
extern char __stack_top[];
__attribute__((noreturn)) void exit(void) {
for(;;);
}
void putchar(char ch) {
// TODO
}
__attribute__((section(".text.start")))
__attribute__((naked))
void start(void) {
__asm__ __volatile__(
"mv sp, %[stack_top]\n"
"call main\n"
"call exit\n"
:: [stack_top] "r" (__stack_top)
);
}