shithub: riscv

Download patch

ref: 72ba3571a3166ca69d28ccebf547675711bd800c
parent: 0a2b418535915c6954fa9df575d71fb04171bb34
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Jun 7 21:35:22 EDT 2014

kernel: remove _xinc()/_xdec()

as with the Block refcount changes, _xinc() and _xdec() arent
used anymore, so remove them.

architecure can still define ainc()/adec() when it needs them.

--- a/sys/src/9/alphapc/l.s
+++ b/sys/src/9/alphapc/l.s
@@ -174,25 +174,6 @@
 tas2:
 	RET
 
-TEXT	_xdec(SB), $-8
-	MOVQ	R0, R1			/* p */
-dec1:
-	MOVLL	(R1), R0		/* *p */
-	SUBL	$1, R0
-	MOVQ	R0, R2
-	MOVLC	R2, (R1)		/* --(*p) */
-	BEQ	R2, dec1		/* write failed, retry */
-	RET
-
-TEXT	_xinc(SB), $-8
-	MOVQ	R0, R1			/* p */
-inc1:
-	MOVLL	(R1), R0		/* *p */
-	ADDL	$1, R0
-	MOVLC	R0, (R1)		/* (*p)++ */
-	BEQ	R0, inc1		/* write failed, retry */
-	RET
-
 TEXT	cmpswap(SB), $-8
 	MOVQ	R0, R1	/* p */
 	MOVL	old+4(FP), R2
--- a/sys/src/9/bitsy/main.c
+++ b/sys/src/9/bitsy/main.c
@@ -524,28 +524,6 @@
 	return nil;
 }
 
-long
-_xdec(long *p)
-{
-	int s;
-	long v;
-
-	s = splhi();
-	v = --*p;
-	splx(s);
-	return v;
-}
-
-void
-_xinc(long *p)
-{
-	int s;
-
-	s = splhi();
-	++*p;
-	splx(s);
-}
-
 int
 cmpswap(long *addr, long old, long new)
 {
--- a/sys/src/9/kw/arch.c
+++ b/sys/src/9/kw/arch.c
@@ -176,28 +176,6 @@
  * atomic ops
  * make sure that we don't drag in the C library versions
  */
-
-long
-_xdec(long *p)
-{
-	int s, v;
-
-	s = splhi();
-	v = --*p;
-	splx(s);
-	return v;
-}
-
-void
-_xinc(long *p)
-{
-	int s;
-
-	s = splhi();
-	++*p;
-	splx(s);
-}
-
 int
 ainc(int *p)
 {
--- a/sys/src/9/mtx/l.s
+++ b/sys/src/9/mtx/l.s
@@ -281,26 +281,6 @@
 	ISYNC
 	RETURN
 
-TEXT	_xinc(SB),$0	/* void _xinc(long *); */
-	MOVW	R3, R4
-xincloop:
-	DCBF	(R4)	/* fix for 603x bug */
-	LWAR	(R4), R3
-	ADD		$1, R3
-	STWCCC	R3, (R4)
-	BNE		xincloop
-	RETURN
-
-TEXT	_xdec(SB),$0	/* long _xdec(long *); */
-	MOVW	R3, R4
-xdecloop:
-	DCBF	(R4)	/* fix for 603x bug */
-	LWAR	(R4), R3
-	ADD		$-1, R3
-	STWCCC	R3, (R4)
-	BNE		xdecloop
-	RETURN
-
 TEXT cmpswap(SB),$0	/* int cmpswap(long*, long, long) */
 	MOVW	R3, R4	/* addr */
 	MOVW	old+4(FP), R5
--- a/sys/src/9/omap/arch.c
+++ b/sys/src/9/omap/arch.c
@@ -178,28 +178,6 @@
  * atomic ops
  * make sure that we don't drag in the C library versions
  */
-
-long
-_xdec(long *p)
-{
-	int s, v;
-
-	s = splhi();
-	v = --*p;
-	splx(s);
-	return v;
-}
-
-void
-_xinc(long *p)
-{
-	int s;
-
-	s = splhi();
-	++*p;
-	splx(s);
-}
-
 int
 ainc(int *p)
 {
--- a/sys/src/9/omap4/l.s
+++ b/sys/src/9/omap4/l.s
@@ -146,7 +146,6 @@
 	RET
 
 TEXT ainc(SB), $-4
-TEXT _xinc(SB), $-4
 spinainc:
 	LDREX(0,1)
 	ADD	$1, R1
@@ -157,7 +156,6 @@
 	RET
 
 TEXT adec(SB), $-4
-TEXT _xdec(SB), $-4
 spinadec:
 	LDREX(0,1)
 	SUB	$1, R1
--- a/sys/src/9/pc/l.s
+++ b/sys/src/9/pc/l.s
@@ -700,25 +700,6 @@
 	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 mb386(SB), $0
 	POPL	AX				/* return PC */
 	PUSHFL
--- a/sys/src/9/pc/sdodin.c
+++ b/sys/src/9/pc/sdodin.c
@@ -932,11 +932,6 @@
 	m = 1<<i;
 	n = cmd | Ditor | i*Dsatareg | m*Dphyno | i*Dcslot;
 //	print("cqwp\t%.8ux : n %ux : d%d; \n", c->cq[0], n, i);
-	/*
-	 * xinc doesn't return the previous value and i can't
-	 * figure out how to do this without a lock
-	 *	s = _xinc(&c->dqwp);
-	 */
 	d->cmd->cflag = Active;
 	ilock(c);
 	s = c->dqwp++;
--- a/sys/src/9/pc64/l.s
+++ b/sys/src/9/pc64/l.s
@@ -509,17 +509,6 @@
 /*
  * Synchronisation
  */
-TEXT _xinc(SB), 1, $-4				/* void _xinc(long*); */
-	MOVL	$1, AX
-	LOCK; XADDL AX, (RARG)
-	RET
-
-TEXT _xdec(SB), 1, $-4				/* long _xdec(long*); */
-	MOVL	$-1, AX
-	LOCK; XADDL AX, (RARG)
-	SUBL	$1, AX
-	RET
-
 TEXT tas(SB), 1, $-4
 	MOVL	$0xdeaddead, AX
 	XCHGL	AX, (RARG)			/*  */
--- a/sys/src/9/port/portfns.h
+++ b/sys/src/9/port/portfns.h
@@ -388,8 +388,6 @@
 uint		nhgetl(void*);
 ushort		nhgets(void*);
 ulong		µs(void);
-void		_xinc(long*);
-long		_xdec(long*);
 long		lcycles(void);
 
 #pragma varargck argpos iprint	1
--- a/sys/src/9/ppc/l.s
+++ b/sys/src/9/ppc/l.s
@@ -361,26 +361,6 @@
 	SYNC
 	RETURN
 
-TEXT _xinc(SB), $0			/* void _xinc(long *); */
-	MOVW	R3, R4
-xincloop:
-	DCBF	(R4)			/* fix for 603x bug */
-	LWAR	(R4), R3
-	ADD	$1, R3
-	STWCCC	R3, (R4)
-	BNE	xincloop
-	RETURN
-
-TEXT _xdec(SB), $0			/* long _xdec(long *); */
-	MOVW	R3, R4
-xdecloop:
-	DCBF	(R4)			/* fix for 603x bug */
-	LWAR	(R4), R3
-	ADD	$-1, R3
-	STWCCC	R3, (R4)
-	BNE	xdecloop
-	RETURN
-
 TEXT tlbflushall(SB), $0
 	MOVW	$TLBENTRIES, R3
 	MOVW	R3, CTR