thunk_64.S 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. /* SAVE_ARGS below is used only for the .cfi directives it contains. */
  47. CFI_STARTPROC
  48. SAVE_ARGS
  49. restore:
  50. RESTORE_ARGS
  51. ret
  52. CFI_ENDPROC
  53. CFI_STARTPROC
  54. SAVE_ARGS
  55. restore_norax:
  56. RESTORE_ARGS 1
  57. ret
  58. CFI_ENDPROC