From 143156f63e2448733f1a35a74e629fe0ae9bb567 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 13 Sep 2020 19:51:09 -0400 Subject: have command shell block while commands are running --- src/kernel/elf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/kernel/elf.c') diff --git a/src/kernel/elf.c b/src/kernel/elf.c index 8113c14..60fa3a9 100644 --- a/src/kernel/elf.c +++ b/src/kernel/elf.c @@ -73,10 +73,10 @@ struct ph_entry { uint32_t align; } __attribute__ ((packed)); -bool try_elf_run(const struct drive *d, const char *path, const char *pass_old_vma) { +uint32_t try_elf_run(const struct drive *d, const char *path, const char *pass_old_vma) { file_id_t h = d->get_file(d, path); if (!h) - return false; + return 0; struct elf_header ehead; @@ -87,7 +87,7 @@ bool try_elf_run(const struct drive *d, const char *path, const char *pass_old_v (ehead.endianness != LITTLE_ENDIAN) || ehead.os_abi_version) { d->free_file(d, h); - return false; + return 0; } uint32_t phtable_size = ehead.phentry_size * ehead.phtable_count; @@ -104,7 +104,7 @@ bool try_elf_run(const struct drive *d, const char *path, const char *pass_old_v continue; void *pma = pd_user_allocate(pd, entry->vma, (entry->vms - 1) / 4096 + 1, entry->flags & PH_WRITABLE); fmcpy(pma, d, h, entry->fa, entry->fs); - for (uint8_t *pma_i = pma + entry->fs; pma_i < pma + entry->vms; ++pma_i) + for (uint8_t *pma_i = pma + entry->fs; pma_i < (uint8_t *)pma + entry->vms; ++pma_i) *pma_i = 0; } @@ -128,6 +128,7 @@ bool try_elf_run(const struct drive *d, const char *path, const char *pass_old_v tstate.page_directory = pd; tstate.ret_addr = ehead.entry_vma; tstate.edx = (uint32_t)pass_vma; + tstate.wait_mode = NONE; const char *path_end_start = path; for (const char *i = path; *i; ++i) @@ -142,6 +143,5 @@ bool try_elf_run(const struct drive *d, const char *path, const char *pass_old_v } tstate.name[i] = '\0'; - new_task(tstate); - return true; + return new_task(tstate); } \ No newline at end of file -- cgit v1.2.3