xref: /original-bsd/lib/libcompat/4.1/tahoe/reset.s (revision a9c19d04)
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	1.2 (Berkeley/CCI) 08/01/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 r2 - r12, 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, 0)
29	movab	setsav,r0
30	storer	$0x1ffc, (r0)
31	movl	(fp),44(r0)		# fp
32	moval	4(fp),48(r0)		# sp
33	movl	-8(fp),52(r0)		# pc
34	clrl	r0
35	ret
36
37ENTRY(reset, 0)
38	movl	4(fp),r0	# returned value
39	movab	setsav,r1
40	loadr	$0x1ffc,(r1)
41	movl	44(r1),fp
42	movl	48(r1),sp
43	jmp 	*52(r1)
44
45	.data
46setsav:	.space	14*4
47