thunk_64.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Save registers before calling assembly functions. This avoids
  4. * disturbance of register allocation in some inline assembly constructs.
  5. * Copyright 2001,2002 by Andi Kleen, SuSE Labs.
  6. */
  7. #include <linux/linkage.h>
  8. #include "calling.h"
  9. #include <asm/asm.h>
  10. #include <asm/export.h>
  11. /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
  12. .macro THUNK name, func
  13. SYM_FUNC_START_NOALIGN(\name)
  14. pushq %rbp
  15. movq %rsp, %rbp
  16. pushq %rdi
  17. pushq %rsi
  18. pushq %rdx
  19. pushq %rcx
  20. pushq %rax
  21. pushq %r8
  22. pushq %r9
  23. pushq %r10
  24. pushq %r11
  25. call \func
  26. jmp __thunk_restore
  27. SYM_FUNC_END(\name)
  28. _ASM_NOKPROBE(\name)
  29. .endm
  30. THUNK preempt_schedule_thunk, preempt_schedule
  31. THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace
  32. EXPORT_SYMBOL(preempt_schedule_thunk)
  33. EXPORT_SYMBOL(preempt_schedule_notrace_thunk)
  34. SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore)
  35. popq %r11
  36. popq %r10
  37. popq %r9
  38. popq %r8
  39. popq %rax
  40. popq %rcx
  41. popq %rdx
  42. popq %rsi
  43. popq %rdi
  44. popq %rbp
  45. RET
  46. _ASM_NOKPROBE(__thunk_restore)
  47. SYM_CODE_END(__thunk_restore)