Initial revision
[AROS-Contrib.git] / development / compilers / freepascal / rtl / i386 / setjump.inc
blob4743248b0dff5736f5dc14dad643c56776ac4df4
2     $Id$
3     This file is part of the Free Pascal run time library.
4     Copyright (c) 1999-2000 by the Free Pascal development team
6     SetJmp and LongJmp implementation for exception handling
8     See the file COPYING.FPC, included in this distribution,
9     for details about the copyright.
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  **********************************************************************}
17 Function SetJmp (Var S : Jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP'];
18 asm
19   movl 8(%ebp),%eax
20   movl %ebx,(%eax)
21   movl %esi,4(%eax)
22   movl %edi,8(%eax)
23   movl 4(%ebp),%edi
24   movl %edi,20(%eax)
25   movl (%ebp),%edi
26   movl %edi,12(%eax)
27   leal 12(%ebp),%edi
28   movl %edi,16(%eax)
29   movl 8(%eax),%edi
30   xorl %eax,%eax
31 end['EAX'];
34 Procedure longJmp (Var S : Jmp_buf; value : longint); assembler;[Public, alias : 'FPC_LONGJMP'];
35 asm
36   movl 8(%ebp),%ecx
37   movl 12(%ebp),%eax
38   movl (%ecx),%ebx
39   movl 4(%ecx),%esi
40   movl 8(%ecx),%edi
41   movl 12(%ecx),%ebp
42   movl 16(%ecx),%esp
43   // we should also clear the fpu
44   // fninit no must be done elsewhere PM
45   // or we should reset the control word also
46   jmp 20(%ecx)
47 end;
50   $Log$
51   Revision 1.1  2002/02/19 08:25:19  sasu
52   Initial revision
54   Revision 1.1  2000/07/13 06:30:42  michael
55   + Initial import
57   Revision 1.13  2000/05/04 09:47:40  pierre
58     * Preserve all registers in SetJmp
59     * set EAX to value filed in LongJmp instead of only 0 or 1
61   Revision 1.12  2000/03/31 23:12:09  pierre
62    * remove fninit in longjump
64   Revision 1.11  2000/02/18 16:16:13  florian
65     * we don't need to to finit twice ...
67   Revision 1.10  2000/02/18 15:23:01  florian
68     * fixed constants in rtti
69     * longjmp does now a finit
71   Revision 1.9  2000/02/09 22:12:54  florian
72     * longjump does now a finit
74   Revision 1.8  2000/02/09 16:59:29  peter
75     * truncated log
77   Revision 1.7  2000/01/07 16:41:33  daniel
78     * copyright 2000
80   Revision 1.6  1999/08/18 10:42:13  pierre
81    * loading of esp value corrected