xref: /openbmc/linux/arch/x86/entry/thunk_64.S (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
13f520cd2SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */
2e6b93f4eSIngo Molnar/*
3e6b93f4eSIngo Molnar * Save registers before calling assembly functions. This avoids
4e6b93f4eSIngo Molnar * disturbance of register allocation in some inline assembly constructs.
5e6b93f4eSIngo Molnar * Copyright 2001,2002 by Andi Kleen, SuSE Labs.
6e6b93f4eSIngo Molnar */
7e6b93f4eSIngo Molnar#include <linux/linkage.h>
8d36f9479SIngo Molnar#include "calling.h"
9e6b93f4eSIngo Molnar#include <asm/asm.h>
10784d5699SAl Viro#include <asm/export.h>
11e6b93f4eSIngo Molnar
12e6b93f4eSIngo Molnar	/* rdi:	arg1 ... normal C conventions. rax is saved/restored. */
130bab9cb2SBorislav Petkov	.macro THUNK name, func
1467e93dddSThomas GleixnerSYM_FUNC_START(\name)
15d4bf7078SJosh Poimboeuf	pushq %rbp
16d4bf7078SJosh Poimboeuf	movq %rsp, %rbp
17e6b93f4eSIngo Molnar
18e6b93f4eSIngo Molnar	pushq %rdi
19e6b93f4eSIngo Molnar	pushq %rsi
20e6b93f4eSIngo Molnar	pushq %rdx
21e6b93f4eSIngo Molnar	pushq %rcx
22e6b93f4eSIngo Molnar	pushq %rax
23e6b93f4eSIngo Molnar	pushq %r8
24e6b93f4eSIngo Molnar	pushq %r9
25e6b93f4eSIngo Molnar	pushq %r10
26e6b93f4eSIngo Molnar	pushq %r11
27e6b93f4eSIngo Molnar
28e6b93f4eSIngo Molnar	call \func
29e6b93f4eSIngo Molnar
30e6b93f4eSIngo Molnar	popq %r11
31e6b93f4eSIngo Molnar	popq %r10
32e6b93f4eSIngo Molnar	popq %r9
33e6b93f4eSIngo Molnar	popq %r8
34e6b93f4eSIngo Molnar	popq %rax
35e6b93f4eSIngo Molnar	popq %rcx
36e6b93f4eSIngo Molnar	popq %rdx
37e6b93f4eSIngo Molnar	popq %rsi
38e6b93f4eSIngo Molnar	popq %rdi
39d4bf7078SJosh Poimboeuf	popq %rbp
40f94909ceSPeter Zijlstra	RET
41*ac27ecf6SJosh PoimboeufSYM_FUNC_END(\name)
42*ac27ecf6SJosh Poimboeuf	_ASM_NOKPROBE(\name)
43*ac27ecf6SJosh Poimboeuf	.endm
44*ac27ecf6SJosh Poimboeuf
45*ac27ecf6SJosh PoimboeufTHUNK preempt_schedule_thunk, preempt_schedule
46*ac27ecf6SJosh PoimboeufTHUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace
47*ac27ecf6SJosh PoimboeufEXPORT_SYMBOL(preempt_schedule_thunk)
48*ac27ecf6SJosh PoimboeufEXPORT_SYMBOL(preempt_schedule_notrace_thunk)
49