diff options
| author | Jake Mannens <jake72360@gmail.com> | 2018-06-20 04:39:25 +1000 |
|---|---|---|
| committer | Jake Mannens <jake72360@gmail.com> | 2018-06-20 04:39:25 +1000 |
| commit | a4ea0b14840ef5946408a3893f3f1c92ed57ae80 (patch) | |
| tree | 0290ff480f8d9156b6bfcd35d009028e08cb5041 /kernel/usrbin | |
| parent | f6858b7333139441215e83e070e098bf09056762 (diff) | |
Added a very basic types.h header file that defines NULL, size_t and
time_t.
Moved the kernel's loading point down to address 0 in
conventional memory and updated linker scripts accordingly.
Began to experiment with loading a binary blob into extended memory
(0x100000), switching to userspace mode, and executing it.
Diffstat (limited to 'kernel/usrbin')
| -rw-r--r-- | kernel/usrbin/Makefile | 17 | ||||
| -rw-r--r-- | kernel/usrbin/usrbin.bin | bin | 0 -> 76 bytes | |||
| -rw-r--r-- | kernel/usrbin/usrbin.s | 32 |
3 files changed, 49 insertions, 0 deletions
diff --git a/kernel/usrbin/Makefile b/kernel/usrbin/Makefile new file mode 100644 index 0000000..dfd1b84 --- /dev/null +++ b/kernel/usrbin/Makefile @@ -0,0 +1,17 @@ +TARGET = usrbin.o + +ASM = nasm + +all: build + +build: $(TARGET) + +usrbin.bin: usrbin.s + $(ASM) -f bin -o usrbin.bin usrbin.s + +$(TARGET): usrbin.bin + objcopy -I binary -O elf32-i386 -B i386 usrbin.bin usrbin.o + +clean: + rm -f usrbin.bin + rm -f $(TARGET) diff --git a/kernel/usrbin/usrbin.bin b/kernel/usrbin/usrbin.bin Binary files differnew file mode 100644 index 0000000..a7d7730 --- /dev/null +++ b/kernel/usrbin/usrbin.bin diff --git a/kernel/usrbin/usrbin.s b/kernel/usrbin/usrbin.s new file mode 100644 index 0000000..91dd94a --- /dev/null +++ b/kernel/usrbin/usrbin.s @@ -0,0 +1,32 @@ +bits 32 +org 0x100000 + +main: + push .msg + call puts + add esp, 4 +.loop: + ; loop forever + jmp .loop +.msg: db "Hello World from Userspace!", 0 + +puts: + push ebp + mov ebp, esp + push esi + push edi + mov esi, [ebp+8] + mov edi, 0xB8000 +.loop: + lodsb + cmp al, 0 + je .end + mov [edi], al + mov byte [edi+1], 0x07 + add edi, 2 + jmp .loop +.end: + pop edi + pop esi + pop ebp + ret |
