123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- From edd15521391233dec3a1538c1e091881395b277b Mon Sep 17 00:00:00 2001
- From: "max.ma" <max.ma@starfivetech.com>
- Date: Wed, 9 Feb 2022 23:12:18 -0800
- Subject: [PATCH 10/12] Revert "RISC-V: Save and restore VCSR when doing user
- context switch"
- This reverts commit 1c08ed548a24c41542bdb7309e05c1aef70f135d.
- ---
- sysdeps/riscv/Makefile | 5 ---
- sysdeps/riscv/rtld-global-offsets.sym | 7 ----
- sysdeps/unix/sysv/linux/riscv/bits/hwcap.h | 31 ---------------
- sysdeps/unix/sysv/linux/riscv/getcontext.S | 22 +----------
- sysdeps/unix/sysv/linux/riscv/setcontext.S | 22 -----------
- sysdeps/unix/sysv/linux/riscv/swapcontext.S | 41 --------------------
- sysdeps/unix/sysv/linux/riscv/ucontext_i.sym | 6 ---
- 7 files changed, 1 insertion(+), 133 deletions(-)
- delete mode 100644 sysdeps/riscv/rtld-global-offsets.sym
- delete mode 100644 sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
- diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
- index a5c2106a09..20a9968106 100644
- --- a/sysdeps/riscv/Makefile
- +++ b/sysdeps/riscv/Makefile
- @@ -2,11 +2,6 @@ ifeq ($(subdir),misc)
- sysdep_headers += sys/asm.h
- endif
-
- -ifeq ($(subdir),csu)
- -# get offset to rtld_global._dl_hwcap and rtld_global._dl_hwcap2.
- -gen-as-const-headers += rtld-global-offsets.sym
- -endif
- -
- # RISC-V's assembler also needs to know about PIC as it changes the definition
- # of some assembler macros.
- ASFLAGS-.os += $(pic-ccflag)
- diff --git a/sysdeps/riscv/rtld-global-offsets.sym b/sysdeps/riscv/rtld-global-offsets.sym
- deleted file mode 100644
- index ff4e97f2a6..0000000000
- --- a/sysdeps/riscv/rtld-global-offsets.sym
- +++ /dev/null
- @@ -1,7 +0,0 @@
- -#define SHARED 1
- -
- -#include <ldsodefs.h>
- -
- -#define rtld_global_ro_offsetof(mem) offsetof (struct rtld_global_ro, mem)
- -
- -RTLD_GLOBAL_RO_DL_HWCAP_OFFSET rtld_global_ro_offsetof (_dl_hwcap)
- diff --git a/sysdeps/unix/sysv/linux/riscv/bits/hwcap.h b/sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
- deleted file mode 100644
- index e6c5ef5740..0000000000
- --- a/sysdeps/unix/sysv/linux/riscv/bits/hwcap.h
- +++ /dev/null
- @@ -1,31 +0,0 @@
- -/* Defines for bits in AT_HWCAP. RISC-V Linux version.
- - Copyright (C) 2021 Free Software Foundation, Inc.
- - This file is part of the GNU C Library.
- -
- - The GNU C Library is free software; you can redistribute it and/or
- - modify it under the terms of the GNU Lesser General Public
- - License as published by the Free Software Foundation; either
- - version 2.1 of the License, or (at your option) any later version.
- -
- - The GNU C Library is distributed in the hope that it will be useful,
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- - Lesser General Public License for more details.
- -
- - You should have received a copy of the GNU Lesser General Public
- - License along with the GNU C Library; if not, see
- - <http://www.gnu.org/licenses/>. */
- -
- -#if !defined (_SYS_AUXV_H) && !defined (_LINUX_RISCV_SYSDEP_H)
- -# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
- -#endif
- -
- -/* The following must match the kernel's <asm/hwcap.h>. */
- -#define HWCAP_ISA_I 0x100 //(1 << ('I' - 'A'))
- -#define HWCAP_ISA_M 0x1000 //(1 << ('M' - 'A'))
- -#define HWCAP_ISA_A 0x1 //(1 << ('A' - 'A'))
- -#define HWCAP_ISA_F 0x20 //(1 << ('F' - 'A'))
- -#define HWCAP_ISA_D 0x8 //(1 << ('D' - 'A'))
- -#define HWCAP_ISA_C 0x4 //(1 << ('C' - 'A'))
- -#define HWCAP_ISA_V 0x200000 //(1 << ('V' - 'A'))
- -
- diff --git a/sysdeps/unix/sysv/linux/riscv/getcontext.S b/sysdeps/unix/sysv/linux/riscv/getcontext.S
- index 840d8feca4..d6a9bbca60 100644
- --- a/sysdeps/unix/sysv/linux/riscv/getcontext.S
- +++ b/sysdeps/unix/sysv/linux/riscv/getcontext.S
- @@ -16,8 +16,6 @@
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
- -#include <sysdep.h>
- -#include <rtld-global-offsets.h>
- #include "ucontext-macros.h"
-
- /* int getcontext (ucontext_t *ucp) */
- @@ -41,25 +39,6 @@ LEAF (__getcontext)
- SAVE_INT_REG (s10, 26, a0)
- SAVE_INT_REG (s11, 27, a0)
-
- -#ifdef __riscv_vector
- -# ifdef SHARED
- - la t1, _rtld_global_ro
- - REG_L t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
- -# else
- - la t1, _dl_hwcap
- - REG_L t1, (t1)
- -# endif
- - li t2, HWCAP_ISA_V
- - and t2, t1, t2
- - beqz t2, 1f
- - addi t2, a0, MCONTEXT_EXTENSION
- - li t1, RVV_MAGIC
- - sw t1, (t2)
- - csrr t1, vcsr
- - REG_S t1, VCSR_OFFSET(t2)
- -1:
- -#endif
- -
- #ifndef __riscv_float_abi_soft
- frsr a1
-
- @@ -94,4 +73,5 @@ LEAF (__getcontext)
- 99: j __syscall_error
-
- PSEUDO_END (__getcontext)
- +
- weak_alias (__getcontext, getcontext)
- diff --git a/sysdeps/unix/sysv/linux/riscv/setcontext.S b/sysdeps/unix/sysv/linux/riscv/setcontext.S
- index d2404fbe9c..9510518750 100644
- --- a/sysdeps/unix/sysv/linux/riscv/setcontext.S
- +++ b/sysdeps/unix/sysv/linux/riscv/setcontext.S
- @@ -16,8 +16,6 @@
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
- -#include <sysdep.h>
- -#include <rtld-global-offsets.h>
- #include "ucontext-macros.h"
-
- /* int __setcontext (const ucontext_t *ucp)
- @@ -66,26 +64,6 @@ LEAF (__setcontext)
- fssr t1
- #endif /* __riscv_float_abi_soft */
-
- -#ifdef __riscv_vector
- -#ifdef SHARED
- - la t1, _rtld_global_ro
- - REG_L t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
- -#else
- - la t1, _dl_hwcap
- - REG_L t1, (t1)
- -#endif
- - li t2, HWCAP_ISA_V
- - and t2, t1, t2
- - beqz t2, 1f
- - li t1, RVV_MAGIC
- - addi t2, t0, MCONTEXT_EXTENSION
- - lw a1, (t2)
- - bne a1, t1, 1f
- - REG_L t1, VCSR_OFFSET(t2)
- - csrw vcsr, t1
- -1:
- -#endif
- -
- /* Note the contents of argument registers will be random
- unless makecontext() has been called. */
- RESTORE_INT_REG (t1, 0, t0)
- diff --git a/sysdeps/unix/sysv/linux/riscv/swapcontext.S b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
- index 94ae8e4bdc..df0f69969c 100644
- --- a/sysdeps/unix/sysv/linux/riscv/swapcontext.S
- +++ b/sysdeps/unix/sysv/linux/riscv/swapcontext.S
- @@ -16,8 +16,6 @@
- License along with the GNU C Library. If not, see
- <https://www.gnu.org/licenses/>. */
-
- -#include <sysdep.h>
- -#include <rtld-global-offsets.h>
- #include "ucontext-macros.h"
-
- /* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
- @@ -42,25 +40,6 @@ LEAF (__swapcontext)
- SAVE_INT_REG (s10, 26, a0)
- SAVE_INT_REG (s11, 27, a0)
-
- -#ifdef __riscv_vector
- -#ifdef SHARED
- - la t1, _rtld_global_ro
- - REG_L t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
- -#else
- - la t1, _dl_hwcap
- - REG_L t1, (t1)
- -#endif
- - li t2, HWCAP_ISA_V
- - and t2, t1, t2
- - beqz t2, 1f
- - addi t2, a0, MCONTEXT_EXTENSION
- - li t1, RVV_MAGIC
- - sw t1, (t2)
- - csrr t1, vcsr
- - REG_S t1, VCSR_OFFSET(t2)
- -1:
- -#endif
- -
- #ifndef __riscv_float_abi_soft
- frsr a1
-
- @@ -110,26 +89,6 @@ LEAF (__swapcontext)
- fssr t1
- #endif /* __riscv_float_abi_soft */
-
- -#ifdef __riscv_vector
- -#ifdef SHARED
- - la t1, _rtld_global_ro
- - REG_L t1, RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(t1)
- -#else
- - la t1, _dl_hwcap
- - REG_L t1, (t1)
- -#endif
- - li t2, HWCAP_ISA_V
- - and t2, t1, t2
- - beqz t2, 1f
- - li t1, RVV_MAGIC
- - addi t2, t0, MCONTEXT_EXTENSION
- - lw a1, (t2)
- - bne a1, t1, 1f
- - REG_L t1, VCSR_OFFSET(t2)
- - csrw vcsr, t1
- -1:
- -#endif
- -
- /* Note the contents of argument registers will be random
- unless makecontext() has been called. */
- RESTORE_INT_REG (t1, 0, t0)
- diff --git a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
- index 4037473c9a..be55b26310 100644
- --- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
- +++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym
- @@ -2,7 +2,6 @@
- #include <signal.h>
- #include <stddef.h>
- #include <sys/ucontext.h>
- -#include <asm/sigcontext.h>
-
- -- Constants used by the rt_sigprocmask call.
-
- @@ -28,10 +27,5 @@ STACK_FLAGS stack (ss_flags)
-
- MCONTEXT_GREGS mcontext (__gregs)
- MCONTEXT_FPREGS mcontext (__fpregs)
- -MCONTEXT_EXTENSION mcontext (__reserved)
-
- UCONTEXT_SIZE sizeof (ucontext_t)
- -
- -VCSR_OFFSET offsetof (struct __riscv_v_state, vcsr)
- -
- -RVV_MAGIC
- --
- 2.33.1
|