User mode

This commit is contained in:
2026-02-15 15:34:42 +04:00
parent 10c456438b
commit c94866f688
8 changed files with 112 additions and 20 deletions

18
src/user.c Normal file
View File

@@ -0,0 +1,18 @@
#include "user.h"
extern char __stack_top[];
__attribute__((noreturn)) void exit(void) {
for (;;)
;
}
void putchar(char c) { /* Доделать*/ }
__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));
}