Commit 4508fbb5 authored by monty@tik.mysql.fi's avatar monty@tik.mysql.fi

Use portable comments in assembler files

parent cb3499b7
...@@ -566,7 +566,8 @@ a commercial memory leakage detector. ...@@ -566,7 +566,8 @@ a commercial memory leakage detector.
@item @item
Works on many different platforms. @xref{Which OS}. Works on many different platforms. @xref{Which OS}.
@item @item
Uses GNU Automake, Autoconf (Ver 2.52 or newer), and Libtool for portability. Uses GNU Automake (1.4), Autoconf (Ver 2.52 or newer), and Libtool for
portability.
@item @item
APIs for C, C++, Eiffel, Java, Perl, PHP, Python and Tcl. @xref{Clients}. APIs for C, C++, Eiffel, Java, Perl, PHP, Python and Tcl. @xref{Clients}.
@item @item
...@@ -7015,11 +7016,10 @@ The initial download of the source tree may take a while, depending on the ...@@ -7015,11 +7016,10 @@ The initial download of the source tree may take a while, depending on the
speed of your connection; be patient. speed of your connection; be patient.
@item @item
You will need GNU @code{autoconf 2.13}, @code{automake 1.4}, You will need GNU @code{autoconf 2.52}, @code{automake 1.4},
@code{libtool}, and @code{m4} to run the next set of commands. @code{libtool}, and @code{m4} to run the next set of commands.
If you are using the 3.23 tree the new versions of @code{autoconf} @code{automake} (1.5) doesn't yet work.
(2.52) and @code{automake} (1.5) will not work.
If you get some strange error during this stage, check that you really If you get some strange error during this stage, check that you really
have @code{libtool} installed! have @code{libtool} installed!
...@@ -13707,6 +13707,13 @@ tell @code{mysql} to read its input from the file: ...@@ -13707,6 +13707,13 @@ tell @code{mysql} to read its input from the file:
shell> mysql < batch-file shell> mysql < batch-file
@end example @end example
If you are running @code{mysql} under windows and have some special
characters in the file that causes problems, you can do:
@example
dos> mysql -e "source batch-file"
@end example
If you need to specify connection parameters on the command line, the If you need to specify connection parameters on the command line, the
command might look like this: command might look like this:
...@@ -13718,6 +13725,9 @@ Enter password: ******** ...@@ -13718,6 +13725,9 @@ Enter password: ********
When you use @code{mysql} this way, you are creating a script file, then When you use @code{mysql} this way, you are creating a script file, then
executing the script. executing the script.
If you want the script to continue even if you have errors, you should
use the @code{--force} command line option.
Why use a script? Here are a few reasons: Why use a script? Here are a few reasons:
@itemize @bullet @itemize @bullet
...@@ -13791,6 +13801,12 @@ If you want to get the interactive output format in batch mode, use ...@@ -13791,6 +13801,12 @@ If you want to get the interactive output format in batch mode, use
@code{mysql -t}. To echo to the output the commands that are executed, use @code{mysql -t}. To echo to the output the commands that are executed, use
@code{mysql -vvv}. @code{mysql -vvv}.
You can also use scripts in the @code{mysql} command line prompt by
using the @code{source} command:
@example
mysql> source filename
@end example
@node Twin, Apache, Batch mode, Tutorial @node Twin, Apache, Batch mode, Tutorial
@section Queries from Twin Project @section Queries from Twin Project
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB # Copyright (C) 2000 MySQL AB
# This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or # (at your option) any later version.
(at your option) any later version. #
# This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details.
GNU General Public License for more details. #
# You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax) # Optimized longlong2str function for Intel 80x86 (gcc/gas syntax)
# Some set sequences are optimized for pentuimpro II # Some set sequences are optimized for pentuimpro II
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB # Copyright (C) 2000 MySQL AB
# This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or # (at your option) any later version.
(at your option) any later version. #
# This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details.
GNU General Public License for more details. #
# You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
# Optimized string functions Intel 80x86 (gcc/gas syntax)
/* Optimized string functions Intel 80x86 (gcc/gas syntax) */
.file "strings.s" .file "strings.s"
.version "1.00" .version "1.00"
.text .text
/* Move a alligned, not overlapped, by (long) divided memory area */ # Move a alligned, not overlapped, by (long) divided memory area
/* Args: to,from,length */ # Args: to,from,length
.globl bmove_allign .globl bmove_allign
.type bmove_allign,@function .type bmove_allign,@function
bmove_allign: bmove_allign:
movl %edi,%edx movl %edi,%edx
movl %esi,%eax movl %esi,%eax
movl 4(%esp),%edi /* to */ movl 4(%esp),%edi # to
movl 8(%esp),%esi /* from */ movl 8(%esp),%esi # from
movl 12(%esp),%ecx /* length */ movl 12(%esp),%ecx # length
addw $3,%cx /* fix if not divisible with long */ addw $3,%cx # fix if not divisible with long
shrw $2,%cx shrw $2,%cx
rep rep
movsl movsl
...@@ -42,198 +41,198 @@ bmove_allign: ...@@ -42,198 +41,198 @@ bmove_allign:
.end: .end:
.size bmove_allign,.end-bmove_allign .size bmove_allign,.end-bmove_allign
/* Move a string from higher to lower */ # Move a string from higher to lower
/* Arg from+1,to+1,length */ # Arg from+1,to+1,length
.globl bmove_upp .globl bmove_upp
.type bmove_upp,@function .type bmove_upp,@function
bmove_upp: bmove_upp:
std /* Work downward */ std # Work downward
movl %edi,%edx movl %edi,%edx
movl %esi,%eax movl %esi,%eax
movl 4(%esp),%edi /* p1 */ movl 4(%esp),%edi # p1
movl 8(%esp),%esi /* p2 */ movl 8(%esp),%esi # p2
movl 12(%esp),%ecx /* length */ movl 12(%esp),%ecx # length
decl %edi /* Don't move last arg */ decl %edi # Don't move last arg
decl %esi decl %esi
rep rep
movsb /* One byte a time because overlap */ movsb # One byte a time because overlap
cld /* C library wants cld */ cld # C library wants cld
movl %eax,%esi movl %eax,%esi
movl %edx,%edi movl %edx,%edi
ret ret
.bmove_upp_end: .bmove_upp_end:
.size bmove_upp,.bmove_upp_end-bmove_upp .size bmove_upp,.bmove_upp_end-bmove_upp
/* Append fillchars to string */ # Append fillchars to string
/* Args: dest,len,fill */ # Args: dest,len,fill
.globl strappend .globl strappend
.type strappend,@function .type strappend,@function
strappend: strappend:
pushl %edi pushl %edi
movl 8(%esp),%edi /* Memory pointer */ movl 8(%esp),%edi # Memory pointer
movl 12(%esp),%ecx /* Length */ movl 12(%esp),%ecx # Length
clrl %eax /* Find end of string */ clrl %eax # Find end of string
repne repne
scasb scasb
jnz sa_99 /* String to long, shorten it */ jnz sa_99 # String to long, shorten it
movzb 16(%esp),%eax /* Fillchar */ movzb 16(%esp),%eax # Fillchar
decl %edi /* Point at end null */ decl %edi # Point at end null
incl %ecx /* rep made one dec for null-char */ incl %ecx # rep made one dec for null-char
movb %al,%ah /* (2) Set up a 32 bit pattern. */ movb %al,%ah # (2) Set up a 32 bit pattern.
movw %ax,%dx /* (2) */ movw %ax,%dx # (2)
shll $16,%eax /* (3) */ shll $16,%eax # (3)
movw %dx,%ax /* (2) %eax has the 32 bit pattern. */ movw %dx,%ax # (2) %eax has the 32 bit pattern.
movl %ecx,%edx /* (2) Save the count of bytes. */ movl %ecx,%edx # (2) Save the count of bytes.
shrl $2,%ecx /* (2) Number of dwords. */ shrl $2,%ecx # (2) Number of dwords.
rep rep
stosl /* (5 + 5n) */ stosl # (5 + 5n)
movb $3,%cl /* (2) */ movb $3,%cl # (2)
and %edx,%ecx /* (2) Fill in the odd bytes*/ and %edx,%ecx # (2) Fill in the odd bytes
rep rep
stosb /* Move last bytes if any */ stosb # Move last bytes if any
sa_99: movb $0,(%edi) /* End of string */ sa_99: movb $0,(%edi) # End of string
popl %edi popl %edi
ret ret
.strappend_end: .strappend_end:
.size strappend,.strappend_end-strappend .size strappend,.strappend_end-strappend
/* Find if string contains any char in another string */ # Find if string contains any char in another string
/* Arg: str,set */ # Arg: str,set
/* Ret: Pointer to first found char in str */ # Ret: Pointer to first found char in str
.globl strcont .globl strcont
.type strcont,@function .type strcont,@function
strcont: strcont:
movl %edi,%edx movl %edi,%edx
pushl %esi pushl %esi
movl 8(%esp),%esi /* str */ movl 8(%esp),%esi # str
movl 12(%esp),%ecx /* set */ movl 12(%esp),%ecx # set
clrb %ah /* For endtest */ clrb %ah # For endtest
jmp sc_60 jmp sc_60
sc_10: scasb sc_10: scasb
jz sc_fo /* Found char */ jz sc_fo # Found char
sc_20: cmp (%edi),%ah /* Test if null */ sc_20: cmp (%edi),%ah # Test if null
jnz sc_10 /* Not end of set yet */ jnz sc_10 # Not end of set yet
incl %esi /* Next char in str */ incl %esi # Next char in str
sc_60: movl %ecx,%edi /* %edi = Set */ sc_60: movl %ecx,%edi # %edi = Set
movb (%esi),%al /* Test if this char exist */ movb (%esi),%al # Test if this char exist
andb %al,%al andb %al,%al
jnz sc_20 /* Not end of string */ jnz sc_20 # Not end of string
clrl %esi /* Return Null */ clrl %esi # Return Null
sc_fo: movl %esi,%eax /* Char found here */ sc_fo: movl %esi,%eax # Char found here
movl %edx,%edi /* Restore */ movl %edx,%edi # Restore
popl %esi popl %esi
ret ret
.strcont_end: .strcont_end:
.size strcont,.strcont_end-strcont .size strcont,.strcont_end-strcont
/* Find end of string */ # Find end of string
/* Arg: str */ # Arg: str
/* ret: Pointer to end null */ # ret: Pointer to end null
.globl strend .globl strend
.type strend,@function .type strend,@function
strend: strend:
movl %edi,%edx /* Save */ movl %edi,%edx # Save
movl 4(%esp),%edi /* str */ movl 4(%esp),%edi # str
clrl %eax /* Find end of string */ clrl %eax # Find end of string
movl %eax,%ecx movl %eax,%ecx
decl %ecx /* ECX = -1 */ decl %ecx # ECX = -1
repne repne
scasb scasb
movl %edi,%eax movl %edi,%eax
decl %eax /* End of string */ decl %eax # End of string
movl %edx,%edi /* Restore */ movl %edx,%edi # Restore
ret ret
.strend_end: .strend_end:
.size strend,.strend_end-strend .size strend,.strend_end-strend
/* Make a string with len fill-chars and endnull */ # Make a string with len fill-chars and endnull
/* Args: dest,len,fill */ # Args: dest,len,fill
/* Ret: dest+len */ # Ret: dest+len
.globl strfill .globl strfill
.type strfill,@function .type strfill,@function
strfill: strfill:
pushl %edi pushl %edi
movl 8(%esp),%edi /* Memory pointer */ movl 8(%esp),%edi # Memory pointer
movl 12(%esp),%ecx /* Length */ movl 12(%esp),%ecx # Length
movzb 16(%esp),%eax /* Fill */ movzb 16(%esp),%eax # Fill
movb %al,%ah /* (2) Set up a 32 bit pattern */ movb %al,%ah # (2) Set up a 32 bit pattern
movw %ax,%dx /* (2) */ movw %ax,%dx # (2)
shll $16,%eax /* (3) */ shll $16,%eax # (3)
movw %dx,%ax /* (2) %eax has the 32 bit pattern. */ movw %dx,%ax # (2) %eax has the 32 bit pattern.
movl %ecx,%edx /* (2) Save the count of bytes. */ movl %ecx,%edx # (2) Save the count of bytes.
shrl $2,%ecx /* (2) Number of dwords. */ shrl $2,%ecx # (2) Number of dwords.
rep rep
stosl /* (5 + 5n) */ stosl # (5 + 5n)
movb $3,%cl /* (2) */ movb $3,%cl # (2)
and %edx,%ecx /* (2) Fill in the odd bytes */ and %edx,%ecx # (2) Fill in the odd bytes
rep rep
stosb /* Move last bytes if any */ stosb # Move last bytes if any
movb %cl,(%edi) /* End NULL */ movb %cl,(%edi) # End NULL
movl %edi,%eax /* End i %eax */ movl %edi,%eax # End i %eax
popl %edi popl %edi
ret ret
.strfill_end: .strfill_end:
.size strfill,.strfill_end-strfill .size strfill,.strfill_end-strfill
/* Find a char in or end of a string */ # Find a char in or end of a string
/* Arg: str,char */ # Arg: str,char
/* Ret: pointer to found char or NullS */ # Ret: pointer to found char or NullS
.globl strcend .globl strcend
.type strcend,@function .type strcend,@function
strcend: strcend:
movl %edi,%edx movl %edi,%edx
movl 4(%esp),%edi /* str */ movl 4(%esp),%edi # str
movb 8(%esp),%ah /* search */ movb 8(%esp),%ah # search
clrb %al /* for scasb to find end */ clrb %al # for scasb to find end
se_10: cmpb (%edi),%ah se_10: cmpb (%edi),%ah
jz se_20 /* Found char */ jz se_20 # Found char
scasb scasb
jnz se_10 /* Not end */ jnz se_10 # Not end
dec %edi /* Not found, point at end of string */ dec %edi # Not found, point at end of string
se_20: movl %edi,%eax se_20: movl %edi,%eax
movl %edx,%edi /* Restore */ movl %edx,%edi # Restore
ret ret
.strcend_end: .strcend_end:
.size strcend,.strcend_end-strcend .size strcend,.strcend_end-strcend
/* Test if string has a given suffix */ # Test if string has a given suffix
.globl is_prefix .globl is_prefix
.type is_prefix,@function .type is_prefix,@function
is_prefix: is_prefix:
movl %edi,%edx /* Save %edi */ movl %edi,%edx # Save %edi
pushl %esi /* and %esi */ pushl %esi # and %esi
movl 12(%esp),%esi /* get suffix */ movl 12(%esp),%esi # get suffix
movl 8(%esp),%edi /* s1 */ movl 8(%esp),%edi # s1
movl $1,%eax /* Ok and zero-test */ movl $1,%eax # Ok and zero-test
ip_10: cmpb (%esi),%ah ip_10: cmpb (%esi),%ah
jz suf_ok /* End of string/ found suffix */ jz suf_ok # End of string/ found suffix
cmpsb /* Compare strings */ cmpsb # Compare strings
jz ip_10 /* Same, possible prefix */ jz ip_10 # Same, possible prefix
xor %eax,%eax /* Not suffix */ xor %eax,%eax # Not suffix
suf_ok: popl %esi suf_ok: popl %esi
movl %edx,%edi movl %edx,%edi
ret ret
.is_prefix_end: .is_prefix_end:
.size is_prefix,.is_prefix_end-is_prefix .size is_prefix,.is_prefix_end-is_prefix
/* Find a substring in string */ # Find a substring in string
/* Arg: str,search */ # Arg: str,search
.globl strstr .globl strstr
.type strstr,@function .type strstr,@function
...@@ -241,31 +240,31 @@ suf_ok: popl %esi ...@@ -241,31 +240,31 @@ suf_ok: popl %esi
strstr: strstr:
pushl %edi pushl %edi
pushl %esi pushl %esi
movl 12(%esp),%esi /* str */ movl 12(%esp),%esi # str
movl 16(%esp),%edi /* search */ movl 16(%esp),%edi # search
movl %edi,%ecx movl %edi,%ecx
incl %ecx /* %ecx = search+1 */ incl %ecx # %ecx = search+1
movb (%edi),%ah /* %ah = First char in search */ movb (%edi),%ah # %ah = First char in search
jmp sf_10 jmp sf_10
sf_00: movl %edx,%esi /* si = Current str-pos */ sf_00: movl %edx,%esi # si = Current str-pos
sf_10: movb (%esi),%al /* Test if this char exist */ sf_10: movb (%esi),%al # Test if this char exist
andb %al,%al andb %al,%al
jz sf_90 /* End of string, didn't find search */ jz sf_90 # End of string, didn't find search
incl %esi incl %esi
cmpb %al,%ah cmpb %al,%ah
jnz sf_10 /* Didn't find first char, continue */ jnz sf_10 # Didn't find first char, continue
movl %esi,%edx /* Save str-pos in %edx */ movl %esi,%edx # Save str-pos in %edx
movl %ecx,%edi movl %ecx,%edi
sf_20: cmpb $0,(%edi) sf_20: cmpb $0,(%edi)
jz sf_fo /* Found substring */ jz sf_fo # Found substring
cmpsb cmpsb
jz sf_20 /* Char ok */ jz sf_20 # Char ok
jmp sf_00 /* Next str-pos */ jmp sf_00 # Next str-pos
sf_90: movl $1,%edx /* Return Null */ sf_90: movl $1,%edx # Return Null
sf_fo: movl %edx,%eax /* Char found here */ sf_fo: movl %edx,%eax # Char found here
decl %eax /* Pointed one after */ decl %eax # Pointed one after
popl %esi popl %esi
popl %edi popl %edi
ret ret
...@@ -273,8 +272,8 @@ sf_fo: movl %edx,%eax /* Char found here */ ...@@ -273,8 +272,8 @@ sf_fo: movl %edx,%eax /* Char found here */
.size strstr,.strstr_end-strstr .size strstr,.strstr_end-strstr
/* Find a substring in string, return index */ # Find a substring in string, return index
/* Arg: str,search */ # Arg: str,search
.globl strinstr .globl strinstr
.type strinstr,@function .type strinstr,@function
...@@ -282,22 +281,22 @@ sf_fo: movl %edx,%eax /* Char found here */ ...@@ -282,22 +281,22 @@ sf_fo: movl %edx,%eax /* Char found here */
strinstr: strinstr:
pushl %ebp pushl %ebp
movl %esp,%ebp movl %esp,%ebp
pushl 12(%ebp) /* search */ pushl 12(%ebp) # search
pushl 8(%ebp) /* str */ pushl 8(%ebp) # str
call strstr call strstr
add $8,%esp add $8,%esp
or %eax,%eax or %eax,%eax
jz si_99 /* Not found, return NULL */ jz si_99 # Not found, return NULL
sub 8(%ebp),%eax /* Pos from start */ sub 8(%ebp),%eax # Pos from start
inc %eax /* And first pos = 1 */ inc %eax # And first pos = 1
si_99: popl %ebp si_99: popl %ebp
ret ret
.strinstr_end: .strinstr_end:
.size strinstr,.strinstr_end-strinstr .size strinstr,.strinstr_end-strinstr
/* Make a string of len length from another string */ # Make a string of len length from another string
/* Arg: dst,src,length */ # Arg: dst,src,length
/* ret: end of dst */ # ret: end of dst
.globl strmake .globl strmake
.type strmake,@function .type strmake,@function
...@@ -305,48 +304,48 @@ si_99: popl %ebp ...@@ -305,48 +304,48 @@ si_99: popl %ebp
strmake: strmake:
pushl %edi pushl %edi
pushl %esi pushl %esi
movl 12(%esp),%edi /* dst */ movl 12(%esp),%edi # dst
movl 16(%esp),%esi /* src */ movl 16(%esp),%esi # src
movl 20(%esp),%ecx /* Length of memory-area */ movl 20(%esp),%ecx # Length of memory-area
clrb %al /* For test of end-null */ clrb %al # For test of end-null
jecxz sm_90 /* Nothing to move, put zero at end. */ jecxz sm_90 # Nothing to move, put zero at end.
sm_10: cmpb (%esi),%al /* Next char to move */ sm_10: cmpb (%esi),%al # Next char to move
movsb /* move arg */ movsb # move arg
jz sm_99 /* last char, we are ready */ jz sm_99 # last char, we are ready
loop sm_10 /* Continue moving */ loop sm_10 # Continue moving
sm_90: movb %al,(%edi) /* Set end pos */ sm_90: movb %al,(%edi) # Set end pos
incl %edi /* Fix that di points at end null */ incl %edi # Fix that di points at end null
sm_99: decl %edi /* di points now at end null */ sm_99: decl %edi # di points now at end null
movl %edi,%eax /* Ret value.p $ */ movl %edi,%eax # Ret value.p $
popl %esi popl %esi
popl %edi popl %edi
ret ret
.strmake_end: .strmake_end:
.size strmake,.strmake_end-strmake .size strmake,.strmake_end-strmake
/* Move a string with max len chars */ # Move a string with max len chars
/* arg: dst,src,len */ # arg: dst,src,len
/* ret: pos to first null or dst+len */ # ret: pos to first null or dst+len
.globl strnmov .globl strnmov
.type strnmov,@function .type strnmov,@function
strnmov: strnmov:
pushl %edi pushl %edi
pushl %esi pushl %esi
movl 12(%esp),%edi /* dst */ movl 12(%esp),%edi # dst
movl 16(%esp),%esi /* src */ movl 16(%esp),%esi # src
movl 20(%esp),%ecx /* Length of memory-area */ movl 20(%esp),%ecx # Length of memory-area
jecxz snm_99 /* Nothing to do */ jecxz snm_99 # Nothing to do
clrb %al /* For test of end-null */ clrb %al # For test of end-null
snm_10: cmpb (%esi),%al /* Next char to move */ snm_10: cmpb (%esi),%al # Next char to move
movsb /* move arg */ movsb # move arg
jz snm_20 /* last char, fill with null */ jz snm_20 # last char, fill with null
loop snm_10 /* Continue moving */ loop snm_10 # Continue moving
incl %edi /* Point two after last */ incl %edi # Point two after last
snm_20: decl %edi /* Point at first null (or last+1) */ snm_20: decl %edi # Point at first null (or last+1)
snm_99: movl %edi,%eax /* Pointer at last char */ snm_99: movl %edi,%eax # Pointer at last char
popl %esi popl %esi
popl %edi popl %edi
ret ret
...@@ -357,17 +356,17 @@ snm_99: movl %edi,%eax /* Pointer at last char */ ...@@ -357,17 +356,17 @@ snm_99: movl %edi,%eax /* Pointer at last char */
.globl strmov .globl strmov
.type strmov,@function .type strmov,@function
strmov: strmov:
movl %esi,%ecx /* Save old %esi and %edi */ movl %esi,%ecx # Save old %esi and %edi
movl %edi,%edx movl %edi,%edx
movl 8(%esp),%esi /* get source pointer (s2) */ movl 8(%esp),%esi # get source pointer (s2)
movl 4(%esp),%edi /* %edi -> s1 */ movl 4(%esp),%edi # %edi -> s1
smo_10: movb (%esi),%al smo_10: movb (%esi),%al
movsb /* move arg */ movsb # move arg
andb %al,%al andb %al,%al
jnz smo_10 /* Not last */ jnz smo_10 # Not last
movl %edi,%eax movl %edi,%eax
dec %eax dec %eax
movl %ecx,%esi /* Restore */ movl %ecx,%esi # Restore
movl %edx,%edi movl %edx,%edi
ret ret
.strmov_end: .strmov_end:
...@@ -376,29 +375,29 @@ smo_10: movb (%esi),%al ...@@ -376,29 +375,29 @@ smo_10: movb (%esi),%al
.globl strxmov .globl strxmov
.type strxmov,@function .type strxmov,@function
strxmov: strxmov:
movl %ebx,%edx /* Save %ebx, %esi and %edi */ movl %ebx,%edx # Save %ebx, %esi and %edi
mov %esi,%ecx mov %esi,%ecx
push %edi push %edi
leal 8(%esp),%ebx /* Get destination */ leal 8(%esp),%ebx # Get destination
movl (%ebx),%edi movl (%ebx),%edi
xorb %al,%al xorb %al,%al
jmp next_str /* Handle source ebx+4 */ jmp next_str # Handle source ebx+4
start_str: start_str:
movsb movsb
cmpb -1(%edi),%al cmpb -1(%edi),%al
jne start_str jne start_str
decl %edi /* Don't copy last null */ decl %edi # Don't copy last null
next_str: next_str:
addl $4,%ebx addl $4,%ebx
movl (%ebx),%esi movl (%ebx),%esi
orl %esi,%esi orl %esi,%esi
jne start_str jne start_str
movb %al,0(%edi) /* Force last to ASCII 0 */ movb %al,0(%edi) # Force last to ASCII 0
movl %edi,%eax /* Return ptr to ASCII 0 */ movl %edi,%eax # Return ptr to ASCII 0
pop %edi /* Restore registers */ pop %edi # Restore registers
movl %ecx,%esi movl %ecx,%esi
movl %edx,%ebx movl %edx,%ebx
ret ret
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment