turntbl now exits upon running a new program
this should allow for users to take advantage of more system memory
This commit is contained in:
parent
7b7857a97a
commit
8bfe43427d
1 changed files with 9 additions and 7 deletions
|
|
@ -187,14 +187,16 @@ fn attempt_run_file(env: &Environment<'_>, name: &str) {
|
||||||
current_directory_path: CURRENT_DIR_PATH.load(Ordering::Relaxed) as usize,
|
current_directory_path: CURRENT_DIR_PATH.load(Ordering::Relaxed) as usize,
|
||||||
current_directory_path_len: CURRENT_DIR_PATH_LEN.load(Ordering::Relaxed),
|
current_directory_path_len: CURRENT_DIR_PATH_LEN.load(Ordering::Relaxed),
|
||||||
};
|
};
|
||||||
|
// fixme: turntable task needs to exit, but it owns the environment memory.
|
||||||
|
// fixme: we need to somehow pass the environment to the task, and have it free the memory
|
||||||
|
|
||||||
let mut task_setup = liblbos::TaskSetup {
|
let mut task_setup = liblbos::TaskSetup {
|
||||||
epc: 0,
|
epc: 0,
|
||||||
stack_block_count: 8,
|
stack_block_count: 8,
|
||||||
ddi_first_addr: 0,
|
ddi_first_addr: 0,
|
||||||
ddi_size: 0,
|
ddi_size: 0,
|
||||||
environment: &e as *const _ as usize,
|
environment: 0,
|
||||||
wait_for_task_exit: true,
|
wait_for_task_exit: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if liblbos::ktask::ktask_loadddifile(buf, size, &mut task_setup as *mut _ as usize) != 0 {
|
if liblbos::ktask::ktask_loadddifile(buf, size, &mut task_setup as *mut _ as usize) != 0 {
|
||||||
|
|
@ -207,11 +209,11 @@ fn attempt_run_file(env: &Environment<'_>, name: &str) {
|
||||||
|
|
||||||
liblbos::syscalls::create_task(task_setup);
|
liblbos::syscalls::create_task(task_setup);
|
||||||
|
|
||||||
// yeah we're extending its lifetime
|
if CURRENT_DIR_PATH.load(Ordering::Relaxed) as usize != 0 {
|
||||||
#[allow(clippy::drop_non_drop)]
|
// free
|
||||||
drop(e);
|
liblbos::syscalls::free_blocks(CURRENT_DIR_PATH.load(Ordering::Relaxed) as usize, CURRENT_DIR_PATH_LEN.load(Ordering::Relaxed).div_ceil(512));
|
||||||
|
}
|
||||||
println("\ntask exited\n");
|
liblbos::syscalls::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn execute(cmd: &str, environment: &mut Environment<'_>) {
|
fn execute(cmd: &str, environment: &mut Environment<'_>) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue