aboutsummaryrefslogtreecommitdiff
path: root/sys/riscv/riscv
diff options
context:
space:
mode:
authorJessica Clarke <jrtc27@FreeBSD.org>2021-07-05 15:16:53 +0000
committerJessica Clarke <jrtc27@FreeBSD.org>2021-07-05 15:16:53 +0000
commit348c41d1815dc2e872a1deba1f4bf760caaa1094 (patch)
tree1ade320155a44c90dc9bc14cbf4a7cd8ea009c2c /sys/riscv/riscv
parentaf433832f7520840c22edd1fe1266c1a5cb781ad (diff)
downloadsrc-348c41d1815dc2e872a1deba1f4bf760caaa1094.tar.gz
src-348c41d1815dc2e872a1deba1f4bf760caaa1094.zip
riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep
PR: 256905 Reviewed by: arichardson, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30963
Diffstat (limited to 'sys/riscv/riscv')
-rw-r--r--sys/riscv/riscv/elf_machdep.c4
-rw-r--r--sys/riscv/riscv/timer.c14
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c
index ee80e04e8c31..2a355a977800 100644
--- a/sys/riscv/riscv/elf_machdep.c
+++ b/sys/riscv/riscv/elf_machdep.c
@@ -87,8 +87,8 @@ struct sysentvec elf64_freebsd_sysvec = {
.sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
- .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_ASLR |
- SV_RNG_SEED_VER,
+ .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_TIMEKEEP |
+ SV_ASLR | SV_RNG_SEED_VER,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
diff --git a/sys/riscv/riscv/timer.c b/sys/riscv/riscv/timer.c
index 845a2fbed2ff..c75350f4aac5 100644
--- a/sys/riscv/riscv/timer.c
+++ b/sys/riscv/riscv/timer.c
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <sys/timeet.h>
#include <sys/timetc.h>
+#include <sys/vdso.h>
#include <sys/watchdog.h>
#include <sys/proc.h>
@@ -78,6 +79,9 @@ struct riscv_timer_softc {
static struct riscv_timer_softc *riscv_timer_sc = NULL;
+static uint32_t riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th,
+ struct timecounter *tc);
+
static timecounter_get_t riscv_timer_get_timecount;
static struct timecounter riscv_timer_timecount = {
@@ -87,6 +91,7 @@ static struct timecounter riscv_timer_timecount = {
.tc_counter_mask = ~0u,
.tc_frequency = 0,
.tc_quality = 1000,
+ .tc_fill_vdso_timehands = riscv_timer_fill_vdso_timehands,
};
static inline uint64_t
@@ -301,3 +306,12 @@ DELAY(int usec)
}
TSEXIT();
}
+
+static uint32_t
+riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th,
+ struct timecounter *tc)
+{
+ vdso_th->th_algo = VDSO_TH_ALGO_RISCV_RDTIME;
+ bzero(vdso_th->th_res, sizeof(vdso_th->th_res));
+ return (1);
+}