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__
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080025#ifdef __i386__
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080026static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
27{
Ben Cheng654325d2012-03-07 21:13:49 -080028/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029 __asm__("xchgb %b0,%h0\n\t"
30 "rorl $16,%0\n\t"
31 "xchgb %b0,%h0"
32 :"=q" (x)
Ben Cheng654325d2012-03-07 21:13:49 -080033/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034 : "0" (x));
35 return x;
36}
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080037static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
Ben Cheng654325d2012-03-07 21:13:49 -080038/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080039{
40 union {
41 struct { __u32 a,b; } s;
42 __u64 u;
Ben Cheng654325d2012-03-07 21:13:49 -080043/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080044 } v;
45 v.u = val;
46 v.s.a = ___arch__swab32(v.s.a);
47 v.s.b = ___arch__swab32(v.s.b);
Ben Cheng654325d2012-03-07 21:13:49 -080048/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080049 __asm__("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
50 return v.u;
51}
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080052#else
Ben Cheng654325d2012-03-07 21:13:49 -080053/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080054static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
55{
56 __asm__("bswapq %0" : "=r" (x) : "0" (x));
57 return x;
Ben Cheng654325d2012-03-07 21:13:49 -080058/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080059}
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080060static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
61{
62 __asm__("bswapl %0" : "=r" (x) : "0" (x));
Ben Cheng654325d2012-03-07 21:13:49 -080063/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080064 return x;
65}
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080066#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080067#define __arch__swab64(x) ___arch__swab64(x)
Ben Cheng654325d2012-03-07 21:13:49 -080068/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080069#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>
Ben Cheng654325d2012-03-07 21:13:49 -080073/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080074#endif