1 /* Compare two memory blocks for differences in the first COUNT bytes.
2 Copyright (C) 2004 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 #include "asm-syntax.h"
25 #define PARMS LINKAGE+4 /* Preserve EBX. */
27 #define BLK2 BLK1+PTR_SIZE
28 #define LEN BLK2+PTR_SIZE
29 #define ENTRANCE pushl %ebx; ENTER
30 #define RETURN popl %ebx; LEAVE; ret
32 /* Load an entry in a jump table into EBX. TABLE is a jump table
33 with relative offsets. INDEX is a register contains the index
34 into the jump table. */
35 #define LOAD_JUMP_TABLE_ENTRY(TABLE, INDEX) \
36 /* We first load PC into EBX. */ \
37 call __i686.get_pc_thunk.bx; \
38 /* Get the address of the jump table. */ \
39 addl $(TABLE - .), %ebx; \
40 /* Get the entry and convert the relative offset to the \
41 absolute address. */ \
42 addl (%ebx,INDEX,4), %ebx
45 .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
46 .globl __i686.get_pc_thunk.bx
47 .hidden __i686.get_pc_thunk.bx
52 .type __i686.get_pc_thunk.bx,@function
53 __i686.get_pc_thunk.bx:
59 ENTRY (BP_SYM (memcmp))
68 movzbl (%eax), %ecx /* LEN == 1 */
81 jl L(bye) /* LEN == 0 */
86 jge L(32bytesormore) /* LEN => 32 */
88 LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx)
170 movzbl -1(%esi), %eax
213 movzwl -2(%esi), %eax
214 movzwl -2(%edx), %ecx
259 movzwl -3(%esi), %eax
260 movzwl -3(%edx), %ecx
265 movzbl -1(%esi), %eax
314 LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx)
345 /* We get there only if we already know there is a
357 .long L(0bytes) - . + 0x0
358 .long L(1bytes) - . + 0x4
359 .long L(2bytes) - . + 0x8
360 .long L(3bytes) - . + 0xc
361 .long L(4bytes) - . + 0x10
362 .long L(5bytes) - . + 0x14
363 .long L(6bytes) - . + 0x18
364 .long L(7bytes) - . + 0x1c
365 .long L(8bytes) - . + 0x20
366 .long L(9bytes) - . + 0x24
367 .long L(10bytes) - . + 0x28
368 .long L(11bytes) - . + 0x2c
369 .long L(12bytes) - . + 0x30
370 .long L(13bytes) - . + 0x34
371 .long L(14bytes) - . + 0x38
372 .long L(15bytes) - . + 0x3c
373 .long L(16bytes) - . + 0x40
374 .long L(17bytes) - . + 0x44
375 .long L(18bytes) - . + 0x48
376 .long L(19bytes) - . + 0x4c
377 .long L(20bytes) - . + 0x50
378 .long L(21bytes) - . + 0x54
379 .long L(22bytes) - . + 0x58
380 .long L(23bytes) - . + 0x5c
381 .long L(24bytes) - . + 0x60
382 .long L(25bytes) - . + 0x64
383 .long L(26bytes) - . + 0x68
384 .long L(27bytes) - . + 0x6c
385 .long L(28bytes) - . + 0x70
386 .long L(29bytes) - . + 0x74
387 .long L(30bytes) - . + 0x78
388 .long L(31bytes) - . + 0x7c
390 END (BP_SYM (memcmp))
393 weak_alias (BP_SYM (memcmp), BP_SYM (bcmp))
394 libc_hidden_builtin_def (BP_SYM (memcmp))