2 * x86-64 rwsem wrappers
4 * This interfaces the inline asm code to the slow-path
5 * C routines. We need to save the call-clobbered regs
6 * that the asm does not mark as clobbered, and move the
7 * argument from %rax to %rdi.
9 * NOTE! We don't need to save %rax, because the functions
10 * will always return the semaphore pointer in %rax (which
11 * is also the input argument to these helpers)
13 * The following can clobber %rdx because the asm clobbers it:
14 * call_rwsem_down_write_failed
16 * but %rdi, %rsi, %rcx, %r8-r11 always need saving.
19 #include <linux/linkage.h>
20 #include <asm/rwlock.h>
21 #include <asm/alternative-asm.h>
22 #include <asm/frame.h>
23 #include <asm/dwarf2.h>
25 #define save_common_regs \
26 pushq_cfi %rdi; CFI_REL_OFFSET rdi, 0; \
27 pushq_cfi %rsi; CFI_REL_OFFSET rsi, 0; \
28 pushq_cfi %rcx; CFI_REL_OFFSET rcx, 0; \
29 pushq_cfi %r8; CFI_REL_OFFSET r8, 0; \
30 pushq_cfi %r9; CFI_REL_OFFSET r9, 0; \
31 pushq_cfi %r10; CFI_REL_OFFSET r10, 0; \
32 pushq_cfi %r11; CFI_REL_OFFSET r11, 0
34 #define restore_common_regs \
35 popq_cfi %r11; CFI_RESTORE r11; \
36 popq_cfi %r10; CFI_RESTORE r10; \
37 popq_cfi %r9; CFI_RESTORE r9; \
38 popq_cfi %r8; CFI_RESTORE r8; \
39 popq_cfi %rcx; CFI_RESTORE rcx; \
40 popq_cfi %rsi; CFI_RESTORE rsi; \
41 popq_cfi %rdi; CFI_RESTORE rdi
43 /* Fix up special calling conventions */
44 ENTRY(call_rwsem_down_read_failed)
50 call rwsem_down_read_failed
56 ENDPROC(call_rwsem_down_read_failed)
58 ENTRY(call_rwsem_down_write_failed)
62 call rwsem_down_write_failed
66 ENDPROC(call_rwsem_down_write_failed)
68 ENTRY(call_rwsem_wake)
70 decl %edx /* do nothing if still outstanding active readers */
78 ENDPROC(call_rwsem_wake)
80 /* Fix up special calling conventions */
81 ENTRY(call_rwsem_downgrade_wake)
87 call rwsem_downgrade_wake
93 ENDPROC(call_rwsem_downgrade_wake)