Plan 9 from Bell Labs’s /usr/web/sources/contrib/yk/dist/9legacy/applied/libthread-xinc.diff

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


diff -Nru /n/sources/plan9/sys/src/libthread/xinc386.s /sys/src/libthread/xinc386.s
--- /n/sources/plan9/sys/src/libthread/xinc386.s	Thu Feb 28 20:29:20 2002
+++ /sys/src/libthread/xinc386.s	Thu Jan  1 00:00:00 1970
@@ -1,29 +0,0 @@
-/*#define XADDL(s,d) BYTE $0x0F; BYTE $0xC1; BYTE $((0<<6)|(s<<3)|(d))*/
-
-/*TEXT	xadd(SB),$0	/* long xadd(long *, long); */
-
-/*	MOVL	l+0(FP),BX
-/*	MOVL	i+4(FP),AX
-/*	LOCK
-/*	XADDL(0,3)
-/*	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),AX
-	LOCK
-	DECL	0(AX)
-	JZ	iszero
-	MOVL	$1, AX
-	RET
-iszero:
-	MOVL	$0, AX
-	RET
diff -Nru /n/sources/plan9/sys/src/libthread/xincamd64.s /sys/src/libthread/xincamd64.s
--- /n/sources/plan9/sys/src/libthread/xincamd64.s	Thu Sep 22 16:10:54 2005
+++ /sys/src/libthread/xincamd64.s	Thu Jan  1 00:00:00 1970
@@ -1,20 +0,0 @@
-/*TEXT	xadd(SB),$0	/* long xadd(long *, long); */
-
-/*	MOVL	i+8(FP),AX
-/*	LOCK
-/*	XADDL	AX, (RARG)
-/*	RET
-*/
-
-TEXT	_xinc(SB),$0	/* void _xinc(long *); */
-
-	LOCK; INCL	0(RARG)
-	RET
-
-TEXT	_xdec(SB),$0	/* long _xdec(long *); */
-
-	MOVL	$0, AX
-	MOVL	$1, BX
-	LOCK; DECL	0(RARG)
-	CMOVLNE	BX, AX
-	RET
diff -Nru /n/sources/plan9/sys/src/libthread/xincarm.c /sys/src/libthread/xincarm.c
--- /n/sources/plan9/sys/src/libthread/xincarm.c	Thu Feb 28 20:29:20 2002
+++ /sys/src/libthread/xincarm.c	Thu Jan  1 00:00:00 1970
@@ -1 +0,0 @@
-#include "xincport.h"
diff -Nru /n/sources/plan9/sys/src/libthread/xincmips.s /sys/src/libthread/xincmips.s
--- /n/sources/plan9/sys/src/libthread/xincmips.s	Thu Feb 28 20:29:20 2002
+++ /sys/src/libthread/xincmips.s	Thu Jan  1 00:00:00 1970
@@ -1,46 +0,0 @@
-/*
- *	R4000 user level lock code
- */
-
-#define	LL(base, rt)	WORD	$((060<<26)|((base)<<21)|((rt)<<16))
-#define	SC(base, rt)	WORD	$((070<<26)|((base)<<21)|((rt)<<16))
-#define	NOOP		WORD	$0x27
-
-#ifdef oldstyle
-TEXT	xadd(SB), $0
-
-	MOVW	R1, R2		/* address of counter */
-loop:	MOVW	n+4(FP), R3	/* increment */
-	LL(2, 1)
-	NOOP
-	ADD	R1,R3,R3
-	SC(2, 3)
-	NOOP
-	BEQ	R3,loop
-	RET
-#endif
-
-TEXT	_xinc(SB), $0
-
-	MOVW	R1, R2		/* address of counter */
-loop:	MOVW	$1, R3
-	LL(2, 1)
-	NOOP
-	ADD	R1,R3,R3
-	SC(2, 3)
-	NOOP
-	BEQ	R3,loop
-	RET
-
-TEXT	_xdec(SB), $0
-
-	MOVW	R1, R2		/* address of counter */
-loop1:	MOVW	$-1, R3
-	LL(2, 1)
-	NOOP
-	ADD	R1,R3,R3
-	MOVW	R3, R1
-	SC(2, 3)
-	NOOP
-	BEQ	R3,loop1
-	RET
diff -Nru /n/sources/plan9/sys/src/libthread/xincport.h /sys/src/libthread/xincport.h
--- /n/sources/plan9/sys/src/libthread/xincport.h	Thu Sep 22 16:10:05 2005
+++ /sys/src/libthread/xincport.h	Thu Jan  1 00:00:00 1970
@@ -1,25 +0,0 @@
-#include <u.h>
-#include <libc.h>
-#include <thread.h>
-
-static Lock l;
-
-void
-_xinc(long *p)
-{
-
-	lock(&l);
-	(*p)++;
-	unlock(&l);
-}
-
-long
-_xdec(long *p)
-{
-	long r;
-
-	lock(&l);
-	r = --(*p);
-	unlock(&l);
-	return r;
-}
diff -Nru /n/sources/plan9/sys/src/libthread/xincpower.s /sys/src/libthread/xincpower.s
--- /n/sources/plan9/sys/src/libthread/xincpower.s	Thu Jan 15 17:55:37 2009
+++ /sys/src/libthread/xincpower.s	Thu Jan  1 00:00:00 1970
@@ -1,21 +0,0 @@
-TEXT	_xinc(SB),$0	/* void _xinc(long *); */
-
-	MOVW	R3, R4
-xincloop:
-	LWAR	(R4), R3
-	ADD		$1, R3
-	DCBT	(R4)				/* fix 405 errata cpu_210 */
-	STWCCC	R3, (R4)
-	BNE		xincloop
-	RETURN
-
-TEXT	_xdec(SB),$0	/* long _xdec(long *); */
-
-	MOVW	R3, R4
-xdecloop:
-	LWAR	(R4), R3
-	ADD		$-1, R3
-	DCBT	(R4)				/* fix 405 errata cpu_210 */
-	STWCCC	R3, (R4)
-	BNE		xdecloop
-	RETURN

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.