xref: /original-bsd/lib/libcompat/4.1/vax/reset.s (revision 2301fdfb)
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved.  The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6#ifdef LIBC_SCCS
7_sccsid:.asciz	"@(#)reset.s	5.4 (Berkeley) 03/09/86"
8#endif LIBC_SCCS
9
10/*
11 * C library -- reset, setexit
12 *
13 *	reset(x)
14 * will generate a "return" from
15 * the last call to
16 *	setexit()
17 * by restoring r6 - r12, ap, fp
18 * and doing a return.
19 * The returned value is x; on the original
20 * call the returned value is 0.
21 *
22 * useful for going back to the main loop
23 * after a horrible error in a lowlevel
24 * routine.
25 */
26#include "DEFS.h"
27
28ENTRY(setexit)
29	movab	setsav,r0
30	movq	r6,(r0)+
31	movq	r8,(r0)+
32	movq	r10,(r0)+
33	movq	8(fp),(r0)+		# ap, fp
34	movab	4(ap),(r0)+		# sp
35	movl	16(fp),(r0)		# pc
36	clrl	r0
37	ret
38
39ENTRY(reset)
40	movl	4(ap),r0	# returned value
41	movab	setsav,r1
42	movq	(r1)+,r6
43	movq	(r1)+,r8
44	movq	(r1)+,r10
45	movq	(r1)+,r12
46	movl	(r1)+,sp
47	jmp 	*(r1)
48
49	.data
50setsav:	.space	10*4
51