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/idt.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/kernel/idt.c') 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 -- cgit v1.2.3