vax.s revision 12027:1eb7dc7aa10b
110152Satgutier@umich.edu/*
210152Satgutier@umich.edu * QuickThreads -- Threads-building toolkit.
310152Satgutier@umich.edu * Copyright (c) 1993 by David Keppel
410152Satgutier@umich.edu *
510234Syasuko.eckert@amd.com * Permission to use, copy, modify and distribute this software and
610152Satgutier@umich.edu * its documentation for any purpose and without fee is hereby
710152Satgutier@umich.edu * granted, provided that the above copyright notice and this notice
810152Satgutier@umich.edu * appear in all copies.  This software is provided as a
910152Satgutier@umich.edu * proof-of-concept and for demonstration purposes; there is no
1010152Satgutier@umich.edu * representation about the suitability of this software for any
1110152Satgutier@umich.edu * purpose.
1210152Satgutier@umich.edu */
1310152Satgutier@umich.edu
1410152Satgutier@umich.edu	.text
1510152Satgutier@umich.edu
1610152Satgutier@umich.edu	.globl _qt_abort
1710152Satgutier@umich.edu	.globl _qt_block
1810152Satgutier@umich.edu	.globl _qt_blocki
1910152Satgutier@umich.edu	.globl _qt_start
2010152Satgutier@umich.edu	.globl _qt_vstart
2110152Satgutier@umich.edu
2210152Satgutier@umich.edu
2310152Satgutier@umich.edu/*
2410152Satgutier@umich.edu// Calls to these routines have the signature
2510152Satgutier@umich.edu//
2610152Satgutier@umich.edu//	void *block (func, arg1, arg2, newsp)
2710152Satgutier@umich.edu//
2810152Satgutier@umich.edu// Since the prologue saves 5 registers, nargs, pc, fp, ap, mask, and
2910234Syasuko.eckert@amd.com// a condition handler (at sp+0), the first argument is 40=4*10 bytes
3010152Satgutier@umich.edu// offset from the stack pointer.
3110152Satgutier@umich.edu*/
3210152Satgutier@umich.edu_qt_block:
3310152Satgutier@umich.edu_qt_blocki:
3410152Satgutier@umich.edu_qt_abort:
3510234Syasuko.eckert@amd.com	.word 0x7c0		/* Callee-save mask: 5 registers. */
3610152Satgutier@umich.edu	movl 56(sp),r1		/* Get stack pointer of new thread. */
3710152Satgutier@umich.edu	movl 52(sp),-(r1)	/* Push arg2 */
3810152Satgutier@umich.edu	movl 48(sp),-(r1)	/* Push arg1 */
3910152Satgutier@umich.edu	movl sp,-(r1)		/* Push arg0 */
4010152Satgutier@umich.edu
4110152Satgutier@umich.edu	movl 44(sp),r0		/* Get helper to call. */
4210152Satgutier@umich.edu	movl r1,sp		/* Move to new thread's stack. */
4310234Syasuko.eckert@amd.com	addl3 sp,$12,fp		/* .. including the frame pointer. */
4410234Syasuko.eckert@amd.com	calls $3,(r0)		/* Call helper. */
4510234Syasuko.eckert@amd.com
4610234Syasuko.eckert@amd.com	ret
4710234Syasuko.eckert@amd.com
4810234Syasuko.eckert@amd.com_qt_start:
4910234Syasuko.eckert@amd.com	movl (sp)+,r0		/* Get `only'. */
5010234Syasuko.eckert@amd.com	calls $3,(r0)		/* Call `only'. */
5110234Syasuko.eckert@amd.com	calls $0,_qt_error	/* `only' erroniously returned. */
5210234Syasuko.eckert@amd.com
5310234Syasuko.eckert@amd.com
5410234Syasuko.eckert@amd.com_qt_vstart:
5510234Syasuko.eckert@amd.com	movl (sp)+,r10		/* Get `pt'. */
5610234Syasuko.eckert@amd.com	movl (sp)+,r9		/* Get `startup'. */
5710234Syasuko.eckert@amd.com	movl (sp)+,r8		/* Get `vuserf'. */
5810234Syasuko.eckert@amd.com	movl (sp)+,r7		/* Get `cleanup'. */
5910234Syasuko.eckert@amd.com
6010234Syasuko.eckert@amd.com	pushl r10		/* Push `qt'. */
6110234Syasuko.eckert@amd.com	calls $1,(r9)		/* Call `startup', pop `qt' on return. */
6210234Syasuko.eckert@amd.com
6310234Syasuko.eckert@amd.com	calls (sp)+,(r8)	/* Call user's function. */
6410234Syasuko.eckert@amd.com
6510234Syasuko.eckert@amd.com	pushl r0		/* Push `vuserf_retval'. */
6610234Syasuko.eckert@amd.com	pushl r10		/* Push `qt'. */
6710152Satgutier@umich.edu	calls $2,(r7)		/* Call `cleanup', never return. */
6810234Syasuko.eckert@amd.com
6910234Syasuko.eckert@amd.com	calls $0,_qt_error	/* `cleanup' erroniously returned. */
7010234Syasuko.eckert@amd.com