1 | /* x86-64 PLT dl-trampoline state macros. |
2 | Copyright (C) 2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, see |
17 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | #if (STATE_SAVE_ALIGNMENT % 16) != 0 |
20 | # error STATE_SAVE_ALIGNMENT must be multiple of 16 |
21 | #endif |
22 | |
23 | #if (STATE_SAVE_OFFSET % STATE_SAVE_ALIGNMENT) != 0 |
24 | # error STATE_SAVE_OFFSET must be multiple of STATE_SAVE_ALIGNMENT |
25 | #endif |
26 | |
27 | #if DL_RUNTIME_RESOLVE_REALIGN_STACK |
28 | /* Local stack area before jumping to function address: RBX. */ |
29 | # define LOCAL_STORAGE_AREA 8 |
30 | # define BASE rbx |
31 | # ifdef USE_FXSAVE |
32 | /* Use fxsave to save XMM registers. */ |
33 | # define REGISTER_SAVE_AREA (512 + STATE_SAVE_OFFSET) |
34 | # if (REGISTER_SAVE_AREA % 16) != 0 |
35 | # error REGISTER_SAVE_AREA must be multiple of 16 |
36 | # endif |
37 | # endif |
38 | #else |
39 | # ifndef USE_FXSAVE |
40 | # error USE_FXSAVE must be defined |
41 | # endif |
42 | /* Use fxsave to save XMM registers. */ |
43 | # define REGISTER_SAVE_AREA (512 + STATE_SAVE_OFFSET + 8) |
44 | /* Local stack area before jumping to function address: All saved |
45 | registers. */ |
46 | # define LOCAL_STORAGE_AREA REGISTER_SAVE_AREA |
47 | # define BASE rsp |
48 | # if (REGISTER_SAVE_AREA % 16) != 8 |
49 | # error REGISTER_SAVE_AREA must be odd multiple of 8 |
50 | # endif |
51 | #endif |
52 | |