@@ -13,12 +13,11 @@ pub fn are_enabled() -> bool {
13
13
/// This is a wrapper around the `sti` instruction.
14
14
#[ inline]
15
15
pub fn enable ( ) {
16
- #[ cfg( feature = "inline_asm" ) ]
17
16
unsafe {
17
+ #[ cfg( feature = "inline_asm" ) ]
18
18
asm ! ( "sti" , options( nomem, nostack) ) ;
19
- }
20
- #[ cfg( not( feature = "inline_asm" ) ) ]
21
- unsafe {
19
+
20
+ #[ cfg( not( feature = "inline_asm" ) ) ]
22
21
crate :: asm:: x86_64_asm_interrupt_enable ( ) ;
23
22
}
24
23
}
@@ -28,13 +27,11 @@ pub fn enable() {
28
27
/// This is a wrapper around the `cli` instruction.
29
28
#[ inline]
30
29
pub fn disable ( ) {
31
- #[ cfg( feature = "inline_asm" ) ]
32
30
unsafe {
31
+ #[ cfg( feature = "inline_asm" ) ]
33
32
asm ! ( "cli" , options( nomem, nostack) ) ;
34
- }
35
33
36
- #[ cfg( not( feature = "inline_asm" ) ) ]
37
- unsafe {
34
+ #[ cfg( not( feature = "inline_asm" ) ) ]
38
35
crate :: asm:: x86_64_asm_interrupt_disable ( ) ;
39
36
}
40
37
}
@@ -129,26 +126,23 @@ where
129
126
/// information.
130
127
#[ inline]
131
128
pub fn enable_and_hlt ( ) {
132
- #[ cfg( feature = "inline_asm" ) ]
133
129
unsafe {
130
+ #[ cfg( feature = "inline_asm" ) ]
134
131
asm ! ( "sti; hlt" , options( nomem, nostack) ) ;
135
- }
136
- #[ cfg( not( feature = "inline_asm" ) ) ]
137
- unsafe {
132
+
133
+ #[ cfg( not( feature = "inline_asm" ) ) ]
138
134
crate :: asm:: x86_64_asm_interrupt_enable_and_hlt ( ) ;
139
135
}
140
136
}
141
137
142
138
/// Cause a breakpoint exception by invoking the `int3` instruction.
143
139
#[ inline]
144
140
pub fn int3 ( ) {
145
- #[ cfg( feature = "inline_asm" ) ]
146
141
unsafe {
142
+ #[ cfg( feature = "inline_asm" ) ]
147
143
asm ! ( "int3" , options( nomem, nostack) ) ;
148
- }
149
144
150
- #[ cfg( not( feature = "inline_asm" ) ) ]
151
- unsafe {
145
+ #[ cfg( not( feature = "inline_asm" ) ) ]
152
146
crate :: asm:: x86_64_asm_int3 ( ) ;
153
147
}
154
148
}
@@ -159,18 +153,10 @@ pub fn int3() {
159
153
/// immediate. This macro will be replaced by a generic function when support for
160
154
/// const generics is implemented in Rust.
161
155
#[ cfg( feature = "inline_asm" ) ]
156
+ #[ cfg_attr( docsrs, doc( cfg( any( feature = "nightly" , feature = "inline_asm" ) ) ) ) ]
162
157
#[ macro_export]
163
158
macro_rules! software_interrupt {
164
159
( $x: expr) => { {
165
160
asm!( "int {id}" , id = const $x, options( nomem, nostack) ) ;
166
161
} } ;
167
162
}
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