Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 May 2004 13:26:13 +0800
From:      Deng XueFeng <dsnofe@hotmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Is this LOST??
Message-ID:  <20040502132115.C583.DSNOFE@hotmail.com>

next in thread | raw e-mail | index | archive | help
--------_4094854BC580036F4F88_MULTIPART_MIXED_
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

I found the htonl implemention in libc for i386 is not sync with the
kern.

sys use bswap for swaping the int. but libc still use xchg.
IS THIS LOST?

Here is the patches.
----------------------------CUT HERE------------------------
--- /usr/src/lib/libc/i386/net/htonl.S.orig	Sun May  2 12:13:13 2004
+++ /usr/src/lib/libc/i386/net/htonl.S	Sun May  2 12:22:02 2004
@@ -46,7 +46,5 @@
         .set CNAME(htonl),CNAME(__htonl)
 ENTRY(__htonl)
 	movl	4(%esp),%eax
-	xchgb	%al,%ah
-	roll	$16,%eax
-	xchgb	%al,%ah
+	bswap   %eax
 	ret
-----------------------------END HERE----------------------
----------------------------CUT HERE------------------------
--- /usr/src/lib/libc/i386/net/ntohl.S.orig	Sun May  2 12:13:21 2004
+++ /usr/src/lib/libc/i386/net/ntohl.S	Sun May  2 12:19:16 2004
@@ -46,7 +46,5 @@
         .set CNAME(ntohl),CNAME(__ntohl)
 ENTRY(__ntohl)
 	movl	4(%esp),%eax
-	xchgb	%al,%ah
-	roll	$16,%eax
-	xchgb	%al,%ah
+	bswap	%eax
 	ret
-----------------------------END HERE----------------------


Sincerely,
Deng XueFeng

--------_4094854BC580036F4F88_MULTIPART_MIXED_
Content-Type: application/octet-stream; name="htonl.S.diff"
Content-Disposition: attachment;
 filename="htonl.S.diff"
Content-Transfer-Encoding: base64

LS0tIC91c3Ivc3JjL2xpYi9saWJjL2kzODYvbmV0L2h0b25sLlMub3JpZwlTdW4gTWF5ICAyIDEy
OjEzOjEzIDIwMDQKKysrIC91c3Ivc3JjL2xpYi9saWJjL2kzODYvbmV0L2h0b25sLlMJU3VuIE1h
eSAgMiAxMjoyMjowMiAyMDA0CkBAIC00Niw3ICs0Niw1IEBACiAgICAgICAgIC5zZXQgQ05BTUUo
aHRvbmwpLENOQU1FKF9faHRvbmwpCiBFTlRSWShfX2h0b25sKQogCW1vdmwJNCglZXNwKSwlZWF4
Ci0JeGNoZ2IJJWFsLCVhaAotCXJvbGwJJDE2LCVlYXgKLQl4Y2hnYgklYWwsJWFoCisJYnN3YXAg
ICAlZWF4CiAJcmV0Cg==

--------_4094854BC580036F4F88_MULTIPART_MIXED_
Content-Type: application/octet-stream; name="ntohl.S.diff"
Content-Disposition: attachment;
 filename="ntohl.S.diff"
Content-Transfer-Encoding: base64

LS0tIC91c3Ivc3JjL2xpYi9saWJjL2kzODYvbmV0L250b2hsLlMub3JpZwlTdW4gTWF5ICAyIDEy
OjEzOjIxIDIwMDQKKysrIC91c3Ivc3JjL2xpYi9saWJjL2kzODYvbmV0L250b2hsLlMJU3VuIE1h
eSAgMiAxMjoxOToxNiAyMDA0CkBAIC00Niw3ICs0Niw1IEBACiAgICAgICAgIC5zZXQgQ05BTUUo
bnRvaGwpLENOQU1FKF9fbnRvaGwpCiBFTlRSWShfX250b2hsKQogCW1vdmwJNCglZXNwKSwlZWF4
Ci0JeGNoZ2IJJWFsLCVhaAotCXJvbGwJJDE2LCVlYXgKLQl4Y2hnYgklYWwsJWFoCisJYnN3YXAJ
JWVheAogCXJldAo=

--------_4094854BC580036F4F88_MULTIPART_MIXED_--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040502132115.C583.DSNOFE>