source: trunk/libs/newlib/src/newlib/libc/sys/sysvi386/_longjmp.S

Last change on this file was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 650 bytes
Line 
1/
2/ our buffer looks like:
3/  eax,ebx,ecx,edx,esi,edi,esp,ebp,pc
4/
5/ _longjmp is called with two parameters:  jmp_buf*,int
6/ jmp_buf* is at 4(%esp), int is at 8(%esp)
7/ retaddr is, of course, at (%esp)
8
9        .globl  _longjmp
10        .globl  longjmp
11_longjmp:
12longjmp:
13        movl    4(%esp), %ebx   / address of buf
14        movl    8(%esp), %eax   / store return value
15
16        movl    24(%ebx), %esp  / restore stack
17        movl    32(%ebx), %edi
18/ Next line sets up return address.
19        movl    %edi, 0(%esp)   
20        movl    8(%ebx), %ecx
21        movl    12(%ebx), %edx
22        movl    16(%ebx), %esi
23        movl    20(%ebx), %edi
24        movl    28(%ebx), %ebp
25        movl    4(%ebx), %ebx
26        testl   %eax,%eax
27        jne     bye
28        incl    %eax            / eax hold 0 if we are here
29bye:
30        ret
31
Note: See TracBrowser for help on using the repository browser.