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

Attachment: htonl.S.diff
Description: Binary data

Attachment: ntohl.S.diff
Description: Binary data

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to