From 8d8a622e6ba95367f9494964210ec5119dca7dfe Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Wed, 30 Apr 2003 18:07:23 +0000 Subject: [PATCH] Update for AMD64 (repocopied from i386/net). We can depend on having the bswap instruction (yay!). Update for register parameter passing instead of i386 style stack based param passing. --- lib/libc/amd64/net/htonl.S | 6 ++---- lib/libc/amd64/net/htons.S | 2 +- lib/libc/amd64/net/ntohl.S | 6 ++---- lib/libc/amd64/net/ntohs.S | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/libc/amd64/net/htonl.S b/lib/libc/amd64/net/htonl.S index da74ed67a90..8d802d62df2 100644 --- a/lib/libc/amd64/net/htonl.S +++ b/lib/libc/amd64/net/htonl.S @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); .weak CNAME(htonl) .set CNAME(htonl),CNAME(__htonl) ENTRY(__htonl) - movl 4(%esp),%eax - xchgb %al,%ah - roll $16,%eax - xchgb %al,%ah + movl %edi,%eax + bswap %eax ret diff --git a/lib/libc/amd64/net/htons.S b/lib/libc/amd64/net/htons.S index d5d63fc0c10..6940ef06b0e 100644 --- a/lib/libc/amd64/net/htons.S +++ b/lib/libc/amd64/net/htons.S @@ -45,6 +45,6 @@ __FBSDID("$FreeBSD$"); .weak CNAME(htons) .set CNAME(htons),CNAME(__htons) ENTRY(__htons) - movzwl 4(%esp),%eax + movl %edi,%eax xchgb %al,%ah ret diff --git a/lib/libc/amd64/net/ntohl.S b/lib/libc/amd64/net/ntohl.S index 15e2d6e3523..e5e2150c452 100644 --- a/lib/libc/amd64/net/ntohl.S +++ b/lib/libc/amd64/net/ntohl.S @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); .weak CNAME(ntohl) .set CNAME(ntohl),CNAME(__ntohl) ENTRY(__ntohl) - movl 4(%esp),%eax - xchgb %al,%ah - roll $16,%eax - xchgb %al,%ah + movl %edi,%eax + bswap %eax ret diff --git a/lib/libc/amd64/net/ntohs.S b/lib/libc/amd64/net/ntohs.S index eb0668c4e1e..02e44418e4e 100644 --- a/lib/libc/amd64/net/ntohs.S +++ b/lib/libc/amd64/net/ntohs.S @@ -47,6 +47,6 @@ __FBSDID("$FreeBSD$"); .weak CNAME(ntohs) .set CNAME(ntohs),CNAME(__ntohs) ENTRY(__ntohs) - movzwl 4(%esp),%eax + movl %edi,%eax xchgb %al,%ah ret