From 15eab1e3e89129ab3ed03f5bdc3415b26e9caeb9 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 1 Feb 2020 05:44:55 -0800 Subject: 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 --- sysdeps/unix/sysv/linux/i386/getcontext.S | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'sysdeps/unix/sysv/linux/i386/getcontext.S') diff --git a/sysdeps/unix/sysv/linux/i386/getcontext.S b/sysdeps/unix/sysv/linux/i386/getcontext.S index f86df4d555..9c1df9a2aa 100644 --- a/sysdeps/unix/sysv/linux/i386/getcontext.S +++ b/sysdeps/unix/sysv/linux/i386/getcontext.S @@ -26,13 +26,7 @@ ENTRY(__getcontext) /* Load address of the context data structure. */ movl 4(%esp), %eax - /* Return value of getcontext. EAX is the only register whose - value is not preserved. */ - movl $0, oEAX(%eax) - - /* Save the 32-bit register values and the return address. */ - movl %ecx, oECX(%eax) - movl %edx, oEDX(%eax) + /* Save the preserved register values and the return address. */ movl %edi, oEDI(%eax) movl %esi, oESI(%eax) movl %ebp, oEBP(%eax) -- cgit 1.4.1