diff options
Diffstat (limited to 'src/user/bootstrap/entry.S')
-rw-r--r-- | src/user/bootstrap/entry.S | 27 |
1 files changed, 27 insertions, 0 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 |