thunk_64.S 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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
  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. thunk __down_failed,__down
  39. thunk_retrax __down_failed_interruptible,__down_interruptible
  40. thunk_retrax __down_failed_trylock,__down_trylock
  41. thunk __up_wakeup,__up
  42. #ifdef CONFIG_TRACE_IRQFLAGS
  43. thunk trace_hardirqs_on_thunk,trace_hardirqs_on
  44. thunk trace_hardirqs_off_thunk,trace_hardirqs_off
  45. #endif
  46. #ifdef CONFIG_DEBUG_LOCK_ALLOC
  47. thunk lockdep_sys_exit_thunk,lockdep_sys_exit
  48. #endif
  49. /* SAVE_ARGS below is used only for the .cfi directives it contains. */
  50. CFI_STARTPROC
  51. SAVE_ARGS
  52. restore:
  53. RESTORE_ARGS
  54. ret
  55. CFI_ENDPROC
  56. CFI_STARTPROC
  57. SAVE_ARGS
  58. restore_norax:
  59. RESTORE_ARGS 1
  60. ret
  61. CFI_ENDPROC