1 /* Compare two memory blocks for differences in the first COUNT bytes.
2 Copyright (C) 2004-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
20 #include "asm-syntax.h"
22 #define PARMS 4+4 /* Preserve EBX. */
26 #define ENTRANCE pushl %ebx; cfi_adjust_cfa_offset (4); \
27 cfi_rel_offset (ebx, 0)
28 #define RETURN popl %ebx; cfi_adjust_cfa_offset (-4); \
29 cfi_restore (ebx); ret
31 /* Load an entry in a jump table into EBX. TABLE is a jump table
32 with relative offsets. INDEX is a register contains the index
33 into the jump table. */
34 #define LOAD_JUMP_TABLE_ENTRY(TABLE, INDEX) \
35 /* We first load PC into EBX. */ \
37 /* Get the address of the jump table. */ \
38 addl $(TABLE - .), %ebx; \
39 /* Get the entry and convert the relative offset to the \
40 absolute address. */ \
41 addl (%ebx,INDEX,4), %ebx
54 movzbl (%eax), %ecx /* LEN == 1 */
61 cfi_adjust_cfa_offset (4)
62 cfi_rel_offset (ebx, 0)
68 cfi_adjust_cfa_offset (4)
69 cfi_rel_offset (ebx, 0)
71 jl L(bye) /* LEN == 0 */
74 cfi_adjust_cfa_offset (4)
76 cfi_rel_offset (esi, 0)
78 jge L(32bytesormore) /* LEN => 32 */
80 LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx)
83 _CET_NOTRACK jmp *%ebx
123 cfi_adjust_cfa_offset (-4)
128 cfi_adjust_cfa_offset (8)
129 cfi_rel_offset (esi, 0)
130 cfi_rel_offset (ebx, 4)
167 movzbl -1(%esi), %eax
171 cfi_adjust_cfa_offset (-4)
176 cfi_adjust_cfa_offset (8)
177 cfi_rel_offset (esi, 0)
178 cfi_rel_offset (ebx, 4)
215 movzwl -2(%esi), %eax
216 movzwl -2(%edx), %ecx
222 cfi_adjust_cfa_offset (-4)
227 cfi_adjust_cfa_offset (8)
228 cfi_rel_offset (esi, 0)
229 cfi_rel_offset (ebx, 4)
266 movzwl -3(%esi), %eax
267 movzwl -3(%edx), %ecx
272 movzbl -1(%esi), %eax
276 cfi_adjust_cfa_offset (-4)
281 cfi_adjust_cfa_offset (8)
282 cfi_rel_offset (esi, 0)
283 cfi_rel_offset (ebx, 4)
326 LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx)
329 _CET_NOTRACK jmp *%ebx
357 /* We get there only if we already know there is a
364 cfi_adjust_cfa_offset (-4)
372 .long L(0bytes) - L(table_32bytes)
373 .long L(1bytes) - L(table_32bytes)
374 .long L(2bytes) - L(table_32bytes)
375 .long L(3bytes) - L(table_32bytes)
376 .long L(4bytes) - L(table_32bytes)
377 .long L(5bytes) - L(table_32bytes)
378 .long L(6bytes) - L(table_32bytes)
379 .long L(7bytes) - L(table_32bytes)
380 .long L(8bytes) - L(table_32bytes)
381 .long L(9bytes) - L(table_32bytes)
382 .long L(10bytes) - L(table_32bytes)
383 .long L(11bytes) - L(table_32bytes)
384 .long L(12bytes) - L(table_32bytes)
385 .long L(13bytes) - L(table_32bytes)
386 .long L(14bytes) - L(table_32bytes)
387 .long L(15bytes) - L(table_32bytes)
388 .long L(16bytes) - L(table_32bytes)
389 .long L(17bytes) - L(table_32bytes)
390 .long L(18bytes) - L(table_32bytes)
391 .long L(19bytes) - L(table_32bytes)
392 .long L(20bytes) - L(table_32bytes)
393 .long L(21bytes) - L(table_32bytes)
394 .long L(22bytes) - L(table_32bytes)
395 .long L(23bytes) - L(table_32bytes)
396 .long L(24bytes) - L(table_32bytes)
397 .long L(25bytes) - L(table_32bytes)
398 .long L(26bytes) - L(table_32bytes)
399 .long L(27bytes) - L(table_32bytes)
400 .long L(28bytes) - L(table_32bytes)
401 .long L(29bytes) - L(table_32bytes)
402 .long L(30bytes) - L(table_32bytes)
403 .long L(31bytes) - L(table_32bytes)
407 weak_alias (memcmp, bcmp)
409 strong_alias (memcmp, __memcmpeq)
410 libc_hidden_builtin_def (memcmp)
411 libc_hidden_def (__memcmpeq)