4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
31 pushl
%esi
/ save register variables
32 movl
8(%esp
),%esi
/ %esi
= first string
34 movl
12(%esp
),%edi
/ %edi
= second string
35 cmpl %esi
,%edi
/ same string?
37 movl
16(%esp
),%ecx
/ %ecx
= length
38 incl
%ecx
/ will later predecrement this uint
41 je
.equal / Used all n chars?
42 movb
(%esi
),%al
/ slodb ; scab
44 jne
.notequal_0 / Are the bytes equal?
46 je
.equal / End of string?
49 je
.equal / Used all n chars?
50 movb
1(%esi
),%al
/ slodb ; scab
52 jne
.notequal_1 / Are the bytes equal?
54 je
.equal / End of string?
57 je
.equal / Used all n chars?
58 movb
2(%esi
),%al
/ slodb ; scab
60 jne
.notequal_2 / Are the bytes equal?
62 je
.equal / End of string?
65 je
.equal / Used all n chars?
66 movb
3(%esi
),%al
/ slodb ; scab
68 jne
.notequal_3 / Are the bytes equal?
72 jne
.loop / End of string?
75 popl
%esi
/ restore registers
76 xorl
%eax
,%eax
/ return
0
88 popl
%esi
/ restore registers
92 movl $
-1, %eax
/ possibly wasted instr
93 jc
.neg / did we overflow in the sub
94 movl $
1, %eax
/ if
not a > b