File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -109,8 +109,22 @@ macro_rules! define_rust_probestack {
109109//
110110// The ABI here is that the stack frame size is located in `%rax`. Upon
111111// return we're not supposed to modify `%rsp` or `%rax`.
112+ #[ cfg( all(
113+ target_arch = "x86_64" ,
114+ not( all( target_env = "sgx" , target_vendor = "fortanix" ) )
115+ ) ) ]
116+ macro_rules! ret ( ( ) => ( "ret" ) ) ;
117+ #[ cfg( all(
118+ target_arch = "x86_64" ,
119+ all( target_env = "sgx" , target_vendor = "fortanix" )
120+ ) ) ]
121+ macro_rules! ret ( ( ) => ( "
122+ pop %r11
123+ lfence
124+ jmp *%r11
125+ " ) ) ;
112126#[ cfg( target_arch = "x86_64" ) ]
113- global_asm ! ( define_rust_probestack!(
127+ global_asm ! ( define_rust_probestack!( concat! (
114128 "
115129 .cfi_startproc
116130 pushq %rbp
@@ -158,10 +172,12 @@ global_asm!(define_rust_probestack!(
158172 leave
159173 .cfi_def_cfa_register %rsp
160174 .cfi_adjust_cfa_offset -8
161- ret
175+ " ,
176+ ret!( ) ,
177+ "
162178 .cfi_endproc
163179 "
164- ) ) ;
180+ ) ) ) ;
165181
166182#[ cfg( target_arch = "x86" ) ]
167183// This is the same as x86_64 above, only translated for 32-bit sizes. Note
You can’t perform that action at this time.
0 commit comments