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

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

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

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

Loading…
Cancel
Save