Skip to content

Commit

Permalink
trigger __rust_probestack in example 3
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrk committed Jan 20, 2021
1 parent 3373ca6 commit 5ec3ec0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/char/rust_example_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ 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 (in
// debug mode at least).
// 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(),
})
Expand Down

0 comments on commit 5ec3ec0

Please sign in to comment.