shithub: riscv

Download patch

ref: 5458506881d9ff73287df354d3be75b35d339f24
parent: e2a6e622c715eac26cdbfba42ba4f3c2af5b8ac9
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Jul 7 15:17:55 EDT 2015

all kernels: declare _tas() to prevent pulling in libc version (for libmemdraw)

--- a/sys/src/9/bitsy/l.s
+++ b/sys/src/9/bitsy/l.s
@@ -449,6 +449,7 @@
 	RET
 
 TEXT tas(SB), $-4
+TEXT _tas(SB), $-4
 	MOVW	R0, R1
 	MOVW	$0xDEADDEAD, R0
 	MOVW	R0, R3
--- a/sys/src/9/mtx/l.s
+++ b/sys/src/9/mtx/l.s
@@ -266,6 +266,7 @@
 	RETURN
 
 TEXT	tas(SB), $0
+TEXT	_tas(SB), $0
 	SYNC
 	MOVW	R3, R4
 	MOVW	$0xdead,R5
--- a/sys/src/9/omap4/l.s
+++ b/sys/src/9/omap4/l.s
@@ -115,6 +115,7 @@
 	RET
 
 TEXT tas(SB), $-4
+TEXT _tas(SB), $-4
 spintas:
 	LDREX(0,1)
 	CMP.S	$0, R1
--- a/sys/src/9/pc/l.s
+++ b/sys/src/9/pc/l.s
@@ -690,6 +690,7 @@
  * Test-And-Set
  */
 TEXT tas(SB), $0
+TEXT _tas(SB), $0
 	MOVL	$0xDEADDEAD, AX
 	MOVL	lock+0(FP), BX
 	XCHGL	AX, (BX)			/* lock->key */
--- a/sys/src/9/pc64/l.s
+++ b/sys/src/9/pc64/l.s
@@ -520,6 +520,7 @@
  * Synchronisation
  */
 TEXT tas(SB), 1, $-4
+TEXT _tas(SB), 1, $-4
 	MOVL	$0xdeaddead, AX
 	XCHGL	AX, (RARG)			/*  */
 	RET
--- a/sys/src/9/ppc/l.s
+++ b/sys/src/9/ppc/l.s
@@ -346,6 +346,7 @@
 	RETURN
 
 TEXT tas(SB), $0
+TEXT _tas(SB), $0
 	MOVW	R3, R4
 	MOVW	$0xdead, R5
 tas1:
--- a/sys/src/9/sgi/l.s
+++ b/sys/src/9/sgi/l.s
@@ -721,8 +721,8 @@
  * Emulate 68020 test and set: load linked / store conditional
  */
 
-TEXT	_tas(SB), $0
 TEXT	tas(SB), $0
+TEXT	_tas(SB), $0
 	MOVW	R1, R2		/* address of key */
 tas1:
 	MOVW	$1, R3
--- a/sys/src/9/teg2/l.s
+++ b/sys/src/9/teg2/l.s
@@ -843,7 +843,8 @@
 
 #include "cache.v7.s"
 
-TEXT	cas+0(SB),0,$12		/* r0 holds p */
+TEXT	cas(SB),0,$12
+TEXT	cmpswap(SB),0,$12	/* r0 holds p */
 	MOVW	ov+4(FP), R1
 	MOVW	nv+8(FP), R2
 spin:
@@ -863,6 +864,7 @@
 	RET
 
 TEXT	tas(SB), $-4			/* _tas(ulong *) */
+TEXT	_tas(SB), $-4
 	/* returns old (R0) after modifying (R0) */
 	MOVW	R0,R5
 	DMB
--- a/sys/src/9/teg2/main.c
+++ b/sys/src/9/teg2/main.c
@@ -920,12 +920,6 @@
 		imagmem->maxsize = kpages;
 }
 
-int
-cmpswap(long *addr, long old, long new)
-{
-	return cas((int *)addr, old, new);
-}
-
 void
 advertwfi(void)			/* advertise my wfi status */
 {
--- a/sys/src/9/xen/l.s
+++ b/sys/src/9/xen/l.s
@@ -195,28 +195,10 @@
  * Test-And-Set
  */
 TEXT tas(SB), $0
+TEXT _tas(SB), $0
 	MOVL	$0xDEADDEAD, AX
 	MOVL	lock+0(FP), BX
 	XCHGL	AX, (BX)			/* lock->key */
-	RET
-
-TEXT _xinc(SB), $0				/* void _xinc(long*); */
-	MOVL	l+0(FP), AX
-	LOCK;	INCL 0(AX)
-	RET
-
-TEXT _xdec(SB), $0				/* long _xdec(long*); */
-	MOVL	l+0(FP), BX
-	XORL	AX, AX
-	LOCK;	DECL 0(BX)
-	JLT	_xdeclt
-	JGT	_xdecgt
-	RET
-_xdecgt:
-	INCL	AX
-	RET
-_xdeclt:
-	DECL	AX
 	RET
 
 TEXT	getstack(SB), $0
--- a/sys/src/9/zynq/l.s
+++ b/sys/src/9/zynq/l.s
@@ -237,7 +237,8 @@
 	MOVW $1, R0
 	RET
 
-TEXT	cas(SB), $0
+TEXT cas(SB), $0
+TEXT cmpswap(SB), $0
 	MOVW	ov+4(FP), R1
 	MOVW	nv+8(FP), R2
 spincas:
@@ -256,6 +257,7 @@
 	RET
 
 TEXT tas(SB), $0
+TEXT _tas(SB), $0
 	MOVW $0xDEADDEAD, R2
 _tas1:
 	LDREX (R0), R1
--- a/sys/src/9/zynq/main.c
+++ b/sys/src/9/zynq/main.c
@@ -70,14 +70,6 @@
 	p->pcycles = -p->kentry;
 }
 
-int
-cmpswap(long *a, long b, long c)
-{
-	extern int cas(int *, int, int);
-
-	return cas((int *) a, b, c);
-}
-
 void
 kexit(Ureg *)
 {