Skip to content

Commit 2753980

Browse files
committed
tests: add missing default trait function overrides
Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>
1 parent c7ce73b commit 2753980

File tree

4 files changed

+84
-12
lines changed

4 files changed

+84
-12
lines changed

examples/derive/commons.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ impl rustsbi::Fence for MyFence {
1919
fn remote_sfence_vma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
2020
todo!()
2121
}
22+
23+
fn remote_hfence_gvma_vmid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
24+
todo!()
25+
}
26+
27+
fn remote_hfence_gvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
28+
todo!()
29+
}
30+
31+
fn remote_hfence_vvma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
32+
todo!()
33+
}
34+
35+
fn remote_hfence_vvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
36+
todo!()
37+
}
2238
}
2339

2440
pub struct MyEnvInfo;

tests/build-full.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ impl rustsbi::Hsm for DummyHsm {
185185
fn hart_get_status(&self, _: usize) -> SbiRet {
186186
unimplemented!()
187187
}
188+
189+
fn hart_suspend(&self, _: u32, _: usize, _: usize) -> SbiRet {
190+
unimplemented!()
191+
}
188192
}
189193

190194
struct DummyIpi;
@@ -244,6 +248,10 @@ impl rustsbi::Pmu for DummyPmu {
244248
fn counter_fw_read(&self, _: usize) -> SbiRet {
245249
unimplemented!()
246250
}
251+
252+
fn counter_fw_read_hi(&self, _: usize) -> SbiRet {
253+
unimplemented!()
254+
}
247255
}
248256

249257
struct DummyReset;
@@ -268,6 +276,22 @@ impl rustsbi::Fence for DummyFence {
268276
fn remote_sfence_vma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
269277
unimplemented!()
270278
}
279+
280+
fn remote_hfence_gvma_vmid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
281+
unimplemented!()
282+
}
283+
284+
fn remote_hfence_gvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
285+
unimplemented!()
286+
}
287+
288+
fn remote_hfence_vvma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
289+
unimplemented!()
290+
}
291+
292+
fn remote_hfence_vvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
293+
unimplemented!()
294+
}
271295
}
272296

273297
struct DummySta;

tests/build-rename.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn rustsbi_assign_multiple() {
5656
},
5757
info: DummyEnvInfo,
5858
};
59-
assert_eq!(sbi.handle_ecall(EID_SPI, 0x0, [0; 6]), SbiRet::success(10));
59+
assert_eq!(sbi.handle_ecall(EID_SPI, 0x0, [0; 6]), SbiRet::success(14));
6060
#[cfg(target_pointer_width = "64")]
6161
sbi.handle_ecall(EID_TIME, 0x0, [0x1122334455667788, 0, 0, 0, 0, 0]);
6262
#[cfg(target_pointer_width = "32")]
@@ -102,6 +102,22 @@ impl rustsbi::Fence for DummyFence {
102102
fn remote_sfence_vma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
103103
SbiRet::success(6)
104104
}
105+
106+
fn remote_hfence_gvma_vmid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
107+
SbiRet::success(7)
108+
}
109+
110+
fn remote_hfence_gvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
111+
SbiRet::success(8)
112+
}
113+
114+
fn remote_hfence_vvma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
115+
SbiRet::success(9)
116+
}
117+
118+
fn remote_hfence_vvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
119+
SbiRet::success(10)
120+
}
105121
}
106122

107123
struct DummyEnvInfo;
@@ -124,15 +140,15 @@ struct RealEnvInfo;
124140

125141
impl rustsbi::EnvInfo for RealEnvInfo {
126142
fn mvendorid(&self) -> usize {
127-
7
143+
11
128144
}
129145

130146
fn marchid(&self) -> usize {
131-
8
147+
12
132148
}
133149

134150
fn mimpid(&self) -> usize {
135-
9
151+
13
136152
}
137153
}
138154

@@ -148,6 +164,6 @@ impl rustsbi::Timer for MockClint {
148164

149165
impl rustsbi::Ipi for MockClint {
150166
fn send_ipi(&self, _: HartMask) -> SbiRet {
151-
SbiRet::success(10)
167+
SbiRet::success(14)
152168
}
153169
}

tests/build-skip.rs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ fn rustsbi_skip_env_info() {
7171
env_info: RealEnvInfo,
7272
};
7373
// The `env_info` instead of `info` field would be used by RustSBI macro; struct
74-
// `RealEnvInfo` would return 7, 8 and 9 for mvendorid, marchid and mimpid.
74+
// `RealEnvInfo` would return 11, 12 and 13 for mvendorid, marchid and mimpid.
7575
assert_eq!(
7676
sbi.handle_ecall(0x10, 0x4, [EID_DBCN, 0, 0, 0, 0, 0]),
77-
SbiRet::success(7)
77+
SbiRet::success(11)
7878
);
7979
assert_eq!(
8080
sbi.handle_ecall(0x10, 0x5, [EID_DBCN, 0, 0, 0, 0, 0]),
81-
SbiRet::success(8)
81+
SbiRet::success(12)
8282
);
8383
assert_eq!(
8484
sbi.handle_ecall(0x10, 0x6, [EID_DBCN, 0, 0, 0, 0, 0]),
85-
SbiRet::success(9)
85+
SbiRet::success(13)
8686
);
8787
let _ = sbi.info;
8888
}
@@ -120,6 +120,22 @@ impl rustsbi::Fence for DummyFence {
120120
fn remote_sfence_vma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
121121
SbiRet::success(6)
122122
}
123+
124+
fn remote_hfence_gvma_vmid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
125+
SbiRet::success(7)
126+
}
127+
128+
fn remote_hfence_gvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
129+
SbiRet::success(8)
130+
}
131+
132+
fn remote_hfence_vvma_asid(&self, _: HartMask, _: usize, _: usize, _: usize) -> SbiRet {
133+
SbiRet::success(9)
134+
}
135+
136+
fn remote_hfence_vvma(&self, _: HartMask, _: usize, _: usize) -> SbiRet {
137+
SbiRet::success(10)
138+
}
123139
}
124140

125141
struct DummyEnvInfo;
@@ -142,14 +158,14 @@ struct RealEnvInfo;
142158

143159
impl rustsbi::EnvInfo for RealEnvInfo {
144160
fn mvendorid(&self) -> usize {
145-
7
161+
11
146162
}
147163

148164
fn marchid(&self) -> usize {
149-
8
165+
12
150166
}
151167

152168
fn mimpid(&self) -> usize {
153-
9
169+
13
154170
}
155171
}

0 commit comments

Comments
 (0)