Initial original import from: fuse-2.4.2-2.fc4
[captive.git] / src / libcaptive / ps / calltype.S
1 /* $Id$
2  * CAPTIVE_STDCALL calling by hand as GCC has it broken
3  * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; exactly version 2 of June 1991 is required
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 /*
21  * typedef gpointer CAPTIVE_STDCALL (*CaptiveStdCallFunc4 )(gpointer arg0);
22  * gpointer captive_stdcall_call_4 (CaptiveStdCallFunc4  func,gpointer arg0);
23  */
24         .globl captive_stdcall_call_4
25 captive_stdcall_call_4:
26         pushl %ebp      /* std stack frame */
27         movl  %esp,%ebp /* std stack frame */
28         pushl 12(%ebp)  /* arg0 */
29         movl   8(%ebp),%eax     /* func */
30         call  *%eax
31         /* keep '%eax' return value */
32         leave
33         ret
34
35 /*
36  * typedef gpointer CAPTIVE_STDCALL (*CaptiveStdCallFunc8 )(gpointer arg0,gpointer arg1);
37  * gpointer captive_stdcall_call_8 (CaptiveStdCallFunc8  func,gpointer arg0,gpointer arg1);
38  */
39         .globl captive_stdcall_call_8
40 captive_stdcall_call_8:
41         pushl %ebp      /* std stack frame */
42         movl  %esp,%ebp /* std stack frame */
43         pushl 16(%ebp)  /* arg1 */
44         pushl 12(%ebp)  /* arg0 */
45         movl   8(%ebp),%eax     /* func */
46         call  *%eax
47         /* keep '%eax' return value */
48         leave
49         ret
50
51 /*
52  * typedef gpointer CAPTIVE_STDCALL (*CaptiveStdCallFunc12)(gpointer arg0,gpointer arg1,gpointer arg2);
53  * gpointer captive_stdcall_call_12(CaptiveStdCallFunc12 func,gpointer arg0,gpointer arg1,gpointer arg2);
54  */
55         .globl captive_stdcall_call_12
56 captive_stdcall_call_12:
57         pushl %ebp      /* std stack frame */
58         movl  %esp,%ebp /* std stack frame */
59         pushl 20(%ebp)  /* arg2 */
60         pushl 16(%ebp)  /* arg1 */
61         pushl 12(%ebp)  /* arg0 */
62         movl   8(%ebp),%eax     /* func */
63         call  *%eax
64         /* keep '%eax' return value */
65         leave
66         ret