xref: /386bsd/usr/src/kernel/ddb/i386/db_setjmp.s (revision a2142627)
1/*
2 * Copyright (c) 1994 William F. Jolitz.
3 * 386BSD Copyright Restrictions Apply. All Other Rights Reserved.
4 *
5 * $Id: $
6 * These are non-local goto functions, similar to their user mode
7 * compliments in the C library. They are only used in the debugger
8 * implementation.
9 */
10#include "asm.h"
11
12ENTRY(setjmp)
13	movl	4(%esp),%eax
14	movl	%ebx, (%eax)		/* save ebx */
15	movl	%esp, 4(%eax)		/* save esp */
16	movl	%ebp, 8(%eax)		/* save ebp */
17	movl	%esi,12(%eax)		/* save esi */
18	movl	%edi,16(%eax)		/* save edi */
19	movl	(%esp),%edx		/* get rta */
20	movl	%edx,20(%eax)		/* save eip */
21	xorl	%eax,%eax		/* return (0); */
22	ret
23
24ENTRY(longjmp)
25	movl	4(%esp),%eax
26	movl	 (%eax),%ebx		/* restore ebx */
27	movl	 4(%eax),%esp		/* restore esp */
28	movl	 8(%eax),%ebp		/* restore ebp */
29	movl	12(%eax),%esi		/* restore esi */
30	movl	16(%eax),%edi		/* restore edi */
31	movl	20(%eax),%edx		/* get rta */
32	movl	%edx,(%esp)		/* put in return frame */
33	xorl	%eax,%eax		/* return (1); */
34	incl	%eax
35	ret
36