diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/byteorder.h xen-unstable-trp-sdp/extras/mini-os/include/byteorder.h --- xen-unstable-trp-sdp-pristine/extras/mini-os/include/byteorder.h 1969-12-31 19:00:00.000000000 -0500 +++ xen-unstable-trp-sdp/extras/mini-os/include/byteorder.h 2011-02-23 19:40:48.000000000 -0500 @@ -0,0 +1,36 @@ +#ifndef MINIOS_BYTEORDER_H +#define MINIOS_BYTEORDER_H + +#include +#include + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define be16_to_cpu(v) bswap_16(v) +#define be32_to_cpu(v) bswap_32(v) +#define be64_to_cpu(v) bswap_64(v) + +#define le16_to_cpu(v) (v) +#define le32_to_cpu(v) (v) +#define le64_to_cpu(v) (v) + +#else /*__BIG_ENDIAN*/ +#define be16_to_cpu(v) (v) +#define be32_to_cpu(v) (v) +#define be64_to_cpu(v) (v) + +#define le16_to_cpu(v) bswap_16(v) +#define le32_to_cpu(v) bswap_32(v) +#define le64_to_cpu(v) bswap_64(v) + +#endif + +#define cpu_to_be16(v) be16_to_cpu(v) +#define cpu_to_be32(v) be32_to_cpu(v) +#define cpu_to_be64(v) be64_to_cpu(v) + +#define cpu_to_le16(v) le16_to_cpu(v) +#define cpu_to_le32(v) le32_to_cpu(v) +#define cpu_to_le64(v) le64_to_cpu(v) + + +#endif diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/byteswap.h xen-unstable-trp-sdp/extras/mini-os/include/byteswap.h --- xen-unstable-trp-sdp-pristine/extras/mini-os/include/byteswap.h 2011-02-23 14:47:26.000000000 -0500 +++ xen-unstable-trp-sdp/extras/mini-os/include/byteswap.h 2011-02-23 19:40:48.000000000 -0500 @@ -4,30 +4,36 @@ /* Unfortunately not provided by newlib. */ #include -static inline uint16_t bswap_16(uint16_t x) -{ - return - ((((x) & 0xff00) >> 8) | (((x) & 0xff) << 8)); -} - -static inline uint32_t bswap_32(uint32_t x) -{ - return - ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | - (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)); -} - -static inline uint64_t bswap_64(uint64_t x) -{ - return - ((((x) & 0xff00000000000000ULL) >> 56) | - (((x) & 0x00ff000000000000ULL) >> 40) | - (((x) & 0x0000ff0000000000ULL) >> 24) | - (((x) & 0x000000ff00000000ULL) >> 8) | - (((x) & 0x00000000ff000000ULL) << 8) | - (((x) & 0x0000000000ff0000ULL) << 24) | - (((x) & 0x000000000000ff00ULL) << 40) | - (((x) & 0x00000000000000ffULL) << 56)); -} + +#define bswap_16(x) ((uint16_t)( \ + (((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \ + (((uint16_t)(x) & (uint16_t)0xff00U) >> 8))) + +/* Use gcc optimized versions if they exist */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#define bswap_32(v) __builtin_bswap32(v) +#define bswap_64(v) __builtin_bswap32(v) +#else + +#define bswap_32(x) ((uint32_t)( \ + (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \ + (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24))) + +#define bswap_64(x) ((uint64_t)( \ + (((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \ + (((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ + (((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ + (((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ + (((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ + (((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ + (((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ + (((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56))) + +#endif + + + #endif /* _BYTESWAP_H */ diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/endian.h xen-unstable-trp-sdp/extras/mini-os/include/endian.h --- xen-unstable-trp-sdp-pristine/extras/mini-os/include/endian.h 1969-12-31 19:00:00.000000000 -0500 +++ xen-unstable-trp-sdp/extras/mini-os/include/endian.h 2011-02-23 19:40:48.000000000 -0500 @@ -0,0 +1,53 @@ +/* Copyright (C) 1992, 1996, 1997, 2000, 2008 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ENDIAN_H +#define _ENDIAN_H 1 + +/* Definitions for byte order, according to significance of bytes, + from low addresses to high addresses. The value is what you get by + putting '4' in the most significant byte, '3' in the second most + significant byte, '2' in the second least significant byte, and '1' + in the least significant byte, and then writing down one digit for + each byte, starting with the byte at the lowest address at the left, + and proceeding to the byte with the highest address at the right. */ + +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __PDP_ENDIAN 3412 + +#define ARCH_ENDIAN_H +/* This will defined __BYTE_ORDER for the current arch */ +#include +#undef ARCH_ENDIAN_H + +/* Some machines may need to use a different endianness for floating point + values. */ +#ifndef __FLOAT_WORD_ORDER +# define __FLOAT_WORD_ORDER __BYTE_ORDER +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define __LONG_LONG_PAIR(HI, LO) LO, HI +#elif __BYTE_ORDER == __BIG_ENDIAN +# define __LONG_LONG_PAIR(HI, LO) HI, LO +#endif + +#include + +#endif /* endian.h */ diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/ia64/arch_endian.h xen-unstable-trp-sdp/extras/mini-os/include/ia64/arch_endian.h --- xen-unstable-trp-sdp-pristine/extras/mini-os/include/ia64/arch_endian.h 1969-12-31 19:00:00.000000000 -0500 +++ xen-unstable-trp-sdp/extras/mini-os/include/ia64/arch_endian.h 2011-02-23 19:40:48.000000000 -0500 @@ -0,0 +1,25 @@ +/* Copyright (C) 1992, 1996, 1997, 2000, 2008 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef ARCH_ENDIAN_H +#error "Do not include arch_endian by itself, include endian.h" +#else + +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/ia64/arch_wordsize.h xen-unstable-trp-sdp/extras/mini-os/include/ia64/arch_wordsize.h --- xen-unstable-trp-sdp-pristine/extras/mini-os/include/ia64/arch_wordsize.h 1969-12-31 19:00:00.000000000 -0500 +++ xen-unstable-trp-sdp/extras/mini-os/include/ia64/arch_wordsize.h 2011-02-23 19:40:48.000000000 -0500 @@ -0,0 +1 @@ +#define __WORDSIZE 64 diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/x86/arch_endian.h xen-unstable-trp-sdp/extras/mini-os/include/x86/arch_endian.h --- xen-unstable-trp-sdp-pristine/extras/mini-os/include/x86/arch_endian.h 1969-12-31 19:00:00.000000000 -0500 +++ xen-unstable-trp-sdp/extras/mini-os/include/x86/arch_endian.h 2011-02-23 19:40:48.000000000 -0500 @@ -0,0 +1,25 @@ +/* Copyright (C) 1992, 1996, 1997, 2000, 2008 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef ARCH_ENDIAN_H +#error "Do not include arch_endian by itself, include endian.h" +#else + +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/x86/x86_32/arch_wordsize.h xen-unstable-trp-sdp/extras/mini-os/include/x86/x86_32/arch_wordsize.h --- xen-unstable-trp-sdp-pristine/extras/mini-os/include/x86/x86_32/arch_wordsize.h 1969-12-31 19:00:00.000000000 -0500 +++ xen-unstable-trp-sdp/extras/mini-os/include/x86/x86_32/arch_wordsize.h 2011-02-23 19:40:48.000000000 -0500 @@ -0,0 +1 @@ +#define __WORDSIZE 32 diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/x86/x86_64/arch_wordsize.h xen-unstable-trp-sdp/extras/mini-os/include/x86/x86_64/arch_wordsize.h --- xen-unstable-trp-sdp-pristine/extras/mini-os/include/x86/x86_64/arch_wordsize.h 1969-12-31 19:00:00.000000000 -0500 +++ xen-unstable-trp-sdp/extras/mini-os/include/x86/x86_64/arch_wordsize.h 2011-02-23 19:40:48.000000000 -0500 @@ -0,0 +1,2 @@ +#define __WORDSIZE 64 +#define __WORDSIZE_COMPAT32 1