diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-10-06 21:02:56 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-10-06 21:02:56 +0000 |
commit | f2984aabfd358ae2731013df5d571a596cb9a5eb (patch) | |
tree | 0b36a098a4b5fcb0d202c68c5a85123e7d95f419 /sys/arch/sh/include/endian.h | |
parent | b50063e7723d8a96f3eaeb641e59f7f161dcd917 (diff) |
Preliminary bits for SuperH-based ports, based on NetBSD/sh3 codebase with
minor changes.
Diffstat (limited to 'sys/arch/sh/include/endian.h')
-rw-r--r-- | sys/arch/sh/include/endian.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sys/arch/sh/include/endian.h b/sys/arch/sh/include/endian.h new file mode 100644 index 00000000000..9615f567cd1 --- /dev/null +++ b/sys/arch/sh/include/endian.h @@ -0,0 +1,43 @@ +/* $OpenBSD: endian.h,v 1.1 2006/10/06 21:02:55 miod Exp $ */ +/* $NetBSD: endian.h,v 1.4 2000/03/17 00:09:25 mycroft Exp $ */ + +/* Written by Manuel Bouyer. Public domain */ + +#ifndef _SH_ENDIAN_H_ +#define _SH_ENDIAN_H_ + +#ifdef __GNUC__ + +#define __swap64md __swap64gen + +#define __swap16md(x) ({ \ + uint16_t rval; \ + \ + __asm volatile ("swap.b %1,%0" : "=r"(rval) : "r"(x)); \ + \ + rval; \ +}) + +#define __swap32md(x) ({ \ + uint32_t rval; \ + \ + __asm volatile ("swap.b %1,%0; swap.w %0,%0; swap.b %0,%0" \ + : "=r"(rval) : "r"(x)); \ + \ + rval; \ +}) + +#define MD_SWAP + +#endif /* __GNUC_ */ + +#ifdef __LITTLE_ENDIAN__ +#define _BYTE_ORDER _LITTLE_ENDIAN +#else +#define _BYTE_ORDER _BIG_ENDIAN +#endif +#include <sys/endian.h> + +#define __STRICT_ALIGNMENT + +#endif /* !_SH_ENDIAN_H_ */ |