diff options
author | kato <kato@FreeBSD.org> | 1998-02-13 09:32:50 +0000 |
---|---|---|
committer | kato <kato@FreeBSD.org> | 1998-02-13 09:32:50 +0000 |
commit | cf182e9c4c2f70b100a2139e84e927d4a4e87776 (patch) | |
tree | c5da68edcf3fb0680cabec25c0117d4c8f2e9fb0 | |
parent | 0c954cc6d4e1ebb0978ad09534a3f2cd888ec9ea (diff) | |
download | FreeBSD-src-cf182e9c4c2f70b100a2139e84e927d4a4e87776.zip FreeBSD-src-cf182e9c4c2f70b100a2139e84e927d4a4e87776.tar.gz |
Sync with sys/i386/isa/npx.c revision 1.56.
-rw-r--r-- | sys/pc98/pc98/npx.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/sys/pc98/pc98/npx.c b/sys/pc98/pc98/npx.c index a9404d0..b82046b 100644 --- a/sys/pc98/pc98/npx.c +++ b/sys/pc98/pc98/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.29 1997/11/19 11:36:24 kato Exp $ + * $Id: npx.c,v 1.30 1998/01/31 07:23:16 eivind Exp $ */ #include "npx.h" @@ -44,6 +44,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/malloc.h> #include <sys/sysctl.h> #include <sys/conf.h> #include <sys/proc.h> @@ -136,6 +137,8 @@ typedef u_char bool_t; static int npxattach __P((struct isa_device *dvp)); static int npxprobe __P((struct isa_device *dvp)); static int npxprobe1 __P((struct isa_device *dvp)); +static long timezero __P((const char *funcname, + void (*func)(void *buf, size_t len))); struct isa_driver npxdriver = { npxprobe, npxattach, "npx", @@ -449,8 +452,10 @@ npxattach(dvp) } npxinit(__INITIAL_NPXCW__); -#if defined(I586_CPU) - if (cpu_class == CPUCLASS_586 && npx_ex16) { +#ifdef I586_CPU + if (cpu_class == CPUCLASS_586 && npx_ex16 && + timezero("i586_bzero()", i586_bzero) < + timezero("bzero()", bzero) * 4 / 5) { if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) { bcopy_vector = i586_bcopy; ovbcopy_vector = i586_bcopy; @@ -728,4 +733,34 @@ npxsave(addr) #endif /* SMP */ } +#ifdef I586_CPU +static long +timezero(funcname, func) + const char *funcname; + void (*func) __P((void *buf, size_t len)); + +{ + void *buf; +#define BUFSIZE 1000000 + long usec; + struct timeval finish, start; + + buf = malloc(BUFSIZE, M_TEMP, M_NOWAIT); + if (buf == NULL) + return (BUFSIZE); + microtime(&start); + (*func)(buf, BUFSIZE); + microtime(&finish); + usec = 1000000 * (finish.tv_sec - start.tv_sec) + + finish.tv_usec - start.tv_usec; + if (usec <= 0) + usec = 1; + if (bootverbose) + printf("%s bandwidth = %ld bytes/sec\n", + funcname, (long)(BUFSIZE * 1000000ll / usec)); + free(buf, M_TEMP); + return (usec); +} +#endif /* I586_CPU */ + #endif /* NNPX > 0 */ |