diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-02-19 03:04:42 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-02-19 03:04:42 +0000 |
commit | c43288b79c7c85702f600e3d0b770419f73d85d5 (patch) | |
tree | b9a5ef762bbe88218458681caff824c3d8486059 /sys/arch | |
parent | ea8965ca2cb5a3139ee54342c3e42aba7f83954a (diff) |
From NetBSD:
Fix microsecond calculation in microtime.
Fix register allocation in microtime().
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/sparc64/locore.s | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index c43a1c1e0f3..98e8514c933 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.9 2001/09/17 04:20:27 jason Exp $ */ +/* $OpenBSD: locore.s,v 1.10 2002/02/19 03:04:41 jason Exp $ */ /* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */ /* @@ -11945,26 +11945,25 @@ microtick: bne 2b ! if time.tv_usec changed sethi %hi(_C_LABEL(cpu_clockrate)), %o1 - ldx [%o1 + %lo(_C_LABEL(cpu_clockrate) + 8)], %o4 ! Get scale factor + ldx [%o1 + %lo(_C_LABEL(cpu_clockrate) + 8)], %g1 ! Get scale factor sethi %hi(MICROPERSEC), %o5 - brnz,pt %o4, 1f ! Already scaled? - or %o2, %lo(MICROPERSEC), %o5 + brnz,pt %g1, 1f ! Already scaled? + or %o5, %lo(MICROPERSEC), %o5 !! Calculate ticks/usec - ldx [%o1 + %lo(_C_LABEL(cpu_clockrate))], %o4 ! No, we need to calculate it - udivx %o4, %o5, %o4 ! Hz / 10^6 = MHz - stx %o4, [%o1 + %lo(_C_LABEL(cpu_clockrate) + 8)] ! Save it so we don't need to divide again + ldx [%o1 + %lo(_C_LABEL(cpu_clockrate))], %g1 ! No, we need to calculate it + udivx %g1, %o5, %g1 ! Hz / 10^6 = MHz + stx %g1, [%o1 + %lo(_C_LABEL(cpu_clockrate) + 8)] ! Save it so we don't need to divide again 1: STPTR %o2, [%o0] ! Store seconds. - udivx %o4, %o1, %o4 ! Scale it: ticks / MHz = usec + udivx %o4, %g1, %o4 ! Scale it: ticks / MHz = usec udivx %o4, %o5, %o2 ! Now %o2 has seconds mulx %o2, %o5, %o5 ! Now calculate usecs -- damn no remainder insn sub %o4, %o5, %o1 ! %o1 has the remainder - add %o1, %o3, %o1 ! I think this is wrong retl STPTR %o1, [%o0+PTRSZ] ! Save time_t low word #endif |