Check _BYTE_ORDER.

This commit is contained in:
msaitoh 2014-02-07 15:49:40 +00:00
parent 97834f7ba0
commit 1f7f7f0d8b

View File

@ -1,4 +1,4 @@
/* $NetBSD: com_arbus.c,v 1.10 2011/07/07 05:06:44 matt Exp $ */
/* $NetBSD: com_arbus.c,v 1.11 2014/02/07 15:49:40 msaitoh Exp $ */
/*-
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
* Copyright (c) 2006 Garrett D'Amore.
@ -101,7 +101,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: com_arbus.c,v 1.10 2011/07/07 05:06:44 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: com_arbus.c,v 1.11 2014/02/07 15:49:40 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -223,10 +223,15 @@ com_arbus_attach(device_t parent, device_t self, void *aux)
void
com_arbus_initmap(struct com_regs *regsp)
{
#if _BYTE_ORDER == _BIG_ENDIAN
int off = 3;
#else
int off = 0;
#endif;
/* rewrite the map to shift for alignment */
for (size_t i = 0; i < __arraycount(regsp->cr_map); i++) {
regsp->cr_map[i] = (com_std_map[i] * 4) + 3;
regsp->cr_map[i] = (com_std_map[i] * 4) + off;
}
}