Fix x86 cfi directives for syscalls.

The syscall generation always used 4 bytes for each push cfi directive.
However, the first push should always use an offset of 8 bytes, each
subsequent push after that is only 4 bytes though.

Change-Id: Ibaabd107f399ef67010b9a08213783957c2f74a9
This commit is contained in:
Christopher Ferris
2014-05-29 18:17:09 -07:00
parent 264d1b8325
commit 15b91e92a0
185 changed files with 1025 additions and 723 deletions

View File

@@ -323,17 +323,20 @@ def x86_genstub(syscall):
stack_bias = numparams*4 + 4
offset = 0
mov_result = ""
cfi_result = " .cfi_def_cfa_offset %d\n" % (numparams*4)
first_push = True
for register in x86_registers[:numparams]:
result += " pushl %%%s\n" % register
if first_push:
result += " .cfi_def_cfa_offset 8\n"
result += " .cfi_rel_offset %s, 0\n" % register
first_push = False
else:
result += " .cfi_adjust_cfa_offset 4\n"
result += " .cfi_rel_offset %s, 0\n" % register
mov_result += " mov %d(%%esp), %%%s\n" % (stack_bias+offset, register)
cfi_result += " .cfi_rel_offset %s, %d\n" % (register, offset)
offset += 4
if numparams:
result += cfi_result
result += mov_result
result += mov_result
result += x86_call % syscall
for register in reversed(x86_registers[:numparams]):
@@ -353,10 +356,11 @@ def x86_genstub_socketcall(syscall):
# save the regs we need
result += " pushl %ebx\n"
result += " pushl %ecx\n"
result += " .cfi_def_cfa_offset 8\n"
result += " .cfi_rel_offset ebx, 0\n"
result += " .cfi_rel_offset ecx, 4\n"
result += " pushl %ecx\n"
result += " .cfi_adjust_cfa_offset 4\n"
result += " .cfi_rel_offset ecx, 0\n"
stack_bias = 12
# set the call id (%ebx)