PERFORCE change 128218 for review
John Birrell
jb at FreeBSD.org
Sat Oct 27 18:05:39 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=128218
Change 128218 by jb at jb_freebsd1 on 2007/10/28 01:05:18
Check endian the FreeBSD way.
Affected files ...
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cg.c#6 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_lex.l#6 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_link.c#9 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/dwarf.c#9 edit
.. //depot/projects/dtrace/src/sys/contrib/opensolaris/common/nvpair/nvpair.c#2 edit
.. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h#2 edit
.. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/rpc/xdr.c#2 edit
.. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/rpc/xdr.h#2 edit
.. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/sys/byteorder.h#2 edit
.. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/sys/dtrace.h#25 edit
.. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/sys/isa_defs.h#8 edit
Differences ...
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cg.c#6 (text) ====
@@ -267,7 +267,7 @@
* properties are used to compute shift as USHIFT or SSHIFT, below.
*/
if (dnp->dn_flags & DT_NF_SIGNED) {
-#ifdef _BIG_ENDIAN
+#if BYTE_ORDER == _BIG_ENDIAN
shift = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY) * NBBY -
mp->ctm_offset % NBBY;
#else
@@ -281,7 +281,7 @@
instr = DIF_INSTR_FMT(DIF_OP_SRA, r1, r2, r1);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
} else {
-#ifdef _BIG_ENDIAN
+#if BYTE_ORDER == _BIG_ENDIAN
shift = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY) * NBBY -
(mp->ctm_offset % NBBY + e.cte_bits);
#else
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_lex.l#6 (text) ====
@@ -427,7 +427,7 @@
xyerror(D_CHR_OFLOW, "character constant is "
"too long");
}
-#ifdef _LITTLE_ENDIAN
+#if BYTE_ORDER == _LITTLE_ENDIAN
p = ((char *)&yylval.l_int) + nbytes - 1;
for (q = s; nbytes != 0; nbytes--)
*p-- = *q++;
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_link.c#9 (text) ====
@@ -493,9 +493,9 @@
elf_file.ehdr.e_ident[EI_MAG3] = ELFMAG3;
elf_file.ehdr.e_ident[EI_VERSION] = EV_CURRENT;
elf_file.ehdr.e_ident[EI_CLASS] = ELFCLASS32;
-#if defined(_BIG_ENDIAN)
+#if BYTE_ORDER == _BIG_ENDIAN
elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2MSB;
-#elif defined(_LITTLE_ENDIAN)
+#else
elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB;
#endif
elf_file.ehdr.e_type = ET_REL;
@@ -630,9 +630,9 @@
elf_file.ehdr.e_ident[EI_MAG3] = ELFMAG3;
elf_file.ehdr.e_ident[EI_VERSION] = EV_CURRENT;
elf_file.ehdr.e_ident[EI_CLASS] = ELFCLASS64;
-#if defined(_BIG_ENDIAN)
+#if BYTE_ORDER == _BIG_ENDIAN
elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2MSB;
-#elif defined(_LITTLE_ENDIAN)
+#else
elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB;
#endif
elf_file.ehdr.e_type = ET_REL;
==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/dwarf.c#9 (text) ====
@@ -934,7 +934,7 @@
ml->ml_size = tdesc_bitsize(ml->ml_type);
if (die_unsigned(dw, mem, DW_AT_bit_offset, &bitoff, 0)) {
-#ifdef FROGFACE_BIG_ENDIAN
+#if BYTE_ORDER == _BIG_ENDIAN
ml->ml_offset += bitoff;
#else
ml->ml_offset += tdesc_bitsize(ml->ml_type) - bitoff -
==== //depot/projects/dtrace/src/sys/contrib/opensolaris/common/nvpair/nvpair.c#2 (text+ko) ====
@@ -1918,7 +1918,7 @@
int err = 0;
nvstream_t nvs;
int nvl_endian;
-#ifdef _LITTLE_ENDIAN
+#if BYTE_ORDER == _LITTLE_ENDIAN
int host_endian = 1;
#else
int host_endian = 0;
==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h#2 (text+ko) ====
@@ -295,7 +295,7 @@
* Note: the byteorder is either 0 or -1, both of which are palindromes.
* This simplifies the endianness handling a bit.
*/
-#ifdef _BIG_ENDIAN
+#if BYTE_ORDER == _BIG_ENDIAN
#define ZFS_HOST_BYTEORDER (0ULL)
#else
#define ZFS_HOST_BYTEORDER (-1ULL)
==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/rpc/xdr.c#2 (text+ko) ====
@@ -54,11 +54,13 @@
#pragma weak xdr_int64_t = xdr_longlong_t
#pragma weak xdr_uint64_t = xdr_u_longlong_t
+#if defined(sun)
#if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
#error "Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined"
#elif defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)
#error "Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined"
#endif
+#endif
/*
* constants specific to the xdr "protocol"
@@ -174,12 +176,12 @@
xdr_longlong_t(XDR *xdrs, longlong_t *hp)
{
if (xdrs->x_op == XDR_ENCODE) {
-#if defined(_LITTLE_ENDIAN)
+#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)hp));
}
-#elif defined(_BIG_ENDIAN)
+#else
if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
@@ -189,12 +191,12 @@
}
if (xdrs->x_op == XDR_DECODE) {
-#if defined(_LITTLE_ENDIAN)
+#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)hp));
}
-#elif defined(_BIG_ENDIAN)
+#else
if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
@@ -213,12 +215,12 @@
{
if (xdrs->x_op == XDR_ENCODE) {
-#if defined(_LITTLE_ENDIAN)
+#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)hp));
}
-#elif defined(_BIG_ENDIAN)
+#else
if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
@@ -228,12 +230,12 @@
}
if (xdrs->x_op == XDR_DECODE) {
-#if defined(_LITTLE_ENDIAN)
+#if BYTE_ORDER == _LITTLE_ENDIAN
if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)hp));
}
-#elif defined(_BIG_ENDIAN)
+#else
if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) {
return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp +
BYTES_PER_XDR_UNIT)));
==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/rpc/xdr.h#2 (text+ko) ====
@@ -365,7 +365,7 @@
#endif
-#ifndef _LITTLE_ENDIAN
+#if BYTE_ORDER == _BIG_ENDIAN
#define IXDR_GET_HYPER(buf, v) { \
*((int32_t *)(&v)) = ntohl(*(uint32_t *)buf++); \
*((int32_t *)(((char *)&v) + BYTES_PER_XDR_UNIT)) \
==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/sys/byteorder.h#2 (text+ko) ====
@@ -58,7 +58,7 @@
* macros for conversion between host and (internet) network byte order
*/
-#if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint)
+#if BYTE_ORDER == _BIG_ENDIAN && !defined(ntohl) && !defined(__lint)
/* big-endian */
#define ntohl(x) (x)
#define ntohs(x) (x)
@@ -108,7 +108,7 @@
/*
* Macros to convert from a specific byte order to/from native byte order
*/
-#ifdef _BIG_ENDIAN
+#if BYTE_ORDER == _BIG_ENDIAN
#define BE_8(x) BMASK_8(x)
#define BE_16(x) BMASK_16(x)
#define BE_32(x) BMASK_32(x)
==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/sys/dtrace.h#25 (text) ====
@@ -514,7 +514,7 @@
((((uint64_t)(y)) << 32) | ((x) & UINT32_MAX))
#ifndef _LP64
-#ifndef _LITTLE_ENDIAN
+#if BYTE_ORDER == _BIG_ENDIAN
#define DTRACE_PTR(type, name) uint32_t name##pad; type *name
#else
#define DTRACE_PTR(type, name) type *name; uint32_t name##pad
@@ -624,7 +624,7 @@
#define DOF_ENCODE_LSB 1
#define DOF_ENCODE_MSB 2
-#ifdef _BIG_ENDIAN
+#if BYTE_ORDER == _BIG_ENDIAN
#define DOF_ENCODE_NATIVE DOF_ENCODE_MSB
#else
#define DOF_ENCODE_NATIVE DOF_ENCODE_LSB
==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/sys/isa_defs.h#8 (text) ====
More information about the p4-projects
mailing list