thunk_64.S 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #ifdef CONFIG_TRACE_IRQFLAGS
  23. /* put return address in rdi (arg1) */
  24. .macro thunk_ra name,func
  25. .globl \name
  26. \name:
  27. CFI_STARTPROC
  28. SAVE_ARGS
  29. /* SAVE_ARGS pushs 9 elements */
  30. /* the next element would be the rip */
  31. movq 9*8(%rsp), %rdi
  32. call \func
  33. jmp restore
  34. CFI_ENDPROC
  35. .endm
  36. thunk_ra trace_hardirqs_on_thunk,trace_hardirqs_on_caller
  37. thunk_ra trace_hardirqs_off_thunk,trace_hardirqs_off_caller
  38. #endif
  39. #ifdef CONFIG_DEBUG_LOCK_ALLOC
  40. thunk lockdep_sys_exit_thunk,lockdep_sys_exit
  41. #endif
  42. /* SAVE_ARGS below is used only for the .cfi directives it contains. */
  43. CFI_STARTPROC
  44. SAVE_ARGS
  45. restore:
  46. RESTORE_ARGS
  47. ret
  48. CFI_ENDPROC