Commit 3f8a7a58 authored by unknown's avatar unknown

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


Docs/glibc-2.2.5.patch:
  Fixed memory overrun bug in glibc patch
sql/share/french/errmsg.txt:
  Updated french error messages (patch from Loic Le Loarer)
strings/longlong2str-x86.s:
  Updated from MySQL 4.0 (to make them work with gcc 3.0)
strings/strings-x86.s:
  Updated from MySQL 4.0 (to make them work with gcc 3.0)
parent 8a32ef1c
...@@ -52,7 +52,7 @@ diff -r -c --exclude=*.info* glibc-2.2.4/nss/nsswitch.c glibc-2.2.4-new/nss/nssw ...@@ -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])) while (isspace (line[0]))
++line; ++line;
*************** ***************
*** 510,522 **** 522
if (name == line) if (name == line)
return result; 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 ...@@ -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) if (new_service == NULL)
return result; 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. */ /* Set default actions. */
new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE; new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
......
...@@ -122,100 +122,100 @@ ...@@ -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", "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é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", "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", "La colonne '%-.32s' fait partie d'un index UNIQUE ou INDEX mais n'est pas définie comme NOT NULL"
"Can't load function '%-.64s'", "Imposible de charger la fonction '%-.64s'",
"Can't initialize function '%-.64s'; %-.80s", "Impossible d'initialiser la fonction '%-.64s'; %-.80s",
"No paths allowed for shared library", "Chemin interdit pour les bibliothèques partagées",
"Function '%-.64s' already exist", "La fonction '%-.64s' existe déjà",
"Can't open shared library '%-.64s' (errno: %d %s)", "Impossible d'ouvrir la bibliothèque partagée '%-.64s' (errno: %d %s)",
"Can't find function '%-.64s' in library'", "Impossible de trouver la fonction '%-.64s' dans la bibliothèque'",
"Function '%-.64s' is not defined", "La fonction '%-.64s' n'est pas définie",
"Host '%-.64s' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'", "L'hôte '%-.64s' est bloqué à cause d'un trop grand nombre d'erreur de connection. Débloquer le par 'mysqladmin flush-hosts'",
"Host '%-.64s' is not allowed to connect to this MySQL server", "Le hôte '%-.64s' n'est pas authorisé à se connecter à ce serveur MySQL",
"You are using MySQL as an anonymous users and anonymous users are not allowed to change passwords", "Vous utilisez un utilisateur anonyme et les utilisateurs anonymes ne sont pas autorisés à changer les mots de passe",
"You must have privileges to update tables in the mysql database to be able to change passwords for others", "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",
"Can't find any matching row in the user table", "Impossible de trouver un enregistrement correspondant dans la table user",
"Rows matched: %ld Changed: %ld Warnings: %ld", "Enregistrements correspondants: %ld Modifiés: %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", "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", "Column count doesn't match value count at row %ld",
"Can't reopen table: '%-.64s', "Impossible de réouvrir la table: '%-.64s',
"Invalid use of NULL value", "Utilisation incorrecte de la valeur NULL",
"Got error '%-.64s' from regexp", "Erreur '%-.64s' provenant de regexp",
"Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause", "Mélanger les colonnes GROUP (MIN(),MAX(),COUNT()...) avec des colonnes normales est interdit s'il n'y a pas de clause GROUP BY",
"There is no such grant defined for user '%-.32s' on host '%-.64s'", "Un tel droit n'est pas défini pour l'utilisateur '%-.32s' sur l'hôte '%-.64s'",
"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'", "La commande '%-.16s' est interdite à l'utilisateur: '%-.32s@%-.64s' sur la table '%-.64s'",
"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'", "La commande '%-.16s' est interdite à l'utilisateur: '%-.32s@%-.64s' sur la colonne '%-.64s' de la table '%-.64s'",
"Illegal GRANT/REVOKE command. Please consult the manual which privleges can be used.", "Commande GRANT/REVOKE incorrecte. Consultez le manuel.",
"The host or user argument to GRANT is too long", "L'hôte ou l'utilisateur donné en argument à GRANT est trop long",
"Table '%-64s.%s' doesn't exist", "La table '%-64s.%s' n'existe pas",
"There is no such grant defined for user '%-.32s' on host '%-.64s' on table '%-.64s'", "Un tel droit n'est pas défini pour l'utilisateur '%-.32s' sur l'hôte '%-.64s' sur la table '%-.64s'",
"The used command is not allowed with this MySQL version", "Cette commande n'existe pas dans cette version de MySQL",
"Something is wrong in your syntax", "Erreur de syntaxe",
"Delayed insert thread couldn't get requested lock for table %-.64s", "La tâche 'delayed insert' n'a pas pu obtenir le verrou démandé sur la table %-.64s",
"Too many delayed threads in use", "Trop de tâche 'delayed' en cours",
"Aborted connection %ld to db: '%-.64s' user: '%-.64s' (%s)", "Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.64s' (%s)",
"Got a packet bigger than 'max_allowed_packet'", "Paquet plus grand que 'max_allowed_packet' reçu",
"Got a read error from the connection pipe", "Erreur de lecture reçue du pipe de connection",
"Got an error from fcntl()", "Erreur reçue de fcntl() ",
"Got packets out of order", "Paquets reçus dans le désordre",
"Couldn't uncompress communication packet", "Impossible de décompresser le paquet reçu",
"Got an error reading communication packets" "Erreur de lecture des paquets reçus"
"Got timeout reading communication packets", "Timeout en lecture des paquets reçus",
"Got an error writing communication packets", "Erreur d'écriture des paquets envoyés",
"Got timeout writing communication packets", "Timeout d'écriture des paquets envoyés",
"Result string is longer than max_allowed_packet", "La chaîne résultat est plus grande que max_allowed_packet",
"The used table type doesn't support BLOB/TEXT columns", "Ce type de table ne supporte pas les colonnes BLOB/TEXT",
"The used table type doesn't support AUTO_INCREMENT columns", "Ce type de table ne supporte pas les colonnes AUTO_INCREMENT",
"INSERT DELAYED can't be used with table '%-.64s', because it is locked with LOCK TABLES", "INSERT DELAYED ne peut être utilisé avec la table '%-.64s', car elle est verrouée avec LOCK TABLES",
"Incorrect column name '%-.100s'", "Nom de colonne '%-.100s' incorrect",
"The used table handler can't index column '%-.64s'", "Le handler de la table ne peut indexé la colonne '%-.64s'",
"All tables in the MERGE table are not defined identically", "Toutes les tables de la table de type MERGE n'ont pas la même définition",
"Can't write, because of unique constraint, to table '%-.64s'", "Écriture impossible à cause d'un index UNIQUE sur la table '%-.64s'",
"BLOB column '%-.64s' used in key specification without a key length", "La colonne '%-.64s' de type BLOB est utilisée dans une définition d'index sans longueur d'index",
"All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead", "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",
"Result consisted of more than one row", "Le résultat contient plus d'un enregistrement",
"This table type requires a primary key", "Ce type de table nécessite une clé primaire (PRIMARY KEY)",
"This version of MySQL is not compiled with RAID support", "Cette version de MySQL n'est pas compilée avec le support RAID",
"You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column", "Vous êtes en mode 'safe update' et vous essayez de faire un UPDATE sans clause WHERE utilisant un index",
"Key '%-.64s' doesn't exist in table '%-.64s'", "L'index '%-.64s' n'existe pas sur la table '%-.64s'",
"Can't open table", "Impossible d'ouvrir la table",
"The handler for the table doesn't support check/repair", "Ce type de table ne supporte pas les check/repair",
"You are not allowed to execute this command in a transaction", "Vous n'êtes pas autorisé à exécute cette commande dans une transaction",
"Got error %d during COMMIT", "Erreur %d lors du COMMIT",
"Got error %d during ROLLBACK", "Erreur %d lors du ROLLBACK",
"Got error %d during FLUSH_LOGS", "Erreur %d lors du FLUSH_LOGS",
"Got error %d during CHECKPOINT", "Erreur %d lors du CHECKPOINT",
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)", "Connection %ld avortée vers la bd: '%-.64s' utilisateur: '%-.32s' hôte: `%-.64s' (%-.64s)",
"The handler for the table does not support binary table dump", "Ce type de table ne supporte pas les copies binaires",
"Binlog closed while trying to FLUSH MASTER", "Le 'binlog' a été fermé pendant l'exécution du FLUSH MASTER",
"Failed rebuilding the index of dumped table '%-.64s'", "La reconstruction de l'index de la table copiée '%-.64s' a échoué",
"Error from master: '%-.64s'", "Erreur reçue du maître: '%-.64s'",
"Net error reading from master", "Erreur de lecture réseau reçue du maître",
"Net error writing to master", "Erreur d'écriture réseau reçue du maître",
"Can't find FULLTEXT index matching the column list", "Impossible de trouver un index FULLTEXT correspondant à cette liste de colonnes",
"Can't execute the given command because you have active locked tables or an active transaction", "Impossible d'exécuter la commande car vous avez des tables verrouillées ou une transaction active",
"Unknown system variable '%-.64s'", "Variable système '%-.64' inconnue",
"Table '%-.64s' is marked as crashed and should be repaired", "La table '%-.64s' est marquée 'crashed' et devrait être réparée",
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "La table '%-.64s' est marquée 'crashed' et le dernier 'repair' a échoué",
"Warning: Some non-transactional changed tables couldn't be rolled back", "Attention: certaines tables ne supportant pas les transactions ont été changées et elles ne pourront pas être restituées",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', "Cette transaction à commandes multiples nécessite plus de 'max_binlog_cache_size' octets de stockage, augmentez cette variable de mysqld et réessayez',
"This operation cannot be performed with a running slave, run SLAVE STOP first", "Cette opération ne peut être réalisée avec un esclave actif, faites SLAVE STOP d'abord",
"This operation requires a running slave, configure slave and do SLAVE START", "Cette opération nécessite un esclave actif, configurez les esclaves et faites SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Le server n'est pas configuré comme un esclave, changez le fichier de configuration ou utilisez CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info", "Impossible d'initialiser les structures d'information de maître, vérifiez les permissions sur master.info",
"Could not create slave thread, check system resources", "Impossible de créer une tâche esclave, vérifiez les ressources système",
"User %-.64s has already more than 'max_user_connections' active connections", "L'utilisateur %-.64s possède déjà plus de 'max_user_connections' connections actives",
"You may only use constant expressions with SET", "Seules les expressions constantes sont autorisées avec SET",
"Lock wait timeout exceeded", "Timeout sur l'obtention du verrou",
"The total number of locks exceeds the lock table size", "Le nombre total de verrou dépasse la taille de la table des verrous",
"Update locks cannot be acquired during a READ UNCOMMITTED transaction", "Un verrou en update ne peut être acquit pendant une transaction READ UNCOMMITTED",
"DROP DATABASE not allowed while thread is holding global read lock", "DROP DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture",
"CREATE DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture",
"Wrong arguments to %s", "Mauvais arguments à %s",
"%-.32s@%-.64s is not allowed to create new users", "%-.32s@%-.64s n'est pas autorisé à créer de nouveaux utilisateurs",
"Incorrect table definition; All MERGE tables must be in the same database", "Définition de table incorrecte : toutes les tables MERGE doivent être dans la même base de donnée",
"Deadlock found when trying to get lock; Try restarting transaction", "Deadlock découvert en essayant d'obtenir les verrous : essayez de redémarrer la transaction",
"The used table type doesn't support FULLTEXT indexes", "Le type de table utilisé ne supporte pas les index FULLTEXT",
"Cannot add foreign key constraint", "Impossible d'ajouter des contraintes d'index externe",
"Cannot add a child row: a foreign key constraint fails", "Impossible d'ajouter un enregistrement fils : une constrainte externe l'empèche",
"Cannot delete a parent row: a foreign key constraint fails", "Impossible de supprimer un enregistrement père : une constrainte externe l'empèche",
/* 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