VM: full munmap
[minix.git] / lib / libm / arch / i387 / abi.h
blob968279ecc2a80c514138998d7a1d486167da67c9
1 /* $NetBSD: abi.h,v 1.5 2008/06/23 10:24:13 drochner Exp $ */
3 /*
4 * Written by Frank van der Linden (fvdl@wasabisystems.com)
5 */
7 /*
8 * The x86-64 ABI specifies that float, double and long double
9 * arguments are passed in SSE2 (xmm) registers. Unfortunately,
10 * there is no way to push those on to the FP stack, which is
11 * where the fancier instructions get their arguments from.
13 * Define some prologues and epilogues to store and retrieve
14 * xmm regs to local variables.
17 #ifdef __x86_64__
19 #define ARG_DOUBLE_ONE -8(%rsp)
20 #define ARG_DOUBLE_ONE_LSW -8(%rsp)
21 #define ARG_DOUBLE_ONE_MSW -4(%rsp)
22 #define ARG_DOUBLE_TWO -16(%rsp)
23 #define ARG_FLOAT_ONE -4(%rsp)
24 #define ARG_FLOAT_TWO -8(%rsp)
26 #define XMM_ONE_ARG_DOUBLE_PROLOGUE \
27 movsd %xmm0, ARG_DOUBLE_ONE
29 #define XMM_TWO_ARG_DOUBLE_PROLOGUE \
30 movsd %xmm0, ARG_DOUBLE_ONE ; \
31 movsd %xmm1, ARG_DOUBLE_TWO
33 #define XMM_ONE_ARG_FLOAT_PROLOGUE \
34 movss %xmm0, ARG_FLOAT_ONE
36 #define XMM_TWO_ARG_FLOAT_PROLOGUE \
37 movss %xmm0, ARG_FLOAT_ONE ; \
38 movss %xmm1, ARG_FLOAT_TWO
40 #define XMM_DOUBLE_EPILOGUE \
41 fstpl ARG_DOUBLE_ONE ; \
42 movsd ARG_DOUBLE_ONE, %xmm0
44 #define XMM_FLOAT_EPILOGUE \
45 fstps ARG_FLOAT_ONE ; \
46 movss ARG_FLOAT_ONE, %xmm0
48 #define FLDL_VAR(x) fldl x(%rip)
50 #else
52 #define ARG_DOUBLE_ONE 4(%esp)
53 #define ARG_DOUBLE_ONE_LSW 4(%esp)
54 #define ARG_DOUBLE_ONE_MSW 8(%esp)
55 #define ARG_DOUBLE_TWO 12(%esp)
56 #define ARG_FLOAT_ONE 4(%esp)
57 #define ARG_FLOAT_TWO 8(%esp)
59 #define XMM_ONE_ARG_DOUBLE_PROLOGUE
60 #define XMM_TWO_ARG_DOUBLE_PROLOGUE
61 #define XMM_ONE_ARG_FLOAT_PROLOGUE
62 #define XMM_TWO_ARG_FLOAT_PROLOGUE
64 #define XMM_DOUBLE_EPILOGUE
65 #define XMM_FLOAT_EPILOGUE
67 #ifdef PIC
68 #define FLDL_VAR(x) \
69 PIC_PROLOGUE ; \
70 fldl PIC_GOTOFF(x) ; \
71 PIC_EPILOGUE
72 #else
73 #define FLDL_VAR(x) \
74 fldl x
76 #endif
77 #endif