diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-08-24 12:59:52 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-08-24 12:59:52 +0000 |
commit | 926402bbfea3baf3e043e75d9bb125259937a8a9 (patch) | |
tree | e7f601ec69e20d21b167fa57468e4514b7572953 /sys | |
parent | 2c3cb02e61134e294bf21d0890c5b78cfc7f66b6 (diff) |
Since the cpu frequency can only be an integral number on the Luna88k,
simplify the delay() code, and as a result do not use floating-point code
in the kernel anymore.
Tested by aoyama@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/luna88k/luna88k/locore.S | 26 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/machdep.c | 19 |
2 files changed, 16 insertions, 29 deletions
diff --git a/sys/arch/luna88k/luna88k/locore.S b/sys/arch/luna88k/luna88k/locore.S index be8404e58a2..de7336ed029 100644 --- a/sys/arch/luna88k/luna88k/locore.S +++ b/sys/arch/luna88k/luna88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.5 2004/08/09 20:52:07 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.6 2004/08/24 12:59:51 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -388,27 +388,23 @@ GLOBAL(spin_cpu) * * REGISTER USAGE: * IN r1 - return address - * IN r2 - (signed int) number of microseconds - * r3 - (float) number of microseconds - * r4/5 - (double) number of cycles per microsecond - * r6 - (float) number of cycles to delay - * r7 - (signed) number of cycles to delay + * IN r2 - number of microseconds + * r3 - cpu speed in MHz + * r4 - number of cycles to delay */ GLOBAL(delay) - flt.ss r3, r2 /* convert microseconds from signed int to float */ - or.u r4, r0, hi16(_cycles_per_microsecond) - ld.d r4, r4, lo16(_cycles_per_microsecond) - fmul.ssd r6, r3, r4 /* convert microseconds to cycles */ - int.ss r7, r6 /* convert cycles from float to signed int */ - subu r7, r7, 25 /* subtract for overhead of above instruction */ + or.u r3, r0, hi16(_cpuspeed) + ld r3, r3, lo16(_cpuspeed) + mul r4, r2, r3 + subu r4, r4, 4 /* overhead of these instructions */ /* now loop for the given number of cycles */ 1: - bcnd.n gt0, r7, 1b - subu r7, r7, 2 /* two cycles per iteration */ + bcnd.n gt0, r4, 1b + subu r4, r4, 2 /* two cycles per iteration */ - jmp r1 /* return */ + jmp r1 /*****************************************************************************/ diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index fb77726cc16..ccb3568dff4 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.9 2004/08/18 13:29:46 aoyama Exp $ */ +/* $OpenBSD: machdep.c,v 1.10 2004/08/24 12:59:51 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -228,8 +228,7 @@ int machtype = LUNA_88K; /* may be overwritten in cpu_startup() */ int cputyp = CPU_88100; /* XXX: aoyama */ int boothowto; /* XXX: should be set in boot loader and locore.S */ int bootdev; /* XXX: should be set in boot loader and locore.S */ -int cpuspeed; -double cycles_per_microsecond; /* used in locore.S:delay() */ +int cpuspeed = 33; /* safe guess */ int sysconsole = 1; /* 0 = ttya, 1 = keyboard/mouse, used in dev/sio.c */ u_int16_t dipswitch = 0; /* set in locore.S */ int hwplanebits; /* set in locore.S */ @@ -355,22 +354,14 @@ size_memory() int getcpuspeed() { - double clock_mhz; - switch(machtype) { case LUNA_88K: - clock_mhz = 25.0; - break; + return 25; case LUNA_88K2: - clock_mhz = 33.0; - break; + return 33; default: panic("getcpuspeed: can not determine CPU speed"); - break; } - - cycles_per_microsecond = clock_mhz; - return (int)clock_mhz; } void @@ -423,7 +414,7 @@ cpu_startup() /* * Initialize error message buffer (at end of core). - * avail_end was pre-decremented in mvme_bootstrap() to compensate. + * avail_end was pre-decremented in luna88k_bootstrap() to compensate. */ for (i = 0; i < btoc(MSGBUFSIZE); i++) pmap_kenter_pa((paddr_t)msgbufp + i * NBPG, |