shrink kstack size, avoid alloc kstack for init thread

master
WangRunji 6 years ago
parent 683814d24c
commit 1e5f901926

@ -8,7 +8,7 @@ _start:
# 1. set sp
# sp = bootstack + (hartid + 1) * 0x10000
add t0, a0, 1
slli t0, t0, 16
slli t0, t0, 14
lui sp, %hi(bootstack)
add sp, sp, t0
@ -32,7 +32,7 @@ _start:
.align 12 # page align
.global bootstack
bootstack:
.space 4096 * 16 * 8
.space 4096 * 4 * 8
.global bootstacktop
bootstacktop:

@ -8,7 +8,7 @@ _start:
# 1. set sp
# sp = bootstack + (hartid + 1) * 0x10000
add t0, a0, 1
slli t0, t0, 16
slli t0, t0, 14
lui sp, %hi(bootstack)
add sp, sp, t0
@ -32,7 +32,7 @@ _start:
.align 12 # page align
.global bootstack
bootstack:
.space 4096 * 16 * 8
.space 4096 * 4 * 8
.global bootstacktop
bootstacktop:

@ -77,7 +77,7 @@ pub fn dealloc_frame(target: usize) {
}
pub struct KernelStack(usize);
const STACK_SIZE: usize = 0x8000;
const STACK_SIZE: usize = 0x4000;
impl KernelStack {
pub fn new() -> Self {

@ -126,10 +126,8 @@ impl Thread {
pub unsafe fn new_init() -> Box<Thread> {
Box::new(Thread {
context: Context::null(),
kstack: KernelStack::new(),
clear_child_tid: 0,
// safety: this field will never be used
proc: core::mem::uninitialized(),
// safety: other fields will never be used
.. core::mem::uninitialized()
})
}

Loading…
Cancel
Save