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?)
This commit is contained in:
Markus Armbruster 2005-12-05 21:07:24 +00:00
parent 081e60d86e
commit 955fab9d86
4 changed files with 14 additions and 194 deletions

View file

@ -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)

View file

@ -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 <stdio.h>
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 <c_asm.h>
@ -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

View file

@ -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)

View file

@ -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