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/usrspace.s | |
| 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/usrspace.s')
| -rw-r--r-- | kernel/usrspace.s | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/kernel/usrspace.s b/kernel/usrspace.s new file mode 100644 index 0000000..e52f2e0 --- /dev/null +++ b/kernel/usrspace.s @@ -0,0 +1,42 @@ +global userspace_init +extern _binary_usrbin_bin_start +extern _binary_usrbin_bin_size + +userspace_init: + push ebp + mov ebp, esp + push esi + push edi + mov ecx, _binary_usrbin_bin_size + mov esi, _binary_usrbin_bin_start + mov edi, 0x100000 +.loop: + movsb + dec ecx + jz .end + jmp .loop +.end: + pop edi + pop esi + call usrcall + pop ebp + ret + +usrcall: + push ebp + mov ebp, esp + cli + mov ax, 0x23 + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov eax, esp + push dword 0x23 + push eax + pushf + push dword 0x1B + push dword 0x00100000 + iret + pop ebp + ret |
