Skip to content

Commit

Permalink
zcontext 修正 fpu 问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
microcai committed Jan 6, 2025
1 parent a8eba13 commit f9e9a99
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions uasync/zcontext_asm/zcontext_x86_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,13 @@ zcontext_swap: // zcontext_swap(zcontext_t* from, zcontext_t* to, swap_hook_func
// 返回
ret


.align 16
.global zcontext_entry_point
.section .text.zcontext_entry_point, "x"
zcontext_entry_point:
ldmxcsr default_mmx_ctl(%rip)
fldcw default_fpu_ctl(%rip)
pop %rbx
pop ARG1_REG
mov %rax, ARG2_REG
Expand All @@ -184,6 +187,12 @@ zcontext_entry_point:
call _exit
hlt

.align 8
default_mmx_ctl:
.int 0x1f80
default_fpu_ctl:
.int 0x37f

#endif


Expand Down Expand Up @@ -217,3 +226,6 @@ zcontext_swap_preserve_none: // zcontext_swap2(zcontext_t* from, zcontext_t* to,
pop NONE_PRESERVE_ARG3_REG ; // pop+jump = ret !
1:
jmp * NONE_PRESERVE_ARG3_REG // tail call optimization


.section .note.GNU-stack,"",%progbits

0 comments on commit f9e9a99

Please sign in to comment.