diff options
Diffstat (limited to 'src/user')
-rw-r--r-- | src/user/bootstrap/entry.S | 27 | ||||
-rw-r--r-- | src/user/bootstrap/main.c | 6 |
2 files changed, 29 insertions, 4 deletions
diff --git a/src/user/bootstrap/entry.S b/src/user/bootstrap/entry.S new file mode 100644 index 0000000..ecd60dd --- /dev/null +++ b/src/user/bootstrap/entry.S @@ -0,0 +1,27 @@ +#define ASM_FILE 1 +#include <camellia/syscalls.h> +#include <camellia/flags.h> + +.set STACK_TOP, 0xFFFFFFFFFFFFFFFF +.set STACK_PAGES, 4 + +.section .text.startup +.global _start +.type _start, @function +_start: + mov $_SYSCALL_MEMFLAG, %rdi + mov $(STACK_TOP & ~0xFFF - (STACK_PAGES - 1) * 0x1000), %rsi + mov $(STACK_PAGES * 0x1000), %rdx + mov $MEMFLAG_PRESENT, %r10 + syscall + mov $(STACK_TOP & ~0xF), %rsp + + mov $_SYSCALL_MEMFLAG, %rdi + mov $_bss_start, %rsi + mov $_bss_end, %rdx + sub $_bss_start, %rdx + mov $MEMFLAG_PRESENT, %r10 + mov %rsp, %r8 + syscall + + jmp main diff --git a/src/user/bootstrap/main.c b/src/user/bootstrap/main.c index ea92af6..a0885dd 100644 --- a/src/user/bootstrap/main.c +++ b/src/user/bootstrap/main.c @@ -11,10 +11,8 @@ extern char _bss_start; extern char _bss_end; extern char _initrd; -__attribute__((section(".text.startup"))) -void _start(void) { - _syscall_memflag(&_bss_start, &_bss_end - &_bss_start, MEMFLAG_PRESENT); - +__attribute__((section(".text"))) +_Noreturn void main(void) { /* move everything provided by the kernel to /kdev */ MOUNT_AT("/kdev/") { fs_passthru(NULL); } MOUNT_AT("/") { |