]> rtime.felk.cvut.cz Git - frescor/fosa.git/blob - src_partikle/fosa_setjmp.S
941c050a385c155b98dea68dd285cd407ae2f97a
[frescor/fosa.git] / src_partikle / fosa_setjmp.S
1 /*
2 //----------------------------------------------------------------------
3 //  Copyright (C) 2006 - 2007 by the FRESCOR consortium:
4 //
5 //    Universidad de Cantabria,              SPAIN
6 //    University of York,                    UK
7 //    Scuola Superiore Sant'Anna,            ITALY
8 //    Kaiserslautern University,             GERMANY
9 //    Univ. Politecnica  Valencia,           SPAIN
10 //    Czech Technical University in Prague,  CZECH REPUBLIC
11 //    ENEA                                   SWEDEN
12 //    Thales Communication S.A.              FRANCE
13 //    Visual Tools S.A.                      SPAIN
14 //    Rapita Systems Ltd                     UK
15 //    Evidence                               ITALY
16 //
17 //    See http://www.frescor.org
18 //
19 //        The FRESCOR project (FP6/2005/IST/5-034026) is funded
20 //        in part by the European Union Sixth Framework Programme
21 //        The European Union is not liable of any use that may be
22 //        made of this code.
23 //
24 //
25 //  based on previous work (FSF) done in the FIRST project
26 //
27 //   Copyright (C) 2005  Mälardalen University, SWEDEN
28 //                       Scuola Superiore S.Anna, ITALY
29 //                       Universidad de Cantabria, SPAIN
30 //                       University of York, UK
31 //
32 // This file is part of FOSA (Frsh Operating System Abstraction)
33 //
34 // FOSA is free software; you can redistribute it and/or modify it
35 // under terms of the GNU General Public License as published by the
36 // Free Software Foundation; either version 2, or (at your option) any
37 // later version.  FOSA is distributed in the hope that it will be
38 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
39 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
40 // General Public License for more details. You should have received a
41 // copy of the GNU General Public License along with FOSA; see file
42 // COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
43 // Cambridge, MA 02139, USA.
44     //
45 // As a special exception, including FOSA header files in a file,
46 // instantiating FOSA generics or templates, or linking other files
47 // with FOSA objects to produce an executable application, does not
48 // by itself cause the resulting executable application to be covered
49 // by the GNU General Public License. This exception does not
50 // however invalidate any other reasons why the executable file might be
51 // covered by the GNU Public License.
52 // -----------------------------------------------------------------------
53 // FOSA(Frescor Operating System Adaptation layer)
54 //================================================
55 */
56 /*
57  * $FILE: fosa_setjmp.S
58  *
59  * Setjmp and Longjmp healper functions
60  */
61         
62 .text
63
64 .global fosa_long_jump_save_context, fosa_setjmp, fosa_longjmp
65 .type   fosa_long_jump_save_context,@function
66 .type   fosa_setjmp,@function
67 .type   fosa_longjmp,@function
68
69
70 fosa_long_jump_save_context:
71         subl    $44,  %esp
72         cmpl    $0, 48(%esp)
73         jne     .L2
74         movl    $22, 24(%esp)
75         jmp     .L4
76 .L2:
77         movl    $0,  24(%esp)
78         movl    44(%esp), %ecx
79         leal    48(%esp), %edx
80         movl    48(%esp), %eax
81         movl    %ebx, 0(%eax)
82         movl    %esi, 4(%eax)
83         movl    %edi, 8(%eax)
84         movl    %ebp, 12(%eax)
85         movl    %edx, 16(%eax)
86         movl    %ecx, 20(%eax)
87         movl    $0,   24(%eax)
88
89         leal    28(%eax), %eax
90         movl    %eax, 8(%esp)
91         movl    $0, 4(%esp)
92         movl    $0, (%esp)
93         call    pthread_sigmask
94
95 .L4:
96         movl    24(%esp), %eax
97         addl    $44, %esp
98         ret
99
100
101 fosa_setjmp:
102         movl 0(%esp), %ecx
103         leal 4(%esp), %edx
104         movl (%edx), %eax
105         movl %ebx, 0(%eax)
106         movl %esi, 4(%eax)
107         movl %edi, 8(%eax)
108         movl %ebp, 12(%eax)
109         movl %edx, 16(%eax)
110         movl %ecx, 20(%eax)
111         movl $0,   24(%eax)
112         movl $0,   %eax
113         ret
114
115 fosa_longjmp:
116         movl 4(%esp),  %ecx
117         movl 8(%esp),  %eax
118         movl %eax,  24(%ecx)
119         movl 20(%ecx), %edx
120         movl 0(%ecx),  %ebx
121         movl 4(%ecx),  %esi
122         movl 8(%ecx),  %edi
123         movl 12(%ecx), %ebp
124         movl 16(%ecx), %esp
125         movl $0,       %eax
126         jmp *%edx