From 66a2ed2360d58009cb1aa1c01bd8aab59e4397c7 Mon Sep 17 00:00:00 2001 From: "Charles E. Youse" Date: Mon, 23 Sep 2019 16:39:11 -0400 Subject: [PATCH] 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 --- arch/x86/core/intel64/locore.S | 2 +- arch/x86/core/offsets/intel64_offsets.c | 2 +- arch/x86/include/intel64/kernel_arch_thread.h | 2 +- arch/x86/include/intel64/offsets_short_arch.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/core/intel64/locore.S b/arch/x86/core/intel64/locore.S index 58b04d72525..a5f3cbca48f 100644 --- a/arch/x86/core/intel64/locore.S +++ b/arch/x86/core/intel64/locore.S @@ -222,12 +222,12 @@ __resume: movq _thread_offset_to_r13(%rdi), %r13 movq _thread_offset_to_r14(%rdi), %r14 movq _thread_offset_to_r15(%rdi), %r15 - movq _thread_offset_to_rax(%rdi), %rax testb $X86_THREAD_FLAG_ALL, _thread_offset_to_flags(%rdi) jz 1f fxrstor _thread_offset_to_sse(%rdi) + movq _thread_offset_to_rax(%rdi), %rax movq _thread_offset_to_rcx(%rdi), %rcx movq _thread_offset_to_rdx(%rdi), %rdx movq _thread_offset_to_rsi(%rdi), %rsi diff --git a/arch/x86/core/offsets/intel64_offsets.c b/arch/x86/core/offsets/intel64_offsets.c index 5ed0200cfb6..c721a2b3fb2 100644 --- a/arch/x86/core/offsets/intel64_offsets.c +++ b/arch/x86/core/offsets/intel64_offsets.c @@ -16,8 +16,8 @@ GEN_OFFSET_SYM(_callee_saved_t, r14); GEN_OFFSET_SYM(_callee_saved_t, r15); GEN_OFFSET_SYM(_callee_saved_t, rip); 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, rdx); GEN_OFFSET_SYM(_thread_arch_t, rsi); diff --git a/arch/x86/include/intel64/kernel_arch_thread.h b/arch/x86/include/intel64/kernel_arch_thread.h index fae7d26716e..a087d0d502f 100644 --- a/arch/x86/include/intel64/kernel_arch_thread.h +++ b/arch/x86/include/intel64/kernel_arch_thread.h @@ -30,7 +30,6 @@ struct _callee_saved { u64_t r15; u64_t rip; u64_t rflags; - u64_t rax; }; typedef struct _callee_saved _callee_saved_t; @@ -38,6 +37,7 @@ typedef struct _callee_saved _callee_saved_t; struct _thread_arch { u8_t flags; + u64_t rax; u64_t rcx; u64_t rdx; u64_t rsi; diff --git a/arch/x86/include/intel64/offsets_short_arch.h b/arch/x86/include/intel64/offsets_short_arch.h index 24b97c8ba37..bef3fc6d2fe 100644 --- a/arch/x86/include/intel64/offsets_short_arch.h +++ b/arch/x86/include/intel64/offsets_short_arch.h @@ -36,7 +36,7 @@ (___thread_t_callee_saved_OFFSET + ___callee_saved_t_rflags_OFFSET) #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 \ (___thread_t_arch_OFFSET + ___thread_arch_t_rcx_OFFSET)