summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-04-04 17:29:55 +0000
committerdes <des@FreeBSD.org>2003-04-04 17:29:55 +0000
commit5468286a89667ccea8bf58047707fe6b3b58f8a5 (patch)
tree78ef428aa1a0daeb9af91f6945cf0b45f53f3207
parent01bed5d97bf4b3317c245d345ff0713026246566 (diff)
downloadFreeBSD-src-5468286a89667ccea8bf58047707fe6b3b58f8a5.zip
FreeBSD-src-5468286a89667ccea8bf58047707fe6b3b58f8a5.tar.gz
Define ovbcopy() as a macro which expands to the equivalent bcopy() call,
to take care of the KAME IPv6 code which needs ovbcopy() because NetBSD's bcopy() doesn't handle overlap like ours. Remove all implementations of ovbcopy(). Previously, bzero was a function pointer on i386, to save a jmp to bzero_vector. Get rid of this microoptimization as it only confuses things, adds machine-dependent code to an MD header, and doesn't really save all that much. This commit does not add my pagezero() / pagecopy() code.
-rw-r--r--sys/alpha/alpha/support.s7
-rw-r--r--sys/amd64/amd64/fpu.c6
-rw-r--r--sys/amd64/amd64/identcpu.c2
-rw-r--r--sys/amd64/amd64/support.S17
-rw-r--r--sys/amd64/amd64/support.s17
-rw-r--r--sys/amd64/include/md_var.h9
-rw-r--r--sys/amd64/isa/npx.c6
-rw-r--r--sys/i386/i386/identcpu.c2
-rw-r--r--sys/i386/i386/support.s17
-rw-r--r--sys/i386/include/md_var.h9
-rw-r--r--sys/i386/isa/npx.c6
-rw-r--r--sys/ia64/ia64/support.S1
-rw-r--r--sys/ia64/ia64/support.s1
-rw-r--r--sys/powerpc/powerpc/bcopy.c6
-rw-r--r--sys/sparc64/sparc64/support.S1
-rw-r--r--sys/sys/systm.h7
16 files changed, 41 insertions, 73 deletions
diff --git a/sys/alpha/alpha/support.s b/sys/alpha/alpha/support.s
index 0ae8aa8..8977c2e 100644
--- a/sys/alpha/alpha/support.s
+++ b/sys/alpha/alpha/support.s
@@ -270,16 +270,11 @@ NESTED(copyoutstr, 4, 16, ra, 0, 0)
/*
* Copy a bytes within the kernel's address space.
- *
- * In the kernel, bcopy() doesn't have to handle the overlapping
- * case; that's that ovbcopy() is for. However, it doesn't hurt
- * to do both in bcopy, and it does provide a measure of safety.
+ * Handles overlapping regions.
*
* void bcopy(char *from, char *to, size_t len);
- * void ovbcopy(char *from, char *to, size_t len);
*/
LEAF(bcopy,3)
-XLEAF(ovbcopy,3)
/* Check for negative length */
ble a2,bcopy_done
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
index 9d11e9e..8dadb6b 100644
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -507,12 +507,10 @@ npx_attach(dev)
if (cpu_class == CPUCLASS_586 && npx_ex16 && npx_exists &&
timezero("i586_bzero()", i586_bzero) <
timezero("bzero()", bzero) * 4 / 5) {
- if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) {
+ if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY))
bcopy_vector = i586_bcopy;
- ovbcopy_vector = i586_bcopy;
- }
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BZERO))
- bzero = i586_bzero;
+ bzero_vector = i586_bzero;
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) {
copyin_vector = i586_copyin;
copyout_vector = i586_copyout;
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c
index 62d8620..fed5ec0 100644
--- a/sys/amd64/amd64/identcpu.c
+++ b/sys/amd64/amd64/identcpu.c
@@ -563,7 +563,7 @@ printcpuinfo(void)
#if defined(I486_CPU)
case CPUCLASS_486:
printf("486");
- bzero = i486_bzero;
+ bzero_vector = i486_bzero;
break;
#endif
#if defined(I586_CPU)
diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S
index cdf78bf..f0f99e4 100644
--- a/sys/amd64/amd64/support.S
+++ b/sys/amd64/amd64/support.S
@@ -48,8 +48,8 @@
.globl bcopy_vector
bcopy_vector:
.long generic_bcopy
- .globl bzero
-bzero:
+ .globl bzero_vector
+bzero_vector:
.long generic_bzero
.globl copyin_vector
copyin_vector:
@@ -57,9 +57,6 @@ copyin_vector:
.globl copyout_vector
copyout_vector:
.long generic_copyout
- .globl ovbcopy_vector
-ovbcopy_vector:
- .long generic_bcopy
#if defined(I586_CPU) && defined(DEV_NPX)
kernel_fpu_lock:
.byte 0xfe
@@ -73,6 +70,10 @@ kernel_fpu_lock:
* void bzero(void *buf, u_int len)
*/
+ENTRY(bzero)
+ MEXITCOUNT
+ jmp *bzero_vector
+
ENTRY(generic_bzero)
pushl %edi
movl 8(%esp),%edi
@@ -361,7 +362,7 @@ ENTRY(i686_pagezero)
1:
xorl %eax, %eax
repe
- scasl
+ scasl
jnz 2f
popl %ebx
@@ -446,10 +447,6 @@ ENTRY(bcopy)
MEXITCOUNT
jmp *bcopy_vector
-ENTRY(ovbcopy)
- MEXITCOUNT
- jmp *ovbcopy_vector
-
/*
* generic_bcopy(src, dst, cnt)
* ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
diff --git a/sys/amd64/amd64/support.s b/sys/amd64/amd64/support.s
index cdf78bf..f0f99e4 100644
--- a/sys/amd64/amd64/support.s
+++ b/sys/amd64/amd64/support.s
@@ -48,8 +48,8 @@
.globl bcopy_vector
bcopy_vector:
.long generic_bcopy
- .globl bzero
-bzero:
+ .globl bzero_vector
+bzero_vector:
.long generic_bzero
.globl copyin_vector
copyin_vector:
@@ -57,9 +57,6 @@ copyin_vector:
.globl copyout_vector
copyout_vector:
.long generic_copyout
- .globl ovbcopy_vector
-ovbcopy_vector:
- .long generic_bcopy
#if defined(I586_CPU) && defined(DEV_NPX)
kernel_fpu_lock:
.byte 0xfe
@@ -73,6 +70,10 @@ kernel_fpu_lock:
* void bzero(void *buf, u_int len)
*/
+ENTRY(bzero)
+ MEXITCOUNT
+ jmp *bzero_vector
+
ENTRY(generic_bzero)
pushl %edi
movl 8(%esp),%edi
@@ -361,7 +362,7 @@ ENTRY(i686_pagezero)
1:
xorl %eax, %eax
repe
- scasl
+ scasl
jnz 2f
popl %ebx
@@ -446,10 +447,6 @@ ENTRY(bcopy)
MEXITCOUNT
jmp *bcopy_vector
-ENTRY(ovbcopy)
- MEXITCOUNT
- jmp *ovbcopy_vector
-
/*
* generic_bcopy(src, dst, cnt)
* ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h
index 6bcecff..bf3eca4 100644
--- a/sys/amd64/include/md_var.h
+++ b/sys/amd64/include/md_var.h
@@ -36,12 +36,14 @@
* Miscellaneous machine-dependent declarations.
*/
-extern long Maxmem;
-extern u_int atdevbase; /* offset in virtual memory of ISA io mem */
extern void (*bcopy_vector)(const void *from, void *to, size_t len);
-extern int busdma_swi_pending;
+extern void (*bzero_vector)(void *buf, size_t len);
extern int (*copyin_vector)(const void *udaddr, void *kaddr, size_t len);
extern int (*copyout_vector)(const void *kaddr, void *udaddr, size_t len);
+
+extern long Maxmem;
+extern u_int atdevbase; /* offset in virtual memory of ISA io mem */
+extern int busdma_swi_pending;
extern u_int cpu_exthigh;
extern u_int cpu_feature;
extern u_int cpu_fxsr;
@@ -56,7 +58,6 @@ extern char kstack[];
extern int need_pre_dma_flush;
extern int need_post_dma_flush;
#endif
-extern void (*ovbcopy_vector)(const void *from, void *to, size_t len);
extern char sigcode[];
extern int szsigcode;
#ifdef COMPAT_FREEBSD4
diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c
index 9d11e9e..8dadb6b 100644
--- a/sys/amd64/isa/npx.c
+++ b/sys/amd64/isa/npx.c
@@ -507,12 +507,10 @@ npx_attach(dev)
if (cpu_class == CPUCLASS_586 && npx_ex16 && npx_exists &&
timezero("i586_bzero()", i586_bzero) <
timezero("bzero()", bzero) * 4 / 5) {
- if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) {
+ if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY))
bcopy_vector = i586_bcopy;
- ovbcopy_vector = i586_bcopy;
- }
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BZERO))
- bzero = i586_bzero;
+ bzero_vector = i586_bzero;
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) {
copyin_vector = i586_copyin;
copyout_vector = i586_copyout;
diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c
index 62d8620..fed5ec0 100644
--- a/sys/i386/i386/identcpu.c
+++ b/sys/i386/i386/identcpu.c
@@ -563,7 +563,7 @@ printcpuinfo(void)
#if defined(I486_CPU)
case CPUCLASS_486:
printf("486");
- bzero = i486_bzero;
+ bzero_vector = i486_bzero;
break;
#endif
#if defined(I586_CPU)
diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s
index cdf78bf..f0f99e4 100644
--- a/sys/i386/i386/support.s
+++ b/sys/i386/i386/support.s
@@ -48,8 +48,8 @@
.globl bcopy_vector
bcopy_vector:
.long generic_bcopy
- .globl bzero
-bzero:
+ .globl bzero_vector
+bzero_vector:
.long generic_bzero
.globl copyin_vector
copyin_vector:
@@ -57,9 +57,6 @@ copyin_vector:
.globl copyout_vector
copyout_vector:
.long generic_copyout
- .globl ovbcopy_vector
-ovbcopy_vector:
- .long generic_bcopy
#if defined(I586_CPU) && defined(DEV_NPX)
kernel_fpu_lock:
.byte 0xfe
@@ -73,6 +70,10 @@ kernel_fpu_lock:
* void bzero(void *buf, u_int len)
*/
+ENTRY(bzero)
+ MEXITCOUNT
+ jmp *bzero_vector
+
ENTRY(generic_bzero)
pushl %edi
movl 8(%esp),%edi
@@ -361,7 +362,7 @@ ENTRY(i686_pagezero)
1:
xorl %eax, %eax
repe
- scasl
+ scasl
jnz 2f
popl %ebx
@@ -446,10 +447,6 @@ ENTRY(bcopy)
MEXITCOUNT
jmp *bcopy_vector
-ENTRY(ovbcopy)
- MEXITCOUNT
- jmp *ovbcopy_vector
-
/*
* generic_bcopy(src, dst, cnt)
* ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h
index 6bcecff..bf3eca4 100644
--- a/sys/i386/include/md_var.h
+++ b/sys/i386/include/md_var.h
@@ -36,12 +36,14 @@
* Miscellaneous machine-dependent declarations.
*/
-extern long Maxmem;
-extern u_int atdevbase; /* offset in virtual memory of ISA io mem */
extern void (*bcopy_vector)(const void *from, void *to, size_t len);
-extern int busdma_swi_pending;
+extern void (*bzero_vector)(void *buf, size_t len);
extern int (*copyin_vector)(const void *udaddr, void *kaddr, size_t len);
extern int (*copyout_vector)(const void *kaddr, void *udaddr, size_t len);
+
+extern long Maxmem;
+extern u_int atdevbase; /* offset in virtual memory of ISA io mem */
+extern int busdma_swi_pending;
extern u_int cpu_exthigh;
extern u_int cpu_feature;
extern u_int cpu_fxsr;
@@ -56,7 +58,6 @@ extern char kstack[];
extern int need_pre_dma_flush;
extern int need_post_dma_flush;
#endif
-extern void (*ovbcopy_vector)(const void *from, void *to, size_t len);
extern char sigcode[];
extern int szsigcode;
#ifdef COMPAT_FREEBSD4
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c
index 9d11e9e..8dadb6b 100644
--- a/sys/i386/isa/npx.c
+++ b/sys/i386/isa/npx.c
@@ -507,12 +507,10 @@ npx_attach(dev)
if (cpu_class == CPUCLASS_586 && npx_ex16 && npx_exists &&
timezero("i586_bzero()", i586_bzero) <
timezero("bzero()", bzero) * 4 / 5) {
- if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) {
+ if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY))
bcopy_vector = i586_bcopy;
- ovbcopy_vector = i586_bcopy;
- }
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BZERO))
- bzero = i586_bzero;
+ bzero_vector = i586_bzero;
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) {
copyin_vector = i586_copyin;
copyout_vector = i586_copyout;
diff --git a/sys/ia64/ia64/support.S b/sys/ia64/ia64/support.S
index b37b3cd..18537f0 100644
--- a/sys/ia64/ia64/support.S
+++ b/sys/ia64/ia64/support.S
@@ -497,7 +497,6 @@ END(copyoutstr)
* Not the fastest bcopy in the world.
*/
ENTRY(bcopy, 3)
-XENTRY(ovbcopy)
mov ret0=r0 // return zero for copy{in,out}
;;
diff --git a/sys/ia64/ia64/support.s b/sys/ia64/ia64/support.s
index b37b3cd..18537f0 100644
--- a/sys/ia64/ia64/support.s
+++ b/sys/ia64/ia64/support.s
@@ -497,7 +497,6 @@ END(copyoutstr)
* Not the fastest bcopy in the world.
*/
ENTRY(bcopy, 3)
-XENTRY(ovbcopy)
mov ret0=r0 // return zero for copy{in,out}
;;
diff --git a/sys/powerpc/powerpc/bcopy.c b/sys/powerpc/powerpc/bcopy.c
index c89b8c7..d4366d6 100644
--- a/sys/powerpc/powerpc/bcopy.c
+++ b/sys/powerpc/powerpc/bcopy.c
@@ -151,9 +151,3 @@ bcopy(const void *src0, void *dst0, size_t length)
memcpy(dst0, src0, length);
}
-void
-ovbcopy(const void *src0, void *dst0, size_t length)
-{
-
- memcpy(dst0, src0, length);
-}
diff --git a/sys/sparc64/sparc64/support.S b/sys/sparc64/sparc64/support.S
index c2e68a7..ddd4336 100644
--- a/sys/sparc64/sparc64/support.S
+++ b/sys/sparc64/sparc64/support.S
@@ -273,7 +273,6 @@ END(bcmp)
* void bcopy(const void *src, void *dst, size_t len)
*/
ENTRY(bcopy)
-ENTRY(ovbcopy)
/*
* Check for overlap, and copy backwards if so.
*/
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 698ff07..04d54cd 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -169,14 +169,9 @@ quad_t strtoq(const char *, char **, int);
u_quad_t strtouq(const char *, char **, int);
void tprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4);
+#define ovbcopy(f, t, l) bcopy((f), (t), (l))
void bcopy(const void *from, void *to, size_t len);
-void ovbcopy(const void *from, void *to, size_t len);
-
-#ifdef __i386__
-extern void (*bzero)(void *buf, size_t len);
-#else
void bzero(void *buf, size_t len);
-#endif
void *memcpy(void *to, const void *from, size_t len);
OpenPOWER on IntegriCloud