Skip to content

Commit 5f8ef5d

Browse files
committed
Kconfig: Add RUST_CHECK_KOBJ_INIT
Enabling this config adds code during use of kernel objects to ensure that they have been properly initialized. Signed-off-by: David Brown <[email protected]>
1 parent 6cab886 commit 5f8ef5d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ config RUST_ALLOC
2929
Zephyr allocator (malloc/free). This this enabled, Rust
3030
applications can use the `alloc` crate.
3131

32+
config RUST_CHECK_KOBJ_INIT
33+
bool "Check at runtime that static kobjects are initialized"
34+
help
35+
If enabled, the static kobject support in Rust will use an atomic
36+
variable to check that the kobject has had the appropriate
37+
initialization done to it.
38+
39+
This adds a 32-bit value to each kobject and requires that these kobjects be placed in zero
40+
initialized memory. Accesses to the shared variable will invoke an atomic read, and the
41+
initializer will have a few atomic operations.
42+
3243
endif # RUST
3344

3445
endmenu

0 commit comments

Comments
 (0)