فهرست منبع

feat(prototyper): rename fw_payload to payload

Signed-off-by: Woshiluo Luo <[email protected]>
Woshiluo Luo 5 ماه پیش
والد
کامیت
b99470377a
6فایلهای تغییر یافته به همراه22 افزوده شده و 22 حذف شده
  1. 1 1
      Makefile.toml
  2. 1 1
      prototyper/Cargo.toml
  3. 3 3
      prototyper/build.rs
  4. 3 3
      prototyper/src/fail.rs
  5. 11 11
      prototyper/src/main.rs
  6. 3 3
      prototyper/src/payload.rs

+ 1 - 1
Makefile.toml

@@ -7,7 +7,7 @@ args = ["clean"]
 
 [tasks.prototyper-nemu-build]
 command = "cargo"
-args = ["build", "-prustsbi-prototyper", "--release", "--features=nemu,fw_payload"]
+args = ["build", "-prustsbi-prototyper", "--release", "--features=nemu,payload"]
 
 [tasks.prototyper-nemu]
 command = "rust-objcopy"

+ 1 - 1
prototyper/Cargo.toml

@@ -32,4 +32,4 @@ bench = false
 
 [features]
 nemu = []
-fw_payload = []
+payload = []

+ 3 - 3
prototyper/build.rs

@@ -11,7 +11,7 @@ fn main() {
     println!("cargo:rustc-link-search={}", out.display());
 }
 
-#[cfg(feature = "fw_payload")]
+#[cfg(feature = "payload")]
 const LINKER_SCRIPT: &[u8] = b"OUTPUT_ARCH(riscv)
 ENTRY(_start) 
 SECTIONS {
@@ -49,11 +49,11 @@ SECTIONS {
         *(.fw_fdt)
     }
     .text 0x80200000 : ALIGN(8) {
-        *(.fw_payload)
+        *(.payload)
     }
 }";
 
-#[cfg(not(feature = "fw_payload"))]
+#[cfg(not(feature = "payload"))]
 const LINKER_SCRIPT: &[u8] = b"OUTPUT_ARCH(riscv)
 ENTRY(_start) 
 SECTIONS {

+ 3 - 3
prototyper/src/fail.rs

@@ -4,7 +4,7 @@ use serde_device_tree::Dtb;
 use crate::dt::{self, ParseDeviceTreeError, Tree};
 use crate::sbi::reset;
 
-#[cfg(not(feature = "fw_payload"))]
+#[cfg(not(feature = "payload"))]
 use crate::dynamic;
 
 #[cold]
@@ -22,7 +22,7 @@ pub fn device_tree_deserialize<'a>(err: serde_device_tree::error::Error) -> Tree
 }
 
 #[cold]
-#[cfg(not(feature = "fw_payload"))]
+#[cfg(not(feature = "payload"))]
 pub fn invalid_dynamic_data(err: dynamic::DynamicError) -> (mstatus::MPP, usize) {
     error!("Invalid data in dynamic information:");
     if err.invalid_mpp {
@@ -45,7 +45,7 @@ pub fn invalid_dynamic_data(err: dynamic::DynamicError) -> (mstatus::MPP, usize)
 }
 
 #[cold]
-#[cfg(not(feature = "fw_payload"))]
+#[cfg(not(feature = "payload"))]
 pub fn no_dynamic_info_available(err: dynamic::DynamicReadError) -> dynamic::DynamicInfo {
     if let Some(bad_paddr) = err.bad_paddr {
         error!(

+ 11 - 11
prototyper/src/main.rs

@@ -10,10 +10,10 @@ mod macros;
 
 mod board;
 mod dt;
-#[cfg(not(feature = "fw_payload"))]
+#[cfg(not(feature = "payload"))]
 mod dynamic;
 mod fail;
-#[cfg(feature = "fw_payload")]
+#[cfg(feature = "payload")]
 mod payload;
 mod riscv_spec;
 mod sbi;
@@ -37,29 +37,29 @@ use crate::sbi::SBI;
 #[no_mangle]
 extern "C" fn rust_main(_hart_id: usize, opaque: usize, nonstandard_a2: usize) {
     // parse dynamic information
-    #[cfg(not(feature = "fw_payload"))]
+    #[cfg(not(feature = "payload"))]
     let info = dynamic::read_paddr(nonstandard_a2).unwrap_or_else(fail::no_dynamic_info_available);
     static GENESIS: AtomicBool = AtomicBool::new(true);
     static SBI_READY: AtomicBool = AtomicBool::new(false);
 
-    #[cfg(not(feature = "fw_payload"))]
+    #[cfg(not(feature = "payload"))]
     let is_boot_hart = if info.boot_hart == usize::MAX {
         GENESIS.swap(false, Ordering::AcqRel)
     } else {
         current_hartid() == info.boot_hart
     };
-    #[cfg(feature = "fw_payload")]
+    #[cfg(feature = "payload")]
     let is_boot_hart = true;
 
-    #[cfg(feature = "fw_payload")]
+    #[cfg(feature = "payload")]
     let fdt_address = payload::get_fdt_address();
-    #[cfg(not(feature = "fw_payload"))]
+    #[cfg(not(feature = "payload"))]
     let fdt_address = opaque;
 
     if is_boot_hart {
-        #[cfg(feature = "fw_payload")]
+        #[cfg(feature = "payload")]
         let (mpp, next_addr) = (mstatus::MPP::Supervisor, payload::get_image_address());
-        #[cfg(not(feature = "fw_payload"))]
+        #[cfg(not(feature = "payload"))]
         let (mpp, next_addr) =
             dynamic::mpp_next_addr(&info).unwrap_or_else(fail::invalid_dynamic_data);
 
@@ -199,7 +199,7 @@ extern "C" fn rust_main(_hart_id: usize, opaque: usize, nonstandard_a2: usize) {
 #[naked]
 #[link_section = ".text.entry"]
 #[export_name = "_start"]
-#[cfg(not(feature = "fw_payload"))]
+#[cfg(not(feature = "payload"))]
 unsafe extern "C" fn start() -> ! {
     core::arch::asm!(
         // 1. Turn off interrupt
@@ -240,7 +240,7 @@ unsafe extern "C" fn start() -> ! {
 #[naked]
 #[link_section = ".text.entry"]
 #[export_name = "_start"]
-#[cfg(feature = "fw_payload")]
+#[cfg(feature = "payload")]
 unsafe extern "C" fn start() -> ! {
     core::arch::asm!(
         // 1. Turn off interrupt

+ 3 - 3
prototyper/src/payload.rs

@@ -10,8 +10,8 @@ pub unsafe extern "C" fn raw_fdt() {
 }
 
 #[naked]
-#[link_section = ".fw_payload"]
-pub unsafe extern "C" fn fw_payload_image() {
+#[link_section = ".payload"]
+pub unsafe extern "C" fn payload_image() {
     asm!(
         concat!(".incbin \"", env!("PROTOTYPER_IMAGE"), "\""),
         options(noreturn)
@@ -25,5 +25,5 @@ pub fn get_fdt_address() -> usize {
 
 #[inline]
 pub fn get_image_address() -> usize {
-    fw_payload_image as usize
+    payload_image as usize
 }