From: Matthew Fioravante Subject: [PATCH 4/12] VTPM mini-os: Mini-os machine specific headers Date: Fri, 11 Mar 2011 17:44:01 -0500 Message-ID: <4D7AA5B1.8060603@jhuapl.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1671918655==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a cryptographically signed message in MIME format. --===============1671918655== Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="------------ms040903050809090106040402" This is a cryptographically signed message in MIME format. --------------ms040903050809090106040402 Content-Type: multipart/mixed; boundary="------------070105020004020501090809" This is a multi-part message in MIME format. --------------070105020004020501090809 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable This patch adds endian.h and byteorder.h to mini-os. endian.h defines __BYTE_ORDER similar to how its done on linux and=20 __WORDSIZE. byteorder.h defines the standard macros for cpu_to_be and friends for=20 16,32, and 64 bit. The bswap inlines in byteswap.h were changed to macros to allow use in=20 some initializer statements. A check is added to check gcc versions to=20 use optimized gcc builtins if they are available. Signed off by: Matthew Fioravante --------------070105020004020501090809 Content-Type: text/x-patch; name="4-minios-machineheaders.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="4-minios-machineheaders.patch" diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/byteorder= =2Eh 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 =3D=3D __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. */ =20 #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__ =3D=3D 4 && __GNUC_MINOR__ >=3D 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 + + + =20 #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 poi= nt + values. */ +#ifndef __FLOAT_WORD_ORDER +# define __FLOAT_WORD_ORDER __BYTE_ORDER +#endif + +#if __BYTE_ORDER =3D=3D __LITTLE_ENDIAN +# define __LONG_LONG_PAIR(HI, LO) LO, HI +#elif __BYTE_ORDER =3D=3D __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= =2Eh 1969-12-31 19:00:00.000000000 -0500 +++ xen-unstable-trp-sdp/extras/mini-os/include/ia64/arch_endian.h 2011-0= 2-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=09 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_wordsiz= e.h --- xen-unstable-trp-sdp-pristine/extras/mini-os/include/ia64/arch_wordsi= ze.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=09 diff -Naur xen-unstable-trp-sdp-pristine/extras/mini-os/include/x86/x86_3= 2/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_6= 4/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 --------------070105020004020501090809-- --------------ms040903050809090106040402 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIHZzCC A5kwggMCoAMCAQICBD/xkcEwDQYJKoZI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7eUOIYAaEyeISbtMQHwgnlAKxGOnNwZt/bgVbFnvjhI+FPKl02hHENWRWg Gr+Kq7h0p1TDsgcqovRniggaC0fRIswHrt/68gAAAAAAAA== --------------ms040903050809090106040402-- --===============1671918655== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1671918655==--