diff --git a/drivers/char/rust_example.rs b/drivers/char/rust_example.rs index 47c4a7f722ef80..4b107ec332b136 100644 --- a/drivers/char/rust_example.rs +++ b/drivers/char/rust_example.rs @@ -52,6 +52,13 @@ impl KernelModule for RustExample { println!(" my_bool: {}", my_bool.read()); println!(" my_i32: {}", my_i32.read()); + // Including this large variable on the stack will trigger a call to + // `compiler_builtins::probestack::__rust_probestack` on x86_64. + // This will verify that we are able to link modules which call + // `__rust_probestack`. + let x: [u64; 1028] = [5; 1028]; + println!("Large array has length: {}", x.len()); + Ok(RustExample { message: "on the heap!".to_owned(), _dev: miscdev::Registration::new_pinned::(cstr!("rust_miscdev"), None)?, diff --git a/drivers/char/rust_example_2.rs b/drivers/char/rust_example_2.rs index b5ffb92870d191..cf80dadbf5505d 100644 --- a/drivers/char/rust_example_2.rs +++ b/drivers/char/rust_example_2.rs @@ -36,6 +36,14 @@ impl KernelModule for RustExample2 { println!("[2] Parameters:"); println!("[2] my_bool: {}", my_bool.read()); println!("[2] my_i32: {}", my_i32.read()); + + // Including this large variable on the stack will trigger a call to + // `compiler_builtins::probestack::__rust_probestack` on x86_64. + // This will verify that we are able to link modules which call + // `__rust_probestack`. + let x: [u64; 1028] = [5; 1028]; + println!("Large array has length: {}", x.len()); + Ok(RustExample2 { message: "on the heap!".to_owned(), }) diff --git a/drivers/char/rust_example_3.rs b/drivers/char/rust_example_3.rs index c6b867e527e9a9..50542da3da02f5 100644 --- a/drivers/char/rust_example_3.rs +++ b/drivers/char/rust_example_3.rs @@ -36,6 +36,14 @@ impl KernelModule for RustExample3 { println!("[3] Parameters:"); println!("[3] my_bool: {}", my_bool.read()); println!("[3] my_i32: {}", my_i32.read()); + + // Including this large variable on the stack will trigger a call to + // `compiler_builtins::probestack::__rust_probestack` on x86_64. + // This will verify that we are able to link modules which call + // `__rust_probestack`. + let x: [u64; 1028] = [5; 1028]; + println!("Large array has length: {}", x.len()); + Ok(RustExample3 { message: "on the heap!".to_owned(), }) diff --git a/drivers/char/rust_example_4.rs b/drivers/char/rust_example_4.rs index b658c55b4ba80b..73c56b2bf43113 100644 --- a/drivers/char/rust_example_4.rs +++ b/drivers/char/rust_example_4.rs @@ -36,6 +36,14 @@ impl KernelModule for RustExample4 { println!("[4] Parameters:"); println!("[4] my_bool: {}", my_bool.read()); println!("[4] my_i32: {}", my_i32.read()); + + // Including this large variable on the stack will trigger a call to + // `compiler_builtins::probestack::__rust_probestack` on x86_64. + // This will verify that we are able to link modules which call + // `__rust_probestack`. + let x: [u64; 1028] = [5; 1028]; + println!("Large array has length: {}", x.len()); + Ok(RustExample4 { message: "on the heap!".to_owned(), })