| author | |
| committer | |
| log | 6635d02143fa7eded22192e9e4bbd1f94df11330 |
| tree | 87aaaf18250c5d9a36cf02814cfb0891ef51dab9 |
| parent | f03142cfe983e81c9c298e3cbb76228e9a32f1ee |
| signature |
24 files changed, 1224 insertions(+), 0 deletions(-)
lib/libc/include/loongarch64-linux-gnusf/bits/endianness.h created+11| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | #ifndef _BITS_ENDIANNESS_H | |
| 2 | #define _BITS_ENDIANNESS_H 1 | |
| 3 | ||
| 4 | #ifndef _BITS_ENDIAN_H | |
| 5 | #error "Never use <bits/endianness.h> directly; include <endian.h> instead." | |
| 6 | #endif | |
| 7 | ||
| 8 | /* LoongArch is little-endian. */ | |
| 9 | #define __BYTE_ORDER __LITTLE_ENDIAN | |
| 10 | ||
| 11 | #endif /* bits/endianness.h */ | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/fcntl.h created+61| ... | ... | @@ -0,0 +1,61 @@ |
| 1 | /* O_*, F_*, FD_* bit values for the generic Linux/LoongArch ABI. | |
| 2 | Copyright (C) 2022-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 | #ifndef _FCNTL_H | |
| 20 | #error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #include <bits/wordsize.h> | |
| 24 | ||
| 25 | /* In 64-bit ISA files are always with 64bit off_t and F_*LK64 are the same as | |
| 26 | non-64-bit versions. It will need to be revised for 128-bit. */ | |
| 27 | #if __WORDSIZE == 64 | |
| 28 | #define __O_LARGEFILE 0 | |
| 29 | ||
| 30 | #define F_GETLK64 5 /* Get record locking info. */ | |
| 31 | #define F_SETLK64 6 /* Set record locking info (non-blocking). */ | |
| 32 | #define F_SETLKW64 7 /* Set record locking info (blocking). */ | |
| 33 | #endif | |
| 34 | ||
| 35 | struct flock | |
| 36 | { | |
| 37 | short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ | |
| 38 | short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ | |
| 39 | #ifndef __USE_FILE_OFFSET64 | |
| 40 | __off_t l_start; /* Offset where the lock begins. */ | |
| 41 | __off_t l_len; /* Size of the locked area; zero means until EOF. */ | |
| 42 | #else | |
| 43 | __off64_t l_start; /* Offset where the lock begins. */ | |
| 44 | __off64_t l_len; /* Size of the locked area; zero means until EOF. */ | |
| 45 | #endif | |
| 46 | __pid_t l_pid; /* Process holding the lock. */ | |
| 47 | }; | |
| 48 | ||
| 49 | #ifdef __USE_LARGEFILE64 | |
| 50 | struct flock64 | |
| 51 | { | |
| 52 | short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ | |
| 53 | short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ | |
| 54 | __off64_t l_start; /* Offset where the lock begins. */ | |
| 55 | __off64_t l_len; /* Size of the locked area; zero means until EOF. */ | |
| 56 | __pid_t l_pid; /* Process holding the lock. */ | |
| 57 | }; | |
| 58 | #endif | |
| 59 | ||
| 60 | /* Include generic Linux declarations. */ | |
| 61 | #include <bits/fcntl-linux.h> | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/fenv.h created+90| ... | ... | @@ -0,0 +1,90 @@ |
| 1 | /* Floating point environment. | |
| 2 | Copyright (C) 2022-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 | #ifndef _FENV_H | |
| 20 | #error "Never use <bits/fenv.h> directly; include <fenv.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | /* Define bits representing the exception. We use the bit positions | |
| 24 | of the appropriate bits in the FPU control word. */ | |
| 25 | enum | |
| 26 | { | |
| 27 | FE_INEXACT = | |
| 28 | #define FE_INEXACT 0x010000 | |
| 29 | FE_INEXACT, | |
| 30 | FE_UNDERFLOW = | |
| 31 | #define FE_UNDERFLOW 0x020000 | |
| 32 | FE_UNDERFLOW, | |
| 33 | FE_OVERFLOW = | |
| 34 | #define FE_OVERFLOW 0x040000 | |
| 35 | FE_OVERFLOW, | |
| 36 | FE_DIVBYZERO = | |
| 37 | #define FE_DIVBYZERO 0x080000 | |
| 38 | FE_DIVBYZERO, | |
| 39 | FE_INVALID = | |
| 40 | #define FE_INVALID 0x100000 | |
| 41 | FE_INVALID, | |
| 42 | }; | |
| 43 | ||
| 44 | #define FE_ALL_EXCEPT \ | |
| 45 | (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) | |
| 46 | ||
| 47 | /* The LoongArch FPU supports all of the four defined rounding modes. We | |
| 48 | use again the bit positions in the FPU control word as the values | |
| 49 | for the appropriate macros. */ | |
| 50 | enum | |
| 51 | { | |
| 52 | FE_TONEAREST = | |
| 53 | #define FE_TONEAREST 0x000 | |
| 54 | FE_TONEAREST, | |
| 55 | FE_TOWARDZERO = | |
| 56 | #define FE_TOWARDZERO 0x100 | |
| 57 | FE_TOWARDZERO, | |
| 58 | FE_UPWARD = | |
| 59 | #define FE_UPWARD 0x200 | |
| 60 | FE_UPWARD, | |
| 61 | FE_DOWNWARD = | |
| 62 | #define FE_DOWNWARD 0x300 | |
| 63 | FE_DOWNWARD | |
| 64 | }; | |
| 65 | ||
| 66 | /* Type representing exception flags. */ | |
| 67 | typedef unsigned int fexcept_t; | |
| 68 | ||
| 69 | /* Type representing floating-point environment. This function corresponds | |
| 70 | to the layout of the block written by the `fstenv'. */ | |
| 71 | typedef struct | |
| 72 | { | |
| 73 | unsigned int __fp_control_register; | |
| 74 | } fenv_t; | |
| 75 | ||
| 76 | /* If the default argument is used we use this value. */ | |
| 77 | #define FE_DFL_ENV ((const fenv_t *) -1) | |
| 78 | ||
| 79 | #ifdef __USE_GNU | |
| 80 | /* Floating-point environment where none of the exception is masked. */ | |
| 81 | #define FE_NOMASK_ENV ((const fenv_t *) -257) | |
| 82 | #endif | |
| 83 | ||
| 84 | #if __GLIBC_USE (IEC_60559_BFP_EXT_C23) | |
| 85 | /* Type representing floating-point control modes. */ | |
| 86 | typedef unsigned int femode_t; | |
| 87 | ||
| 88 | /* Default floating-point control modes. */ | |
| 89 | #define FE_DFL_MODE ((const femode_t *) -1L) | |
| 90 | #endif | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/hwcap.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* Defines for bits in AT_HWCAP. LoongArch64 Linux version. | |
| 2 | Copyright (C) 2022-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 | <http://www.gnu.org/licenses/>. */ | |
| 18 | ||
| 19 | #if !defined (_SYS_AUXV_H) | |
| 20 | # error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | /* The following must match the kernel's <asm/hwcap.h>. */ | |
| 24 | /* HWCAP flags */ | |
| 25 | #define HWCAP_LOONGARCH_CPUCFG (1 << 0) | |
| 26 | #define HWCAP_LOONGARCH_LAM (1 << 1) | |
| 27 | #define HWCAP_LOONGARCH_UAL (1 << 2) | |
| 28 | #define HWCAP_LOONGARCH_FPU (1 << 3) | |
| 29 | #define HWCAP_LOONGARCH_LSX (1 << 4) | |
| 30 | #define HWCAP_LOONGARCH_LASX (1 << 5) | |
| 31 | #define HWCAP_LOONGARCH_CRC32 (1 << 6) | |
| 32 | #define HWCAP_LOONGARCH_COMPLEX (1 << 7) | |
| 33 | #define HWCAP_LOONGARCH_CRYPTO (1 << 8) | |
| 34 | #define HWCAP_LOONGARCH_LVZ (1 << 9) | |
| 35 | #define HWCAP_LOONGARCH_LBT_X86 (1 << 10) | |
| 36 | #define HWCAP_LOONGARCH_LBT_ARM (1 << 11) | |
| 37 | #define HWCAP_LOONGARCH_LBT_MIPS (1 << 12) | |
| 38 | #define HWCAP_LOONGARCH_PTW (1 << 13) | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/link.h created+76| ... | ... | @@ -0,0 +1,76 @@ |
| 1 | /* Machine-specific declarations for dynamic linker interface. | |
| 2 | Copyright (C) 2022-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 | #ifndef _LINK_H | |
| 20 | #error "Never include <bits/link.h> directly; use <link.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef __loongarch_soft_float | |
| 24 | typedef float La_loongarch_vr | |
| 25 | __attribute__ ((__vector_size__ (16), __aligned__ (16))); | |
| 26 | typedef float La_loongarch_xr | |
| 27 | __attribute__ ((__vector_size__ (32), __aligned__ (16))); | |
| 28 | ||
| 29 | typedef union | |
| 30 | { | |
| 31 | double fpreg[4]; | |
| 32 | La_loongarch_vr vr[2]; | |
| 33 | La_loongarch_xr xr[1]; | |
| 34 | } La_loongarch_vector __attribute__ ((__aligned__ (16))); | |
| 35 | #endif | |
| 36 | ||
| 37 | typedef struct La_loongarch_regs | |
| 38 | { | |
| 39 | unsigned long int lr_reg[8]; /* a0 - a7 */ | |
| 40 | #ifndef __loongarch_soft_float | |
| 41 | La_loongarch_vector lr_vec[8]; /* fa0 - fa7 or vr0 - vr7 or xr0 - xr7*/ | |
| 42 | #endif | |
| 43 | unsigned long int lr_ra; | |
| 44 | unsigned long int lr_sp; | |
| 45 | } La_loongarch_regs; | |
| 46 | ||
| 47 | /* Return values for calls from PLT on LoongArch. */ | |
| 48 | typedef struct La_loongarch_retval | |
| 49 | { | |
| 50 | unsigned long int lrv_a0; | |
| 51 | unsigned long int lrv_a1; | |
| 52 | #ifndef __loongarch_soft_float | |
| 53 | La_loongarch_vector lrv_vec0; | |
| 54 | La_loongarch_vector lrv_vec1; | |
| 55 | #endif | |
| 56 | } La_loongarch_retval; | |
| 57 | ||
| 58 | __BEGIN_DECLS | |
| 59 | ||
| 60 | extern ElfW (Addr) la_loongarch_gnu_pltenter (ElfW (Sym) *__sym, | |
| 61 | 					 unsigned int __ndx, | |
| 62 | 					 uintptr_t *__refcook, | |
| 63 | 					 uintptr_t *__defcook, | |
| 64 | 					 La_loongarch_regs *__regs, | |
| 65 | 					 unsigned int *__flags, | |
| 66 | 					 const char *__symname, | |
| 67 | 					 long int *__framesizep); | |
| 68 | extern unsigned int la_loongarch_gnu_pltexit (ElfW (Sym) *__sym, | |
| 69 | 					 unsigned int __ndx, | |
| 70 | 					 uintptr_t *__refcook, | |
| 71 | 					 uintptr_t *__defcook, | |
| 72 | 					 const La_loongarch_regs *__inregs, | |
| 73 | 					 La_loongarch_retval *__outregs, | |
| 74 | 					 const char *__symname); | |
| 75 | ||
| 76 | __END_DECLS | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/link_lavcurrent.h created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | /* Data structure for communication from the run-time dynamic linker for | |
| 2 | loaded ELF shared objects. LAV_CURRENT definition. | |
| 3 | Copyright (C) 2023-2024 Free Software Foundation, Inc. | |
| 4 | This file is part of the GNU C Library. | |
| 5 | ||
| 6 | The GNU C Library is free software; you can redistribute it and/or | |
| 7 | modify it under the terms of the GNU Lesser General Public | |
| 8 | License as published by the Free Software Foundation; either | |
| 9 | version 2.1 of the License, or (at your option) any later version. | |
| 10 | ||
| 11 | The GNU C Library is distributed in the hope that it will be useful, | |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | Lesser General Public License for more details. | |
| 15 | ||
| 16 | You should have received a copy of the GNU Lesser General Public | |
| 17 | License along with the GNU C Library; if not, see | |
| 18 | <https://www.gnu.org/licenses/>. */ | |
| 19 | ||
| 20 | #ifndef _LINK_H | |
| 21 | # error "Never include <bits/link_lavcurrent.h> directly; use <link.h> instead." | |
| 22 | #endif | |
| 23 | ||
| 24 | /* Version numbers for la_version handshake interface. */ | |
| 25 | #define LAV_CURRENT	3 | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/long-double.h created+21| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | /* Properties of long double type. ldbl-128 version. | |
| 2 | Copyright (C) 2016-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 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 | /* long double is distinct from double, so there is nothing to | |
| 20 | define here. */ | |
| 21 | #define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/procfs.h created+52| ... | ... | @@ -0,0 +1,52 @@ |
| 1 | /* Types for registers for sys/procfs.h. | |
| 2 | Copyright (C) 2022-2024 Free Software Foundation, Inc. | |
| 3 | ||
| 4 | This file is part of the GNU C Library. | |
| 5 | ||
| 6 | The GNU C Library is free software; you can redistribute it and/or | |
| 7 | modify it under the terms of the GNU Lesser General Public | |
| 8 | License as published by the Free Software Foundation; either | |
| 9 | version 2.1 of the License, or (at your option) any later version. | |
| 10 | ||
| 11 | The GNU C Library is distributed in the hope that it will be useful, | |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | Lesser General Public License for more details. | |
| 15 | ||
| 16 | You should have received a copy of the GNU Lesser General Public | |
| 17 | License along with the GNU C Library. If not, see | |
| 18 | <https://www.gnu.org/licenses/>. */ | |
| 19 | ||
| 20 | #ifndef _SYS_PROCFS_H | |
| 21 | # error "Never include <bits/procfs.h> directly; use <sys/procfs.h> instead." | |
| 22 | #endif | |
| 23 | ||
| 24 | /* Type for a general-purpose register. */ | |
| 25 | typedef __uint64_t elf_greg_t; | |
| 26 | ||
| 27 | /* And the whole bunch of them. We could have used `struct | |
| 28 | pt_regs' directly in the typedef, but tradition says that | |
| 29 | the register set is an array, which does have some peculiar | |
| 30 | semantics, so leave it that way. */ | |
| 31 | #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t)) | |
| 32 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | |
| 33 | ||
| 34 | #define ELF_NFPREG 34 /* 32 FPRs + 8-byte byte-vec for fcc + 4-byte FCR */ | |
| 35 | typedef union | |
| 36 | { | |
| 37 | double d; | |
| 38 | float f; | |
| 39 | } elf_fpreg_t; | |
| 40 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | |
| 41 | ||
| 42 | typedef union | |
| 43 | { | |
| 44 | double d[2]; | |
| 45 | float f[4]; | |
| 46 | } __attribute__ ((__aligned__ (16))) elf_lsxregset_t[32]; | |
| 47 | ||
| 48 | typedef union | |
| 49 | { | |
| 50 | double d[4]; | |
| 51 | float f[8]; | |
| 52 | } __attribute__ ((__aligned__ (32))) elf_lasxregset_t[32]; | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/pthread_stack_min.h created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | /* Definition of PTHREAD_STACK_MIN. LoongArch Linux version. | |
| 2 | Copyright (C) 2022-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 License as | |
| 7 | published by the Free Software Foundation; either version 2.1 of the | |
| 8 | 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 | /* Minimum size for a thread. At least two pages with 64k pages. */ | |
| 20 | #define PTHREAD_STACK_MIN	131072 | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/setjmp.h created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | /* Define the machine-dependent type `jmp_buf'. | |
| 2 | Copyright (C) 2022-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 | #ifndef _LOONGARCH_BITS_SETJMP_H | |
| 20 | #define _LOONGARCH_BITS_SETJMP_H | |
| 21 | ||
| 22 | typedef struct __jmp_buf_internal_tag | |
| 23 | { | |
| 24 | /* Program counter. */ | |
| 25 | long int __pc; | |
| 26 | /* Stack pointer. */ | |
| 27 | long int __sp; | |
| 28 | /* Reserved */ | |
| 29 | long int __x; | |
| 30 | /* Frame pointer. */ | |
| 31 | long int __fp; | |
| 32 | /* Callee-saved registers. */ | |
| 33 | long int __regs[9]; | |
| 34 | ||
| 35 | #ifndef __loongarch_soft_float | |
| 36 | /* Callee-saved floating point registers. */ | |
| 37 | double __fpregs[8]; | |
| 38 | #endif | |
| 39 | ||
| 40 | } __jmp_buf[1]; | |
| 41 | ||
| 42 | #endif /* _LOONGARCH_BITS_SETJMP_H */ | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/shmlba.h created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | /* Define SHMLBA. LoongArch version. | |
| 2 | Copyright (C) 2023-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 | #ifndef _SYS_SHM_H | |
| 20 | # error "Never use <bits/shmlba.h> directly; include <sys/shm.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | /* Segment low boundary address multiple. */ | |
| 24 | #define SHMLBA		0x10000 | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/sigstack.h created+32| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | /* sigstack, sigaltstack definitions. | |
| 2 | Copyright (C) 2022-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 | #ifndef _BITS_SIGSTACK_H | |
| 20 | #define _BITS_SIGSTACK_H 1 | |
| 21 | ||
| 22 | #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H | |
| 23 | # error "Never include this file directly. Use <signal.h> instead" | |
| 24 | #endif | |
| 25 | ||
| 26 | /* Minimum stack size for a signal handler. */ | |
| 27 | #define MINSIGSTKSZ	4096 | |
| 28 | ||
| 29 | /* System default stack size. */ | |
| 30 | #define SIGSTKSZ	16384 | |
| 31 | ||
| 32 | #endif /* bits/sigstack.h */ | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/struct_stat.h created+127| ... | ... | @@ -0,0 +1,127 @@ |
| 1 | /* Definition for struct stat. | |
| 2 | Copyright (C) 2020-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 !defined _SYS_STAT_H && !defined _FCNTL_H | |
| 20 | # error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead." | |
| 21 | #endif | |
| 22 | ||
| 23 | #ifndef _BITS_STRUCT_STAT_H | |
| 24 | #define _BITS_STRUCT_STAT_H	1 | |
| 25 | ||
| 26 | #include <bits/endian.h> | |
| 27 | #include <bits/wordsize.h> | |
| 28 | ||
| 29 | #if defined __USE_FILE_OFFSET64 | |
| 30 | # define __field64(type, type64, name) type64 name | |
| 31 | #elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T | |
| 32 | # if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T | |
| 33 | # error "ino_t and off_t must both be the same type" | |
| 34 | # endif | |
| 35 | # define __field64(type, type64, name) type name | |
| 36 | #elif __BYTE_ORDER == __LITTLE_ENDIAN | |
| 37 | # define __field64(type, type64, name) \ | |
| 38 | type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad | |
| 39 | #else | |
| 40 | # define __field64(type, type64, name) \ | |
| 41 | int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name | |
| 42 | #endif | |
| 43 | ||
| 44 | struct stat | |
| 45 | { | |
| 46 | __dev_t st_dev;		/* Device. */ | |
| 47 | __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */ | |
| 48 | __mode_t st_mode;		/* File mode. */ | |
| 49 | __nlink_t st_nlink;		/* Link count. */ | |
| 50 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 51 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 52 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 53 | __dev_t __pad1; | |
| 54 | __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */ | |
| 55 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 56 | int __pad2; | |
| 57 | __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */ | |
| 58 | #ifdef __USE_XOPEN2K8 | |
| 59 | /* Nanosecond resolution timestamps are stored in a format | |
| 60 | equivalent to 'struct timespec'. This is the type used | |
| 61 | whenever possible but the Unix namespace rules do not allow the | |
| 62 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 63 | Therefore we have to handle the use of this header in strictly | |
| 64 | standard-compliant sources special. */ | |
| 65 | struct timespec st_atim;		/* Time of last access. */ | |
| 66 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 67 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 68 | # define st_atime st_atim.tv_sec	/* Backward compatibility. */ | |
| 69 | # define st_mtime st_mtim.tv_sec | |
| 70 | # define st_ctime st_ctim.tv_sec | |
| 71 | #else | |
| 72 | __time_t st_atime;			/* Time of last access. */ | |
| 73 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 74 | __time_t st_mtime;			/* Time of last modification. */ | |
| 75 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 76 | __time_t st_ctime;			/* Time of last status change. */ | |
| 77 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 78 | #endif | |
| 79 | int __glibc_reserved[2]; | |
| 80 | }; | |
| 81 | ||
| 82 | #undef __field64 | |
| 83 | ||
| 84 | #ifdef __USE_LARGEFILE64 | |
| 85 | struct stat64 | |
| 86 | { | |
| 87 | __dev_t st_dev;		/* Device. */ | |
| 88 | __ino64_t st_ino;		/* File serial number.	*/ | |
| 89 | __mode_t st_mode;		/* File mode. */ | |
| 90 | __nlink_t st_nlink;		/* Link count. */ | |
| 91 | __uid_t st_uid;		/* User ID of the file's owner.	*/ | |
| 92 | __gid_t st_gid;		/* Group ID of the file's group.*/ | |
| 93 | __dev_t st_rdev;		/* Device number, if device. */ | |
| 94 | __dev_t __pad1; | |
| 95 | __off64_t st_size;		/* Size of file, in bytes. */ | |
| 96 | __blksize_t st_blksize;	/* Optimal block size for I/O. */ | |
| 97 | int __pad2; | |
| 98 | __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated. */ | |
| 99 | #ifdef __USE_XOPEN2K8 | |
| 100 | /* Nanosecond resolution timestamps are stored in a format | |
| 101 | equivalent to 'struct timespec'. This is the type used | |
| 102 | whenever possible but the Unix namespace rules do not allow the | |
| 103 | identifier 'timespec' to appear in the <sys/stat.h> header. | |
| 104 | Therefore we have to handle the use of this header in strictly | |
| 105 | standard-compliant sources special. */ | |
| 106 | struct timespec st_atim;		/* Time of last access. */ | |
| 107 | struct timespec st_mtim;		/* Time of last modification. */ | |
| 108 | struct timespec st_ctim;		/* Time of last status change. */ | |
| 109 | #else | |
| 110 | __time_t st_atime;			/* Time of last access. */ | |
| 111 | unsigned long int st_atimensec;	/* Nscecs of last access. */ | |
| 112 | __time_t st_mtime;			/* Time of last modification. */ | |
| 113 | unsigned long int st_mtimensec;	/* Nsecs of last modification. */ | |
| 114 | __time_t st_ctime;			/* Time of last status change. */ | |
| 115 | unsigned long int st_ctimensec;	/* Nsecs of last status change. */ | |
| 116 | #endif | |
| 117 | int __glibc_reserved[2]; | |
| 118 | }; | |
| 119 | #endif | |
| 120 | ||
| 121 | /* Tell code we have these members. */ | |
| 122 | #define	_STATBUF_ST_BLKSIZE | |
| 123 | #define _STATBUF_ST_RDEV | |
| 124 | /* Nanosecond resolution time values are supported. */ | |
| 125 | #define _STATBUF_ST_NSEC | |
| 126 | ||
| 127 | #endif /* _BITS_STRUCT_STAT_H */ | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/timesize.h created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | /* Bit size of the time_t type at glibc build time, general case. | |
| 2 | Copyright (C) 2018-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 | /* Size in bits of the 'time_t' type of the default ABI. */ | |
| 20 | #define __TIMESIZE	64 | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/bits/wordsize.h created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | /* Copyright (C) 1999-2024 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 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 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #define __WORDSIZE			64 | |
| 19 | #define __WORDSIZE_TIME64_COMPAT32	0 | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/fpu_control.h created+119| ... | ... | @@ -0,0 +1,119 @@ |
| 1 | /* FPU control word bits. | |
| 2 | Copyright (C) 2022-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 | #ifndef _FPU_CONTROL_H | |
| 20 | #define _FPU_CONTROL_H | |
| 21 | ||
| 22 | /* LoongArch FPU floating point control register bits. | |
| 23 | * | |
| 24 | * 31-29 -> reserved (read as 0, can not changed by software) | |
| 25 | * 28 -> cause bit for invalid exception | |
| 26 | * 27 -> cause bit for division by zero exception | |
| 27 | * 26 -> cause bit for overflow exception | |
| 28 | * 25 -> cause bit for underflow exception | |
| 29 | * 24 -> cause bit for inexact exception | |
| 30 | * 23-21 -> reserved (read as 0, can not changed by software) | |
| 31 | * 20 -> flag invalid exception | |
| 32 | * 19 -> flag division by zero exception | |
| 33 | * 18 -> flag overflow exception | |
| 34 | * 17 -> flag underflow exception | |
| 35 | * 16 -> flag inexact exception | |
| 36 | * 9-8 -> rounding control | |
| 37 | * 7-5 -> reserved (read as 0, can not changed by software) | |
| 38 | * 4 -> enable exception for invalid exception | |
| 39 | * 3 -> enable exception for division by zero exception | |
| 40 | * 2 -> enable exception for overflow exception | |
| 41 | * 1 -> enable exception for underflow exception | |
| 42 | * 0 -> enable exception for inexact exception | |
| 43 | * | |
| 44 | * | |
| 45 | * Rounding Control: | |
| 46 | * 00 - rounding ties to even (RNE) | |
| 47 | * 01 - rounding toward zero (RZ) | |
| 48 | * 10 - rounding (up) toward plus infinity (RP) | |
| 49 | * 11 - rounding (down) toward minus infinity (RM) | |
| 50 | */ | |
| 51 | ||
| 52 | #include <features.h> | |
| 53 | ||
| 54 | #ifdef __loongarch_soft_float | |
| 55 | ||
| 56 | #define _FPU_RESERVED 0xffffffff | |
| 57 | #define _FPU_DEFAULT 0x00000000 | |
| 58 | typedef unsigned int fpu_control_t; | |
| 59 | #define _FPU_GETCW(cw) (cw) = 0 | |
| 60 | #define _FPU_SETCW(cw) (void) (cw) | |
| 61 | extern fpu_control_t __fpu_control; | |
| 62 | ||
| 63 | #else /* __loongarch_soft_float */ | |
| 64 | ||
| 65 | /* Masks for interrupts. */ | |
| 66 | #define _FPU_MASK_V 0x10 /* Invalid operation */ | |
| 67 | #define _FPU_MASK_Z 0x08 /* Division by zero */ | |
| 68 | #define _FPU_MASK_O 0x04 /* Overflow */ | |
| 69 | #define _FPU_MASK_U 0x02 /* Underflow */ | |
| 70 | #define _FPU_MASK_I 0x01 /* Inexact operation */ | |
| 71 | ||
| 72 | /* Flush denormalized numbers to zero. */ | |
| 73 | #define _FPU_FLUSH_TZ 0x1000000 | |
| 74 | ||
| 75 | /* Rounding control. */ | |
| 76 | #define _FPU_RC_NEAREST 0x000 /* RECOMMENDED */ | |
| 77 | #define _FPU_RC_ZERO 0x100 | |
| 78 | #define _FPU_RC_UP 0x200 | |
| 79 | #define _FPU_RC_DOWN 0x300 | |
| 80 | /* Mask for rounding control. */ | |
| 81 | #define _FPU_RC_MASK 0x300 | |
| 82 | ||
| 83 | #define _FPU_RESERVED 0x0 | |
| 84 | ||
| 85 | #define _FPU_DEFAULT 0x0 | |
| 86 | #define _FPU_IEEE 0x1F | |
| 87 | ||
| 88 | /* Type of the control word. */ | |
| 89 | typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__))); | |
| 90 | ||
| 91 | /* Macros for accessing the hardware control word. */ | |
| 92 | extern fpu_control_t __loongarch_fpu_getcw (void) __THROW; | |
| 93 | extern void __loongarch_fpu_setcw (fpu_control_t) __THROW; | |
| 94 | #define _FPU_GETCW(cw) __asm__ volatile ("movfcsr2gr %0,$fcsr0" : "=r"(cw)) | |
| 95 | #define _FPU_SETCW(cw) __asm__ volatile ("movgr2fcsr $fcsr0,%0" : : "r"(cw)) | |
| 96 | ||
| 97 | /* Default control word set at startup. */ | |
| 98 | extern fpu_control_t __fpu_control; | |
| 99 | ||
| 100 | # define _FCLASS_SNAN (1 << 0) | |
| 101 | # define _FCLASS_QNAN (1 << 1) | |
| 102 | # define _FCLASS_MINF (1 << 2) | |
| 103 | # define _FCLASS_MNORM (1 << 3) | |
| 104 | # define _FCLASS_MSUBNORM (1 << 4) | |
| 105 | # define _FCLASS_MZERO (1 << 5) | |
| 106 | # define _FCLASS_PINF (1 << 6) | |
| 107 | # define _FCLASS_PNORM (1 << 7) | |
| 108 | # define _FCLASS_PSUBNORM (1 << 8) | |
| 109 | # define _FCLASS_PZERO (1 << 9) | |
| 110 | ||
| 111 | # define _FCLASS_ZERO (_FCLASS_MZERO | _FCLASS_PZERO) | |
| 112 | # define _FCLASS_SUBNORM (_FCLASS_MSUBNORM | _FCLASS_PSUBNORM) | |
| 113 | # define _FCLASS_NORM (_FCLASS_MNORM | _FCLASS_PNORM) | |
| 114 | # define _FCLASS_INF (_FCLASS_MINF | _FCLASS_PINF) | |
| 115 | # define _FCLASS_NAN (_FCLASS_SNAN | _FCLASS_QNAN) | |
| 116 | ||
| 117 | #endif /* __loongarch_soft_float */ | |
| 118 | ||
| 119 | #endif /* fpu_control.h */ | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/gnu/lib-names-lp64s.h created+27| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | /* This file is automatically generated. */ | |
| 2 | #ifndef __GNU_LIB_NAMES_H | |
| 3 | # error "Never use <gnu/lib-names-lp64s.h> directly; include <gnu/lib-names.h> instead." | |
| 4 | #endif | |
| 5 | ||
| 6 | #define LD_LINUX_LOONGARCH_LP64S_SO "ld-linux-loongarch-lp64s.so.1" | |
| 7 | #define LD_SO "ld-linux-loongarch-lp64s.so.1" | |
| 8 | #define LIBANL_SO "libanl.so.1" | |
| 9 | #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" | |
| 10 | #define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" | |
| 11 | #define LIBC_SO "libc.so.6" | |
| 12 | #define LIBDL_SO "libdl.so.2" | |
| 13 | #define LIBGCC_S_SO "libgcc_s.so.1" | |
| 14 | #define LIBMVEC_SO "libmvec.so.1" | |
| 15 | #define LIBM_SO "libm.so.6" | |
| 16 | #define LIBNSL_SO "libnsl.so.1" | |
| 17 | #define LIBNSS_COMPAT_SO "libnss_compat.so.2" | |
| 18 | #define LIBNSS_DB_SO "libnss_db.so.2" | |
| 19 | #define LIBNSS_DNS_SO "libnss_dns.so.2" | |
| 20 | #define LIBNSS_FILES_SO "libnss_files.so.2" | |
| 21 | #define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" | |
| 22 | #define LIBNSS_LDAP_SO "libnss_ldap.so.2" | |
| 23 | #define LIBPTHREAD_SO "libpthread.so.0" | |
| 24 | #define LIBRESOLV_SO "libresolv.so.2" | |
| 25 | #define LIBRT_SO "librt.so.1" | |
| 26 | #define LIBTHREAD_DB_SO "libthread_db.so.1" | |
| 27 | #define LIBUTIL_SO "libutil.so.1" | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/gnu/lib-names.h created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | /* This file is automatically generated. | |
| 2 | It defines macros to allow user program to find the shared | |
| 3 | library files which come as part of GNU libc. */ | |
| 4 | #ifndef __GNU_LIB_NAMES_H | |
| 5 | #define __GNU_LIB_NAMES_H	1 | |
| 6 | ||
| 7 | #include <bits/wordsize.h> | |
| 8 | ||
| 9 | #if __WORDSIZE == 64 && defined __loongarch_soft_float | |
| 10 | # include <gnu/lib-names-lp64s.h> | |
| 11 | #endif | |
| 12 | #if __WORDSIZE == 64 && defined __loongarch_double_float | |
| 13 | # include <gnu/lib-names-lp64d.h> | |
| 14 | #endif | |
| 15 | ||
| 16 | #endif	/* gnu/lib-names.h */ | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/gnu/stubs-lp64s.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /* This file is automatically generated. | |
| 2 | It defines a symbol `__stub_FUNCTION' for each function | |
| 3 | in the C library which is a stub, meaning it will fail | |
| 4 | every time called, usually setting errno to ENOSYS. */ | |
| 5 | ||
| 6 | #ifdef _LIBC | |
| 7 | #error Applications may not define the macro _LIBC | |
| 8 | #endif | |
| 9 | ||
| 10 | #define __stub___compat_bdflush | |
| 11 | #define __stub___compat_create_module | |
| 12 | #define __stub___compat_get_kernel_syms | |
| 13 | #define __stub___compat_query_module | |
| 14 | #define __stub___compat_uselib | |
| 15 | #define __stub_chflags | |
| 16 | #define __stub_fchflags | |
| 17 | #define __stub_feclearexcept | |
| 18 | #define __stub_fedisableexcept | |
| 19 | #define __stub_feenableexcept | |
| 20 | #define __stub_fegetenv | |
| 21 | #define __stub_fegetexcept | |
| 22 | #define __stub_fegetexceptflag | |
| 23 | #define __stub_fegetmode | |
| 24 | #define __stub_fegetround | |
| 25 | #define __stub_feholdexcept | |
| 26 | #define __stub_feraiseexcept | |
| 27 | #define __stub_fesetenv | |
| 28 | #define __stub_fesetexcept | |
| 29 | #define __stub_fesetexceptflag | |
| 30 | #define __stub_fesetmode | |
| 31 | #define __stub_fesetround | |
| 32 | #define __stub_fetestexcept | |
| 33 | #define __stub_feupdateenv | |
| 34 | #define __stub_gtty | |
| 35 | #define __stub_revoke | |
| 36 | #define __stub_setlogin | |
| 37 | #define __stub_sigreturn | |
| 38 | #define __stub_stty | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/gnu/stubs.h created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | /* This file is automatically generated. | |
| 2 | This file selects the right generated file of `__stub_FUNCTION' macros | |
| 3 | based on the architecture being compiled for. */ | |
| 4 | ||
| 5 | #include <bits/wordsize.h> | |
| 6 | ||
| 7 | #if __WORDSIZE == 64 && defined __loongarch_soft_float | |
| 8 | # include <gnu/stubs-lp64s.h> | |
| 9 | #endif | |
| 10 | #if __WORDSIZE == 64 && defined __loongarch_double_float | |
| 11 | # include <gnu/stubs-lp64d.h> | |
| 12 | #endif | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/ieee754.h created+170| ... | ... | @@ -0,0 +1,170 @@ |
| 1 | /* Copyright (C) 1992-2024 Free Software Foundation, Inc. | |
| 2 | This file is part of the GNU C Library. | |
| 3 | ||
| 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 | ||
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with the GNU C Library; if not, see | |
| 16 | <https://www.gnu.org/licenses/>. */ | |
| 17 | ||
| 18 | #ifndef _IEEE754_H | |
| 19 | #define _IEEE754_H 1 | |
| 20 | ||
| 21 | #include <features.h> | |
| 22 | ||
| 23 | #include <bits/endian.h> | |
| 24 | ||
| 25 | __BEGIN_DECLS | |
| 26 | ||
| 27 | union ieee754_float | |
| 28 | { | |
| 29 | float f; | |
| 30 | ||
| 31 | /* This is the IEEE 754 single-precision format. */ | |
| 32 | struct | |
| 33 | { | |
| 34 | #if	__BYTE_ORDER == __BIG_ENDIAN | |
| 35 | 	unsigned int negative:1; | |
| 36 | 	unsigned int exponent:8; | |
| 37 | 	unsigned int mantissa:23; | |
| 38 | #endif				/* Big endian. */ | |
| 39 | #if	__BYTE_ORDER == __LITTLE_ENDIAN | |
| 40 | 	unsigned int mantissa:23; | |
| 41 | 	unsigned int exponent:8; | |
| 42 | 	unsigned int negative:1; | |
| 43 | #endif				/* Little endian. */ | |
| 44 | } ieee; | |
| 45 | ||
| 46 | /* This format makes it easier to see if a NaN is a signalling NaN. */ | |
| 47 | struct | |
| 48 | { | |
| 49 | #if	__BYTE_ORDER == __BIG_ENDIAN | |
| 50 | 	unsigned int negative:1; | |
| 51 | 	unsigned int exponent:8; | |
| 52 | 	unsigned int quiet_nan:1; | |
| 53 | 	unsigned int mantissa:22; | |
| 54 | #endif				/* Big endian. */ | |
| 55 | #if	__BYTE_ORDER == __LITTLE_ENDIAN | |
| 56 | 	unsigned int mantissa:22; | |
| 57 | 	unsigned int quiet_nan:1; | |
| 58 | 	unsigned int exponent:8; | |
| 59 | 	unsigned int negative:1; | |
| 60 | #endif				/* Little endian. */ | |
| 61 | } ieee_nan; | |
| 62 | }; | |
| 63 | ||
| 64 | #define IEEE754_FLOAT_BIAS	0x7f /* Added to exponent. */ | |
| 65 | ||
| 66 | ||
| 67 | union ieee754_double | |
| 68 | { | |
| 69 | double d; | |
| 70 | ||
| 71 | /* This is the IEEE 754 double-precision format. */ | |
| 72 | struct | |
| 73 | { | |
| 74 | #if	__BYTE_ORDER == __BIG_ENDIAN | |
| 75 | 	unsigned int negative:1; | |
| 76 | 	unsigned int exponent:11; | |
| 77 | 	/* Together these comprise the mantissa. */ | |
| 78 | 	unsigned int mantissa0:20; | |
| 79 | 	unsigned int mantissa1:32; | |
| 80 | #endif				/* Big endian. */ | |
| 81 | #if	__BYTE_ORDER == __LITTLE_ENDIAN | |
| 82 | 	/* Together these comprise the mantissa. */ | |
| 83 | 	unsigned int mantissa1:32; | |
| 84 | 	unsigned int mantissa0:20; | |
| 85 | 	unsigned int exponent:11; | |
| 86 | 	unsigned int negative:1; | |
| 87 | #endif				/* Little endian. */ | |
| 88 | } ieee; | |
| 89 | ||
| 90 | /* This format makes it easier to see if a NaN is a signalling NaN. */ | |
| 91 | struct | |
| 92 | { | |
| 93 | #if	__BYTE_ORDER == __BIG_ENDIAN | |
| 94 | 	unsigned int negative:1; | |
| 95 | 	unsigned int exponent:11; | |
| 96 | 	unsigned int quiet_nan:1; | |
| 97 | 	/* Together these comprise the mantissa. */ | |
| 98 | 	unsigned int mantissa0:19; | |
| 99 | 	unsigned int mantissa1:32; | |
| 100 | #else | |
| 101 | 	/* Together these comprise the mantissa. */ | |
| 102 | 	unsigned int mantissa1:32; | |
| 103 | 	unsigned int mantissa0:19; | |
| 104 | 	unsigned int quiet_nan:1; | |
| 105 | 	unsigned int exponent:11; | |
| 106 | 	unsigned int negative:1; | |
| 107 | #endif | |
| 108 | } ieee_nan; | |
| 109 | }; | |
| 110 | ||
| 111 | #define IEEE754_DOUBLE_BIAS	0x3ff /* Added to exponent. */ | |
| 112 | ||
| 113 | ||
| 114 | union ieee854_long_double | |
| 115 | { | |
| 116 | long double d; | |
| 117 | ||
| 118 | /* This is the IEEE 854 quad-precision format. */ | |
| 119 | struct | |
| 120 | { | |
| 121 | #if	__BYTE_ORDER == __BIG_ENDIAN | |
| 122 | 	unsigned int negative:1; | |
| 123 | 	unsigned int exponent:15; | |
| 124 | 	/* Together these comprise the mantissa. */ | |
| 125 | 	unsigned int mantissa0:16; | |
| 126 | 	unsigned int mantissa1:32; | |
| 127 | 	unsigned int mantissa2:32; | |
| 128 | 	unsigned int mantissa3:32; | |
| 129 | #endif				/* Big endian. */ | |
| 130 | #if	__BYTE_ORDER == __LITTLE_ENDIAN | |
| 131 | 	/* Together these comprise the mantissa. */ | |
| 132 | 	unsigned int mantissa3:32; | |
| 133 | 	unsigned int mantissa2:32; | |
| 134 | 	unsigned int mantissa1:32; | |
| 135 | 	unsigned int mantissa0:16; | |
| 136 | 	unsigned int exponent:15; | |
| 137 | 	unsigned int negative:1; | |
| 138 | #endif				/* Little endian. */ | |
| 139 | } ieee; | |
| 140 | ||
| 141 | /* This format makes it easier to see if a NaN is a signalling NaN. */ | |
| 142 | struct | |
| 143 | { | |
| 144 | #if	__BYTE_ORDER == __BIG_ENDIAN | |
| 145 | 	unsigned int negative:1; | |
| 146 | 	unsigned int exponent:15; | |
| 147 | 	unsigned int quiet_nan:1; | |
| 148 | 	/* Together these comprise the mantissa. */ | |
| 149 | 	unsigned int mantissa0:15; | |
| 150 | 	unsigned int mantissa1:32; | |
| 151 | 	unsigned int mantissa2:32; | |
| 152 | 	unsigned int mantissa3:32; | |
| 153 | #else | |
| 154 | 	/* Together these comprise the mantissa. */ | |
| 155 | 	unsigned int mantissa3:32; | |
| 156 | 	unsigned int mantissa2:32; | |
| 157 | 	unsigned int mantissa1:32; | |
| 158 | 	unsigned int mantissa0:15; | |
| 159 | 	unsigned int quiet_nan:1; | |
| 160 | 	unsigned int exponent:15; | |
| 161 | 	unsigned int negative:1; | |
| 162 | #endif | |
| 163 | } ieee_nan; | |
| 164 | }; | |
| 165 | ||
| 166 | #define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */ | |
| 167 | ||
| 168 | __END_DECLS | |
| 169 | ||
| 170 | #endif /* ieee754.h */ | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/sys/asm.h created+78| ... | ... | @@ -0,0 +1,78 @@ |
| 1 | /* Miscellaneous macros. | |
| 2 | Copyright (C) 2022-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 | #ifndef _SYS_ASM_H | |
| 20 | #define _SYS_ASM_H | |
| 21 | ||
| 22 | #include <sys/regdef.h> | |
| 23 | #include <sysdeps/generic/sysdep.h> | |
| 24 | ||
| 25 | /* Macros to handle different pointer/register sizes for 32/64-bit code. */ | |
| 26 | #define SZREG 8 | |
| 27 | #define SZFREG 8 | |
| 28 | #define SZVREG 16 | |
| 29 | #define SZXREG 32 | |
| 30 | #define REG_L ld.d | |
| 31 | #define REG_S st.d | |
| 32 | #define SRLI srli.d | |
| 33 | #define SLLI slli.d | |
| 34 | #define ADDI addi.d | |
| 35 | #define ADD add.d | |
| 36 | #define SUB sub.d | |
| 37 | #define BSTRINS bstrins.d | |
| 38 | #define LI li.d | |
| 39 | #define FREG_L fld.d | |
| 40 | #define FREG_S fst.d | |
| 41 | ||
| 42 | /* Declare leaf routine. | |
| 43 | The usage of macro LEAF/ENTRY is as follows: | |
| 44 | 1. LEAF(fcn) -- the align value of fcn is .align 3 (default value) | |
| 45 | 2. LEAF(fcn, 6) -- the align value of fcn is .align 6 | |
| 46 | */ | |
| 47 | #define LEAF_IMPL(symbol, aln, ...)	\ | |
| 48 | 	.text;				\ | |
| 49 | 	.globl symbol;			\ | |
| 50 | 	.align aln;			\ | |
| 51 | 	.type symbol, @function;	\ | |
| 52 | symbol: \ | |
| 53 | 	cfi_startproc; | |
| 54 | ||
| 55 | ||
| 56 | #define LEAF(...) LEAF_IMPL(__VA_ARGS__, 3) | |
| 57 | #define ENTRY(...) LEAF(__VA_ARGS__) | |
| 58 | ||
| 59 | #define	LEAF_NO_ALIGN(symbol)		\ | |
| 60 | 	.text;				\ | |
| 61 | 	.globl	symbol;			\ | |
| 62 | 	.type	symbol, @function;	\ | |
| 63 | symbol: \ | |
| 64 | 	cfi_startproc; | |
| 65 | ||
| 66 | #define ENTRY_NO_ALIGN(symbol) LEAF_NO_ALIGN(symbol) | |
| 67 | ||
| 68 | ||
| 69 | /* Mark end of function. */ | |
| 70 | #undef END | |
| 71 | #define END(function) \ | |
| 72 | cfi_endproc; \ | |
| 73 | .size function, .- function; | |
| 74 | ||
| 75 | /* Stack alignment. */ | |
| 76 | #define ALMASK ~15 | |
| 77 | ||
| 78 | #endif /* sys/asm.h */ | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/sys/ucontext.h created+64| ... | ... | @@ -0,0 +1,64 @@ |
| 1 | /* struct ucontext definition. | |
| 2 | Copyright (C) 2022-2024 Free Software Foundation, Inc. | |
| 3 | ||
| 4 | This file is part of the GNU C Library. | |
| 5 | ||
| 6 | The GNU C Library is free software; you can redistribute it and/or | |
| 7 | modify it under the terms of the GNU Lesser General Public | |
| 8 | License as published by the Free Software Foundation; either | |
| 9 | version 2.1 of the License, or (at your option) any later version. | |
| 10 | ||
| 11 | The GNU C Library is distributed in the hope that it will be useful, | |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | Lesser General Public License for more details. | |
| 15 | ||
| 16 | You should have received a copy of the GNU Lesser General Public | |
| 17 | License along with the GNU C Library. If not, see | |
| 18 | <https://www.gnu.org/licenses/>. */ | |
| 19 | ||
| 20 | /* Don't rely on this, the interface is currently messed up and may need to | |
| 21 | be broken to be fixed. */ | |
| 22 | #ifndef _SYS_UCONTEXT_H | |
| 23 | #define _SYS_UCONTEXT_H 1 | |
| 24 | ||
| 25 | #include <features.h> | |
| 26 | ||
| 27 | #include <bits/types/sigset_t.h> | |
| 28 | #include <bits/types/stack_t.h> | |
| 29 | ||
| 30 | #ifdef __USE_MISC | |
| 31 | #define LARCH_NGREG 32 | |
| 32 | ||
| 33 | #define LARCH_REG_RA 1 | |
| 34 | #define LARCH_REG_SP 3 | |
| 35 | #define LARCH_REG_S0 23 | |
| 36 | #define LARCH_REG_S1 24 | |
| 37 | #define LARCH_REG_A0 4 | |
| 38 | #define LARCH_REG_S2 25 | |
| 39 | #define LARCH_REG_NARGS 8 | |
| 40 | ||
| 41 | typedef unsigned long int greg_t; | |
| 42 | /* Container for all general registers. */ | |
| 43 | typedef greg_t gregset_t[32]; | |
| 44 | #endif | |
| 45 | ||
| 46 | typedef struct mcontext_t | |
| 47 | { | |
| 48 | unsigned long long __pc; | |
| 49 | unsigned long long __gregs[32]; | |
| 50 | unsigned int __flags; | |
| 51 | unsigned long long __extcontext[0] __attribute__((__aligned__(16))); | |
| 52 | } mcontext_t; | |
| 53 | ||
| 54 | /* Userlevel context. */ | |
| 55 | typedef struct ucontext_t | |
| 56 | { | |
| 57 | unsigned long int __uc_flags; | |
| 58 | struct ucontext_t *uc_link; | |
| 59 | stack_t uc_stack; | |
| 60 | sigset_t uc_sigmask; | |
| 61 | mcontext_t uc_mcontext; | |
| 62 | } ucontext_t; | |
| 63 | ||
| 64 | #endif /* sys/ucontext.h */ | |
| \ No newline at end of file |
lib/libc/include/loongarch64-linux-gnusf/sys/user.h created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | /* struct user_regs_struct definition for LoongArch. | |
| 2 | Copyright (C) 2022-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 | #ifndef _SYS_USER_H | |
| 20 | #define _SYS_USER_H 1 | |
| 21 | ||
| 22 | #include <stdint.h> | |
| 23 | ||
| 24 | struct user_regs_struct | |
| 25 | { | |
| 26 | /* Saved main processor registers. */ | |
| 27 | uint64_t regs[32]; | |
| 28 | ||
| 29 | /* Saved special registers. */ | |
| 30 | uint64_t orig_a0; | |
| 31 | uint64_t csr_era; | |
| 32 | uint64_t csr_badv; | |
| 33 | uint64_t reserved[10]; | |
| 34 | }; | |
| 35 | ||
| 36 | struct user_fp_struct { | |
| 37 | uint64_t fpr[32]; | |
| 38 | uint64_t fcc; | |
| 39 | uint32_t fcsr; | |
| 40 | }; | |
| 41 | ||
| 42 | #endif /* _SYS_USER_H */ | |
| \ No newline at end of file |