|
@@ -72,6 +72,31 @@ fn rustsbi_impl_id() {
|
|
|
timer: DummyTimer,
|
|
|
info: DummyEnvInfo,
|
|
|
};
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x0, [0; 6]).value, 0x02000000);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x1, [0; 6]).value, 4);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x10, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x54494d45, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x735049, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x52464e43, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x48534d, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x53525354, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x504d55, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x4442434e, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x53555350, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x4e41434c, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 0x3, [0x535441, 0, 0, 0, 0, 0]).value, 1);
|
|
|
+ assert_eq!(sbi.handle_ecall(0x4442434e, 0, [0; 6]), SbiRet::success(1));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x4442434e, 1, [0; 6]), SbiRet::success(2));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x4442434e, 2, [0; 6]), SbiRet::success(3));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x43505043, 0, [0; 6]), SbiRet::success(4));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x43505043, 1, [0; 6]), SbiRet::success(5));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x43505043, 2, [0; 6]), SbiRet::success(6));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x43505043, 3, [0; 6]), SbiRet::success(7));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x48534d, 0, [0; 6]), SbiRet::success(8));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x48534d, 1, [0; 6]), SbiRet::success(9));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x48534d, 2, [0; 6]), SbiRet::success(10));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x48534d, 3, [0; 6]), SbiRet::success(11));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x735049, 0, [0; 6]), SbiRet::success(12));
|
|
|
assert_eq!(sbi.handle_ecall(0x4E41434C, 0x0, [0; 6]), SbiRet::success(13));
|
|
|
assert_eq!(sbi.handle_ecall(0x4E41434C, 0x1, [0; 6]), SbiRet::success(14));
|
|
|
assert_eq!(sbi.handle_ecall(0x4E41434C, 0x2, [0; 6]), SbiRet::success(15));
|
|
@@ -92,6 +117,13 @@ fn rustsbi_impl_id() {
|
|
|
assert_eq!(sbi.handle_ecall(0x52464E43, 0x4, [0; 6]), SbiRet::success(30));
|
|
|
assert_eq!(sbi.handle_ecall(0x52464E43, 0x5, [0; 6]), SbiRet::success(31));
|
|
|
assert_eq!(sbi.handle_ecall(0x52464E43, 0x6, [0; 6]), SbiRet::success(32));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x535441, 0, [0; 6]), SbiRet::success(33));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x53555350, 0, [0; 6]), SbiRet::success(34));
|
|
|
+ // assert_eq!(sbi.handle_ecall(0x54494D45, 0, [0; 6]), SbiRet::success(35));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 4, [0; 6]), SbiRet::success(36));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 5, [0; 6]), SbiRet::success(37));
|
|
|
+ assert_eq!(sbi.handle_ecall(0x10, 6, [0; 6]), SbiRet::success(38));
|
|
|
+
|
|
|
let sbi = AlternateName {
|
|
|
dbcn: DummyConsole,
|
|
|
cppc: DummyCppc,
|
|
@@ -157,16 +189,15 @@ struct DummyConsole;
|
|
|
|
|
|
impl rustsbi::Console for DummyConsole {
|
|
|
fn write(&self, _: Physical<&[u8]>) -> SbiRet {
|
|
|
- // special return value for test cases
|
|
|
- SbiRet::failed()
|
|
|
+ SbiRet::success(1)
|
|
|
}
|
|
|
|
|
|
fn read(&self, _: Physical<&mut [u8]>) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(2)
|
|
|
}
|
|
|
|
|
|
fn write_byte(&self, _: u8) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(3)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -174,19 +205,19 @@ struct DummyCppc;
|
|
|
|
|
|
impl rustsbi::Cppc for DummyCppc {
|
|
|
fn probe(&self, _: u32) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(4)
|
|
|
}
|
|
|
|
|
|
fn read(&self, _: u32) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(5)
|
|
|
}
|
|
|
|
|
|
fn read_hi(&self, _: u32) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(6)
|
|
|
}
|
|
|
|
|
|
fn write(&self, _: u32, _: u64) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(7)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -194,19 +225,19 @@ struct DummyHsm;
|
|
|
|
|
|
impl rustsbi::Hsm for DummyHsm {
|
|
|
fn hart_start(&self, _: usize, _: usize, _: usize) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(8)
|
|
|
}
|
|
|
|
|
|
fn hart_stop(&self) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(9)
|
|
|
}
|
|
|
|
|
|
fn hart_get_status(&self, _: usize) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(10)
|
|
|
}
|
|
|
|
|
|
fn hart_suspend(&self, _: u32, _: usize, _: usize) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(11)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -214,7 +245,7 @@ struct DummyIpi;
|
|
|
|
|
|
impl rustsbi::Ipi for DummyIpi {
|
|
|
fn send_ipi(&self, _: HartMask) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(12)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -317,7 +348,7 @@ struct DummySta;
|
|
|
|
|
|
impl rustsbi::Sta for DummySta {
|
|
|
fn set_shmem(&self, _: SharedPtr<[u8; 64]>, _: usize) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(33)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -325,7 +356,7 @@ struct DummySusp;
|
|
|
|
|
|
impl rustsbi::Susp for DummySusp {
|
|
|
fn system_suspend(&self, _: u32, _: usize, _: usize) -> SbiRet {
|
|
|
- unimplemented!()
|
|
|
+ SbiRet::success(34)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -333,7 +364,7 @@ struct DummyTimer;
|
|
|
|
|
|
impl rustsbi::Timer for DummyTimer {
|
|
|
fn set_timer(&self, _: u64) {
|
|
|
- unimplemented!()
|
|
|
+ todo!()
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -341,14 +372,14 @@ struct DummyEnvInfo;
|
|
|
|
|
|
impl rustsbi::EnvInfo for DummyEnvInfo {
|
|
|
fn mvendorid(&self) -> usize {
|
|
|
- unimplemented!()
|
|
|
+ 36
|
|
|
}
|
|
|
|
|
|
fn marchid(&self) -> usize {
|
|
|
- unimplemented!()
|
|
|
+ 37
|
|
|
}
|
|
|
|
|
|
fn mimpid(&self) -> usize {
|
|
|
- unimplemented!()
|
|
|
+ 38
|
|
|
}
|
|
|
}
|