* Bring back rbuild build to be used until bug 6372 is fixed.
[reactos.git] / ntoskrnl / kdbg / i386 / setjmp.S
1 .file "setjmp.S"
2 /*
3 * Copyright (C) 1998, 1999, Jonathan S. Shapiro.
4 *
5 * This file is part of the EROS Operating System.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22 /* #include <eros/i486/asm.h> */
23
24
25 /*
26 * typedef struct {
27 * unsigned long ebx, esi, edi;
28 * unsigned long ebp;
29 * unsigned long sp;
30 * unsigned long pc;
31 * } jmp_buf[1];
32 */
33
34 /*
35 * On entry, the stack to setjmp looks like:
36 *
37 * ptr to jmp_buf
38 * return PC
39 */
40 .globl _setjmp
41 .globl __setjmp
42 _setjmp:
43 __setjmp:
44 pushl %ebp
45 movl %esp,%ebp
46
47 movl 0x8(%ebp),%eax /* address of jmp_buf to eax */
48 movl %ebx,(%eax) /* save %ebx */
49 movl %esi,4(%eax) /* save %esi */
50 movl %edi,8(%eax) /* save %edi */
51 leal 8(%ebp),%edx /* calling proc's esp, not ours! */
52 movl %edx,16(%eax)
53 movl 4(%ebp), %edx /* save return PC */
54 movl %edx,20(%eax)
55 movl 0(%ebp),%edx /* calling proc's ebp, not ours! */
56 movl %edx,12(%eax)
57
58 xorl %eax,%eax /* return 0 the first time */
59 leave
60 ret
61