The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 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 Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 10 | *** 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 Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef _ASM_X86_BYTEORDER_H |
| 20 | #define _ASM_X86_BYTEORDER_H |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 21 | #include <asm/types.h> |
| 22 | #include <linux/compiler.h> |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 23 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 24 | #ifdef __GNUC__ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 25 | #ifdef __i386__ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 26 | static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) |
| 27 | { |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 28 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | __asm__("xchgb %b0,%h0\n\t" |
| 30 | "rorl $16,%0\n\t" |
| 31 | "xchgb %b0,%h0" |
| 32 | :"=q" (x) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 33 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 34 | : "0" (x)); |
| 35 | return x; |
| 36 | } |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 37 | static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 38 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 39 | { |
| 40 | union { |
| 41 | struct { __u32 a,b; } s; |
| 42 | __u64 u; |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 43 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 44 | } v; |
| 45 | v.u = val; |
| 46 | v.s.a = ___arch__swab32(v.s.a); |
| 47 | v.s.b = ___arch__swab32(v.s.b); |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 48 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 49 | __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 Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 52 | #else |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 53 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 54 | static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) |
| 55 | { |
| 56 | __asm__("bswapq %0" : "=r" (x) : "0" (x)); |
| 57 | return x; |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 58 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 59 | } |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 60 | static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) |
| 61 | { |
| 62 | __asm__("bswapl %0" : "=r" (x) : "0" (x)); |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 63 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 64 | return x; |
| 65 | } |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 66 | #endif |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 67 | #define __arch__swab64(x) ___arch__swab64(x) |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 68 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 69 | #define __arch__swab32(x) ___arch__swab32(x) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 70 | #define __BYTEORDER_HAS_U64__ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 71 | #endif |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 72 | #include <linux/byteorder/little_endian.h> |
Ben Cheng | 654325d | 2012-03-07 21:13:49 -0800 | [diff] [blame^] | 73 | /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 74 | #endif |