-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 182579 b: refs/heads/master c: bafaecd h: refs/heads/master i: 182577: c6d53c2 182575: 3374c3b v: v3
- Loading branch information
Linus Torvalds
authored and
H. Peter Anvin
committed
Jan 14, 2010
1 parent
c82bad2
commit f318052
Showing
4 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 5d0b7235d83eefdafda300656e97d368afcafc9a | ||
refs/heads/master: bafaecd11df15ad5b1e598adc7736afcd38ee13d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* x86-64 rwsem wrappers | ||
* | ||
* This interfaces the inline asm code to the slow-path | ||
* C routines. We need to save the call-clobbered regs | ||
* that the asm does not mark as clobbered, and move the | ||
* argument from %rax to %rdi. | ||
* | ||
* NOTE! We don't need to save %rax, because the functions | ||
* will always return the semaphore pointer in %rax (which | ||
* is also the input argument to these helpers) | ||
* | ||
* The following can clobber %rdx because the asm clobbers it: | ||
* call_rwsem_down_write_failed | ||
* call_rwsem_wake | ||
* but %rdi, %rsi, %rcx, %r8-r11 always need saving. | ||
*/ | ||
|
||
#include <linux/linkage.h> | ||
#include <asm/rwlock.h> | ||
#include <asm/alternative-asm.h> | ||
#include <asm/frame.h> | ||
#include <asm/dwarf2.h> | ||
|
||
#define save_common_regs \ | ||
pushq %rdi; \ | ||
pushq %rsi; \ | ||
pushq %rcx; \ | ||
pushq %r8; \ | ||
pushq %r9; \ | ||
pushq %r10; \ | ||
pushq %r11 | ||
|
||
#define restore_common_regs \ | ||
popq %r11; \ | ||
popq %r10; \ | ||
popq %r9; \ | ||
popq %r8; \ | ||
popq %rcx; \ | ||
popq %rsi; \ | ||
popq %rdi | ||
|
||
/* Fix up special calling conventions */ | ||
ENTRY(call_rwsem_down_read_failed) | ||
save_common_regs | ||
pushq %rdx | ||
movq %rax,%rdi | ||
call rwsem_down_read_failed | ||
popq %rdx | ||
restore_common_regs | ||
ret | ||
ENDPROC(call_rwsem_down_read_failed) | ||
|
||
ENTRY(call_rwsem_down_write_failed) | ||
save_common_regs | ||
movq %rax,%rdi | ||
call rwsem_down_write_failed | ||
restore_common_regs | ||
ret | ||
ENDPROC(call_rwsem_down_write_failed) | ||
|
||
ENTRY(call_rwsem_wake) | ||
decw %dx /* do nothing if still outstanding active readers */ | ||
jnz 1f | ||
save_common_regs | ||
movq %rax,%rdi | ||
call rwsem_wake | ||
restore_common_regs | ||
1: ret | ||
ENDPROC(call_rwsem_wake) | ||
|
||
/* Fix up special calling conventions */ | ||
ENTRY(call_rwsem_downgrade_wake) | ||
save_common_regs | ||
pushq %rdx | ||
movq %rax,%rdi | ||
call rwsem_downgrade_wake | ||
popq %rdx | ||
restore_common_regs | ||
ret | ||
ENDPROC(call_rwsem_downgrade_wake) |