arch/x86: (Intel64) move RAX to volatile register set

This used to be part of the "restore always" set of registers because
__swap was expected to return a value.  No longer required, so RAX is
moved to the volatile registers and we save a few cycles occasionally.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
This commit is contained in:
Charles E. Youse 2019-09-23 16:39:11 -04:00 committed by Andrew Boie
commit 66a2ed2360
4 changed files with 4 additions and 4 deletions

View file

@ -222,12 +222,12 @@ __resume:
movq _thread_offset_to_r13(%rdi), %r13 movq _thread_offset_to_r13(%rdi), %r13
movq _thread_offset_to_r14(%rdi), %r14 movq _thread_offset_to_r14(%rdi), %r14
movq _thread_offset_to_r15(%rdi), %r15 movq _thread_offset_to_r15(%rdi), %r15
movq _thread_offset_to_rax(%rdi), %rax
testb $X86_THREAD_FLAG_ALL, _thread_offset_to_flags(%rdi) testb $X86_THREAD_FLAG_ALL, _thread_offset_to_flags(%rdi)
jz 1f jz 1f
fxrstor _thread_offset_to_sse(%rdi) fxrstor _thread_offset_to_sse(%rdi)
movq _thread_offset_to_rax(%rdi), %rax
movq _thread_offset_to_rcx(%rdi), %rcx movq _thread_offset_to_rcx(%rdi), %rcx
movq _thread_offset_to_rdx(%rdi), %rdx movq _thread_offset_to_rdx(%rdi), %rdx
movq _thread_offset_to_rsi(%rdi), %rsi movq _thread_offset_to_rsi(%rdi), %rsi

View file

@ -16,8 +16,8 @@ GEN_OFFSET_SYM(_callee_saved_t, r14);
GEN_OFFSET_SYM(_callee_saved_t, r15); GEN_OFFSET_SYM(_callee_saved_t, r15);
GEN_OFFSET_SYM(_callee_saved_t, rip); GEN_OFFSET_SYM(_callee_saved_t, rip);
GEN_OFFSET_SYM(_callee_saved_t, rflags); GEN_OFFSET_SYM(_callee_saved_t, rflags);
GEN_OFFSET_SYM(_callee_saved_t, rax);
GEN_OFFSET_SYM(_thread_arch_t, rax);
GEN_OFFSET_SYM(_thread_arch_t, rcx); GEN_OFFSET_SYM(_thread_arch_t, rcx);
GEN_OFFSET_SYM(_thread_arch_t, rdx); GEN_OFFSET_SYM(_thread_arch_t, rdx);
GEN_OFFSET_SYM(_thread_arch_t, rsi); GEN_OFFSET_SYM(_thread_arch_t, rsi);

View file

@ -30,7 +30,6 @@ struct _callee_saved {
u64_t r15; u64_t r15;
u64_t rip; u64_t rip;
u64_t rflags; u64_t rflags;
u64_t rax;
}; };
typedef struct _callee_saved _callee_saved_t; typedef struct _callee_saved _callee_saved_t;
@ -38,6 +37,7 @@ typedef struct _callee_saved _callee_saved_t;
struct _thread_arch { struct _thread_arch {
u8_t flags; u8_t flags;
u64_t rax;
u64_t rcx; u64_t rcx;
u64_t rdx; u64_t rdx;
u64_t rsi; u64_t rsi;

View file

@ -36,7 +36,7 @@
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_rflags_OFFSET) (___thread_t_callee_saved_OFFSET + ___callee_saved_t_rflags_OFFSET)
#define _thread_offset_to_rax \ #define _thread_offset_to_rax \
(___thread_t_callee_saved_OFFSET + ___callee_saved_t_rax_OFFSET) (___thread_t_arch_OFFSET + ___thread_arch_t_rax_OFFSET)
#define _thread_offset_to_rcx \ #define _thread_offset_to_rcx \
(___thread_t_arch_OFFSET + ___thread_arch_t_rcx_OFFSET) (___thread_t_arch_OFFSET + ___thread_arch_t_rcx_OFFSET)