source: trunk/third/gmp/tests/x86call.asm @ 18191

Revision 18191, 2.4 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18190, which included commits to RCS files with non-trunk default branches.
Line 
1dnl  x86 calling conventions checking.
2
3dnl  Copyright 2000 Free Software Foundation, Inc.
4dnl
5dnl  This file is part of the GNU MP Library.
6dnl
7dnl  The GNU MP Library is free software; you can redistribute it and/or
8dnl  modify it under the terms of the GNU Lesser General Public License as
9dnl  published by the Free Software Foundation; either version 2.1 of the
10dnl  License, or (at your option) any later version.
11dnl
12dnl  The GNU MP Library is distributed in the hope that it will be useful,
13dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15dnl  Lesser General Public License for more details.
16dnl
17dnl  You should have received a copy of the GNU Lesser General Public
18dnl  License along with the GNU MP Library; see the file COPYING.LIB.  If
19dnl  not, write to the Free Software Foundation, Inc., 59 Temple Place -
20dnl  Suite 330, Boston, MA 02111-1307, USA.
21
22
23include(`../config.m4')
24
25
26C int calling_conventions (...);
27C
28C The global variable "calling_conventions_function" is the function to
29C call, with the arguments as passed here.
30C
31C Perhaps the finit should be done only if the tags word isn't clear, but
32C nothing uses the rounding mode or anything at the moment.
33
34define(G,
35m4_assert_numargs(1)
36`GSYM_PREFIX`'$1')
37
38        .text
39        ALIGN(8)
40PROLOGUE(calling_conventions)
41        movl    (%esp), %eax
42        movl    %eax, G(calling_conventions_retaddr)
43
44        movl    $L(return), (%esp)
45
46        movl    %ebx, G(calling_conventions_save_ebx)
47        movl    %esi, G(calling_conventions_save_esi)
48        movl    %edi, G(calling_conventions_save_edi)
49        movl    %ebp, G(calling_conventions_save_ebp)
50
51        movl    $0x01234567, %ebx
52        movl    $0x89ABCDEF, %esi
53        movl    $0xFEDCBA98, %edi
54        movl    $0x76543210, %ebp
55
56        C try to provoke a problem by starting with junk in the registers,
57        C especially in %eax and %edx which will be return values
58        movl    $0x70246135, %eax
59        movl    $0x8ACE9BDF, %ecx
60        movl    $0xFDB97531, %edx
61
62        jmp     *G(calling_conventions_function)
63
64L(return):
65        movl    %ebx, G(calling_conventions_ebx)
66        movl    %esi, G(calling_conventions_esi)
67        movl    %edi, G(calling_conventions_edi)
68        movl    %ebp, G(calling_conventions_ebp)
69
70        pushf
71        popl    %ebx
72        movl    %ebx, G(calling_conventions_eflags)
73
74        fstenv  G(calling_conventions_fenv)
75        finit
76
77        movl    G(calling_conventions_save_ebx), %ebx
78        movl    G(calling_conventions_save_esi), %esi
79        movl    G(calling_conventions_save_edi), %edi
80        movl    G(calling_conventions_save_ebp), %ebp
81
82        jmp     *G(calling_conventions_retaddr)
83
84EPILOGUE()
85
Note: See TracBrowser for help on using the repository browser.