ref: 95565d289ebf40a697654cf243021a85572e91b6
parent: 45d1d31847dfc425410a107b66537e567c0d5637
author: cinap_lenrek <[email protected]>
date: Sat Feb 28 08:26:38 EST 2015
libthread: remove unused internal functions and old xinc assembler files
--- a/sys/src/libthread/create.c
+++ b/sys/src/libthread/create.c
@@ -109,44 +109,3 @@
{
return procrfork(f, arg, stacksize, 0);
}
-
-void
-_freeproc(Proc *p)
-{
- Thread *t, *nextt;
-
- for(t = p->threads.head; t; t = nextt){
- if(t->cmdname)
- free(t->cmdname);
- assert(t->stk != nil);
- free(t->stk);
- nextt = t->nextt;
- free(t);
- }
- free(p);
-}
-
-void
-_freethread(Thread *t)
-{
- Proc *p;
- Thread **l;
-
- p = t->proc;
- lock(&p->lock);
- for(l=&p->threads.head; *l; l=&(*l)->nextt){
- if(*l == t){
- *l = t->nextt;
- if(*l == nil)
- p->threads.tail = l;
- break;
- }
- }
- unlock(&p->lock);
- if (t->cmdname)
- free(t->cmdname);
- assert(t->stk != nil);
- free(t->stk);
- free(t);
-}
-
--- a/sys/src/libthread/threadimpl.h
+++ b/sys/src/libthread/threadimpl.h
@@ -159,8 +159,6 @@
char err[ERRMAX];
};
-void _freeproc(Proc*);
-void _freethread(Thread*);
Proc* _newproc(void(*)(void*), void*, uint, char*, int, int);
int _procsplhi(void);
void _procsplx(int);
@@ -183,7 +181,6 @@
void _threadnote(void*, char*);
void _threadready(Thread*);
void* _threadrendezvous(void*, void*);
-void _threadsignal(void);
void _threadsysfatal(char*, va_list);
void** _workerdata(void);
--- a/sys/src/libthread/xinc386.s
+++ /dev/null
@@ -1,29 +1,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
--- a/sys/src/libthread/xincalpha.s
+++ /dev/null
@@ -1,19 +1,0 @@
-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
-
--- a/sys/src/libthread/xincamd64.s
+++ /dev/null
@@ -1,20 +1,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
--- a/sys/src/libthread/xincarm.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "xincport.h"
--- a/sys/src/libthread/xincmips.s
+++ /dev/null
@@ -1,46 +1,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
--- a/sys/src/libthread/xincport.h
+++ /dev/null
@@ -1,25 +1,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;
-}
--- a/sys/src/libthread/xincpower.s
+++ /dev/null
@@ -1,21 +1,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