123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- {
- This file is part of the Free Pascal run time library.
- Copyright (c) 2008 by the Free Pascal development team.
- SetJmp and LongJmp implementation for exception handling
- See the file COPYING.FPC, included in this distribution,
- for details about the copyright.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- **********************************************************************}
- function fpc_setjmp(var S : jmp_buf) : shortint;assembler;[Public, alias : 'FPC_SETJMP'];nostackframe;compilerproc;
- asm
- mov r26,r24
- mov r27,r25
- st x+,r1
- st x+,r2
- st x+,r3
- st x+,r4
- st x+,r5
- st x+,r6
- st x+,r7
- st x+,r8
- st x+,r9
- st x+,r10
- st x+,r11
- st x+,r12
- st x+,r13
- st x+,r14
- st x+,r15
- st x+,r16
- st x+,r17
- st x+,r28
- st x+,r29
- // store stack pointer
- in r18,61
- in r19,62
- st x+,r18
- st x+,r19
- // store return address
- pop r18
- pop r19
- st x+,r18
- st x+,r19
- push r19
- push r18
- clr r24
- end;
- procedure fpc_longjmp(var S : jmp_buf;value : shortint);assembler;[Public, alias : 'FPC_LONGJMP'];compilerproc;
- asm
- mov r26,r24
- mov r27,r25
- ld r1,x+
- ld r2,x+
- ld r3,x+
- ld r4,x+
- ld r5,x+
- ld r6,x+
- ld r7,x+
- ld r8,x+
- ld r9,x+
- ld r10,x+
- ld r11,x+
- ld r12,x+
- ld r13,x+
- ld r14,x+
- ld r15,x+
- ld r16,x+
- ld r17,x+
- ld r28,x+
- ld r29,x+
- // restore stack pointer
- ld r18,x+
- ld r19,x+
- in r0,63
- cli
- out 62,r19
- out 63,r0
- out 61,r18
- // restore return address
- pop r18
- pop r19
- ld r18,x+
- ld r19,x+
- push r19
- push r18
- mov r24,r22
- end;
|