112027Sjungma@eit.uni-kl.de/*
212027Sjungma@eit.uni-kl.de * QuickThreads -- Threads-building toolkit.
312027Sjungma@eit.uni-kl.de * Copyright (c) 1993 by David Keppel
412027Sjungma@eit.uni-kl.de *
512027Sjungma@eit.uni-kl.de * Permission to use, copy, modify and distribute this software and
612027Sjungma@eit.uni-kl.de * its documentation for any purpose and without fee is hereby
712027Sjungma@eit.uni-kl.de * granted, provided that the above copyright notice and this notice
812027Sjungma@eit.uni-kl.de * appear in all copies.  This software is provided as a
912027Sjungma@eit.uni-kl.de * proof-of-concept and for demonstration purposes; there is no
1012027Sjungma@eit.uni-kl.de * representation about the suitability of this software for any
1112027Sjungma@eit.uni-kl.de * purpose.
1212027Sjungma@eit.uni-kl.de */
1312027Sjungma@eit.uni-kl.de
1412027Sjungma@eit.uni-kl.de	.text
1512027Sjungma@eit.uni-kl.de
1612027Sjungma@eit.uni-kl.de	.globl _qt_abort
1712027Sjungma@eit.uni-kl.de	.globl _qt_block
1812027Sjungma@eit.uni-kl.de	.globl _qt_blocki
1912027Sjungma@eit.uni-kl.de	.globl _qt_start
2012027Sjungma@eit.uni-kl.de	.globl _qt_vstart
2112027Sjungma@eit.uni-kl.de
2212027Sjungma@eit.uni-kl.de
2312027Sjungma@eit.uni-kl.de/*
2412027Sjungma@eit.uni-kl.de// Calls to these routines have the signature
2512027Sjungma@eit.uni-kl.de//
2612027Sjungma@eit.uni-kl.de//	void *block (func, arg1, arg2, newsp)
2712027Sjungma@eit.uni-kl.de//
2812027Sjungma@eit.uni-kl.de// Since the prologue saves 5 registers, nargs, pc, fp, ap, mask, and
2912027Sjungma@eit.uni-kl.de// a condition handler (at sp+0), the first argument is 40=4*10 bytes
3012027Sjungma@eit.uni-kl.de// offset from the stack pointer.
3112027Sjungma@eit.uni-kl.de*/
3212027Sjungma@eit.uni-kl.de_qt_block:
3312027Sjungma@eit.uni-kl.de_qt_blocki:
3412027Sjungma@eit.uni-kl.de_qt_abort:
3512027Sjungma@eit.uni-kl.de	.word 0x7c0		/* Callee-save mask: 5 registers. */
3612027Sjungma@eit.uni-kl.de	movl 56(sp),r1		/* Get stack pointer of new thread. */
3712027Sjungma@eit.uni-kl.de	movl 52(sp),-(r1)	/* Push arg2 */
3812027Sjungma@eit.uni-kl.de	movl 48(sp),-(r1)	/* Push arg1 */
3912027Sjungma@eit.uni-kl.de	movl sp,-(r1)		/* Push arg0 */
4012027Sjungma@eit.uni-kl.de
4112027Sjungma@eit.uni-kl.de	movl 44(sp),r0		/* Get helper to call. */
4212027Sjungma@eit.uni-kl.de	movl r1,sp		/* Move to new thread's stack. */
4312027Sjungma@eit.uni-kl.de	addl3 sp,$12,fp		/* .. including the frame pointer. */
4412027Sjungma@eit.uni-kl.de	calls $3,(r0)		/* Call helper. */
4512027Sjungma@eit.uni-kl.de
4612027Sjungma@eit.uni-kl.de	ret
4712027Sjungma@eit.uni-kl.de
4812027Sjungma@eit.uni-kl.de_qt_start:
4912027Sjungma@eit.uni-kl.de	movl (sp)+,r0		/* Get `only'. */
5012027Sjungma@eit.uni-kl.de	calls $3,(r0)		/* Call `only'. */
5112027Sjungma@eit.uni-kl.de	calls $0,_qt_error	/* `only' erroniously returned. */
5212027Sjungma@eit.uni-kl.de
5312027Sjungma@eit.uni-kl.de
5412027Sjungma@eit.uni-kl.de_qt_vstart:
5512027Sjungma@eit.uni-kl.de	movl (sp)+,r10		/* Get `pt'. */
5612027Sjungma@eit.uni-kl.de	movl (sp)+,r9		/* Get `startup'. */
5712027Sjungma@eit.uni-kl.de	movl (sp)+,r8		/* Get `vuserf'. */
5812027Sjungma@eit.uni-kl.de	movl (sp)+,r7		/* Get `cleanup'. */
5912027Sjungma@eit.uni-kl.de
6012027Sjungma@eit.uni-kl.de	pushl r10		/* Push `qt'. */
6112027Sjungma@eit.uni-kl.de	calls $1,(r9)		/* Call `startup', pop `qt' on return. */
6212027Sjungma@eit.uni-kl.de
6312027Sjungma@eit.uni-kl.de	calls (sp)+,(r8)	/* Call user's function. */
6412027Sjungma@eit.uni-kl.de
6512027Sjungma@eit.uni-kl.de	pushl r0		/* Push `vuserf_retval'. */
6612027Sjungma@eit.uni-kl.de	pushl r10		/* Push `qt'. */
6712027Sjungma@eit.uni-kl.de	calls $2,(r7)		/* Call `cleanup', never return. */
6812027Sjungma@eit.uni-kl.de
6912027Sjungma@eit.uni-kl.de	calls $0,_qt_error	/* `cleanup' erroniously returned. */
70