1
dnl x86 calling conventions checking.
3
dnl Copyright 2000 Free Software Foundation, Inc.
5
dnl This file is part of the GNU MP Library.
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.
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.
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.
23
include(`../config.m4')
26
C int calling_conventions (...);
28
C The global variable "calling_conventions_function" is the function to
29
C call, with the arguments as passed here.
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.
40
PROLOGUE(calling_conventions)
42
movl %eax, G(calling_conventions_retaddr)
44
movl $L(return), (%esp)
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)
51
movl $0x01234567, %ebx
52
movl $0x89ABCDEF, %esi
53
movl $0xFEDCBA98, %edi
54
movl $0x76543210, %ebp
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
62
jmp *G(calling_conventions_function)
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)
72
movl %ebx, G(calling_conventions_eflags)
74
fstenv G(calling_conventions_fenv)
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
82
jmp *G(calling_conventions_retaddr)