diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-04-20 10:35:58 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-04-20 10:35:58 +0000 |
commit | 678771218a02548453be71f852ffd5eef855d5d6 (patch) | |
tree | 26da417dbbb60b56ca6d8d9903787704b3f879fb /sys/arch | |
parent | 72f7f196514cec45fc1583f824660562bb125e91 (diff) |
Remove the random() function from locore.s (which used sparcv7 instructions,
including mulscc to do multiplications) and switch to the generic random.c
code.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/sparc64/locore.s | 79 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 3 |
2 files changed, 13 insertions, 69 deletions
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index 77f6715ff8f..ff12401c558 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.136 2008/04/20 09:18:52 kettenis Exp $ */ +/* $OpenBSD: locore.s,v 1.137 2008/04/20 10:35:57 kettenis Exp $ */ /* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */ /* @@ -8905,72 +8905,6 @@ ENTRY(send_softint) wrpr %g1, 0, %pstate ! restore interrupts /* - * Here is a very good random number generator. This implementation is - * based on _Two Fast Implementations of the `Minimal Standard' Random - * Number Generator_, David G. Carta, Communications of the ACM, Jan 1990, - * Vol 33 No 1. - */ -/* - * This should be rewritten using the mulx instr. if I ever understand what it - * does. - */ - .data -randseed: - .word 1 - .text -ENTRY(random) - sethi %hi(16807), %o1 - wr %o1, %lo(16807), %y - sethi %hi(randseed), %o5 - ld [%o5 + %lo(randseed)], %o0 - andcc %g0, 0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %o0, %o2 - mulscc %o2, %g0, %o2 - rd %y, %o3 - srl %o2, 16, %o1 - set 0xffff, %o4 - and %o4, %o2, %o0 - sll %o0, 15, %o0 - srl %o3, 17, %o3 - or %o3, %o0, %o0 - addcc %o0, %o1, %o0 - bneg 1f - sethi %hi(0x7fffffff), %o1 - retl - st %o0, [%o5 + %lo(randseed)] -1: - or %o1, %lo(0x7fffffff), %o1 - add %o0, 1, %o0 - and %o1, %o0, %o0 - retl - st %o0, [%o5 + %lo(randseed)] - -#define MICROPERSEC (1000000) - .data - .align 16 - .globl _C_LABEL(cpu_clockrate) -_C_LABEL(cpu_clockrate): - !! Pretend we have a 200MHz clock -- cpu_attach will fix this - .xword 200000000 - !! Here we'll store cpu_clockrate/1000000 so we can calculate usecs - .xword 0 - .text - -/* * On Blackbird (UltraSPARC-II) CPUs, writes to %tick_cmpr may fail. * The workaround is to do a read immediately after the write and make * sure the same cache line. @@ -8995,6 +8929,17 @@ ENTRY(tickcmpr_set) retl nop +#define MICROPERSEC (1000000) + .data + .align 16 + .globl _C_LABEL(cpu_clockrate) +_C_LABEL(cpu_clockrate): + !! Pretend we have a 200MHz clock -- cpu_attach will fix this + .xword 200000000 + !! Here we'll store cpu_clockrate/1000000 so we can calculate usecs + .xword 0 + .text + /* * delay function * diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index eb5dcc28da8..8cccef8b9ae 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.108 2008/04/18 06:42:21 djm Exp $ */ +/* $OpenBSD: machdep.c,v 1.109 2008/04/20 10:35:57 kettenis Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -187,7 +187,6 @@ int bufpages = 0; int bufcachepercent = BUFCACHEPERCENT; int physmem; -u_long _randseed; extern caddr_t msgbufaddr; int sparc_led_blink; |