thunk_64.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. * Added trace_hardirqs callers - Copyright 2007 Steven Rostedt, Red Hat, Inc.
  6. * Subject to the GNU public license, v.2. No warranty of any kind.
  7. */
  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, "ax"
  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. #ifdef CONFIG_TRACE_IRQFLAGS
  40. /* put return address in rdi (arg1) */
  41. .macro thunk_ra name,func
  42. .globl \name
  43. \name:
  44. CFI_STARTPROC
  45. SAVE_ARGS
  46. /* SAVE_ARGS pushs 9 elements */
  47. /* the next element would be the rip */
  48. movq 9*8(%rsp), %rdi
  49. call \func
  50. jmp restore
  51. CFI_ENDPROC
  52. .endm
  53. thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller
  54. thunk_ra trace_hardirqs_off_thunk,trace_hardirqs_off_caller
  55. #endif
  56. #ifdef CONFIG_DEBUG_LOCK_ALLOC
  57. thunk lockdep_sys_exit_thunk,lockdep_sys_exit
  58. #endif
  59. /* SAVE_ARGS below is used only for the .cfi directives it contains. */
  60. CFI_STARTPROC
  61. SAVE_ARGS
  62. restore:
  63. RESTORE_ARGS
  64. ret
  65. CFI_ENDPROC
  66. CFI_STARTPROC
  67. SAVE_ARGS
  68. restore_norax:
  69. RESTORE_ARGS 1
  70. ret
  71. CFI_ENDPROC