diff options
Diffstat (limited to 'src/setjmp.s')
-rw-r--r-- | src/setjmp.s | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/setjmp.s b/src/setjmp.s new file mode 100644 index 0000000..59f2522 --- /dev/null +++ b/src/setjmp.s @@ -0,0 +1,27 @@ +.global setjmp +.global longjmp + +setjmp: + mov 4(%esp), %eax + mov %ebx, (%eax) + mov %esi, 4(%eax) + mov %edi, 8(%eax) + mov %ebp, 12(%eax) + lea 4(%esp), %ecx + mov %ecx, 16(%eax) + mov (%esp), %ecx + mov %ecx, 20(%eax) + xor %eax, %eax + ret + +longjmp: + mov 4(%esp),%edx + mov 8(%esp),%eax + cmp $1,%eax + adc $0, %al + mov (%edx),%ebx + mov 4(%edx),%esi + mov 8(%edx),%edi + mov 12(%edx),%ebp + mov 16(%edx),%esp + jmp *20(%edx) |