@@ -13,12 +13,11 @@ pub fn are_enabled() -> bool {
1313/// This is a wrapper around the `sti` instruction.
1414#[ inline]
1515pub fn enable ( ) {
16- #[ cfg( feature = "inline_asm" ) ]
1716 unsafe {
17+ #[ cfg( feature = "inline_asm" ) ]
1818 asm ! ( "sti" , options( nomem, nostack) ) ;
19- }
20- #[ cfg( not( feature = "inline_asm" ) ) ]
21- unsafe {
19+
20+ #[ cfg( not( feature = "inline_asm" ) ) ]
2221 crate :: asm:: x86_64_asm_interrupt_enable ( ) ;
2322 }
2423}
@@ -28,13 +27,11 @@ pub fn enable() {
2827/// This is a wrapper around the `cli` instruction.
2928#[ inline]
3029pub fn disable ( ) {
31- #[ cfg( feature = "inline_asm" ) ]
3230 unsafe {
31+ #[ cfg( feature = "inline_asm" ) ]
3332 asm ! ( "cli" , options( nomem, nostack) ) ;
34- }
3533
36- #[ cfg( not( feature = "inline_asm" ) ) ]
37- unsafe {
34+ #[ cfg( not( feature = "inline_asm" ) ) ]
3835 crate :: asm:: x86_64_asm_interrupt_disable ( ) ;
3936 }
4037}
@@ -129,26 +126,23 @@ where
129126/// information.
130127#[ inline]
131128pub fn enable_and_hlt ( ) {
132- #[ cfg( feature = "inline_asm" ) ]
133129 unsafe {
130+ #[ cfg( feature = "inline_asm" ) ]
134131 asm ! ( "sti; hlt" , options( nomem, nostack) ) ;
135- }
136- #[ cfg( not( feature = "inline_asm" ) ) ]
137- unsafe {
132+
133+ #[ cfg( not( feature = "inline_asm" ) ) ]
138134 crate :: asm:: x86_64_asm_interrupt_enable_and_hlt ( ) ;
139135 }
140136}
141137
142138/// Cause a breakpoint exception by invoking the `int3` instruction.
143139#[ inline]
144140pub fn int3 ( ) {
145- #[ cfg( feature = "inline_asm" ) ]
146141 unsafe {
142+ #[ cfg( feature = "inline_asm" ) ]
147143 asm ! ( "int3" , options( nomem, nostack) ) ;
148- }
149144
150- #[ cfg( not( feature = "inline_asm" ) ) ]
151- unsafe {
145+ #[ cfg( not( feature = "inline_asm" ) ) ]
152146 crate :: asm:: x86_64_asm_int3 ( ) ;
153147 }
154148}
@@ -159,18 +153,10 @@ pub fn int3() {
159153/// immediate. This macro will be replaced by a generic function when support for
160154/// const generics is implemented in Rust.
161155#[ cfg( feature = "inline_asm" ) ]
156+ #[ cfg_attr( docsrs, doc( cfg( any( feature = "nightly" , feature = "inline_asm" ) ) ) ) ]
162157#[ macro_export]
163158macro_rules! software_interrupt {
164159 ( $x: expr) => { {
165160 asm!( "int {id}" , id = const $x, options( nomem, nostack) ) ;
166161 } } ;
167162}
168-
169- /// Not implemented
170- #[ cfg( not( feature = "inline_asm" ) ) ]
171- #[ macro_export]
172- macro_rules! software_interrupt {
173- ( $x: expr) => { {
174- compile_error!( "software_interrupt not implemented for non-nightly" ) ;
175- } } ;
176- }
0 commit comments