Commit 4595d30d authored by Stefan Lankes's avatar Stefan Lankes
Browse files

using a readable names for constants

parent 7bae465b
......@@ -46,6 +46,11 @@ pub enum TaskStacks {
}
impl TaskStacks {
/// Size of the debug marker at the very top of each stack.
///
/// We have a marker at the very top of the stack for debugging (`0xdeadbeef`), which should not be overridden.
pub const MARKER_SIZE: usize = 0x10;
pub fn new(size: usize) -> Self {
let user_stack_size = if size < KERNEL_STACK_SIZE {
KERNEL_STACK_SIZE
......
......@@ -6,7 +6,7 @@
// copied, modified, or distributed except according to those terms.
use crate::arch::aarch64::kernel::serial::SerialPort;
use crate::arch::aarch64::kernel::BootInfo;
use crate::arch::aarch64::kernel::{scheduler::TaskStacks, BootInfo};
use crate::KERNEL_STACK_SIZE;
static mut BOOT_STACK: [u8; KERNEL_STACK_SIZE] = [0; KERNEL_STACK_SIZE];
......@@ -18,7 +18,7 @@ static mut BOOT_STACK: [u8; KERNEL_STACK_SIZE] = [0; KERNEL_STACK_SIZE];
pub unsafe extern "C" fn _start() -> ! {
asm!("ldr x1, {0}",
"add x1, x1, {1}",
"sub x1, x1, #0x10", /* Previous version subtracted 0x10 from End, so I'm doing this too. Not sure why though. COMMENT from SL: This is a habit of mine. I always start 16 bytes before the end of the stack. */
"sub x1, x1, {2}", /* Previous version subtracted 0x10 from End, so I'm doing this too. Not sure why though. COMMENT from SL: This is a habit of mine. I always start 0x10 bytes before the end of the stack. */
"mov sp, x1",
/* Set exception table */
"adr x8, vector_table",
......@@ -26,6 +26,7 @@ pub unsafe extern "C" fn _start() -> ! {
"b pre_init",
sym BOOT_STACK,
const KERNEL_STACK_SIZE,
const TaskStacks::MARKER_SIZE,
options(noreturn),
)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment