[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201109144425.270789-3-alexandre.chartre@oracle.com>
Date: Mon, 9 Nov 2020 15:44:03 +0100
From: Alexandre Chartre <alexandre.chartre@...cle.com>
To: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, hpa@...or.com,
x86@...nel.org, dave.hansen@...ux.intel.com, luto@...nel.org,
peterz@...radead.org, linux-kernel@...r.kernel.org,
thomas.lendacky@....com, jroedel@...e.de
Cc: konrad.wilk@...cle.com, jan.setjeeilers@...cle.com,
junaids@...gle.com, oweisse@...gle.com, rppt@...ux.vnet.ibm.com,
graf@...zon.de, mgross@...ux.intel.com, kuzuno@...il.com,
alexandre.chartre@...cle.com
Subject: [RFC][PATCH 02/24] x86/entry: Update asm_call_on_stack to support more function arguments
Update the asm_call_on_stack() function so that it can be invoked
with a function having up to three arguments instead of only one.
Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com>
---
arch/x86/entry/entry_64.S | 15 +++++++++++----
arch/x86/include/asm/irq_stack.h | 8 ++++++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index cad08703c4ad..c42948aca0a8 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -759,9 +759,14 @@ SYM_CODE_END(.Lbad_gs)
/*
* rdi: New stack pointer points to the top word of the stack
* rsi: Function pointer
- * rdx: Function argument (can be NULL if none)
+ * rdx: Function argument 1 (can be NULL if none)
+ * rcx: Function argument 2 (can be NULL if none)
+ * r8 : Function argument 3 (can be NULL if none)
*/
SYM_FUNC_START(asm_call_on_stack)
+SYM_FUNC_START(asm_call_on_stack_1)
+SYM_FUNC_START(asm_call_on_stack_2)
+SYM_FUNC_START(asm_call_on_stack_3)
SYM_INNER_LABEL(asm_call_sysvec_on_stack, SYM_L_GLOBAL)
SYM_INNER_LABEL(asm_call_irq_on_stack, SYM_L_GLOBAL)
/*
@@ -777,15 +782,17 @@ SYM_INNER_LABEL(asm_call_irq_on_stack, SYM_L_GLOBAL)
*/
mov %rsp, (%rdi)
mov %rdi, %rsp
- /* Move the argument to the right place */
+ mov %rsi, %rax
+ /* Move arguments to the right place */
mov %rdx, %rdi
-
+ mov %rcx, %rsi
+ mov %r8, %rdx
1:
.pushsection .discard.instr_begin
.long 1b - .
.popsection
- CALL_NOSPEC rsi
+ CALL_NOSPEC rax
2:
.pushsection .discard.instr_end
diff --git a/arch/x86/include/asm/irq_stack.h b/arch/x86/include/asm/irq_stack.h
index 775816965c6a..359427216336 100644
--- a/arch/x86/include/asm/irq_stack.h
+++ b/arch/x86/include/asm/irq_stack.h
@@ -13,6 +13,14 @@ static __always_inline bool irqstack_active(void)
}
void asm_call_on_stack(void *sp, void (*func)(void), void *arg);
+
+void asm_call_on_stack_1(void *sp, void (*func)(void),
+ void *arg1);
+void asm_call_on_stack_2(void *sp, void (*func)(void),
+ void *arg1, void *arg2);
+void asm_call_on_stack_3(void *sp, void (*func)(void),
+ void *arg1, void *arg2, void *arg3);
+
void asm_call_sysvec_on_stack(void *sp, void (*func)(struct pt_regs *regs),
struct pt_regs *regs);
void asm_call_irq_on_stack(void *sp, void (*func)(struct irq_desc *desc),
--
2.18.4
Powered by blists - more mailing lists