Sussy stuff

pull/12/head
Erin 2023-11-15 19:41:44 +01:00
parent b820c3bc95
commit 9e213d8549
1 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,7 @@ type Vm = hbvm::Vm<mem::Memory, TIMER_QUOTIENT>;
pub struct ExecThread<'p> {
vm: Vm,
stack_top: *mut u8,
stack_bottom: *mut u8,
_phantom: PhantomData<&'p [u8]>,
}
@ -40,12 +40,12 @@ impl<'p> ExecThread<'p> {
)
};
let stack_top = unsafe { allocate_stack().as_ptr().add(STACK_SIZE - 1) };
vm.write_reg(254, stack_top as u64);
let stack_bottom = unsafe { allocate_stack().as_ptr() };
vm.write_reg(254, (stack_bottom as usize + STACK_SIZE - 1) as u64);
ExecThread {
vm,
stack_top,
stack_bottom,
_phantom: Default::default(),
}
}
@ -53,7 +53,7 @@ impl<'p> ExecThread<'p> {
impl<'p> Drop for ExecThread<'p> {
fn drop(&mut self) {
unsafe { alloc::alloc::dealloc(self.stack_top.sub(STACK_SIZE - 1), stack_layout()) };
unsafe { alloc::alloc::dealloc(self.stack_bottom, stack_layout()) };
}
}