summaryrefslogtreecommitdiff
path: root/src/kernel/elf.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2020-09-13 17:12:29 -0400
committerBenji Dial <benji6283@gmail.com>2020-09-13 17:12:29 -0400
commit5481848e27fdd4fc859def9841a0283665531a46 (patch)
tree990a8df008214d85141a3bd10bd96898e64b0c37 /src/kernel/elf.c
parent1e4a254674f668839e5de273916024c16814b045 (diff)
downloadportland-os-5481848e27fdd4fc859def9841a0283665531a46.tar.gz
fixed some paging bugs, added fault handlers and new programs
Diffstat (limited to 'src/kernel/elf.c')
-rw-r--r--src/kernel/elf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/kernel/elf.c b/src/kernel/elf.c
index 423d51a..07cff91 100644
--- a/src/kernel/elf.c
+++ b/src/kernel/elf.c
@@ -126,6 +126,20 @@ 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;
+
+ const char *path_end_start = path;
+ for (const char *i = path; *i; ++i)
+ if (*i == '/')
+ path_end_start = i + 1;
+
+ uint8_t i;
+ for (i = 0; i < TASK_NAME_LEN; ++i) {
+ if (!path_end_start[i])
+ break;
+ tstate.name[i] = path_end_start[i];
+ }
+ tstate.name[i] = '\0';
+
new_task(tstate);
return true;
} \ No newline at end of file