File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -149,14 +149,14 @@ pub fn int3() {
149
149
150
150
/// Generate a software interrupt by invoking the `int` instruction.
151
151
///
152
- /// This currently needs to be a macro because the `int` argument needs to be an
153
- /// immediate. This macro will be replaced by a generic function when support for
154
- /// const generics is implemented in Rust.
152
+ /// ## Safety
153
+ ///
154
+ /// Invoking an arbitrary interrupt is unsafe. It can cause your system to
155
+ /// crash if you invoke a double-fault (#8) or machine-check (#18) exception.
156
+ /// It can also cause memory/register corruption depending on the interrupt
157
+ /// implementation (if it expects values/pointers to be passed in registers).
155
158
#[ cfg( feature = "inline_asm" ) ]
156
159
#[ cfg_attr( docsrs, doc( cfg( any( feature = "nightly" , feature = "inline_asm" ) ) ) ) ]
157
- #[ macro_export]
158
- macro_rules! software_interrupt {
159
- ( $x: expr) => { {
160
- asm!( "int {id}" , id = const $x, options( nomem, nostack) ) ;
161
- } } ;
160
+ pub unsafe fn software_interrupt < const NUM : u8 > ( ) {
161
+ asm ! ( "int {num}" , num = const NUM , options( nomem, nostack) ) ;
162
162
}
You can’t perform that action at this time.
0 commit comments