Changeset c55dd58 in mainline


Ignore:
Timestamp:
2006-11-30T15:37:16Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8c19cf28
Parents:
058b021
Message:

cleanup endian conversion macros

Location:
kernel/arch
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/byteorder.h

    r058b021 rc55dd58  
    3636#define KERN_amd64_BYTEORDER_H_
    3737
     38#include <byteorder.h>
     39
    3840/* AMD64 is little-endian */
    39 #define unative_t_le2host(n)            (n)
     41#define uint32_t_le2host(n)             (n)
    4042#define uint64_t_le2host(n)             (n)
     43
     44#define uint32_t_be2host(n)             uint64_t_byteorder_swap(n)
     45#define uint64_t_be2host(n)             uint32_t_byteorder_swap(n)
    4146
    4247#endif
  • kernel/arch/ia32/include/byteorder.h

    r058b021 rc55dd58  
    3636#define KERN_ia32_BYTEORDER_H_
    3737
     38#include <byteorder.h>
     39
    3840/* IA-32 is little-endian */
    39 #define unative_t_le2host(n)            (n)
     41#define uint32_t_le2host(n)             (n)
    4042#define uint64_t_le2host(n)             (n)
     43
     44#define uint32_t_be2host(n)             uint64_t_byteorder_swap(n)
     45#define uint64_t_be2host(n)             uint32_t_byteorder_swap(n)
    4146
    4247#endif
  • kernel/arch/ia64/include/byteorder.h

    r058b021 rc55dd58  
    3636#define KERN_ia64_BYTEORDER_H_
    3737
     38#include <byteorder.h>
     39
    3840/* IA-64 is little-endian */
    39 #define unative_t_le2host(n)            (n)
     41#define uint32_t_le2host(n)             (n)
    4042#define uint64_t_le2host(n)             (n)
     43
     44#define uint32_t_be2host(n)             uint64_t_byteorder_swap(n)
     45#define uint64_t_be2host(n)             uint32_t_byteorder_swap(n)
    4146
    4247#endif
  • kernel/arch/mips32/include/byteorder.h

    r058b021 rc55dd58  
    3636#define KERN_mips32_BYTEORDER_H_
    3737
    38 #include <arch/types.h>
    3938#include <byteorder.h>
    4039
    4140#ifdef BIG_ENDIAN
    42 static inline uint64_t uint64_t_le2host(uint64_t n)
    43 {
    44         return uint64_t_byteorder_swap(n);
    45 }
    4641
    47 static inline unative_t unative_t_le2host(unative_t n)
    48 {
    49         return uint32_t_byteorder_swap(n);
    50 }
     42#define uint32_t_le2host(n)             uint64_t_byteorder_swap(n)
     43#define uint64_t_le2host(n)             uint32_t_byteorder_swap(n)
     44
     45#define uint32_t_be2host(n)             (n)
     46#define uint64_t_be2host(n)             (n)
    5147
    5248#else
    53 #  define unative_t_le2host(n)          (n)
    54 #  define uint64_t_le2host(n)           (n)
     49
     50#define uint32_t_le2host(n)             (n)
     51#define uint64_t_le2host(n)             (n)
     52
     53#define uint32_t_be2host(n)             uint64_t_byteorder_swap(n)
     54#define uint64_t_be2host(n)             uint32_t_byteorder_swap(n)
     55
    5556#endif
    5657
  • kernel/arch/ppc32/include/byteorder.h

    r058b021 rc55dd58  
    3636#define KERN_ppc32_BYTEORDER_H_
    3737
    38 #include <arch/types.h>
    3938#include <byteorder.h>
    4039
    41 #define BIG_ENDIAN
     40#define uint32_t_le2host(n)             uint64_t_byteorder_swap(n)
     41#define uint64_t_le2host(n)             uint32_t_byteorder_swap(n)
    4242
    43 static inline uint64_t uint64_t_le2host(uint64_t n)
    44 {
    45         return uint64_t_byteorder_swap(n);
    46 }
    47 
    48 
    49 /** Convert little-endian unative_t to host unative_t
    50  *
    51  * Convert little-endian unative_t parameter to host endianess.
    52  *
    53  * @param n Little-endian unative_t argument.
    54  *
    55  * @return Result in host endianess.
    56  *
    57  */
    58 static inline unative_t unative_t_le2host(unative_t n)
    59 {
    60         uintptr_t v;
    61        
    62         asm volatile (
    63                 "lwbrx %0, %1, %2\n"
    64                 : "=r" (v)
    65                 : "i" (0), "r" (&n)
    66         );
    67         return v;
    68 }
     43#define uint32_t_be2host(n)             (n)
     44#define uint64_t_be2host(n)             (n)
    6945
    7046#endif
  • kernel/arch/ppc64/include/byteorder.h

    r058b021 rc55dd58  
    3636#define KERN_ppc64_BYTEORDER_H_
    3737
    38 #include <arch/types.h>
    3938#include <byteorder.h>
    4039
    41 #define BIG_ENDIAN
     40#define uint32_t_le2host(n)             uint64_t_byteorder_swap(n)
     41#define uint64_t_le2host(n)             uint32_t_byteorder_swap(n)
    4242
    43 static inline uint64_t uint64_t_le2host(uint64_t n)
    44 {
    45         return uint64_t_byteorder_swap(n);
    46 }
    47 
    48 
    49 /** Convert little-endian unative_t to host unative_t
    50  *
    51  * Convert little-endian unative_t parameter to host endianess.
    52  *
    53  * @param n Little-endian unative_t argument.
    54  *
    55  * @return Result in host endianess.
    56  *
    57  */
    58 static inline unative_t unative_t_le2host(unative_t n)
    59 {
    60         uintptr_t v;
    61        
    62         asm volatile (
    63                 "lwbrx %0, %1, %2\n"
    64                 : "=r" (v)
    65                 : "i" (0), "r" (&n)
    66         );
    67         return v;
    68 }
     43#define uint32_t_be2host(n)             (n)
     44#define uint64_t_be2host(n)             (n)
    6945
    7046#endif
  • kernel/arch/sparc64/include/byteorder.h

    r058b021 rc55dd58  
    3636#define KERN_sparc64_BYTEORDER_H_
    3737
    38 #include <arch/types.h>
    3938#include <byteorder.h>
    4039
    41 static inline uint64_t uint64_t_le2host(uint64_t n)
    42 {
    43         return uint64_t_byteorder_swap(n);
    44 }
     40#define uint32_t_le2host(n)             uint64_t_byteorder_swap(n)
     41#define uint64_t_le2host(n)             uint32_t_byteorder_swap(n)
    4542
    46 static inline unative_t unative_t_le2host(unative_t n)
    47 {
    48         return uint64_t_byteorder_swap(n);
    49 }
     43#define uint32_t_be2host(n)             (n)
     44#define uint64_t_be2host(n)             (n)
    5045
    5146#endif
Note: See TracChangeset for help on using the changeset viewer.