From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OSDcu-0001aI-0L for mharc-grub-devel@gnu.org; Fri, 25 Jun 2010 14:27:44 -0400 Received: from [140.186.70.92] (port=44024 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSDcn-0001Xs-6b for grub-devel@gnu.org; Fri, 25 Jun 2010 14:27:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OSDch-0003h3-OX for grub-devel@gnu.org; Fri, 25 Jun 2010 14:27:32 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:47788) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OSDch-0003gw-KQ for grub-devel@gnu.org; Fri, 25 Jun 2010 14:27:31 -0400 Received: by wwf26 with SMTP id 26so1350730wwf.0 for ; Fri, 25 Jun 2010 11:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=ovVrIlIw97PIzP3EbyiWbRQq9osVybKqV58UqC4goj8=; b=MMN8Gq+BefLNmyI0gJuueiSsvB96AvevdOYEByz2onVuQzlIpZteuOWf9npgO/RUTQ l9ibagqYpXrLlc6dXRKND+pTxdGKsexqSz216ScqJdyirO7jx3FAmUFy0lXIT+nAchiN uliskpdOw1gSAWXpf4lfrOEv6N3Swje32bMT8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=r+Mu8gsYvTaBgzvAZ4o8hsfXVAEPTODfKCBAUXlQwaG5HalAqinIWLOLuMzdo1Sq/Y u1gdEOpavIkccIejMlp6TodGeZZ9pKtXfaTl7TiUJ6a18YL1WMcWwwC3DrpNb0Vg2jH/ NJJssBasJxlspSX1FoCqOY/x3ifzXs6f7Zue8= Received: by 10.216.89.11 with SMTP id b11mr889506wef.32.1277490450620; Fri, 25 Jun 2010 11:27:30 -0700 (PDT) Received: from debian.bg45.phnet (gprs51.swisscom-mobile.ch [193.247.250.51]) by mx.google.com with ESMTPS id o72sm3088446wej.15.2010.06.25.11.27.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 25 Jun 2010 11:27:29 -0700 (PDT) Message-ID: <4C24F508.6040501@gmail.com> Date: Fri, 25 Jun 2010 20:27:20 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100515 Icedove/3.0.4 MIME-Version: 1.0 To: grub-devel@gnu.org References: <20100623213838.GI21862@riva.ucam.org> In-Reply-To: <20100623213838.GI21862@riva.ucam.org> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigA4687828A93DBF4E46E82342" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] Optimise memset on i386 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jun 2010 18:27:38 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA4687828A93DBF4E46E82342 Content-Type: multipart/mixed; boundary="------------060406080308090502030506" This is a multi-part message in MIME format. --------------060406080308090502030506 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > > +void * > +grub_memset (void *s, int c, grub_size_t n) > +{ > + unsigned char *p =3D (unsigned char *) s; > + > + while (n--) > + *p++ =3D (unsigned char) c; > + > + return s; > +} > =20 Attached is a possible generic implementation. Not even compile-tested. Could you test it and compare disasm of this version on i386 and glibc i386 version. Perhaps they are equivalent. If they are for maintainance reasons it's better to always use generic one. > + > +#ifndef APPLE_CC > +void *memset (void *s, int c, grub_size_t n) > + __attribute__ ((alias ("grub_memset"))); > +#else > +void *memset (void *s, int c, grub_size_t n) > +{ > + return grub_memset (s, c, n); > +} > +#endif > > Thanks, > > =20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------060406080308090502030506 Content-Type: text/x-csrc; name="memset.c" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="memset.c" void grub_memset (void *p, int c, grub_size_t len) { grub_uint8_t pattern8 =3D c; if (len >=3D 3 * sizeof (unsigned long)) { unsigned long patternl =3D 0; int i; for (i =3D 0; i < sizeof (unsigned long); i++) patternl |=3D ((unsigned long) pattern8) << (8 * i); while (len > 0 && (((grub_addr_t) p) & (sizeof (unsigned long) - 1)= )) { *(grub_uint8_t *) p =3D pattern8; p =3D (grub_uint8_t *) p + 1; } while (len >=3D sizeof (unsigned long)) { *(unsigned long *) p =3D patternl; p =3D (unsigned long *) p + 1; } } while (len > 0) { *(grub_uint8_t *) p =3D pattern8; p =3D (grub_uint8_t *) p + 1; } } --------------060406080308090502030506-- --------------enigA4687828A93DBF4E46E82342 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAkwk9QgACgkQNak7dOguQgk+kQD/drtryaeEKVTkePEEYxzcbhiA WPjz0KY+glEgnMP7BSEBAJxH3jlE5fHrZVcgz4xfjQ8BmIjzqj4ZeFttjn1rKzpY =PcJO -----END PGP SIGNATURE----- --------------enigA4687828A93DBF4E46E82342--