/trunk/kernel/arch/sparc64/include/byteorder.h |
---|
35,18 → 35,13 |
#ifndef KERN_sparc64_BYTEORDER_H_ |
#define KERN_sparc64_BYTEORDER_H_ |
#include <arch/types.h> |
#include <byteorder.h> |
static inline uint64_t uint64_t_le2host(uint64_t n) |
{ |
return uint64_t_byteorder_swap(n); |
} |
#define uint32_t_le2host(n) uint64_t_byteorder_swap(n) |
#define uint64_t_le2host(n) uint32_t_byteorder_swap(n) |
static inline unative_t unative_t_le2host(unative_t n) |
{ |
return uint64_t_byteorder_swap(n); |
} |
#define uint32_t_be2host(n) (n) |
#define uint64_t_be2host(n) (n) |
#endif |
/trunk/kernel/arch/ia64/include/byteorder.h |
---|
35,10 → 35,15 |
#ifndef KERN_ia64_BYTEORDER_H_ |
#define KERN_ia64_BYTEORDER_H_ |
#include <byteorder.h> |
/* IA-64 is little-endian */ |
#define unative_t_le2host(n) (n) |
#define uint32_t_le2host(n) (n) |
#define uint64_t_le2host(n) (n) |
#define uint32_t_be2host(n) uint64_t_byteorder_swap(n) |
#define uint64_t_be2host(n) uint32_t_byteorder_swap(n) |
#endif |
/** @} |
/trunk/kernel/arch/ppc32/include/byteorder.h |
---|
35,38 → 35,14 |
#ifndef KERN_ppc32_BYTEORDER_H_ |
#define KERN_ppc32_BYTEORDER_H_ |
#include <arch/types.h> |
#include <byteorder.h> |
#define BIG_ENDIAN |
#define uint32_t_le2host(n) uint64_t_byteorder_swap(n) |
#define uint64_t_le2host(n) uint32_t_byteorder_swap(n) |
static inline uint64_t uint64_t_le2host(uint64_t n) |
{ |
return uint64_t_byteorder_swap(n); |
} |
#define uint32_t_be2host(n) (n) |
#define uint64_t_be2host(n) (n) |
/** Convert little-endian unative_t to host unative_t |
* |
* Convert little-endian unative_t parameter to host endianess. |
* |
* @param n Little-endian unative_t argument. |
* |
* @return Result in host endianess. |
* |
*/ |
static inline unative_t unative_t_le2host(unative_t n) |
{ |
uintptr_t v; |
asm volatile ( |
"lwbrx %0, %1, %2\n" |
: "=r" (v) |
: "i" (0), "r" (&n) |
); |
return v; |
} |
#endif |
/** @} |
/trunk/kernel/arch/amd64/include/byteorder.h |
---|
35,10 → 35,15 |
#ifndef KERN_amd64_BYTEORDER_H_ |
#define KERN_amd64_BYTEORDER_H_ |
#include <byteorder.h> |
/* AMD64 is little-endian */ |
#define unative_t_le2host(n) (n) |
#define uint32_t_le2host(n) (n) |
#define uint64_t_le2host(n) (n) |
#define uint32_t_be2host(n) uint64_t_byteorder_swap(n) |
#define uint64_t_be2host(n) uint32_t_byteorder_swap(n) |
#endif |
/** @} |
/trunk/kernel/arch/ppc64/include/byteorder.h |
---|
35,38 → 35,14 |
#ifndef KERN_ppc64_BYTEORDER_H_ |
#define KERN_ppc64_BYTEORDER_H_ |
#include <arch/types.h> |
#include <byteorder.h> |
#define BIG_ENDIAN |
#define uint32_t_le2host(n) uint64_t_byteorder_swap(n) |
#define uint64_t_le2host(n) uint32_t_byteorder_swap(n) |
static inline uint64_t uint64_t_le2host(uint64_t n) |
{ |
return uint64_t_byteorder_swap(n); |
} |
#define uint32_t_be2host(n) (n) |
#define uint64_t_be2host(n) (n) |
/** Convert little-endian unative_t to host unative_t |
* |
* Convert little-endian unative_t parameter to host endianess. |
* |
* @param n Little-endian unative_t argument. |
* |
* @return Result in host endianess. |
* |
*/ |
static inline unative_t unative_t_le2host(unative_t n) |
{ |
uintptr_t v; |
asm volatile ( |
"lwbrx %0, %1, %2\n" |
: "=r" (v) |
: "i" (0), "r" (&n) |
); |
return v; |
} |
#endif |
/** @} |
/trunk/kernel/arch/mips32/include/byteorder.h |
---|
35,23 → 35,24 |
#ifndef KERN_mips32_BYTEORDER_H_ |
#define KERN_mips32_BYTEORDER_H_ |
#include <arch/types.h> |
#include <byteorder.h> |
#ifdef BIG_ENDIAN |
static inline uint64_t uint64_t_le2host(uint64_t n) |
{ |
return uint64_t_byteorder_swap(n); |
} |
static inline unative_t unative_t_le2host(unative_t n) |
{ |
return uint32_t_byteorder_swap(n); |
} |
#define uint32_t_le2host(n) uint64_t_byteorder_swap(n) |
#define uint64_t_le2host(n) uint32_t_byteorder_swap(n) |
#define uint32_t_be2host(n) (n) |
#define uint64_t_be2host(n) (n) |
#else |
# define unative_t_le2host(n) (n) |
#define uint32_t_le2host(n) (n) |
# define uint64_t_le2host(n) (n) |
#define uint32_t_be2host(n) uint64_t_byteorder_swap(n) |
#define uint64_t_be2host(n) uint32_t_byteorder_swap(n) |
#endif |
#endif |
/trunk/kernel/arch/ia32/include/byteorder.h |
---|
35,10 → 35,15 |
#ifndef KERN_ia32_BYTEORDER_H_ |
#define KERN_ia32_BYTEORDER_H_ |
#include <byteorder.h> |
/* IA-32 is little-endian */ |
#define unative_t_le2host(n) (n) |
#define uint32_t_le2host(n) (n) |
#define uint64_t_le2host(n) (n) |
#define uint32_t_be2host(n) uint64_t_byteorder_swap(n) |
#define uint64_t_be2host(n) uint32_t_byteorder_swap(n) |
#endif |
/** @} |