]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/riscv/sys/asm.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / riscv / sys / asm.h
1 /* Miscellaneous macros.
2 Copyright (C) 2000-2020 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 #ifndef _SYS_ASM_H
20 #define _SYS_ASM_H
21
22 /* Macros to handle different pointer/register sizes for 32/64-bit code. */
23 #if __riscv_xlen == 64
24 # define PTRLOG 3
25 # define SZREG 8
26 # define REG_S sd
27 # define REG_L ld
28 #elif __riscv_xlen == 32
29 # error "rv32i-based targets are not supported"
30 #else
31 # error __riscv_xlen must equal 32 or 64
32 #endif
33
34 #if !defined __riscv_float_abi_soft
35 /* For ABI uniformity, reserve 8 bytes for floats, even if double-precision
36 floating-point is not supported in hardware. */
37 # if defined __riscv_float_abi_double
38 # define FREG_L fld
39 # define FREG_S fsd
40 # define SZFREG 8
41 # else
42 # error unsupported FLEN
43 # endif
44 #endif
45
46 /* Declare leaf routine. */
47 #define LEAF(symbol) \
48 .globl symbol; \
49 .align 2; \
50 .type symbol,@function; \
51 symbol: \
52 cfi_startproc;
53
54 /* Mark end of function. */
55 #undef END
56 #define END(function) \
57 cfi_endproc; \
58 .size function,.-function
59
60 /* Stack alignment. */
61 #define ALMASK ~15
62
63 #endif /* sys/asm.h */