aboutsummaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2017-11-29 15:36:56 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-12-03 22:08:53 -0600
commit1486a08de557b8f237a066a57cc2c74961ba36e0 (patch)
tree493986a01191b9d5449fb43dc421a8ea7a1e1dc5 /asm
parent1e85912b921028bafa3a68fa286682a5d21a1223 (diff)
downloadskiboot-1486a08de557b8f237a066a57cc2c74961ba36e0.zip
skiboot-1486a08de557b8f237a066a57cc2c74961ba36e0.tar.gz
skiboot-1486a08de557b8f237a066a57cc2c74961ba36e0.tar.bz2
core/lock: Introduce atomic cmpxchg and implement try_lock with it
cmpxchg will be used in a subsequent change, and this reduces the amount of asm code. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [stewart: fix some ifdef __TEST__ foo to ensure unittests work] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'asm')
-rw-r--r--asm/Makefile.inc2
-rw-r--r--asm/lock.S43
2 files changed, 1 insertions, 44 deletions
diff --git a/asm/Makefile.inc b/asm/Makefile.inc
index 2e678fd..34e2b28 100644
--- a/asm/Makefile.inc
+++ b/asm/Makefile.inc
@@ -1,7 +1,7 @@
# -*-Makefile-*-
SUBDIRS += asm
-ASM_OBJS = head.o lock.o misc.o kernel-wrapper.o rom_entry.o
+ASM_OBJS = head.o misc.o kernel-wrapper.o rom_entry.o
ASM=asm/built-in.o
# Add extra dependency to the kernel wrapper
diff --git a/asm/lock.S b/asm/lock.S
deleted file mode 100644
index ce28010..0000000
--- a/asm/lock.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright 2013-2014 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <asm-utils.h>
-#include <asm-offsets.h>
-#include <processor.h>
-
- .section ".text","ax"
- .balign 0x10
-
- /* bool try_lock(struct lock *lock) */
-.global __try_lock
-__try_lock:
- ld %r0,0(%r3)
- andi. %r10,%r0,1
- bne 2f
- lwz %r9,CPUTHREAD_PIR(%r13)
-1: ldarx %r0,0,%r3
- andi. %r10,%r0,1
- bne- 2f
- ori %r0,%r0,1
- rldimi %r0,%r9,32,0
- stdcx. %r0,0,%r3
- bne 1b
- sync
- li %r3,-1
- blr
-2: li %r3,0
- blr
-