Some boot blocks too big now, only compare in big chunks if !_STANDALONE.diff -r1.9 -r1.10 src/common/lib/libc/string/bcmp.c
(ad)
--- src/common/lib/libc/string/bcmp.c 2020/01/27 22:22:03 1.9
+++ src/common/lib/libc/string/bcmp.c 2020/01/29 09:18:26 1.10
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: bcmp.c,v 1.9 2020/01/27 22:22:03 ad Exp $ */ | 1 | /* $NetBSD: bcmp.c,v 1.10 2020/01/29 09:18:26 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2020 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2020 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Andrew Doran. | 8 | * by Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -53,65 +53,71 @@ | @@ -53,65 +53,71 @@ | |||
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
58 | * SUCH DAMAGE. | 58 | * SUCH DAMAGE. | |
59 | */ | 59 | */ | |
60 | 60 | |||
61 | #include <sys/cdefs.h> | 61 | #include <sys/cdefs.h> | |
62 | #if defined(LIBC_SCCS) && !defined(lint) | 62 | #if defined(LIBC_SCCS) && !defined(lint) | |
63 | #if 0 | 63 | #if 0 | |
64 | static char sccsid[] = "@(#)bcmp.c 8.1 (Berkeley) 6/4/93"; | 64 | static char sccsid[] = "@(#)bcmp.c 8.1 (Berkeley) 6/4/93"; | |
65 | #else | 65 | #else | |
66 | __RCSID("$NetBSD: bcmp.c,v 1.9 2020/01/27 22:22:03 ad Exp $"); | 66 | __RCSID("$NetBSD: bcmp.c,v 1.10 2020/01/29 09:18:26 ad Exp $"); | |
67 | #endif | 67 | #endif | |
68 | #endif /* LIBC_SCCS and not lint */ | 68 | #endif /* LIBC_SCCS and not lint */ | |
69 | 69 | |||
70 | 70 | |||
71 | #if defined(_KERNEL) || defined(_STANDALONE) | 71 | #if defined(_KERNEL) || defined(_STANDALONE) | |
72 | #include <lib/libkern/libkern.h> | 72 | #include <lib/libkern/libkern.h> | |
73 | #if defined(_STANDALONE) | 73 | #if defined(_STANDALONE) | |
74 | #include <lib/libsa/stand.h> | 74 | #include <lib/libsa/stand.h> | |
75 | #endif | 75 | #endif | |
76 | #else | 76 | #else | |
77 | #include <sys/types.h> | 77 | #include <sys/types.h> | |
78 | 78 | |||
79 | #include <assert.h> | 79 | #include <assert.h> | |
80 | #include <string.h> | 80 | #include <string.h> | |
81 | #endif | 81 | #endif | |
82 | 82 | |||
83 | /* | 83 | /* | |
84 | * bcmp -- vax cmpc3 instruction | 84 | * bcmp -- vax cmpc3 instruction | |
85 | */ | 85 | */ | |
86 | int | 86 | int | |
87 | bcmp(const void *s1, const void *s2, size_t n) | 87 | bcmp(const void *s1, const void *s2, size_t n) | |
88 | { | 88 | { | |
89 | const uintptr_t *b1, *b2; | |||
90 | const unsigned char *c1, *c2; | 89 | const unsigned char *c1, *c2; | |
91 | 90 | |||
91 | #ifndef _STANDALONE | |||
92 | const uintptr_t *b1, *b2; | |||
93 | ||||
92 | b1 = s1; | 94 | b1 = s1; | |
93 | b2 = s2; | 95 | b2 = s2; | |
94 | 96 | |||
95 | #ifndef __NO_STRICT_ALIGNMENT | 97 | #ifndef __NO_STRICT_ALIGNMENT | |
96 | if ((((uintptr_t)b1 | (uintptr_t)b2) & (sizeof(uintptr_t) - 1)) == 0) | 98 | if ((((uintptr_t)b1 | (uintptr_t)b2) & (sizeof(uintptr_t) - 1)) == 0) | |
97 | #endif | 99 | #endif | |
98 | { | 100 | { | |
99 | while (n >= sizeof(uintptr_t)) { | 101 | while (n >= sizeof(uintptr_t)) { | |
100 | if (*b1++ != *b2++) | 102 | if (*b1++ != *b2++) | |
101 | return 1; | 103 | return 1; | |
102 | n -= sizeof(uintptr_t); | 104 | n -= sizeof(uintptr_t); | |
103 | } | 105 | } | |
104 | } | 106 | } | |
105 | 107 | |||
106 | c1 = (const unsigned char *)b1; | 108 | c1 = (const unsigned char *)b1; | |
107 | c2 = (const unsigned char *)b2; | 109 | c2 = (const unsigned char *)b2; | |
110 | #else | |||
111 | c1 = (const unsigned char *)s1; | |||
112 | c2 = (const unsigned char *)s2; | |||
113 | #endif | |||
108 | 114 | |||
109 | if (n != 0) { | 115 | if (n != 0) { | |
110 | do { | 116 | do { | |
111 | if (*c1++ != *c2++) | 117 | if (*c1++ != *c2++) | |
112 | return 1; | 118 | return 1; | |
113 | } while (--n != 0); | 119 | } while (--n != 0); | |
114 | } | 120 | } | |
115 | 121 | |||
116 | return 0; | 122 | return 0; | |
117 | } | 123 | } |
--- src/common/lib/libc/string/memcmp.c 2020/01/27 22:22:03 1.7
+++ src/common/lib/libc/string/memcmp.c 2020/01/29 09:18:26 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: memcmp.c,v 1.7 2020/01/27 22:22:03 ad Exp $ */ | 1 | /* $NetBSD: memcmp.c,v 1.8 2020/01/29 09:18:26 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2020 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2020 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Andrew Doran. | 8 | * by Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -56,67 +56,73 @@ | @@ -56,67 +56,73 @@ | |||
56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
57 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 57 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
61 | * SUCH DAMAGE. | 61 | * SUCH DAMAGE. | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | #if defined(LIBC_SCCS) && !defined(lint) | 65 | #if defined(LIBC_SCCS) && !defined(lint) | |
66 | #if 0 | 66 | #if 0 | |
67 | static char sccsid[] = "@(#)memcmp.c 8.1 (Berkeley) 6/4/93"; | 67 | static char sccsid[] = "@(#)memcmp.c 8.1 (Berkeley) 6/4/93"; | |
68 | #else | 68 | #else | |
69 | __RCSID("$NetBSD: memcmp.c,v 1.7 2020/01/27 22:22:03 ad Exp $"); | 69 | __RCSID("$NetBSD: memcmp.c,v 1.8 2020/01/29 09:18:26 ad Exp $"); | |
70 | #endif | 70 | #endif | |
71 | #endif /* LIBC_SCCS and not lint */ | 71 | #endif /* LIBC_SCCS and not lint */ | |
72 | 72 | |||
73 | #if !defined(_KERNEL) && !defined(_STANDALONE) | 73 | #if !defined(_KERNEL) && !defined(_STANDALONE) | |
74 | #include <sys/types.h> | 74 | #include <sys/types.h> | |
75 | 75 | |||
76 | #include <assert.h> | 76 | #include <assert.h> | |
77 | #include <string.h> | 77 | #include <string.h> | |
78 | #else | 78 | #else | |
79 | #include <lib/libkern/libkern.h> | 79 | #include <lib/libkern/libkern.h> | |
80 | #endif | 80 | #endif | |
81 | 81 | |||
82 | #undef memcmp | 82 | #undef memcmp | |
83 | /* | 83 | /* | |
84 | * Compare memory regions. | 84 | * Compare memory regions. | |
85 | */ | 85 | */ | |
86 | int | 86 | int | |
87 | memcmp(const void *s1, const void *s2, size_t n) | 87 | memcmp(const void *s1, const void *s2, size_t n) | |
88 | { | 88 | { | |
89 | const uintptr_t *b1, *b2; | |||
90 | const unsigned char *c1, *c2; | 89 | const unsigned char *c1, *c2; | |
91 | 90 | |||
91 | #ifndef _STANDALONE | |||
92 | const uintptr_t *b1, *b2; | |||
93 | ||||
92 | b1 = s1; | 94 | b1 = s1; | |
93 | b2 = s2; | 95 | b2 = s2; | |
94 | 96 | |||
95 | #ifndef __NO_STRICT_ALIGNMENT | 97 | #ifndef __NO_STRICT_ALIGNMENT | |
96 | if ((((uintptr_t)b1 | (uintptr_t)b2) & (sizeof(uintptr_t) - 1)) == 0) | 98 | if ((((uintptr_t)b1 | (uintptr_t)b2) & (sizeof(uintptr_t) - 1)) == 0) | |
97 | #endif | 99 | #endif | |
98 | { | 100 | { | |
99 | while (n >= sizeof(uintptr_t)) { | 101 | while (n >= sizeof(uintptr_t)) { | |
100 | if (*b1 != *b2) | 102 | if (*b1 != *b2) | |
101 | break; | 103 | break; | |
102 | b1++; | 104 | b1++; | |
103 | b2++; | 105 | b2++; | |
104 | n -= sizeof(uintptr_t); | 106 | n -= sizeof(uintptr_t); | |
105 | } | 107 | } | |
106 | } | 108 | } | |
107 | 109 | |||
108 | c1 = (const unsigned char *)b1; | 110 | c1 = (const unsigned char *)b1; | |
109 | c2 = (const unsigned char *)b2; | 111 | c2 = (const unsigned char *)b2; | |
112 | #else | |||
113 | c1 = (const unsigned char *)s1; | |||
114 | c2 = (const unsigned char *)s2; | |||
115 | #endif | |||
110 | 116 | |||
111 | if (n != 0) { | 117 | if (n != 0) { | |
112 | do { | 118 | do { | |
113 | if (*c1++ != *c2++) | 119 | if (*c1++ != *c2++) | |
114 | return *--c1 - *--c2; | 120 | return *--c1 - *--c2; | |
115 | } while (--n != 0); | 121 | } while (--n != 0); | |
116 | } | 122 | } | |
117 | 123 | |||
118 | return 0; | 124 | return 0; | |
119 | } | 125 | } | |
120 | 126 | |||
121 | #if defined(__ARM_EABI__) | 127 | #if defined(__ARM_EABI__) | |
122 | __strong_alias(__aeabi_memcmp, memcmp) | 128 | __strong_alias(__aeabi_memcmp, memcmp) |