thunk.S 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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/config.h>
  8. #include <linux/linkage.h>
  9. #include <asm/dwarf2.h>
  10. #include <asm/calling.h>
  11. #include <asm/rwlock.h>
  12. /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
  13. .macro thunk name,func
  14. .globl \name
  15. \name:
  16. CFI_STARTPROC
  17. SAVE_ARGS
  18. call \func
  19. jmp restore
  20. CFI_ENDPROC
  21. .endm
  22. /* rdi: arg1 ... normal C conventions. rax is passed from C. */
  23. .macro thunk_retrax name,func
  24. .globl \name
  25. \name:
  26. CFI_STARTPROC
  27. SAVE_ARGS
  28. call \func
  29. jmp restore_norax
  30. CFI_ENDPROC
  31. .endm
  32. .section .sched.text
  33. #ifdef CONFIG_RWSEM_XCHGADD_ALGORITHM
  34. thunk rwsem_down_read_failed_thunk,rwsem_down_read_failed
  35. thunk rwsem_down_write_failed_thunk,rwsem_down_write_failed
  36. thunk rwsem_wake_thunk,rwsem_wake
  37. thunk rwsem_downgrade_thunk,rwsem_downgrade_wake
  38. #endif
  39. thunk __down_failed,__down
  40. thunk_retrax __down_failed_interruptible,__down_interruptible
  41. thunk_retrax __down_failed_trylock,__down_trylock
  42. thunk __up_wakeup,__up
  43. #ifdef CONFIG_TRACE_IRQFLAGS
  44. thunk trace_hardirqs_on_thunk,trace_hardirqs_on
  45. thunk trace_hardirqs_off_thunk,trace_hardirqs_off
  46. #endif
  47. /* SAVE_ARGS below is used only for the .cfi directives it contains. */
  48. CFI_STARTPROC
  49. SAVE_ARGS
  50. restore:
  51. RESTORE_ARGS
  52. ret
  53. CFI_ENDPROC
  54. CFI_STARTPROC
  55. SAVE_ARGS
  56. restore_norax:
  57. RESTORE_ARGS 1
  58. ret
  59. CFI_ENDPROC