Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jan 2020 03:17:28 +0000 (UTC)
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356592 - head/sys/riscv/riscv
Message-ID:  <202001100317.00A3HSNC008302@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mhorne
Date: Fri Jan 10 03:17:28 2020
New Revision: 356592
URL: https://svnweb.freebsd.org/changeset/base/356592

Log:
  Replace inline assembly with rdtime macro
  
  This macro is used elsewhere and is slightly cleaner. NFC.

Modified:
  head/sys/riscv/riscv/timer.c

Modified: head/sys/riscv/riscv/timer.c
==============================================================================
--- head/sys/riscv/riscv/timer.c	Fri Jan 10 03:16:40 2020	(r356591)
+++ head/sys/riscv/riscv/timer.c	Fri Jan 10 03:17:28 2020	(r356592)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/bus.h>
 #include <machine/cpu.h>
+#include <machine/cpufunc.h>
 #include <machine/intr.h>
 #include <machine/asm.h>
 #include <machine/trap.h>
@@ -91,11 +92,8 @@ static struct timecounter riscv_timer_timecount = {
 static inline uint64_t
 get_cycles(void)
 {
-	uint64_t cycles;
 
-	__asm __volatile("rdtime %0" : "=r" (cycles));
-
-	return (cycles);
+	return (rdtime());
 }
 
 static long



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001100317.00A3HSNC008302>