blob: 98fc6b1ce515bbad39c2ed25e252829956070710 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
Ben Cheng654325d2012-03-07 21:13:49 -080010 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080017 ****************************************************************************
18 ****************************************************************************/
19#ifndef _ASM_X86_BYTEORDER_H
20#define _ASM_X86_BYTEORDER_H
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080021#include <asm/types.h>
22#include <linux/compiler.h>
Ben Cheng654325d2012-03-07 21:13:49 -080023/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080024#ifdef __GNUC__
Elliott Hughesd3e64a32013-09-30 17:41:08 -070025#ifdef __i386__
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080026static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
27{
Andrew Hsieh126601d2012-03-23 23:07:36 +080028/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Elliott Hughesd3e64a32013-09-30 17:41:08 -070029 __asm__("xchgb %b0,%h0\n\t"
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080030 "rorl $16,%0\n\t"
31 "xchgb %b0,%h0"
32 :"=q" (x)
Andrew Hsieh126601d2012-03-23 23:07:36 +080033/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Elliott Hughesd3e64a32013-09-30 17:41:08 -070034 : "0" (x));
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080035 return x;
36}
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080037static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
Andrew Hsieh126601d2012-03-23 23:07:36 +080038/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Elliott Hughesd3e64a32013-09-30 17:41:08 -070039{
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080040 union {
41 struct { __u32 a,b; } s;
42 __u64 u;
Andrew Hsieh126601d2012-03-23 23:07:36 +080043/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Elliott Hughesd3e64a32013-09-30 17:41:08 -070044 } v;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080045 v.u = val;
46 v.s.a = ___arch__swab32(v.s.a);
47 v.s.b = ___arch__swab32(v.s.b);
Andrew Hsieh126601d2012-03-23 23:07:36 +080048/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Elliott Hughesd3e64a32013-09-30 17:41:08 -070049 __asm__("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080050 return v.u;
51}
Elliott Hughesd3e64a32013-09-30 17:41:08 -070052#else
Andrew Hsieh126601d2012-03-23 23:07:36 +080053/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Elliott Hughesd3e64a32013-09-30 17:41:08 -070054static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
55{
56 __asm__("bswapq %0" : "=r" (x) : "0" (x));
57 return x;
58/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59}
60static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
61{
62 __asm__("bswapl %0" : "=r" (x) : "0" (x));
63/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64 return x;
65}
66#endif
67#define __arch__swab64(x) ___arch__swab64(x)
68/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69#define __arch__swab32(x) ___arch__swab32(x)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080070#define __BYTEORDER_HAS_U64__
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080071#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080072#include <linux/byteorder/little_endian.h>
Andrew Hsieh126601d2012-03-23 23:07:36 +080073/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Elliott Hughesd3e64a32013-09-30 17:41:08 -070074#endif