From 2fc768319887945c5c6beafcd21d29d9884cd48a Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Wed, 3 Mar 2021 23:47:26 -0500 Subject: moving windows with mouse, changing some old panics into syslogs, small bugfix in knob files, "send to back" wm keybinding --- src/kernel/elf.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/kernel/elf.c') diff --git a/src/kernel/elf.c b/src/kernel/elf.c index f601654..fdb13aa 100644 --- a/src/kernel/elf.c +++ b/src/kernel/elf.c @@ -76,6 +76,10 @@ struct ph_entry { } __attribute__ ((packed)); uint32_t try_elf_run(const struct drive *d, const char *path, const char *pass_old_vma, uint32_t io_handle) { + struct task_state *tstate = new_task(); + if (!tstate) + return 0; + file_id_t h = d->get_file(d, path); if (!h) return 0; @@ -126,18 +130,17 @@ uint32_t try_elf_run(const struct drive *d, const char *path, const char *pass_o memcpy(pass_pma, pass, pass_l); - struct task_state tstate; - tstate.page_directory = pd; - tstate.ret_addr = ehead.entry_vma; - tstate.stack_bottom = 0; + tstate->page_directory = pd; + tstate->ret_addr = ehead.entry_vma; + tstate->stack_bottom = 0; //logf(LOG_INFO, " tasks: 0x%h", tasks); //logf(LOG_INFO, "active_task: 0x%h", active_task); //logf(LOG_INFO, " new edi: 0x%hb", active_task - tasks + 1); - tstate.edx = (uint32_t)pass_vma; - tstate.esi = io_handle; - tstate.edi = active_task - tasks + 1; - tstate.esp = 0; + tstate->edx = (uint32_t)pass_vma; + tstate->esi = io_handle; + tstate->edi = active_task - tasks + 1; + tstate->esp = 0; const char *path_end_start = path; for (const char *i = path; *i; ++i) @@ -148,9 +151,9 @@ uint32_t try_elf_run(const struct drive *d, const char *path, const char *pass_o for (i = 0; i < TASK_NAME_LEN; ++i) { if (!path_end_start[i]) break; - tstate.name[i] = path_end_start[i]; + tstate->name[i] = path_end_start[i]; } - tstate.name[i] = '\0'; + tstate->name[i] = '\0'; - return new_task(tstate); + return (tstate - tasks) + 1; } -- cgit v1.2.3