mirror of
https://github.com/libffi/libffi.git
synced 2026-01-26 10:07:53 +00:00
Fix closures using FFI_REGISTER ABI (#949)
* Fix closures using FFI_REGISTER ABI ffi_closure_REGISTER had the positions of the closure and return address switched, resulting in a segfault when calling a closure created with the FFI_REGISTER ABI. * Fix comment and remove redundant assembly * After fixing closures using FFI_REGISTER ABI, the comments were incorrect, not reflecting the value that was actually loaded into eax and ecx. * Additionally, ecx was loaded with the data at esp + closure_FS only to write it back to esp + closure_FS. Both commands were removed as they end up not having any effect as ecx is overwritten during FFI_CLOSURE_COPY_TRAMP_DATA.
This commit is contained in:
parent
f067aef649
commit
2263d6037f
@ -458,9 +458,7 @@ L(UW24):
|
||||
L(UW25):
|
||||
# cfi_def_cfa_offset(closure_FS + 4)
|
||||
FFI_CLOSURE_SAVE_REGS
|
||||
movl closure_FS-4(%esp), %ecx /* load retaddr */
|
||||
movl closure_FS(%esp), %eax /* load closure */
|
||||
movl %ecx, closure_FS(%esp) /* move retaddr */
|
||||
movl closure_FS-4(%esp), %eax /* load closure */
|
||||
jmp L(do_closure_REGISTER)
|
||||
L(UW26):
|
||||
# cfi_endproc
|
||||
|
||||
@ -394,9 +394,7 @@ L(UW24):
|
||||
L(UW25):
|
||||
/* cfi_def_cfa_offset(closure_FS + 4) */
|
||||
FFI_CLOSURE_SAVE_REGS
|
||||
mov ecx, [esp+closure_FS-4] /* load retaddr */
|
||||
mov eax, [esp+closure_FS] /* load closure */
|
||||
mov [esp+closure_FS], ecx /* move retaddr */
|
||||
mov eax, [esp+closure_FS-4] /* load closure */
|
||||
jmp L(do_closure_REGISTER)
|
||||
L(UW26):
|
||||
/* cfi_endproc */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user