source: trunk/minix/lib/i386/string/bcmp.s@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 758 bytes
Line 
1! bcmp() Author: Kees J. Bot
2! 2 Jan 1994
3.sect .text; .sect .rom; .sect .data; .sect .bss
4
5! int bcmp(const void *s1, const void *s2, size_t n)
6! Compare two chunks of memory.
7! This is a BSD routine that escaped from the kernel. Don't use.
8! (Alas it is not without some use, it reports the number of bytes
9! after the bytes that are equal. So it can't be simply replaced.)
10!
11.sect .text
12.define _bcmp
13 .align 16
14_bcmp:
15 push ebp
16 mov ebp, esp
17 push 16(ebp)
18 push 12(ebp)
19 push 8(ebp)
20 call _memcmp ! Let memcmp do the work
21 test eax, eax
22 jz equal
23 sub edx, 8(ebp) ! Memcmp was nice enough to leave "esi" in edx
24 dec edx ! Number of bytes that are equal
25 mov eax, 16(ebp)
26 sub eax, edx ! Number of bytes that are unequal
27equal: leave
28 ret
Note: See TracBrowser for help on using the repository browser.