asm.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Miscellaneous macros.
  2. Copyright (C) 2000-2018 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library. If not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _SYS_ASM_H
  16. #define _SYS_ASM_H
  17. /* Macros to handle different pointer/register sizes for 32/64-bit code. */
  18. #if __riscv_xlen == 64
  19. # define PTRLOG 3
  20. # define SZREG 8
  21. # define REG_S sd
  22. # define REG_L ld
  23. #elif __riscv_xlen == 32
  24. # error "rv32i-based targets are not supported"
  25. #else
  26. # error __riscv_xlen must equal 32 or 64
  27. #endif
  28. #if !defined __riscv_float_abi_soft
  29. /* For ABI uniformity, reserve 8 bytes for floats, even if double-precision
  30. floating-point is not supported in hardware. */
  31. # if defined __riscv_float_abi_double
  32. # define FREG_L fld
  33. # define FREG_S fsd
  34. # define SZFREG 8
  35. # else
  36. # error unsupported FLEN
  37. # endif
  38. #endif
  39. /* Declare leaf routine. */
  40. #define LEAF(symbol) \
  41. .globl symbol; \
  42. .align 2; \
  43. .type symbol,@function; \
  44. symbol: \
  45. cfi_startproc;
  46. /* Mark end of function. */
  47. #undef END
  48. #define END(function) \
  49. cfi_endproc; \
  50. .size function,.-function
  51. /* Stack alignment. */
  52. #define ALMASK ~15
  53. #endif /* sys/asm.h */