Commit 8c3b7745 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Updated assembler code from MySQL 4.0 (to make them work with gcc 3.0)

Fixed memory overrun bug in glibc patch
Updated french error messages
parent b716c181
......@@ -52,7 +52,7 @@ diff -r -c --exclude=*.info* glibc-2.2.4/nss/nsswitch.c glibc-2.2.4-new/nss/nssw
while (isspace (line[0]))
++line;
***************
*** 510,522 ****
522
if (name == line)
return result;
......@@ -86,7 +86,7 @@ diff -r -c --exclude=*.info* glibc-2.2.4/nss/nsswitch.c glibc-2.2.4-new/nss/nssw
if (new_service == NULL)
return result;
! *((char *) __mempcpy (new_service->name, name, name_alloc_len)) = '\0';
! *((char *) __mempcpy (new_service->name, name, name_alloc_len-1)) = '\0';
/* Set default actions. */
new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
......
......@@ -122,100 +122,100 @@
"Ligne trop grande. Le taille maximale d'une ligne, sauf les BLOBs, est %d. Changez le type de quelques colonnes en BLOB",
"Débordement de la pile des tâches (Thread stack). Utilisées: %ld pour une pile de %ld. Essayez 'mysqld -O thread_stack=#' pour indiquer une plus grande valeur",
"Dépendance croisée dans une clause OUTER JOIN. Vérifiez la condition ON",
"Column '%-.32s' is used with UNIQUE or INDEX but is not defined as NOT NULL",
"Can't load function '%-.64s'",
"Can't initialize function '%-.64s'; %-.80s",
"No paths allowed for shared library",
"Function '%-.64s' already exist",
"Can't open shared library '%-.64s' (errno: %d %s)",
"Can't find function '%-.64s' in library'",
"Function '%-.64s' is not defined",
"Host '%-.64s' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'",
"Host '%-.64s' is not allowed to connect to this MySQL server",
"You are using MySQL as an anonymous users and anonymous users are not allowed to change passwords",
"You must have privileges to update tables in the mysql database to be able to change passwords for others",
"Can't find any matching row in the user table",
"Rows matched: %ld Changed: %ld Warnings: %ld",
"Can't create a new thread (errno %d). If you are not out of available memory you can consult the manual for any possible OS dependent bug",
"La colonne '%-.32s' fait partie d'un index UNIQUE ou INDEX mais n'est pas définie comme NOT NULL"
"Imposible de charger la fonction '%-.64s'",
"Impossible d'initialiser la fonction '%-.64s'; %-.80s",
"Chemin interdit pour les bibliothèques partagées",
"La fonction '%-.64s' existe déjà",
"Impossible d'ouvrir la bibliothèque partagée '%-.64s' (errno: %d %s)",
"Impossible de trouver la fonction '%-.64s' dans la bibliothèque'",
"La fonction '%-.64s' n'est pas définie",
"L'hôte '%-.64s' est bloqué à cause d'un trop grand nombre d'erreur de connection. Débloquer le par 'mysqladmin flush-hosts'",
"Le hôte '%-.64s' n'est pas authorisé à se connecter à ce serveur MySQL",
"Vous utilisez un utilisateur anonyme et les utilisateurs anonymes ne sont pas autorisés à changer les mots de passe",
"Vous devez avoir le privilège update sur les tables de la base de donnée mysql pour pouvoir changer les mots de passe des autres",
"Impossible de trouver un enregistrement correspondant dans la table user",
"Enregistrements correspondants: %ld Modifiés: %ld Warnings: %ld",
"Impossible de créer une nouvelle tâche (errno %d). S'il reste de la mémoire libre, consultez le manual pour trouver un éventuel bug dépendant de l'OS",
"Column count doesn't match value count at row %ld",
"Can't reopen table: '%-.64s',
"Invalid use of NULL value",
"Got error '%-.64s' from regexp",
"Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause",
"There is no such grant defined for user '%-.32s' on host '%-.64s'",
"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'",
"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'",
"Illegal GRANT/REVOKE command. Please consult the manual which privleges can be used.",
"The host or user argument to GRANT is too long",
"Table '%-64s.%s' doesn't exist",
"There is no such grant defined for user '%-.32s' on host '%-.64s' on table '%-.64s'",
"The used command is not allowed with this MySQL version",
"Something is wrong in your syntax",
"Delayed insert thread couldn't get requested lock for table %-.64s",
"Too many delayed threads in use",
"Aborted connection %ld to db: '%-.64s' user: '%-.64s' (%s)",
"Got a packet bigger than 'max_allowed_packet'",
"Got a read error from the connection pipe",
"Got an error from fcntl()",
"Got packets out of order",
"Couldn't uncompress communication packet",
"Got an error reading communication packets"
"Got timeout reading communication packets",
"Got an error writing communication packets",
"Got timeout writing communication packets",
"Result string is longer than max_allowed_packet",
"The used table type doesn't support BLOB/TEXT columns",
"The used table type doesn't support AUTO_INCREMENT columns",
"INSERT DELAYED can't be used with table '%-.64s', because it is locked with LOCK TABLES",
"Incorrect column name '%-.100s'",
"The used table handler can't index column '%-.64s'",
"All tables in the MERGE table are not defined identically",
"Can't write, because of unique constraint, to table '%-.64s'",
"BLOB column '%-.64s' used in key specification without a key length",
"All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead",
"Result consisted of more than one row",
"This table type requires a primary key",
"This version of MySQL is not compiled with RAID support",
"You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column",
"Key '%-.64s' doesn't exist in table '%-.64s'",
"Can't open table",
"The handler for the table doesn't support check/repair",
"You are not allowed to execute this command in a transaction",
"Got error %d during COMMIT",
"Got error %d during ROLLBACK",
"Got error %d during FLUSH_LOGS",
"Got error %d during CHECKPOINT",
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)",
"The handler for the table does not support binary table dump",
"Binlog closed while trying to FLUSH MASTER",
"Failed rebuilding the index of dumped table '%-.64s'",
"Error from master: '%-.64s'",
"Net error reading from master",
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
"Unknown system variable '%-.64s'",
"Table '%-.64s' is marked as crashed and should be repaired",
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",
"User %-.64s has already more than 'max_user_connections' active connections",
"You may only use constant expressions with SET",
"Lock wait timeout exceeded",
"The total number of locks exceeds the lock table size",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",
"DROP DATABASE not allowed while thread is holding global read lock",
"CREATE DATABASE not allowed while thread is holding global read lock",
"Wrong arguments to %s",
"%-.32s@%-.64s is not allowed to create new users",
"Incorrect table definition; All MERGE tables must be in the same database",
"Deadlock found when trying to get lock; Try restarting transaction",
"The used table type doesn't support FULLTEXT indexes",
"Cannot add foreign key constraint",
"Cannot add a child row: a foreign key constraint fails",
"Cannot delete a parent row: a foreign key constraint fails",
"Impossible de réouvrir la table: '%-.64s',
"Utilisation incorrecte de la valeur NULL",
"Erreur '%-.64s' provenant de regexp",
"Mélanger les colonnes GROUP (MIN(),MAX(),COUNT()...) avec des colonnes normales est interdit s'il n'y a pas de clause GROUP BY",
"Un tel droit n'est pas défini pour l'utilisateur '%-.32s' sur l'hôte '%-.64s'",
"La commande '%-.16s' est interdite à l'utilisateur: '%-.32s@%-.64s' sur la table '%-.64s'",
"La commande '%-.16s' est interdite à l'utilisateur: '%-.32s@%-.64s' sur la colonne '%-.64s' de la table '%-.64s'",
"Commande GRANT/REVOKE incorrecte. Consultez le manuel.",
"L'hôte ou l'utilisateur donné en argument à GRANT est trop long",
"La table '%-64s.%s' n'existe pas",
"Un tel droit n'est pas défini pour l'utilisateur '%-.32s' sur l'hôte '%-.64s' sur la table '%-.64s'",
"Cette commande n'existe pas dans cette version de MySQL",
"Erreur de syntaxe",
"La tâche 'delayed insert' n'a pas pu obtenir le verrou démandé sur la table %-.64s",
"Trop de tâche 'delayed' en cours",
"Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.64s' (%s)",
"Paquet plus grand que 'max_allowed_packet' reçu",
"Erreur de lecture reçue du pipe de connection",
"Erreur reçue de fcntl() ",
"Paquets reçus dans le désordre",
"Impossible de décompresser le paquet reçu",
"Erreur de lecture des paquets reçus"
"Timeout en lecture des paquets reçus",
"Erreur d'écriture des paquets envoyés",
"Timeout d'écriture des paquets envoyés",
"La chaîne résultat est plus grande que max_allowed_packet",
"Ce type de table ne supporte pas les colonnes BLOB/TEXT",
"Ce type de table ne supporte pas les colonnes AUTO_INCREMENT",
"INSERT DELAYED ne peut être utilisé avec la table '%-.64s', car elle est verrouée avec LOCK TABLES",
"Nom de colonne '%-.100s' incorrect",
"Le handler de la table ne peut indexé la colonne '%-.64s'",
"Toutes les tables de la table de type MERGE n'ont pas la même définition",
"Écriture impossible à cause d'un index UNIQUE sur la table '%-.64s'",
"La colonne '%-.64s' de type BLOB est utilisée dans une définition d'index sans longueur d'index",
"Toutes les parties d'un index PRIMARY KEY doivent être NOT NULL; Si vous avez besoin d'un NULL dans l'index, utilisez un index UNIQUE",
"Le résultat contient plus d'un enregistrement",
"Ce type de table nécessite une clé primaire (PRIMARY KEY)",
"Cette version de MySQL n'est pas compilée avec le support RAID",
"Vous êtes en mode 'safe update' et vous essayez de faire un UPDATE sans clause WHERE utilisant un index",
"L'index '%-.64s' n'existe pas sur la table '%-.64s'",
"Impossible d'ouvrir la table",
"Ce type de table ne supporte pas les check/repair",
"Vous n'êtes pas autorisé à exécute cette commande dans une transaction",
"Erreur %d lors du COMMIT",
"Erreur %d lors du ROLLBACK",
"Erreur %d lors du FLUSH_LOGS",
"Erreur %d lors du CHECKPOINT",
"Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.32s' hôte: `%-.64s' (%-.64s)",
"Ce type de table ne supporte pas les copies binaires",
"Le 'binlog' a été fermé pendant l'exécution du FLUSH MASTER",
"La reconstruction de l'index de la table copiée '%-.64s' a échoué",
"Erreur reçue du maître: '%-.64s'",
"Erreur de lecture réseau reçue du maître",
"Erreur d'écriture réseau reçue du maître",
"Impossible de trouver un index FULLTEXT correspondant à cette liste de colonnes",
"Impossible d'exécuter la commande car vous avez des tables verrouillées ou une transaction active",
"Variable système '%-.64' inconnue",
"La table '%-.64s' est marquée 'crashed' et devrait être réparée",
"La table '%-.64s' est marquée 'crashed' et le dernier 'repair' a échoué",
"Attention: certaines tables ne supportant pas les transactions ont été changées et elles ne pourront pas être restituées",
"Cette transaction à commandes multiples nécessite plus de 'max_binlog_cache_size' octets de stockage, augmentez cette variable de mysqld et réessayez',
"Cette opération ne peut être réalisée avec un esclave actif, faites SLAVE STOP d'abord",
"Cette opération nécessite un esclave actif, configurez les esclaves et faites SLAVE START",
"Le server n'est pas configuré comme un esclave, changez le fichier de configuration ou utilisez CHANGE MASTER TO",
"Impossible d'initialiser les structures d'information de maître, vérifiez les permissions sur master.info",
"Impossible de créer une tâche esclave, vérifiez les ressources système",
"L'utilisateur %-.64s possède déjà plus de 'max_user_connections' connections actives",
"Seules les expressions constantes sont autorisées avec SET",
"Timeout sur l'obtention du verrou",
"Le nombre total de verrou dépasse la taille de la table des verrous",
"Un verrou en update ne peut être acquit pendant une transaction READ UNCOMMITTED",
"DROP DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture",
"CREATE DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture",
"Mauvais arguments à %s",
"%-.32s@%-.64s n'est pas autorisé à créer de nouveaux utilisateurs",
"Définition de table incorrecte : toutes les tables MERGE doivent être dans la même base de donnée",
"Deadlock découvert en essayant d'obtenir les verrous : essayez de redémarrer la transaction",
"Le type de table utilisé ne supporte pas les index FULLTEXT",
"Impossible d'ajouter des contraintes d'index externe",
"Impossible d'ajouter un enregistrement fils : une constrainte externe l'empèche",
"Impossible de supprimer un enregistrement père : une constrainte externe l'empèche",
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
# Copyright (C) 2000 MySQL AB
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Optimized longlong2str function for Intel 80x86 (gcc/gas syntax)
# Some set sequences are optimized for pentuimpro II
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Optimized string functions Intel 80x86 (gcc/gas syntax) */
# Copyright (C) 2000 MySQL AB
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Optimized string functions Intel 80x86 (gcc/gas syntax)
.file "strings.s"
.version "1.00"
.text
/* Move a alligned, not overlapped, by (long) divided memory area */
/* Args: to,from,length */
# Move a alligned, not overlapped, by (long) divided memory area
# Args: to,from,length
.globl bmove_allign
.type bmove_allign,@function
bmove_allign:
movl %edi,%edx
movl %esi,%eax
movl 4(%esp),%edi /* to */
movl 8(%esp),%esi /* from */
movl 12(%esp),%ecx /* length */
addw $3,%cx /* fix if not divisible with long */
movl 4(%esp),%edi # to
movl 8(%esp),%esi # from
movl 12(%esp),%ecx # length
addw $3,%cx # fix if not divisible with long
shrw $2,%cx
rep
movsl
......@@ -42,198 +41,198 @@ bmove_allign:
.end:
.size bmove_allign,.end-bmove_allign
/* Move a string from higher to lower */
/* Arg from+1,to+1,length */
# Move a string from higher to lower
# Arg from+1,to+1,length
.globl bmove_upp
.type bmove_upp,@function
bmove_upp:
std /* Work downward */
std # Work downward
movl %edi,%edx
movl %esi,%eax
movl 4(%esp),%edi /* p1 */
movl 8(%esp),%esi /* p2 */
movl 12(%esp),%ecx /* length */
decl %edi /* Don't move last arg */
movl 4(%esp),%edi # p1
movl 8(%esp),%esi # p2
movl 12(%esp),%ecx # length
decl %edi # Don't move last arg
decl %esi
rep
movsb /* One byte a time because overlap */
cld /* C library wants cld */
movsb # One byte a time because overlap
cld # C library wants cld
movl %eax,%esi
movl %edx,%edi
ret
.bmove_upp_end:
.size bmove_upp,.bmove_upp_end-bmove_upp
/* Append fillchars to string */
/* Args: dest,len,fill */
# Append fillchars to string
# Args: dest,len,fill
.globl strappend
.type strappend,@function
strappend:
pushl %edi
movl 8(%esp),%edi /* Memory pointer */
movl 12(%esp),%ecx /* Length */
clrl %eax /* Find end of string */
movl 8(%esp),%edi # Memory pointer
movl 12(%esp),%ecx # Length
clrl %eax # Find end of string
repne
scasb
jnz sa_99 /* String to long, shorten it */
movzb 16(%esp),%eax /* Fillchar */
decl %edi /* Point at end null */
incl %ecx /* rep made one dec for null-char */
movb %al,%ah /* (2) Set up a 32 bit pattern. */
movw %ax,%dx /* (2) */
shll $16,%eax /* (3) */
movw %dx,%ax /* (2) %eax has the 32 bit pattern. */
movl %ecx,%edx /* (2) Save the count of bytes. */
shrl $2,%ecx /* (2) Number of dwords. */
jnz sa_99 # String to long, shorten it
movzb 16(%esp),%eax # Fillchar
decl %edi # Point at end null
incl %ecx # rep made one dec for null-char
movb %al,%ah # (2) Set up a 32 bit pattern.
movw %ax,%dx # (2)
shll $16,%eax # (3)
movw %dx,%ax # (2) %eax has the 32 bit pattern.
movl %ecx,%edx # (2) Save the count of bytes.
shrl $2,%ecx # (2) Number of dwords.
rep
stosl /* (5 + 5n) */
movb $3,%cl /* (2) */
and %edx,%ecx /* (2) Fill in the odd bytes*/
stosl # (5 + 5n)
movb $3,%cl # (2)
and %edx,%ecx # (2) Fill in the odd bytes
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
ret
.strappend_end:
.size strappend,.strappend_end-strappend
/* Find if string contains any char in another string */
/* Arg: str,set */
/* Ret: Pointer to first found char in str */
# Find if string contains any char in another string
# Arg: str,set
# Ret: Pointer to first found char in str
.globl strcont
.type strcont,@function
strcont:
movl %edi,%edx
pushl %esi
movl 8(%esp),%esi /* str */
movl 12(%esp),%ecx /* set */
clrb %ah /* For endtest */
movl 8(%esp),%esi # str
movl 12(%esp),%ecx # set
clrb %ah # For endtest
jmp sc_60
sc_10: scasb
jz sc_fo /* Found char */
sc_20: cmp (%edi),%ah /* Test if null */
jnz sc_10 /* Not end of set yet */
incl %esi /* Next char in str */
sc_60: movl %ecx,%edi /* %edi = Set */
movb (%esi),%al /* Test if this char exist */
jz sc_fo # Found char
sc_20: cmp (%edi),%ah # Test if null
jnz sc_10 # Not end of set yet
incl %esi # Next char in str
sc_60: movl %ecx,%edi # %edi = Set
movb (%esi),%al # Test if this char exist
andb %al,%al
jnz sc_20 /* Not end of string */
clrl %esi /* Return Null */
sc_fo: movl %esi,%eax /* Char found here */
movl %edx,%edi /* Restore */
jnz sc_20 # Not end of string
clrl %esi # Return Null
sc_fo: movl %esi,%eax # Char found here
movl %edx,%edi # Restore
popl %esi
ret
.strcont_end:
.size strcont,.strcont_end-strcont
/* Find end of string */
/* Arg: str */
/* ret: Pointer to end null */
# Find end of string
# Arg: str
# ret: Pointer to end null
.globl strend
.type strend,@function
strend:
movl %edi,%edx /* Save */
movl 4(%esp),%edi /* str */
clrl %eax /* Find end of string */
movl %edi,%edx # Save
movl 4(%esp),%edi # str
clrl %eax # Find end of string
movl %eax,%ecx
decl %ecx /* ECX = -1 */
decl %ecx # ECX = -1
repne
scasb
movl %edi,%eax
decl %eax /* End of string */
movl %edx,%edi /* Restore */
decl %eax # End of string
movl %edx,%edi # Restore
ret
.strend_end:
.size strend,.strend_end-strend
/* Make a string with len fill-chars and endnull */
/* Args: dest,len,fill */
/* Ret: dest+len */
# Make a string with len fill-chars and endnull
# Args: dest,len,fill
# Ret: dest+len
.globl strfill
.type strfill,@function
strfill:
pushl %edi
movl 8(%esp),%edi /* Memory pointer */
movl 12(%esp),%ecx /* Length */
movzb 16(%esp),%eax /* Fill */
movl 8(%esp),%edi # Memory pointer
movl 12(%esp),%ecx # Length
movzb 16(%esp),%eax # Fill
movb %al,%ah /* (2) Set up a 32 bit pattern */
movw %ax,%dx /* (2) */
shll $16,%eax /* (3) */
movw %dx,%ax /* (2) %eax has the 32 bit pattern. */
movb %al,%ah # (2) Set up a 32 bit pattern
movw %ax,%dx # (2)
shll $16,%eax # (3)
movw %dx,%ax # (2) %eax has the 32 bit pattern.
movl %ecx,%edx /* (2) Save the count of bytes. */
shrl $2,%ecx /* (2) Number of dwords. */
movl %ecx,%edx # (2) Save the count of bytes.
shrl $2,%ecx # (2) Number of dwords.
rep
stosl /* (5 + 5n) */
movb $3,%cl /* (2) */
and %edx,%ecx /* (2) Fill in the odd bytes */
stosl # (5 + 5n)
movb $3,%cl # (2)
and %edx,%ecx # (2) Fill in the odd bytes
rep
stosb /* Move last bytes if any */
stosb # Move last bytes if any
movb %cl,(%edi) /* End NULL */
movl %edi,%eax /* End i %eax */
movb %cl,(%edi) # End NULL
movl %edi,%eax # End i %eax
popl %edi
ret
.strfill_end:
.size strfill,.strfill_end-strfill
/* Find a char in or end of a string */
/* Arg: str,char */
/* Ret: pointer to found char or NullS */
# Find a char in or end of a string
# Arg: str,char
# Ret: pointer to found char or NullS
.globl strcend
.type strcend,@function
strcend:
movl %edi,%edx
movl 4(%esp),%edi /* str */
movb 8(%esp),%ah /* search */
clrb %al /* for scasb to find end */
movl 4(%esp),%edi # str
movb 8(%esp),%ah # search
clrb %al # for scasb to find end
se_10: cmpb (%edi),%ah
jz se_20 /* Found char */
jz se_20 # Found char
scasb
jnz se_10 /* Not end */
dec %edi /* Not found, point at end of string */
jnz se_10 # Not end
dec %edi # Not found, point at end of string
se_20: movl %edi,%eax
movl %edx,%edi /* Restore */
movl %edx,%edi # Restore
ret
.strcend_end:
.size strcend,.strcend_end-strcend
/* Test if string has a given suffix */
# Test if string has a given suffix
.globl is_prefix
.type is_prefix,@function
is_prefix:
movl %edi,%edx /* Save %edi */
pushl %esi /* and %esi */
movl 12(%esp),%esi /* get suffix */
movl 8(%esp),%edi /* s1 */
movl $1,%eax /* Ok and zero-test */
movl %edi,%edx # Save %edi
pushl %esi # and %esi
movl 12(%esp),%esi # get suffix
movl 8(%esp),%edi # s1
movl $1,%eax # Ok and zero-test
ip_10: cmpb (%esi),%ah
jz suf_ok /* End of string/ found suffix */
cmpsb /* Compare strings */
jz ip_10 /* Same, possible prefix */
xor %eax,%eax /* Not suffix */
jz suf_ok # End of string/ found suffix
cmpsb # Compare strings
jz ip_10 # Same, possible prefix
xor %eax,%eax # Not suffix
suf_ok: popl %esi
movl %edx,%edi
ret
.is_prefix_end:
.size is_prefix,.is_prefix_end-is_prefix
/* Find a substring in string */
/* Arg: str,search */
# Find a substring in string
# Arg: str,search
.globl strstr
.type strstr,@function
......@@ -241,31 +240,31 @@ suf_ok: popl %esi
strstr:
pushl %edi
pushl %esi
movl 12(%esp),%esi /* str */
movl 16(%esp),%edi /* search */
movl 12(%esp),%esi # str
movl 16(%esp),%edi # search
movl %edi,%ecx
incl %ecx /* %ecx = search+1 */
movb (%edi),%ah /* %ah = First char in search */
incl %ecx # %ecx = search+1
movb (%edi),%ah # %ah = First char in search
jmp sf_10
sf_00: movl %edx,%esi /* si = Current str-pos */
sf_10: movb (%esi),%al /* Test if this char exist */
sf_00: movl %edx,%esi # si = Current str-pos
sf_10: movb (%esi),%al # Test if this char exist
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
cmpb %al,%ah
jnz sf_10 /* Didn't find first char, continue */
movl %esi,%edx /* Save str-pos in %edx */
jnz sf_10 # Didn't find first char, continue
movl %esi,%edx # Save str-pos in %edx
movl %ecx,%edi
sf_20: cmpb $0,(%edi)
jz sf_fo /* Found substring */
jz sf_fo # Found substring
cmpsb
jz sf_20 /* Char ok */
jmp sf_00 /* Next str-pos */
jz sf_20 # Char ok
jmp sf_00 # Next str-pos
sf_90: movl $1,%edx /* Return Null */
sf_fo: movl %edx,%eax /* Char found here */
decl %eax /* Pointed one after */
sf_90: movl $1,%edx # Return Null
sf_fo: movl %edx,%eax # Char found here
decl %eax # Pointed one after
popl %esi
popl %edi
ret
......@@ -273,8 +272,8 @@ sf_fo: movl %edx,%eax /* Char found here */
.size strstr,.strstr_end-strstr
/* Find a substring in string, return index */
/* Arg: str,search */
# Find a substring in string, return index
# Arg: str,search
.globl strinstr
.type strinstr,@function
......@@ -282,22 +281,22 @@ sf_fo: movl %edx,%eax /* Char found here */
strinstr:
pushl %ebp
movl %esp,%ebp
pushl 12(%ebp) /* search */
pushl 8(%ebp) /* str */
pushl 12(%ebp) # search
pushl 8(%ebp) # str
call strstr
add $8,%esp
or %eax,%eax
jz si_99 /* Not found, return NULL */
sub 8(%ebp),%eax /* Pos from start */
inc %eax /* And first pos = 1 */
jz si_99 # Not found, return NULL
sub 8(%ebp),%eax # Pos from start
inc %eax # And first pos = 1
si_99: popl %ebp
ret
.strinstr_end:
.size strinstr,.strinstr_end-strinstr
/* Make a string of len length from another string */
/* Arg: dst,src,length */
/* ret: end of dst */
# Make a string of len length from another string
# Arg: dst,src,length
# ret: end of dst
.globl strmake
.type strmake,@function
......@@ -305,48 +304,48 @@ si_99: popl %ebp
strmake:
pushl %edi
pushl %esi
movl 12(%esp),%edi /* dst */
movl 16(%esp),%esi /* src */
movl 20(%esp),%ecx /* Length of memory-area */
clrb %al /* For test of end-null */
jecxz sm_90 /* Nothing to move, put zero at end. */
sm_10: cmpb (%esi),%al /* Next char to move */
movsb /* move arg */
jz sm_99 /* last char, we are ready */
loop sm_10 /* Continue moving */
sm_90: movb %al,(%edi) /* Set end pos */
incl %edi /* Fix that di points at end null */
sm_99: decl %edi /* di points now at end null */
movl %edi,%eax /* Ret value.p $ */
movl 12(%esp),%edi # dst
movl 16(%esp),%esi # src
movl 20(%esp),%ecx # Length of memory-area
clrb %al # For test of end-null
jecxz sm_90 # Nothing to move, put zero at end.
sm_10: cmpb (%esi),%al # Next char to move
movsb # move arg
jz sm_99 # last char, we are ready
loop sm_10 # Continue moving
sm_90: movb %al,(%edi) # Set end pos
incl %edi # Fix that di points at end null
sm_99: decl %edi # di points now at end null
movl %edi,%eax # Ret value.p $
popl %esi
popl %edi
ret
.strmake_end:
.size strmake,.strmake_end-strmake
/* Move a string with max len chars */
/* arg: dst,src,len */
/* ret: pos to first null or dst+len */
# Move a string with max len chars
# arg: dst,src,len
# ret: pos to first null or dst+len
.globl strnmov
.type strnmov,@function
strnmov:
pushl %edi
pushl %esi
movl 12(%esp),%edi /* dst */
movl 16(%esp),%esi /* src */
movl 20(%esp),%ecx /* Length of memory-area */
jecxz snm_99 /* Nothing to do */
clrb %al /* For test of end-null */
snm_10: cmpb (%esi),%al /* Next char to move */
movsb /* move arg */
jz snm_20 /* last char, fill with null */
loop snm_10 /* Continue moving */
incl %edi /* Point two after last */
snm_20: decl %edi /* Point at first null (or last+1) */
snm_99: movl %edi,%eax /* Pointer at last char */
movl 12(%esp),%edi # dst
movl 16(%esp),%esi # src
movl 20(%esp),%ecx # Length of memory-area
jecxz snm_99 # Nothing to do
clrb %al # For test of end-null
snm_10: cmpb (%esi),%al # Next char to move
movsb # move arg
jz snm_20 # last char, fill with null
loop snm_10 # Continue moving
incl %edi # Point two after last
snm_20: decl %edi # Point at first null (or last+1)
snm_99: movl %edi,%eax # Pointer at last char
popl %esi
popl %edi
ret
......@@ -357,17 +356,17 @@ snm_99: movl %edi,%eax /* Pointer at last char */
.globl strmov
.type strmov,@function
strmov:
movl %esi,%ecx /* Save old %esi and %edi */
movl %esi,%ecx # Save old %esi and %edi
movl %edi,%edx
movl 8(%esp),%esi /* get source pointer (s2) */
movl 4(%esp),%edi /* %edi -> s1 */
movl 8(%esp),%esi # get source pointer (s2)
movl 4(%esp),%edi # %edi -> s1
smo_10: movb (%esi),%al
movsb /* move arg */
movsb # move arg
andb %al,%al
jnz smo_10 /* Not last */
jnz smo_10 # Not last
movl %edi,%eax
dec %eax
movl %ecx,%esi /* Restore */
movl %ecx,%esi # Restore
movl %edx,%edi
ret
.strmov_end:
......@@ -376,29 +375,29 @@ smo_10: movb (%esi),%al
.globl strxmov
.type strxmov,@function
strxmov:
movl %ebx,%edx /* Save %ebx, %esi and %edi */
movl %ebx,%edx # Save %ebx, %esi and %edi
mov %esi,%ecx
push %edi
leal 8(%esp),%ebx /* Get destination */
leal 8(%esp),%ebx # Get destination
movl (%ebx),%edi
xorb %al,%al
jmp next_str /* Handle source ebx+4 */
jmp next_str # Handle source ebx+4
start_str:
movsb
cmpb -1(%edi),%al
jne start_str
decl %edi /* Don't copy last null */
decl %edi # Don't copy last null
next_str:
addl $4,%ebx
movl (%ebx),%esi
orl %esi,%esi
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 */
pop %edi /* Restore registers */
movl %edi,%eax # Return ptr to ASCII 0
pop %edi # Restore registers
movl %ecx,%esi
movl %edx,%ebx
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