diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-02-01 05:44:55 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-02-01 05:44:55 -0800 |
commit | 15eab1e3e89129ab3ed03f5bdc3415b26e9caeb9 (patch) | |
tree | fa94bea918c6ce99212161143aa65683560e2e78 /sysdeps/unix/sysv/linux/i386/setcontext.S | |
parent | 635d6fae03257129b4672591b700a495cb6cb6c7 (diff) | |
download | glibc-15eab1e3e89129ab3ed03f5bdc3415b26e9caeb9.tar.gz glibc-15eab1e3e89129ab3ed03f5bdc3415b26e9caeb9.tar.xz glibc-15eab1e3e89129ab3ed03f5bdc3415b26e9caeb9.zip |
i386: Don't unnecessarily save and restore EAX, ECX and EDX [BZ# 25262]
On i386, since EAX, ECX and EDX are caller-saved, there are no need to save and restore EAX, ECX and EDX in getcontext, setcontext and swapcontext. They just need to clear EAX on success. The extra scratch registers are needed to enable CET. Tested on i386. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/setcontext.S')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setcontext.S | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/setcontext.S b/sysdeps/unix/sysv/linux/i386/setcontext.S index b4b5c0298c..f042d80bf4 100644 --- a/sysdeps/unix/sysv/linux/i386/setcontext.S +++ b/sysdeps/unix/sysv/linux/i386/setcontext.S @@ -65,22 +65,19 @@ ENTRY(__setcontext) cfi_offset (esi, oESI) cfi_offset (ebp, oEBP) cfi_offset (ebx, oEBX) - cfi_offset (edx, oEDX) - cfi_offset (ecx, oECX) movl oESP(%eax), %esp /* Push the return address on the new stack so we can return there. */ pushl %ecx - /* Load the values of all the 32-bit registers (except ESP). - Since we are loading from EAX, it must be last. */ + /* Load the values of all the preserved registers (except ESP). */ movl oEDI(%eax), %edi movl oESI(%eax), %esi movl oEBP(%eax), %ebp movl oEBX(%eax), %ebx - movl oEDX(%eax), %edx - movl oECX(%eax), %ecx - movl oEAX(%eax), %eax + + /* All done, return 0 for success. */ + xorl %eax, %eax /* End FDE here, we fall into another context. */ cfi_endproc |