summaryrefslogtreecommitdiffstats
path: root/kernel/arch/sparc/lib/locks.S
diff options
context:
space:
mode:
authorYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 12:17:53 -0700
committerYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 15:44:42 -0700
commit9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch)
tree1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/arch/sparc/lib/locks.S
parent98260f3884f4a202f9ca5eabed40b1354c489b29 (diff)
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/arch/sparc/lib/locks.S')
-rw-r--r--kernel/arch/sparc/lib/locks.S92
1 files changed, 92 insertions, 0 deletions
diff --git a/kernel/arch/sparc/lib/locks.S b/kernel/arch/sparc/lib/locks.S
new file mode 100644
index 000000000..64f53f2b6
--- /dev/null
+++ b/kernel/arch/sparc/lib/locks.S
@@ -0,0 +1,92 @@
+/*
+ * locks.S: SMP low-level lock primitives on Sparc.
+ *
+ * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1998 Anton Blanchard (anton@progsoc.uts.edu.au)
+ * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
+ */
+
+#include <asm/ptrace.h>
+#include <asm/psr.h>
+#include <asm/smp.h>
+#include <asm/spinlock.h>
+
+ .text
+ .align 4
+
+ /* Read/writer locks, as usual this is overly clever to make it
+ * as fast as possible.
+ */
+
+ /* caches... */
+___rw_read_enter_spin_on_wlock:
+ orcc %g2, 0x0, %g0
+ be,a ___rw_read_enter
+ ldstub [%g1 + 3], %g2
+ b ___rw_read_enter_spin_on_wlock
+ ldub [%g1 + 3], %g2
+___rw_read_try_spin_on_wlock:
+ andcc %g2, 0xff, %g0
+ be,a ___rw_read_try
+ ldstub [%g1 + 3], %g2
+ xnorcc %g2, 0x0, %o0 /* if g2 is ~0, set o0 to 0 and bugger off */
+ bne,a ___rw_read_enter_spin_on_wlock
+ ld [%g1], %g2
+ retl
+ mov %g4, %o7
+___rw_read_exit_spin_on_wlock:
+ orcc %g2, 0x0, %g0
+ be,a ___rw_read_exit
+ ldstub [%g1 + 3], %g2
+ b ___rw_read_exit_spin_on_wlock
+ ldub [%g1 + 3], %g2
+___rw_write_enter_spin_on_wlock:
+ orcc %g2, 0x0, %g0
+ be,a ___rw_write_enter
+ ldstub [%g1 + 3], %g2
+ b ___rw_write_enter_spin_on_wlock
+ ld [%g1], %g2
+
+ .globl ___rw_read_enter
+___rw_read_enter:
+ orcc %g2, 0x0, %g0
+ bne,a ___rw_read_enter_spin_on_wlock
+ ldub [%g1 + 3], %g2
+ ld [%g1], %g2
+ add %g2, 1, %g2
+ st %g2, [%g1]
+ retl
+ mov %g4, %o7
+
+ .globl ___rw_read_exit
+___rw_read_exit:
+ orcc %g2, 0x0, %g0
+ bne,a ___rw_read_exit_spin_on_wlock
+ ldub [%g1 + 3], %g2
+ ld [%g1], %g2
+ sub %g2, 0x1ff, %g2
+ st %g2, [%g1]
+ retl
+ mov %g4, %o7
+
+ .globl ___rw_read_try
+___rw_read_try:
+ orcc %g2, 0x0, %g0
+ bne ___rw_read_try_spin_on_wlock
+ ld [%g1], %g2
+ add %g2, 1, %g2
+ st %g2, [%g1]
+ set 1, %o1
+ retl
+ mov %g4, %o7
+
+ .globl ___rw_write_enter
+___rw_write_enter:
+ orcc %g2, 0x0, %g0
+ bne ___rw_write_enter_spin_on_wlock
+ ld [%g1], %g2
+ andncc %g2, 0xff, %g0
+ bne,a ___rw_write_enter_spin_on_wlock
+ stb %g0, [%g1 + 3]
+ retl
+ mov %g4, %o7