Skip to content

Commit f9e9a99

Browse files
committed
zcontext 修正 fpu 问题。
1 parent a8eba13 commit f9e9a99

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

uasync/zcontext_asm/zcontext_x86_64.S

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,13 @@ zcontext_swap: // zcontext_swap(zcontext_t* from, zcontext_t* to, swap_hook_func
171171
// 返回
172172
ret
173173

174+
174175
.align 16
175176
.global zcontext_entry_point
176177
.section .text.zcontext_entry_point, "x"
177178
zcontext_entry_point:
179+
ldmxcsr default_mmx_ctl(%rip)
180+
fldcw default_fpu_ctl(%rip)
178181
pop %rbx
179182
pop ARG1_REG
180183
mov %rax, ARG2_REG
@@ -184,6 +187,12 @@ zcontext_entry_point:
184187
call _exit
185188
hlt
186189

190+
.align 8
191+
default_mmx_ctl:
192+
.int 0x1f80
193+
default_fpu_ctl:
194+
.int 0x37f
195+
187196
#endif
188197

189198

@@ -217,3 +226,6 @@ zcontext_swap_preserve_none: // zcontext_swap2(zcontext_t* from, zcontext_t* to,
217226
pop NONE_PRESERVE_ARG3_REG ; // pop+jump = ret !
218227
1:
219228
jmp * NONE_PRESERVE_ARG3_REG // tail call optimization
229+
230+
231+
.section .note.GNU-stack,"",%progbits

0 commit comments

Comments
 (0)