From 955fab9d867ac9c7fd19de3a338f25f96c145e62 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 5 Dec 2005 21:07:24 +0000 Subject: [PATCH] Remove LWP code for targets we no longer support: VAX/MIPS Ultrix (dropped in Make.sysdefs rev. 1.12), 386 USL/Unixware (unclear, long ago), 386BSD (never been?) --- src/lib/lwp/Makefile | 5 -- src/lib/lwp/arch.c | 130 +++++------------------------------------ src/lib/lwp/lwpint.h | 2 +- src/lib/lwp/mipsarch.s | 71 ---------------------- 4 files changed, 14 insertions(+), 194 deletions(-) delete mode 100644 src/lib/lwp/mipsarch.s diff --git a/src/lib/lwp/Makefile b/src/lib/lwp/Makefile index 4c27b824..4b47caf7 100644 --- a/src/lib/lwp/Makefile +++ b/src/lib/lwp/Makefile @@ -36,8 +36,6 @@ LIB = $(SRCDIR)/lib/liblwp.a OBJS = arch.o lwp.o queue.o sel.o sem.o status.o -MIPSOBJS = mipsarch.o - AIXOBJS = lwpInit.o lwpRestore.o lwpSave.o GENMASTER = GLOBALCFLAGS="$(GLOBALCFLAGS)" GLOBALLFLAGS="$(GLOBALLFLAGS)" @@ -51,9 +49,6 @@ $(LIB): $(OBJS) $(EXTRAOBJS) nt: -mipsultrix: - make EXTRAOBJS="$(MIPSOBJS)" $(GENMASTER) - aix: make EXTRAOBJS="$(AIXOBJS)" $(GENMASTER) diff --git a/src/lib/lwp/arch.c b/src/lib/lwp/arch.c index ba40382b..ad0fdc91 100644 --- a/src/lib/lwp/arch.c +++ b/src/lib/lwp/arch.c @@ -39,6 +39,17 @@ #include "lwp.h" #include "lwpint.h" +/* + * Implement machine-dependent functions lwpInitContext(), lwpSave(), + * lwpRestore(). + * + * If lwpSave() and lwpRestore() are #def'd to setjmp() and longjmp(), + * then lwpInitContext() needs to set up the jmp_buf for a longjmp(), + * similar to setjmp(). To figure that out for another machine, check + * their source or reverse engineer. + */ + + #if defined UCONTEXT /* * Alternate aproach using setcontext and getcontext instead of setjmp and @@ -191,14 +202,6 @@ lwpRestore(jmp_buf jb) asm volatile ("ldi 1, %ret0"); } -#elif defined(BSD386) -void -lwpInitContext(struct lwpProc *newp, void *sp) -{ - newp->context[2] = (int)sp; - newp->context[0] = (int)lwpEntryPoint; -} - #elif defined(FBSD) void @@ -240,78 +243,6 @@ lwpInitContext(struct lwpProc *newp, void *sp) newp->context[3] = (int)lwpEntryPoint; } -#elif defined(__vax) - -#include - -void -lwpInitContext(struct lwpProc *newp, void *stack) -{ - int *sp = (int *)stack; - int *fp = 0; - - /* Build root frame on new stack for lwpEntryPoint */ - *--sp = 0; /* pc */ - *--sp = (int)fp; /* fp */ - *--sp = 0; /* ap */ - *--sp = 0; /* psw */ - *--sp = 0; /* condition handler */ - fp = sp; - - /* Build stack frame to return from. */ - *--sp = (int)lwpEntryPoint + 2; /* pc */ - *--sp = (int)fp; /* fp */ - *--sp = 0; /* ap */ - *--sp = 0; /* psw */ - *--sp = 0; /* condition handler */ - fp = sp; - - /* Fill in the context */ - /* Note: This is *not* how libc fills out jump buffers. */ - newp->context[0] = 0; /* r6 */ - newp->context[1] = 0; - newp->context[2] = 0; - newp->context[3] = 0; - newp->context[4] = 0; - newp->context[5] = 0; /* r11 */ - newp->context[6] = 0; /* ap */ - newp->context[7] = (int)fp; /* fp */ - return; -} - -int -lwpSave(jmp_buf jb) -{ - asm("movl 4(ap), r0"); /* r0 = &jb */ - asm("movl r6, (r0)"); /* jb[0] = r6 */ - asm("movl r7, 4(r0)"); - asm("movl r8, 8(r0)"); - asm("movl r9, 12(r0)"); - asm("movl r10, 16(r0)"); - asm("movl r11, 20(r0)"); - asm("movl ap, 24(r0)"); - asm("movl fp, 28(r0)"); /* jb[7] = fp */ - return 0; -} - -void -lwpRestore(jmp_buf jb) -{ - asm("movl 4(ap), r0"); /* r0 = &jb */ - asm("movl (r0), r6"); /* r6 = jb[0] */ - asm("movl 4(r0), r7"); - asm("movl 8(r0), r8"); - asm("movl 12(r0), r9"); - asm("movl 16(r0), r10"); - asm("movl 20(r0), r11"); - asm("movl 24(r0), ap"); - asm("movl 28(r0), fp"); /* fp = jb[7] */ - asm("movl $1, r0"); /* faked return 1 from lwpSave() */ - asm("ret"); - return; -} - - #elif defined(SUN4) void @@ -339,43 +270,6 @@ lwpInitContext(struct lwpProc *newp, void *sp) } } -#elif defined(__USLC__) && defined(i386) - -/* USL/Unixware on an Intel 386/486/... processor. - * Tested on Unixware v1.1.2, based on SYSV R4.2 - */ - -/* As per normal empire documentation, there is none. - * - * But, what we are attempting to do here is set up a longjump - * context buffer so that the lwpEntryPoint is called when - * the thread starts. - * - * I.E., what a setjmp/longjmp call set would do. - * - * How to figure this out? Well, without the setjmp code, you - * need to reverse engineer it by printing out the context buffer - * and the processor registers, and mapping which ones need - * to be set. - * - * Alternatively, you can single instruction step through the longjmp - * function, and figure out the offsets that it uses. - * - * Using offsets in bytes, - * context + 0x04 [1] -> esi (general purpose reg) - * context + 0x08 [2] -> edi (general purpose reg) - * context + 0x0C [3] -> ebp (general purpose or parameter passing) - * context + 0x10 [4] -> esp (stack) - * context + 0x14 [5] -> jump location for return - */ - -void -lwpInitContext(struct lwpProc *newp, void *sp) -{ - newp->context[4] = (int)sp; - newp->context[5] = (int)lwpEntryPoint; -} - #elif defined(ALPHA) #include @@ -409,6 +303,8 @@ lwpRestore(jmp_buf jb) asm("bsr %ra, __longjump_resume"); } +#elif defined(AIX32) +/* Code is in .s files, as compiler doesn't grok asm */ #endif #endif diff --git a/src/lib/lwp/lwpint.h b/src/lib/lwp/lwpint.h index bfd9e6e2..da253dd9 100644 --- a/src/lib/lwp/lwpint.h +++ b/src/lib/lwp/lwpint.h @@ -39,7 +39,7 @@ void lwpInitContext(volatile struct lwpProc * volatile, void *); #else void lwpInitContext(struct lwpProc *, void *); #endif -#if (defined(hpux) && !defined(hpc)) || defined(MIPS) || defined(AIX32) || defined(ALPHA) || defined(__vax) +#if (defined(hpux) && !defined(hpc)) || defined(AIX32) || defined(ALPHA) int lwpSave(jmp_buf); void lwpRestore(jmp_buf); #elif defined(SUN4) diff --git a/src/lib/lwp/mipsarch.s b/src/lib/lwp/mipsarch.s deleted file mode 100644 index 29e143b2..00000000 --- a/src/lib/lwp/mipsarch.s +++ /dev/null @@ -1,71 +0,0 @@ - .verstamp 3 0 - .extern tzname 0 - .extern LwpCurrent 4 - .lcomm $$9 4 - .text - .align 2 - .file 2 "arch.new.c" - .globl lwpSave - .ent lwpSave 2 -lwpSave: - .option O1 - subu $sp, 32 - sw $31, 28($sp) - sw $4, 32($sp) - .mask 0x80000000, -4 - .frame $sp, 32, $31 - sw $0, $$9 - sw $30, 0($4) - sw $sp, 4($4) - sw $31, 8($4) - sd $16, 12($4) - sd $18, 20($4) - sd $20, 28($4) - sd $22, 36($4) - lw $2, $$9 - .livereg 0x2000FF0E,0x00000FFF - lw $31, 28($sp) - addu $sp, 32 - j $31 - .end lwpSave - .text - .align 2 - .file 2 "arch.new.c" - .globl lwpRestore - .ent lwpRestore 2 -lwpRestore: - .option O1 - subu $sp, 32 - sw $31, 28($sp) - sw $4, 32($sp) - .mask 0x80000000, -4 - .frame $sp, 32, $31 - li $14, 1 - sw $14, $$9 - lw $30, 0($4) - lw $sp, 4($4) - lw $31, 8($4) - ld $16, 12($4) - ld $18, 20($4) - ld $20, 28($4) - ld $22, 36($4) - lw $2, $$9 - .livereg 0x0000FF0E,0x00000FFF - addu $sp, 32 - j $31 - .end lwpRestore - .text - .align 2 - .file 2 "arch.new.c" - .globl lwpInitContext - .ent lwpInitContext 2 -lwpInitContext: - .option O1 - .frame $sp, 0, $31 - sw $5, 4($4) - la $14, lwpEntryPoint - sw $14, 8($4) - .livereg 0x0000FF0E,0x00000FFF - j $31 - .end lwpInitContext -