Subversion Repositories HelenOS

Rev

Rev 1888 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1888 Rev 2003
Line 33... Line 33...
33
 */
33
 */
34
 
34
 
35
#ifndef KERN_ppc64_BYTEORDER_H_
35
#ifndef KERN_ppc64_BYTEORDER_H_
36
#define KERN_ppc64_BYTEORDER_H_
36
#define KERN_ppc64_BYTEORDER_H_
37
 
37
 
38
#include <arch/types.h>
-
 
39
#include <byteorder.h>
38
#include <byteorder.h>
40
 
39
 
-
 
40
#define uint32_t_le2host(n)     uint64_t_byteorder_swap(n)
41
#define BIG_ENDIAN
41
#define uint64_t_le2host(n)     uint32_t_byteorder_swap(n)
42
 
42
 
43
static inline uint64_t uint64_t_le2host(uint64_t n)
43
#define uint32_t_be2host(n)     (n)
44
{
-
 
45
    return uint64_t_byteorder_swap(n);
44
#define uint64_t_be2host(n)     (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
}
-
 
69
 
45
 
70
#endif
46
#endif
71
 
47
 
72
/** @}
48
/** @}
73
 */
49
 */