Skip to content

Commit 28c78f8

Browse files
committed
Let thumb* targets do A32 SVC calls, using an extra function.
1 parent 513f1d6 commit 28c78f8

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

examples/versatileab/reference/svc-a32-thumbv4t-none-eabi.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
x = 1, y = 2, z = 3.000
2+
In svc_handler, with arg=0xabcdef
3+
In svc_handler, with arg=0x456789
24
x = 1, y = 2, z = 3.000
35
PANIC: PanicInfo {
46
message: I am an example panic,

examples/versatileab/reference/svc-a32-thumbv5te-none-eabi.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
x = 1, y = 2, z = 3.000
2+
In svc_handler, with arg=0xabcdef
3+
In svc_handler, with arg=0x456789
24
x = 1, y = 2, z = 3.000
35
PANIC: PanicInfo {
46
message: I am an example panic,

examples/versatileab/src/bin/svc-a32.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ fn main() -> ! {
1616
let y = x + 1;
1717
let z = (y as f64) * 1.5;
1818
println!("x = {}, y = {}, z = {:0.3}", x, y, z);
19-
#[cfg(arm_isa = "a32")]
20-
aarch32_cpu::svc!(0xABCDEF);
19+
do_svc1();
2120
println!("x = {}, y = {}, z = {:0.3}", x, y, z);
21+
2222
panic!("I am an example panic");
2323
}
2424

@@ -28,7 +28,22 @@ fn svc_handler(arg: u32) {
2828
println!("In svc_handler, with arg=0x{:06x}", arg);
2929
if arg == 0xABCDEF {
3030
// test nested SVC calls
31-
#[cfg(arm_isa = "a32")]
32-
aarch32_cpu::svc!(0x456789);
31+
do_svc2();
3332
}
3433
}
34+
35+
#[cfg_attr(
36+
any(arm_architecture = "v4t", arm_architecture = "v5te"),
37+
instruction_set(arm::a32)
38+
)]
39+
fn do_svc1() {
40+
aarch32_cpu::svc!(0xABCDEF);
41+
}
42+
43+
#[cfg_attr(
44+
any(arm_architecture = "v4t", arm_architecture = "v5te"),
45+
instruction_set(arm::a32)
46+
)]
47+
fn do_svc2() {
48+
aarch32_cpu::svc!(0x456789);
49+
}

0 commit comments

Comments
 (0)