Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/arch/i386/setjmp.S
Parent Directory | Revision Log
Revision 532 -
(show annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File size: 963 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File size: 963 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | # |
2 | # arch/i386/setjmp.S |
3 | # |
4 | # setjmp/longjmp for the i386 architecture |
5 | # |
6 | |
7 | # |
8 | # The jmp_buf is assumed to contain the following, in order: |
9 | # %ebx |
10 | # %esp |
11 | # %ebp |
12 | # %esi |
13 | # %edi |
14 | # <return address> |
15 | # |
16 | |
17 | .text |
18 | .align 4 |
19 | .globl setjmp |
20 | .type setjmp, @function |
21 | setjmp: |
22 | #ifdef _REGPARM |
23 | movl %eax,%edx |
24 | #else |
25 | movl 4(%esp),%edx |
26 | #endif |
27 | popl %ecx # Return address, and adjust the stack |
28 | xorl %eax,%eax # Return value |
29 | movl %ebx,(%edx) |
30 | movl %esp,4(%edx) # Post-return %esp! |
31 | pushl %ecx # Make the call/return stack happy |
32 | movl %ebp,8(%edx) |
33 | movl %esi,12(%edx) |
34 | movl %edi,16(%edx) |
35 | movl %ecx,20(%edx) # Return address |
36 | ret |
37 | |
38 | .size setjmp,.-setjmp |
39 | |
40 | .text |
41 | .align 4 |
42 | .globl longjmp |
43 | .type longjmp, @function |
44 | longjmp: |
45 | #ifdef _REGPARM |
46 | xchgl %eax,%edx |
47 | #else |
48 | movl 4(%esp),%edx # jmp_ptr address |
49 | movl 8(%esp),%eax # Return value |
50 | #endif |
51 | movl (%edx),%ebx |
52 | movl 4(%edx),%esp |
53 | movl 8(%edx),%ebp |
54 | movl 12(%edx),%esi |
55 | movl 16(%edx),%edi |
56 | jmp *20(%edx) |
57 | |
58 | .size longjmp,.-longjmp |