Skip to content

Commit ff15b5a

Browse files
committed
lib: update dependency sbi-rt and sbi-spec
Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>
1 parent 3cf1777 commit ff15b5a

File tree

6 files changed

+30
-16
lines changed

6 files changed

+30
-16
lines changed

Cargo.lock

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
resolver = "2"
33
members = ["rustsbi-qemu", "hsm-cell", "test-kernel", "bench-kernel", "xtask"]
44
default-members = ["xtask"]
5+
6+
[profile.release]
7+
opt-level = 3

bench-kernel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ publish = false
88
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
99

1010
[dependencies]
11-
sbi-rt = "0.0.2"
11+
sbi-rt = "0.0.3-rc.5"
1212
riscv = "0.10.1"
1313
uart_16550 = "0.2"
1414
rcore-console = "0.0.0"

hsm-cell/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
sbi-spec = "0.0.4"
9+
sbi-spec = "0.0.7-alpha.3"
1010

1111
[lib]
1212
name = "hsm_cell"

hsm-cell/src/lib.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<T> HsmCell<T> {
3131
/// 创建一个新的共享对象。
3232
pub const fn new() -> Self {
3333
Self {
34-
status: AtomicUsize::new(HART_STATE_STOPPED),
34+
status: AtomicUsize::new(hart_state::STOPPED),
3535
val: UnsafeCell::new(None),
3636
}
3737
}
@@ -59,8 +59,8 @@ impl<T> LocalHsmCell<'_, T> {
5959
pub fn start(&self) -> Result<T, usize> {
6060
loop {
6161
match self.0.status.compare_exchange(
62-
HART_STATE_START_PENDING,
63-
HART_STATE_STARTED,
62+
hart_state::START_PENDING,
63+
hart_state::STARTED,
6464
Ordering::AcqRel,
6565
Ordering::Relaxed,
6666
) {
@@ -74,19 +74,21 @@ impl<T> LocalHsmCell<'_, T> {
7474
/// 关闭。
7575
#[inline]
7676
pub fn stop(&self) {
77-
self.0.status.store(HART_STATE_STOPPED, Ordering::Release)
77+
self.0.status.store(hart_state::STOPPED, Ordering::Release)
7878
}
7979

8080
/// 关闭。
8181
#[inline]
8282
pub fn suspend(&self) {
83-
self.0.status.store(HART_STATE_SUSPENDED, Ordering::Relaxed)
83+
self.0
84+
.status
85+
.store(hart_state::SUSPENDED, Ordering::Relaxed)
8486
}
8587

8688
/// 关闭。
8789
#[inline]
8890
pub fn resume(&self) {
89-
self.0.status.store(HART_STATE_STARTED, Ordering::Relaxed)
91+
self.0.status.store(hart_state::STARTED, Ordering::Relaxed)
9092
}
9193
}
9294

@@ -98,7 +100,7 @@ impl<T> RemoteHsmCell<'_, T> {
98100
.0
99101
.status
100102
.compare_exchange(
101-
HART_STATE_STOPPED,
103+
hart_state::STOPPED,
102104
HART_STATE_START_PENDING_EXT,
103105
Ordering::Acquire,
104106
Ordering::Relaxed,
@@ -108,7 +110,7 @@ impl<T> RemoteHsmCell<'_, T> {
108110
unsafe { *self.0.val.get() = Some(t) };
109111
self.0
110112
.status
111-
.store(HART_STATE_START_PENDING, Ordering::Release);
113+
.store(hart_state::START_PENDING, Ordering::Release);
112114
true
113115
} else {
114116
false
@@ -119,7 +121,7 @@ impl<T> RemoteHsmCell<'_, T> {
119121
#[inline]
120122
pub fn sbi_get_status(&self) -> usize {
121123
match self.0.status.load(Ordering::Relaxed) {
122-
HART_STATE_START_PENDING_EXT => HART_STATE_START_PENDING,
124+
HART_STATE_START_PENDING_EXT => hart_state::START_PENDING,
123125
normal => normal,
124126
}
125127
}
@@ -129,7 +131,7 @@ impl<T> RemoteHsmCell<'_, T> {
129131
pub fn allow_ipi(&self) -> bool {
130132
matches!(
131133
self.0.status.load(Ordering::Relaxed),
132-
HART_STATE_STARTED | HART_STATE_SUSPENDED
134+
hart_state::STARTED | hart_state::SUSPENDED
133135
)
134136
}
135137
}

rustsbi-qemu/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ extern "C" fn rust_main(hartid: usize, opaque: usize) {
8989
// 打印启动信息
9090
print!(
9191
"\
92-
[rustsbi] RustSBI version {ver_sbi}, adapting to RISC-V SBI v1.0.0
92+
[rustsbi] RustSBI version {ver_sbi}, adapting to RISC-V SBI v2.0.0
9393
{logo}
9494
[rustsbi] Implementation : RustSBI-QEMU Version {ver_impl}
9595
[rustsbi] Platform Name : {model}

0 commit comments

Comments
 (0)