浏览代码

feat(prototyper): rename `len_stack_per_hart`

Also move config file into prototyper/prototyper/config

Signed-off-by: Woshiluo Luo <[email protected]>
Woshiluo Luo 1 月之前
父节点
当前提交
7ae49c0d88

+ 1 - 1
prototyper/prototyper/default.toml → prototyper/prototyper/config/default.toml

@@ -1,5 +1,5 @@
 num_hart_max = 8
-len_stack_per_hart = 16384 # 16 * 1024
+stack_size_per_hart = 16384 # 16 * 1024
 heap_size = 32768 # 32 * 1024
 page_size = 4096
 log_level = "INFO"

+ 1 - 1
prototyper/prototyper/config_example.toml → prototyper/prototyper/config/sipeed_m1s_dock.toml

@@ -1,5 +1,5 @@
 num_hart_max = 8
-len_stack_per_hart = 16384 # 16 * 1024
+stack_size_per_hart = 16384 # 16 * 1024
 heap_size = 32768 # 32 * 1024
 page_size = 4096
 log_level = "INFO"

+ 1 - 1
prototyper/prototyper/src/cfg.rs

@@ -10,7 +10,7 @@ static_toml! {
 /// Maximum number of supported harts.
 pub const NUM_HART_MAX: usize = CONFIG.num_hart_max as usize;
 /// Stack size per hart (hardware thread) in bytes.
-pub const LEN_STACK_PER_HART: usize = CONFIG.len_stack_per_hart as usize;
+pub const STACK_SIZE_PER_HART: usize = CONFIG.stack_size_per_hart as usize;
 /// Heap Size of SBI firmware.
 pub const HEAP_SIZE: usize = CONFIG.heap_size as usize;
 /// Platform page size.

+ 4 - 4
prototyper/prototyper/src/sbi/trap_stack.rs

@@ -1,4 +1,4 @@
-use crate::cfg::{LEN_STACK_PER_HART, NUM_HART_MAX};
+use crate::cfg::{NUM_HART_MAX, STACK_SIZE_PER_HART};
 use crate::riscv::current_hartid;
 use crate::sbi::hart_context::HartContext;
 use crate::sbi::trap::fast_handler;
@@ -26,7 +26,7 @@ pub(crate) unsafe extern "C" fn locate() {
             call t1, {move_stack}       // Call stack reuse function
             ret                         // Return
         ",
-            per_hart_stack_size = const LEN_STACK_PER_HART,
+            per_hart_stack_size = const STACK_SIZE_PER_HART,
             stack               =   sym ROOT_STACK,
             move_stack          =   sym fast_trap::reuse_stack_for_trap,
         )
@@ -51,10 +51,10 @@ pub(crate) fn prepare_for_trap() {
 ///
 /// Each hart has a single stack that contains both its context and working space.
 #[repr(C, align(128))]
-pub(crate) struct Stack([u8; LEN_STACK_PER_HART]);
+pub(crate) struct Stack([u8; STACK_SIZE_PER_HART]);
 
 impl Stack {
-    const ZERO: Self = Self([0; LEN_STACK_PER_HART]);
+    const ZERO: Self = Self([0; STACK_SIZE_PER_HART]);
 
     /// Gets mutable reference to hart context at bottom of stack.
     #[inline]

+ 1 - 0
xtask/src/prototyper.rs

@@ -50,6 +50,7 @@ pub fn run(arg: &PrototyperArg) -> Option<ExitStatus> {
         .unwrap()
         .join("prototyper")
         .join("prototyper")
+        .join("config")
         .join("default.toml");
     let config_file = arg.config_file.clone().unwrap_or(default_config_file);