diff --git a/src/lib.rs b/src/lib.rs index 4cd21081..418d5783 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -123,13 +123,15 @@ pub trait KernelModule: Sized + Sync { } extern "C" { - fn bug_helper() -> !; + #[link_name="bug_helper"] + #[allow(improper_style)] + fn BUG() -> !; } #[panic_handler] fn panic(_info: &PanicInfo) -> ! { unsafe { - bug_helper(); + BUG(); } } diff --git a/src/user_ptr.rs b/src/user_ptr.rs index eefdbe28..1d6abd0f 100644 --- a/src/user_ptr.rs +++ b/src/user_ptr.rs @@ -7,7 +7,8 @@ use crate::c_types; use crate::error; extern "C" { - fn access_ok_helper(addr: *const c_types::c_void, len: c_types::c_ulong) -> c_types::c_int; + #[link_name="access_ok_helper"] + fn access_ok(addr: *const c_types::c_void, len: c_types::c_ulong) -> c_types::c_int; } /// A reference to an area in userspace memory, which can be either @@ -55,7 +56,7 @@ impl UserSlicePtr { ptr: *mut c_types::c_void, length: usize, ) -> error::KernelResult { - if access_ok_helper(ptr, length as c_types::c_ulong) == 0 { + if access_ok(ptr, length as c_types::c_ulong) == 0 { return Err(error::Error::EFAULT); } Ok(UserSlicePtr(ptr, length))