xref: /original-bsd/lib/libc/i386/gen/_setjmp.s (revision f608913f)
1/*-
2 * Copyright (c) 1990, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * %sccs.include.redist.c%
9 */
10
11#if defined(LIBC_SCCS) && !defined(lint)
12	.asciz "@(#)_setjmp.s	8.1 (Berkeley) 06/04/93"
13#endif /* LIBC_SCCS and not lint */
14
15/*
16 * C library -- _setjmp, _longjmp
17 *
18 *	_longjmp(a,v)
19 * will generate a "return(v)" from the last call to
20 *	_setjmp(a)
21 * by restoring registers from the stack.
22 * The previous signal state is NOT restored.
23 */
24
25#include "DEFS.h"
26
27ENTRY(_setjmp)
28	movl	4(%esp),%eax
29	movl	0(%esp),%edx
30	movl	%edx, 0(%eax)		/* rta */
31	movl	%ebx, 4(%eax)
32	movl	%esp, 8(%eax)
33	movl	%ebp,12(%eax)
34	movl	%esi,16(%eax)
35	movl	%edi,20(%eax)
36	movl	$0,%eax
37	ret
38
39ENTRY(_longjmp)
40	movl	4(%esp),%edx
41	movl	8(%esp),%eax
42	movl	0(%edx),%ecx
43	movl	4(%edx),%ebx
44	movl	8(%edx),%esp
45	movl	12(%edx),%ebp
46	movl	16(%edx),%esi
47	movl	20(%edx),%edi
48	cmpl	$0,%eax
49	jne	1f
50	movl	$1,%eax
511:	movl	%ecx,0(%esp)
52	ret
53