mirror of
https://github.com/StepanovPlaton/OSin1000Lines.git
synced 2026-04-04 04:40:48 +04:00
User mode
This commit is contained in:
18
src/user.c
Normal file
18
src/user.c
Normal 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));
|
||||
}
|
||||
Reference in New Issue
Block a user