Load a very simple ELF and launch it in usermode

This commit is contained in:
Jeremy Soller 2016-09-07 21:16:30 -06:00
parent 398838dc1b
commit 850792bbf1
11 changed files with 201 additions and 59 deletions

BIN
init/main Executable file

Binary file not shown.

20
init/main.asm Normal file
View file

@ -0,0 +1,20 @@
[bits 64]
section .text
global _start ;must be declared for linker (ld)
_start: ;tell linker entry point
xchg bx, bx
mov rdx,len ;message length
mov rcx,msg ;message to write
mov rbx,1 ;file descriptor (stdout)
mov rax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov rax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
msg db 'Hello, world!',0xa ;our dear string
len equ $ - msg ;length of our dear string

BIN
init/main.o Normal file

Binary file not shown.