Inline assembly and naked functions

This might be one of the most interesting nightly features of Rust. Using #[feature(asm)], we will get a new macro, asm!(), which we will be able to use in our code. With this macro, we can write inline assembly to perform fine-grained operations in the code if we need further performance optimizations.

The exact syntax is still being worked on, but it already enables you to write arbitrary assembly code within your functions. This is a must for kernel development, for example, where access to CPU features can only be done by direct CPU instructions. Make sure you thoroughly test this code, since it will be unsafe to use it.

Furthermore, #[feature(naked_functions)] allows you to add the #[naked] attribute to a function. This will remove some boilerplate assembly that gets added before and after each function so that you can write plain assembly code. Many times, this is essential for using some CPU intrinsics.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.93.132