From 5434aafe4adc2515b76c3491ea2e712a4c63f159 Mon Sep 17 00:00:00 2001 From: Geoffrey Thomas Date: Tue, 11 Aug 2020 03:20:04 -0400 Subject: [PATCH] Get rid of _helper from the Rust names of helpers --- src/lib.rs | 6 ++++-- src/user_ptr.rs | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) 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))