summaryrefslogtreecommitdiff
path: root/src/kernel/idt.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2020-09-13 19:51:09 -0400
committerBenji Dial <benji6283@gmail.com>2020-09-13 19:51:09 -0400
commit143156f63e2448733f1a35a74e629fe0ae9bb567 (patch)
treebcf70a6940038986da2cfb2d6ed380ed8ebb91de /src/kernel/idt.c
parent54101cf327b7def90636babbadbb66ce697298ee (diff)
downloadportland-os-143156f63e2448733f1a35a74e629fe0ae9bb567.tar.gz
have command shell block while commands are running
Diffstat (limited to 'src/kernel/idt.c')
-rw-r--r--src/kernel/idt.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/kernel/idt.c b/src/kernel/idt.c
index b789d42..4ffa1e2 100644
--- a/src/kernel/idt.c
+++ b/src/kernel/idt.c
@@ -54,11 +54,11 @@ static uint32_t sc_file_read(uint32_t handle, uint32_t file_offset, uint32_t cou
return count;
}
-static bool sc_start_task(uint32_t drive_number, char *path, const char *pass) {
+static uint32_t sc_start_task(uint32_t drive_number, char *path, const char *pass) {
switch_to_kernel_cr3();
- bool result = try_elf_run(drives + drive_number, vma_to_pma(active_task->page_directory, path), pass);
+ uint32_t process_id = try_elf_run(drives + drive_number, vma_to_pma(active_task->page_directory, path), pass);
switch_to_task_cr3();
- return result;
+ return process_id;
}
static void *sc_allocate_ram(uint32_t pages) {
@@ -91,6 +91,11 @@ static uint32_t sc_memory_info(enum mi_arg arg) {
}
}
+static void sc_wait_for_task(uint32_t handle) {
+ active_task->wait_mode = PROCESS_END;
+ active_task->wait_arg = handle;
+}
+
void const *syscall_table[] = {
&sc_open_file,
&sc_close_file,
@@ -100,7 +105,8 @@ void const *syscall_table[] = {
&logsz,
&get_key_code,
&sc_allocate_ram,
- &sc_memory_info
+ &sc_memory_info,
+ &sc_wait_for_task
};
//these aren't really void ()'s, but gcc complains if we take an address of a void, so we give it a type