Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[workspace]
resolver = "3"
members = ["xtask", "fast-trap", "test-app"]
default-members = ["xtask"]
2 changes: 1 addition & 1 deletion fast-trap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "fast-trap"
description = "Provide a framework for bare-metal trap handling, aiming at ensuring performance while reusing code."
version = "0.0.1"
edition = "2021"
edition = "2024"
authors = ["YdrMaster <[email protected]>"]
repository = "https://github.com/YdrMaster/fast-trap.git"
documentation = "https://docs.rs/fast-trap"
Expand Down
6 changes: 2 additions & 4 deletions fast-trap/src/hal/riscv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,13 @@ impl FlowContext {
#[naked]
pub unsafe extern "C" fn reuse_stack_for_trap() {
const LAYOUT: Layout = Layout::new::<TrapHandler>();
core::arch::asm!(
core::arch::naked_asm!(
" addi sp, sp, {size}
andi sp, sp, {mask}
ret
",
size = const -(LAYOUT.size() as isize),
mask = const !(LAYOUT.align() as isize - 1) ,
options(noreturn)
)
}

Expand All @@ -127,7 +126,7 @@ pub unsafe extern "C" fn reuse_stack_for_trap() {
/// See [proto](crate::hal::doc::trap_entry).
#[naked]
pub unsafe extern "C" fn trap_entry() {
core::arch::asm!(
core::arch::naked_asm!(
".align 2",
// 换栈
exchange!(),
Expand Down Expand Up @@ -242,6 +241,5 @@ pub unsafe extern "C" fn trap_entry() {
load!(a1[ 9] => a1),
exchange!(),
r#return!(),
options(noreturn),
)
}
2 changes: 1 addition & 1 deletion test-app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "test-app"
version = "0.0.0"
edition = "2021"
edition = "2024"
authors = ["YdrMaster <[email protected]>"]
publish = false

Expand Down
2 changes: 1 addition & 1 deletion xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "xtask"
version = "0.1.0"
edition = "2021"
edition = "2024"
authors = ["YdrMaster <[email protected]>"]
publish = false

Expand Down
Loading