cmse: additional argument passing tests

This commit is contained in:
Folkert de Vries 2026-01-28 13:50:54 +01:00
parent 43ee28aa16
commit df0bdea545
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 39 additions and 4 deletions

View file

@ -24,3 +24,24 @@ pub extern "cmse-nonsecure-entry" fn f4(_: AlignRelevant, _: u32) {} //~ ERROR [
#[no_mangle]
#[allow(improper_ctypes_definitions)]
pub extern "cmse-nonsecure-entry" fn f5(_: [u32; 5]) {} //~ ERROR [E0798]
struct Four {
a: u32,
b: u32,
c: u32,
d: u32,
}
struct Five {
a: u32,
b: u32,
c: u32,
d: u32,
e: u32,
}
#[no_mangle]
pub extern "cmse-nonsecure-entry" fn four(_: Four) {}
#[no_mangle]
pub extern "cmse-nonsecure-entry" fn five(_: Five) {} //~ ERROR [E0798]

View file

@ -40,6 +40,14 @@ LL | pub extern "cmse-nonsecure-entry" fn f5(_: [u32; 5]) {}
|
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
error: aborting due to 5 previous errors
error[E0798]: arguments for `"cmse-nonsecure-entry"` function too large to pass via registers
--> $DIR/params-via-stack.rs:47:46
|
LL | pub extern "cmse-nonsecure-entry" fn five(_: Five) {}
| ^^^^ does not fit in the available registers
|
= note: functions with the `"cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit argument registers
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0798`.

View file

@ -40,9 +40,15 @@ pub extern "cmse-nonsecure-entry" fn inputs5(_: f64, _: f32, _: f32) {}
#[no_mangle]
pub extern "cmse-nonsecure-entry" fn inputs6(_: ReprTransparentStruct<u64>, _: U32Compound) {}
#[no_mangle]
#[allow(improper_ctypes_definitions)]
#[expect(improper_ctypes_definitions)]
pub extern "cmse-nonsecure-entry" fn inputs7(_: [u32; 4]) {}
// With zero-sized types we can actually have more than 4 arguments.
#[expect(improper_ctypes_definitions)]
pub extern "cmse-nonsecure-entry" fn inputs8(_: (), _: (), _: (), _: (), _: ()) {}
#[expect(improper_ctypes_definitions)]
pub extern "cmse-nonsecure-entry" fn inputs9(_: (), _: (), _: (), _: (), _: ()) {}
#[no_mangle]
pub extern "cmse-nonsecure-entry" fn outputs1() -> u32 {
0
@ -69,8 +75,8 @@ pub extern "cmse-nonsecure-entry" fn outputs6() -> ReprTransparentStruct<u64> {
ReprTransparentStruct { _marker1: (), _marker2: (), field: 0xAA, _marker3: () }
}
#[no_mangle]
pub extern "cmse-nonsecure-entry" fn outputs7(
) -> ReprTransparentStruct<ReprTransparentStruct<u64>> {
pub extern "cmse-nonsecure-entry" fn outputs7() -> ReprTransparentStruct<ReprTransparentStruct<u64>>
{
ReprTransparentStruct {
_marker1: (),
_marker2: (),