forked from DevSolar/pdclib
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.text | ||
|
||
/* | ||
Buffer layout: | ||
0: unsigned long ebp | ||
4: unsigned long ebx | ||
8: unsigned long edi | ||
12: unsigned long esi | ||
16: unsigned long esp | ||
20: unsigned long eip | ||
*/ | ||
|
||
.globl _longjmp | ||
_longjmp: | ||
movl 4(%esp), %ecx | ||
movl 8(%esp), %eax | ||
|
||
movl (%ecx), %ebp | ||
movl 4(%ecx), %ebx | ||
movl 8(%ecx), %edi | ||
movl 12(%ecx), %esi | ||
movl 16(%ecx), %esp | ||
movl 20(%ecx), %edx | ||
testl %eax, %eax | ||
jnz .r | ||
incl %eax | ||
.r: jmp *%edx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.text | ||
|
||
/* | ||
Buffer layout: | ||
0: unsigned long ebp | ||
4: unsigned long ebx | ||
8: unsigned long edi | ||
12: unsigned long esi | ||
16: unsigned long esp | ||
20: unsigned long eip | ||
*/ | ||
|
||
.globl _setjmp | ||
_setjmp: | ||
movl 4(%esp), %eax | ||
|
||
movl %ebp, (%eax) | ||
movl %ebx, 4(%eax) | ||
movl %edi, 8(%eax) | ||
movl %esi, 12(%eax) | ||
leal 4(%esp), %ecx | ||
movl %ecx, 16(%eax) | ||
movl (%esp), %ecx | ||
movl %ecx, 20(%eax) | ||
|
||
xorl %eax, %eax | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef _PDCLIB_SETJMP_H | ||
#define _PDCLIB_SETJMP_H _PDCLIB_SETJMP_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* | ||
Buffer layout: | ||
0: unsigned long ebp | ||
4: unsigned long ebx | ||
8: unsigned long edi | ||
12: unsigned long esi | ||
16: unsigned long esp | ||
20: unsigned long eip | ||
*/ | ||
typedef unsigned long jmp_buf[6]; | ||
|
||
int setjmp( jmp_buf env ); | ||
_Noreturn void longjmp( jmp_buf env, int val ); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |