#[macro_export]
macro_rules! static_branch_unlikely {
($key:path, $keytyp:ty, $field:ident) => {{
let _key: *const $keytyp = ::core::ptr::addr_of!($key);
let _key: *const $crate::bindings::static_key_false = ::core::ptr::addr_of!((*_key).$field);
let _key: *const $crate::bindings::static_key = _key.cast();
#[cfg(not(CONFIG_JUMP_LABEL))]
{
$crate::bindings::static_key_count(_key.cast_mut()) > 0
}
#[cfg(CONFIG_JUMP_LABEL)]
$crate::jump_label::arch_static_branch! { $key, $keytyp, $field, false }
}};
}
pub use static_branch_unlikely;
#[cfg(CONFIG_JUMP_LABEL)]
const _: &str = include!(concat!(
env!("OBJTREE"),
"/rust/kernel/generated_arch_static_branch_asm.rs"
));
#[macro_export]
#[doc(hidden)]
#[cfg(CONFIG_JUMP_LABEL)]
macro_rules! arch_static_branch {
($key:path, $keytyp:ty, $field:ident, $branch:expr) => {'my_label: {
$crate::asm!(
include!(concat!(env!("OBJTREE"), "/rust/kernel/generated_arch_static_branch_asm.rs"));
l_yes = label {
break 'my_label true;
},
symb = sym $key,
off = const ::core::mem::offset_of!($keytyp, $field),
branch = const $crate::jump_label::bool_to_int($branch),
);
break 'my_label false;
}};
}
#[cfg(CONFIG_JUMP_LABEL)]
pub use arch_static_branch;
#[doc(hidden)]
pub const fn bool_to_int(b: bool) -> i32 {
b as i32
}