thunk_64.S 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Save registers before calling assembly functions. This avoids
  3. * disturbance of register allocation in some inline assembly constructs.
  4. * Copyright 2001,2002 by Andi Kleen, SuSE Labs.
  5. * Subject to the GNU public license, v.2. No warranty of any kind.
  6. */
  7. #include <linux/linkage.h>
  8. #include <asm/dwarf2.h>
  9. #include <asm/calling.h>
  10. #include <asm/rwlock.h>
  11. /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
  12. .macro thunk name,func
  13. .globl \name
  14. \name:
  15. CFI_STARTPROC
  16. SAVE_ARGS
  17. call \func
  18. jmp restore
  19. CFI_ENDPROC
  20. .endm
  21. /* rdi: arg1 ... normal C conventions. rax is passed from C. */
  22. .macro thunk_retrax name,func
  23. .globl \name
  24. \name:
  25. CFI_STARTPROC
  26. SAVE_ARGS
  27. call \func
  28. jmp restore_norax
  29. CFI_ENDPROC
  30. .endm
  31. .section .sched.text, "ax"
  32. #ifdef CONFIG_RWSEM_XCHGADD_ALGORITHM
  33. thunk rwsem_down_read_failed_thunk,rwsem_down_read_failed
  34. thunk rwsem_down_write_failed_thunk,rwsem_down_write_failed
  35. thunk rwsem_wake_thunk,rwsem_wake
  36. thunk rwsem_downgrade_thunk,rwsem_downgrade_wake
  37. #endif
  38. #ifdef CONFIG_TRACE_IRQFLAGS
  39. thunk trace_hardirqs_on_thunk,trace_hardirqs_on
  40. thunk trace_hardirqs_off_thunk,trace_hardirqs_off
  41. #endif
  42. #ifdef CONFIG_DEBUG_LOCK_ALLOC
  43. thunk lockdep_sys_exit_thunk,lockdep_sys_exit
  44. #endif
  45. /* SAVE_ARGS below is used only for the .cfi directives it contains. */
  46. CFI_STARTPROC
  47. SAVE_ARGS
  48. restore:
  49. RESTORE_ARGS
  50. ret
  51. CFI_ENDPROC
  52. CFI_STARTPROC
  53. SAVE_ARGS
  54. restore_norax:
  55. RESTORE_ARGS 1
  56. ret
  57. CFI_ENDPROC