lkml.org 
[lkml]   [2021]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2 19/41] x86/entry: move PUSH_AND_CLEAR_REGS out of paranoid_entry
Date
From: Lai Jiangshan <laijs@linux.alibaba.com>

It is prepared for converting the whole paranoid_entry() into C code.

No functional change intended.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
---
arch/x86/entry/entry_64.S | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index a0d73dc0d2f3..bd6bce341360 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -322,9 +322,6 @@ SYM_CODE_END(ret_from_fork)
*/
.macro idtentry_body cfunc has_error_code:req

- PUSH_AND_CLEAR_REGS
- ENCODE_FRAME_POINTER
-
movq %rsp, %rdi
call error_entry
movq %rax, %rsp /* switch stack settled by sync_regs() */
@@ -376,6 +373,9 @@ SYM_CODE_START(\asmsym)
.Lfrom_usermode_no_gap_\@:
.endif

+ PUSH_AND_CLEAR_REGS
+ ENCODE_FRAME_POINTER
+
idtentry_body \cfunc \has_error_code

_ASM_NOKPROBE(\asmsym)
@@ -427,11 +427,14 @@ SYM_CODE_START(\asmsym)

pushq $-1 /* ORIG_RAX: no syscall to restart */

+ PUSH_AND_CLEAR_REGS
+ ENCODE_FRAME_POINTER
+
/*
* If the entry is from userspace, switch stacks and treat it as
* a normal entry.
*/
- testb $3, CS-ORIG_RAX(%rsp)
+ testb $3, CS(%rsp)
jnz .Lfrom_usermode_switch_stack_\@

/* paranoid_entry returns GS information for paranoid_exit in EBX. */
@@ -481,11 +484,14 @@ SYM_CODE_START(\asmsym)
UNWIND_HINT_IRET_REGS
ASM_CLAC

+ PUSH_AND_CLEAR_REGS
+ ENCODE_FRAME_POINTER
+
/*
* If the entry is from userspace, switch stacks and treat it as
* a normal entry.
*/
- testb $3, CS-ORIG_RAX(%rsp)
+ testb $3, CS(%rsp)
jnz .Lfrom_usermode_switch_stack_\@

/*
@@ -543,6 +549,9 @@ SYM_CODE_START(\asmsym)
UNWIND_HINT_IRET_REGS offset=8
ASM_CLAC

+ PUSH_AND_CLEAR_REGS
+ ENCODE_FRAME_POINTER
+
/* paranoid_entry returns GS information for paranoid_exit in EBX. */
call paranoid_entry
UNWIND_HINT_REGS
@@ -855,8 +864,6 @@ SYM_CODE_END(xen_failsafe_callback)
SYM_CODE_START_LOCAL(paranoid_entry)
UNWIND_HINT_FUNC
cld
- PUSH_AND_CLEAR_REGS save_ret=1
- ENCODE_FRAME_POINTER 8

/*
* Always stash CR3 in %r14. This value will be restored,
@@ -1269,6 +1276,9 @@ end_repeat_nmi:
*/
pushq $-1 /* ORIG_RAX: no syscall to restart */

+ PUSH_AND_CLEAR_REGS
+ ENCODE_FRAME_POINTER
+
/*
* Use paranoid_entry to handle SWAPGS and CR3.
*/
--
2.19.1.6.gb485710b
\
 
 \ /
  Last update: 2021-09-26 17:11    [W:0.262 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site