First user process!
All checks were successful
continuous-integration/drone/push Build is passing

Putting it all together, we have a user process that successfully calls sys_exit() w/o crashing.
This commit is contained in:
apio 2023-01-05 21:55:21 +01:00
parent 0aac6c888d
commit 0ea9974512
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 3 additions and 24 deletions

View File

@ -1,18 +1,4 @@
section .text
global _start
_start:
mov eax, ecx
push rdx
mov eax, 1
mov edi, hello_world
mov esi, 14
int 42h
nop
section .rodata
hello_world:
db 'Hello, world!', 0xa, 0
section .bss
array:
resb 10

View File

@ -51,7 +51,8 @@ Result<void> init()
kinfoln("Used memory: %s", to_dynamic_unit(MemoryManager::used()).release_value().chars());
kinfoln("Reserved memory: %s", to_dynamic_unit(MemoryManager::reserved()).release_value().chars());
MMU::unmap(0x400000);
Thread::init();
Scheduler::init();
TarStream::Entry entry;
while (TRY(g_initrd.read_next_entry().try_set_value_with_specific_error(entry, 0)))
@ -61,18 +62,10 @@ Result<void> init()
kinfoln("Found file %s in initial ramdisk, of size %s", entry.name,
to_dynamic_unit(entry.size).release_value().chars());
if (!strcmp(entry.name, "bin/app"))
{
auto data = TRY(ELFLoader::load(entry, g_initrd));
data.segments.consume([](ELFSegment* segment) { delete segment; });
kinfoln("Loaded ELF with entry=%#.16lx", data.entry);
}
if (!strcmp(entry.name, "bin/app")) { TRY(Scheduler::new_userspace_thread(entry, g_initrd)); }
}
}
Thread::init();
Scheduler::init();
TRY(Scheduler::new_kernel_thread(heap_thread));
TRY(Scheduler::new_kernel_thread(reap_thread));