forked from AbleOS/ableos
Sussy stuff
This commit is contained in:
parent
d396da5f3c
commit
b8ce78b6dd
|
@ -21,7 +21,7 @@ type Vm = hbvm::Vm<mem::Memory, TIMER_QUOTIENT>;
|
||||||
|
|
||||||
pub struct ExecThread<'p> {
|
pub struct ExecThread<'p> {
|
||||||
vm: Vm,
|
vm: Vm,
|
||||||
stack_top: *mut u8,
|
stack_bottom: *mut u8,
|
||||||
_phantom: PhantomData<&'p [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) };
|
let stack_bottom = unsafe { allocate_stack().as_ptr() };
|
||||||
vm.write_reg(254, stack_top as u64);
|
vm.write_reg(254, (stack_bottom as usize + STACK_SIZE - 1) as u64);
|
||||||
|
|
||||||
ExecThread {
|
ExecThread {
|
||||||
vm,
|
vm,
|
||||||
stack_top,
|
stack_bottom,
|
||||||
_phantom: Default::default(),
|
_phantom: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ impl<'p> ExecThread<'p> {
|
||||||
|
|
||||||
impl<'p> Drop for ExecThread<'p> {
|
impl<'p> Drop for ExecThread<'p> {
|
||||||
fn drop(&mut self) {
|
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()) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue