summaryrefslogtreecommitdiff
path: root/src/kernel/elf.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2021-03-03 23:47:26 -0500
committerBenji Dial <benji6283@gmail.com>2021-03-03 23:47:26 -0500
commit2fc768319887945c5c6beafcd21d29d9884cd48a (patch)
tree9dadaf32069588c23e755228099669557449304f /src/kernel/elf.c
parent81df4702c424f91cca5570ab2554d1d4cbae534d (diff)
downloadportland-os-2fc768319887945c5c6beafcd21d29d9884cd48a.tar.gz
moving windows with mouse, changing some old panics into syslogs, small bugfix in knob files, "send to back" wm keybinding
Diffstat (limited to 'src/kernel/elf.c')
-rw-r--r--src/kernel/elf.c25
1 files changed, 14 insertions, 11 deletions
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;
}