From 531943a766cf8c4c616513e850124e60fec019b2 Mon Sep 17 00:00:00 2001 From: ru Date: Mon, 20 May 2002 14:42:48 +0000 Subject: Bootstrap elf2aout(1) for sparc64; used to build sys/boot/sparc64/boot1. --- usr.sbin/elf2aout/elf2aout.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'usr.sbin') diff --git a/usr.sbin/elf2aout/elf2aout.c b/usr.sbin/elf2aout/elf2aout.c index f087880..e35dcd3 100644 --- a/usr.sbin/elf2aout/elf2aout.c +++ b/usr.sbin/elf2aout/elf2aout.c @@ -27,9 +27,37 @@ #include __FBSDID("$FreeBSD$"); -#include +#include #include +#if __FreeBSD_version >= 500034 #include +#else +#include +#if BYTE_ORDER == LITTLE_ENDIAN + +#define bswap16(x) \ + ((x >> 8) | (x << 8)) + +#define bswap32(x) \ + ((x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24)) + +#define bswap64(x) \ + ((x >> 56) | ((x >> 40) & 0xff00) | ((x >> 24) & 0xff0000) | \ + ((x >> 8) & 0xff000000) | ((x << 8) & ((u_int64_t)0xff << 32)) | \ + ((x << 24) & ((u_int64_t)0xff << 40)) | \ + ((x << 40) & ((u_int64_t)0xff << 48)) | ((x << 56))) + +#define be16toh(x) bswap16((x)) +#define be32toh(x) bswap32((x)) +#define be64toh(x) bswap64((x)) +#define htobe32(x) bswap32((x)) +#else +#define be16toh(x) (x) +#define be32toh(x) (x) +#define be64toh(x) (x) +#define htobe32(x) (x) +#endif +#endif #include #include -- cgit v1.1