Skip to content

Commit 2485c24

Browse files
committed
trigger __rust_probestack in example 3
1 parent 3373ca6 commit 2485c24

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/char/rust_example_3.rs

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ impl KernelModule for RustExample3 {
3636
println!("[3] Parameters:");
3737
println!("[3] my_bool: {}", my_bool.read());
3838
println!("[3] my_i32: {}", my_i32.read());
39+
40+
// Including this large variable on the stack will trigger a call to
41+
// `compiler_builtins::probestack::__rust_probestack` on x86_64.
42+
// This will verify that we are able to link modules which call
43+
// `__rust_probestack`.
44+
let x: [u64; 1028] = [5; 1028];
45+
println!("Large array has length: {}", x.len());
46+
3947
Ok(RustExample3 {
4048
message: "on the heap!".to_owned(),
4149
})

0 commit comments

Comments
 (0)