Putting it all together, we have a user process that successfully calls sys_exit() w/o crashing.
This commit is contained in:
parent
0aac6c888d
commit
0ea9974512
14
apps/app.asm
14
apps/app.asm
@ -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
|
@ -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,17 +62,9 @@ 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));
|
||||
|
Loading…
Reference in New Issue
Block a user