xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/x86_64/dos64.m4 (revision 72c7faa4dbb41dbb0238d6b4a109da0d4b236dd4)
1divert(-1)
2dnl  Copyright 2011-2013 Free Software Foundation, Inc.
3
4dnl  This file is part of the GNU MP Library.
5dnl
6dnl  The GNU MP Library is free software; you can redistribute it and/or modify
7dnl  it under the terms of either:
8dnl
9dnl    * the GNU Lesser General Public License as published by the Free
10dnl      Software Foundation; either version 3 of the License, or (at your
11dnl      option) any later version.
12dnl
13dnl  or
14dnl
15dnl    * the GNU General Public License as published by the Free Software
16dnl      Foundation; either version 2 of the License, or (at your option) any
17dnl      later version.
18dnl
19dnl  or both in parallel, as here.
20dnl
21dnl  The GNU MP Library is distributed in the hope that it will be useful, but
22dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24dnl  for more details.
25dnl
26dnl  You should have received copies of the GNU General Public License and the
27dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
28dnl  see https://www.gnu.org/licenses/.
29
30define(`HOST_DOS64')
31
32
33dnl  On DOS64 we always generate position-independent-code
34dnl
35
36define(`PIC')
37
38
39define(`LEA',`
40	lea	$1(%rip), $2
41')
42
43
44dnl  Usage: CALL(funcname)
45dnl
46dnl  Simply override the definition in x86_64-defs.m4.
47
48define(`CALL',`call	GSYM_PREFIX`'$1')
49define(`TCALL',`jmp	GSYM_PREFIX`'$1')
50
51
52dnl  Usage: JUMPTABSECT
53
54define(`JUMPTABSECT', `RODATA')
55
56
57dnl  Usage: JMPENT(targlabel,tablabel)
58
59define(`JMPENT', `.long	$1-$2')
60
61
62dnl  Usage: FUNC_ENTRY(nregparmas)
63dnl  Usage: FUNC_EXIT()
64
65dnl  FUNC_ENTRY and FUNC_EXIT provide an easy path for adoption of standard
66dnl  ABI assembly to the DOS64 ABI.
67
68define(`FUNC_ENTRY',
69	`push	%rdi
70	push	%rsi
71	mov	%rcx, %rdi
72ifelse(eval($1>=2),1,`dnl
73	mov	%rdx, %rsi
74ifelse(eval($1>=3),1,`dnl
75	mov	%r8, %rdx
76ifelse(eval($1>=4),1,`dnl
77	mov	%r9, %rcx
78')')')')
79
80define(`FUNC_EXIT',
81	`pop	%rsi
82	pop	%rdi')
83
84
85dnl  Target ABI macros.  For DOS64 we override the defaults.
86
87define(`IFDOS',   `$1')
88define(`IFSTD',   `')
89define(`IFELF',   `')
90
91
92dnl  Usage: PROTECT(symbol)
93dnl
94dnl  Used for private GMP symbols that should never be overridden by users.
95dnl  This can save reloc entries and improve shlib sharing as well as
96dnl  application startup times
97
98define(`PROTECT',  `')
99
100
101divert`'dnl
102