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