File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 22
33#![ no_std]
44#![ feature( allocator_api, global_asm) ]
5+ #![ feature( test) ]
56
67use alloc:: boxed:: Box ;
78use core:: pin:: Pin ;
@@ -52,6 +53,13 @@ impl KernelModule for RustExample {
5253 println ! ( " my_bool: {}" , my_bool. read( ) ) ;
5354 println ! ( " my_i32: {}" , my_i32. read( ) ) ;
5455
56+ // Including this large variable on the stack will trigger
57+ // stack probing on the supported archs.
58+ // This will verify that stack probing does not lead to
59+ // any errors if we need to link `__rust_probestack`.
60+ let x: [ u64 ; 1028 ] = core:: hint:: black_box ( [ 5 ; 1028 ] ) ;
61+ println ! ( "Large array has length: {}" , x. len( ) ) ;
62+
5563 Ok ( RustExample {
5664 message : "on the heap!" . to_owned ( ) ,
5765 _dev : miscdev:: Registration :: new_pinned :: < RustFile > ( cstr ! ( "rust_miscdev" ) , None ) ?,
Original file line number Diff line number Diff line change 22
33#![ no_std]
44#![ feature( allocator_api, global_asm) ]
5+ #![ feature( test) ]
56
67use kernel:: prelude:: * ;
78
@@ -36,6 +37,14 @@ impl KernelModule for RustExample2 {
3637 println ! ( "[2] Parameters:" ) ;
3738 println ! ( "[2] my_bool: {}" , my_bool. read( ) ) ;
3839 println ! ( "[2] my_i32: {}" , my_i32. read( ) ) ;
40+
41+ // Including this large variable on the stack will trigger
42+ // stack probing on the supported archs.
43+ // This will verify that stack probing does not lead to
44+ // any errors if we need to link `__rust_probestack`.
45+ let x: [ u64 ; 1028 ] = core:: hint:: black_box ( [ 5 ; 1028 ] ) ;
46+ println ! ( "Large array has length: {}" , x. len( ) ) ;
47+
3948 Ok ( RustExample2 {
4049 message : "on the heap!" . to_owned ( ) ,
4150 } )
Original file line number Diff line number Diff line change 22
33#![ no_std]
44#![ feature( allocator_api, global_asm) ]
5+ #![ feature( test) ]
56
67use kernel:: prelude:: * ;
78
@@ -36,6 +37,14 @@ impl KernelModule for RustExample3 {
3637 println ! ( "[3] Parameters:" ) ;
3738 println ! ( "[3] my_bool: {}" , my_bool. read( ) ) ;
3839 println ! ( "[3] my_i32: {}" , my_i32. read( ) ) ;
40+
41+ // Including this large variable on the stack will trigger
42+ // stack probing on the supported archs.
43+ // This will verify that stack probing does not lead to
44+ // any errors if we need to link `__rust_probestack`.
45+ let x: [ u64 ; 1028 ] = core:: hint:: black_box ( [ 5 ; 1028 ] ) ;
46+ println ! ( "Large array has length: {}" , x. len( ) ) ;
47+
3948 Ok ( RustExample3 {
4049 message : "on the heap!" . to_owned ( ) ,
4150 } )
Original file line number Diff line number Diff line change 22
33#![ no_std]
44#![ feature( allocator_api, global_asm) ]
5+ #![ feature( test) ]
56
67use kernel:: prelude:: * ;
78
@@ -36,6 +37,14 @@ impl KernelModule for RustExample4 {
3637 println ! ( "[4] Parameters:" ) ;
3738 println ! ( "[4] my_bool: {}" , my_bool. read( ) ) ;
3839 println ! ( "[4] my_i32: {}" , my_i32. read( ) ) ;
40+
41+ // Including this large variable on the stack will trigger
42+ // stack probing on the supported archs.
43+ // This will verify that stack probing does not lead to
44+ // any errors if we need to link `__rust_probestack`.
45+ let x: [ u64 ; 1028 ] = core:: hint:: black_box ( [ 5 ; 1028 ] ) ;
46+ println ! ( "Large array has length: {}" , x. len( ) ) ;
47+
3948 Ok ( RustExample4 {
4049 message : "on the heap!" . to_owned ( ) ,
4150 } )
You can’t perform that action at this time.
0 commit comments