summaryrefslogtreecommitdiff
path: root/ext/systemc/src/sysc/qt/md/vax.s
blob: fed03f043f6f1d7b5ff831a6d0305111c472ce13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * QuickThreads -- Threads-building toolkit.
 * Copyright (c) 1993 by David Keppel
 *
 * Permission to use, copy, modify and distribute this software and
 * its documentation for any purpose and without fee is hereby
 * granted, provided that the above copyright notice and this notice
 * appear in all copies.  This software is provided as a
 * proof-of-concept and for demonstration purposes; there is no
 * representation about the suitability of this software for any
 * purpose.
 */

	.text

	.globl _qt_abort
	.globl _qt_block
	.globl _qt_blocki
	.globl _qt_start
	.globl _qt_vstart


/*
// Calls to these routines have the signature
//
//	void *block (func, arg1, arg2, newsp)
//
// Since the prologue saves 5 registers, nargs, pc, fp, ap, mask, and
// a condition handler (at sp+0), the first argument is 40=4*10 bytes
// offset from the stack pointer.
*/
_qt_block:
_qt_blocki:
_qt_abort:
	.word 0x7c0		/* Callee-save mask: 5 registers. */
	movl 56(sp),r1		/* Get stack pointer of new thread. */
	movl 52(sp),-(r1)	/* Push arg2 */
	movl 48(sp),-(r1)	/* Push arg1 */
	movl sp,-(r1)		/* Push arg0 */

	movl 44(sp),r0		/* Get helper to call. */
	movl r1,sp		/* Move to new thread's stack. */
	addl3 sp,$12,fp		/* .. including the frame pointer. */
	calls $3,(r0)		/* Call helper. */

	ret

_qt_start:
	movl (sp)+,r0		/* Get `only'. */
	calls $3,(r0)		/* Call `only'. */
	calls $0,_qt_error	/* `only' erroniously returned. */


_qt_vstart:
	movl (sp)+,r10		/* Get `pt'. */
	movl (sp)+,r9		/* Get `startup'. */
	movl (sp)+,r8		/* Get `vuserf'. */
	movl (sp)+,r7		/* Get `cleanup'. */

	pushl r10		/* Push `qt'. */
	calls $1,(r9)		/* Call `startup', pop `qt' on return. */

	calls (sp)+,(r8)	/* Call user's function. */

	pushl r0		/* Push `vuserf_retval'. */
	pushl r10		/* Push `qt'. */
	calls $2,(r7)		/* Call `cleanup', never return. */

	calls $0,_qt_error	/* `cleanup' erroniously returned. */