diff options
author | Christopher Ferris <cferris@google.com> | 2014-05-29 18:17:09 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2014-05-29 19:04:36 -0700 |
commit | 15b91e92a0bb4a15b4f2258bea332f4a67fa94d7 (patch) | |
tree | b83242c20fc59e1d5bc3420e9f8cbf2b5b6a1aae /libc/tools | |
parent | 264d1b832510b746c1d45b5efaa33c164d6f8b2b (diff) | |
download | bionic-15b91e92a0bb4a15b4f2258bea332f4a67fa94d7.zip bionic-15b91e92a0bb4a15b4f2258bea332f4a67fa94d7.tar.gz bionic-15b91e92a0bb4a15b4f2258bea332f4a67fa94d7.tar.bz2 |
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
Diffstat (limited to 'libc/tools')
-rwxr-xr-x | libc/tools/gensyscalls.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py index 87d51e3..5e4ddc5 100755 --- a/libc/tools/gensyscalls.py +++ b/libc/tools/gensyscalls.py @@ -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) |