-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sample of how to generate the function #1531
base: master
Are you sure you want to change the base?
Conversation
#[proc_macro] | ||
pub fn dynamic_hashcrypt(_item: TokenStream) -> TokenStream { | ||
let code = quote! { | ||
static mut USE_ROM: core::sync::atomic::AtomicBool = core::sync::atomic::AtomicBool::new(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: improve readability w/ use core::sync::atomic::AtomicBool;
|
||
pub fn set_hashcrypt_default() { | ||
unsafe { | ||
USE_ROM.store(false, core::sync::atomic::Ordering::Relaxed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: improve readability w/ use core::sync::atomic::Ordering
|
||
pub fn set_hashcrypt_rom() { | ||
unsafe { | ||
USE_ROM.store(true, core::sync::atomic::Ordering::Relaxed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
#[allow(non_snake_case)] | ||
#[no_mangle] | ||
pub unsafe extern "C" fn HASHCRYPT() { | ||
if USE_ROM.load(core::sync::atomic::Ordering::Relaxed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
} else { | ||
kern::arch::DefaultHandler(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: whitespace
} | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: whitespace
No description provided.