Annotation of OpenXM_contrib/gmp/mpn/tests/x86call.asm, Revision 1.1.1.1
1.1 maekawa 1: dnl x86 calling conventions checking.
2:
3: dnl Copyright (C) 2000 Free Software Foundation, Inc.
4: dnl
5: dnl This file is part of the GNU MP Library.
6: dnl
7: dnl The GNU MP Library is free software; you can redistribute it and/or
8: dnl modify it under the terms of the GNU Lesser General Public License as
9: dnl published by the Free Software Foundation; either version 2.1 of the
10: dnl License, or (at your option) any later version.
11: dnl
12: dnl The GNU MP Library is distributed in the hope that it will be useful,
13: dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14: dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: dnl Lesser General Public License for more details.
16: dnl
17: dnl You should have received a copy of the GNU Lesser General Public
18: dnl License along with the GNU MP Library; see the file COPYING.LIB. If
19: dnl not, write to the Free Software Foundation, Inc., 59 Temple Place -
20: dnl Suite 330, Boston, MA 02111-1307, USA.
21:
22:
23: include(`../config.m4')
24:
25:
26: C int calling_conventions (...);
27: C
28: C The global variable "calling_conventions_function" is the function to
29: C call, with the arguments as passed here.
30: C
31: C Perhaps the finit should be done only if the tags word isn't clear, but
32: C nothing uses the rounding mode or anything at the moment.
33:
34: define(G,
35: m4_assert_numargs(1)
36: `GSYM_PREFIX`'$1')
37:
38: .text
39: ALIGN(8)
40: PROLOGUE(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:
64: L(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:
84: EPILOGUE()
85:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>