blob: 1cad22139c880659aa1428cb053f9070b00ddce0 [file] [log] [blame]
Jan Beulich4625cd62011-07-19 12:59:51 +01001/* Slow paths of read/write spinlocks. */
2
3#include <linux/linkage.h>
4#include <asm/alternative-asm.h>
5#include <asm/frame.h>
6#include <asm/rwlock.h>
7
8#ifdef CONFIG_X86_32
9# define __lock_ptr eax
10#else
11# define __lock_ptr rdi
12#endif
13
14ENTRY(__write_lock_failed)
15 CFI_STARTPROC
16 FRAME
170: LOCK_PREFIX
Jan Beulicha7500362011-07-19 13:00:45 +010018 WRITE_LOCK_ADD($RW_LOCK_BIAS) (%__lock_ptr)
Jan Beulich4625cd62011-07-19 12:59:51 +0100191: rep; nop
Jan Beulicha7500362011-07-19 13:00:45 +010020 cmpl $WRITE_LOCK_CMP, (%__lock_ptr)
Jan Beulich4625cd62011-07-19 12:59:51 +010021 jne 1b
22 LOCK_PREFIX
Jan Beulicha7500362011-07-19 13:00:45 +010023 WRITE_LOCK_SUB($RW_LOCK_BIAS) (%__lock_ptr)
Jan Beulich4625cd62011-07-19 12:59:51 +010024 jnz 0b
25 ENDFRAME
26 ret
27 CFI_ENDPROC
28END(__write_lock_failed)
29
30ENTRY(__read_lock_failed)
31 CFI_STARTPROC
32 FRAME
330: LOCK_PREFIX
Jan Beulicha7500362011-07-19 13:00:45 +010034 READ_LOCK_SIZE(inc) (%__lock_ptr)
Jan Beulich4625cd62011-07-19 12:59:51 +0100351: rep; nop
Jan Beulicha7500362011-07-19 13:00:45 +010036 READ_LOCK_SIZE(cmp) $1, (%__lock_ptr)
Jan Beulich4625cd62011-07-19 12:59:51 +010037 js 1b
38 LOCK_PREFIX
Jan Beulicha7500362011-07-19 13:00:45 +010039 READ_LOCK_SIZE(dec) (%__lock_ptr)
Jan Beulich4625cd62011-07-19 12:59:51 +010040 js 0b
41 ENDFRAME
42 ret
43 CFI_ENDPROC
44END(__read_lock_failed)