diff options
author | Benji Dial <Benji3.141@gmail.com> | 2019-12-26 18:21:44 -0500 |
---|---|---|
committer | Benji Dial <Benji3.141@gmail.com> | 2019-12-26 18:21:44 -0500 |
commit | c055a2f6a9778f93a8f09b6d820d2504d3fa2601 (patch) | |
tree | cdaf3f6cc2673571e67ecfde0dbf5b78c78037c2 /src/kernel/proc.c | |
parent | dc6b746faa656729de3ffc5b3ec5b087328dbd27 (diff) | |
download | portland-os-c055a2f6a9778f93a8f09b6d820d2504d3fa2601.tar.gz |
keyboard skeleton, skeleton, rcs, etc
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r-- | src/kernel/proc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c index 84075d7..0912f3c 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -25,10 +25,10 @@ uint16_t new_proc(uint8_t *file) { uint16_t handle = open_file(file); if (handle) for (uint16_t id = 3; id; ++id) - if (!proc_table[id].memory_start) { + if (!proc_table[id].text) { uint32_t size = get_size(id); void *mem; - proc_table[id].memory_end = size + (proc_table[id].memory_start = allocate_block(size, id)); + proc_table[id].text = size + (proc_table[id].text = allocate_block(size, id)); read_file(handle, size, mem); close_file(handle); //Process file header and make new process @@ -39,6 +39,14 @@ uint16_t new_proc(uint8_t *file) { } void end_proc(uint16_t id) { - deallocate_block(proc_table[id].memory_start); - proc_table[id].memory_start = 0; + if (id && proc_table[id].text) { + deallocate_block(proc_table[id].text); + if (proc_table[id].rodata) + deallocate_block(proc_table[id].rodata); + if (proc_table[id].data) + deallocate_block(proc_table[id].data); + if (proc_table[id].bss) + deallocate_block(proc_table[id].bss); + proc_table[id].text = 0; + } }
\ No newline at end of file |