Re: include/linux/dynamic_debug.h:111:2: error: implicitdeclaration of function âstrstrâ

From: shawn
Date: Tue May 29 2012 - 21:43:27 EST


jim,
On Tue, 2012-05-29 at 19:11 -0600, Jim Cromie wrote:
> On Tue, May 29, 2012 at 5:31 PM, shawn <shawnlandden@xxxxxxxxx> wrote:
> > SHIPPED arch/arm/boot/compressed/lib1funcs.S
> > In file included from include/linux/kernel.h:23:0,
> > from
> > arch/arm/boot/compressed/../../../../lib/xz/xz_private.h:15,
> > from
> > arch/arm/boot/compressed/../../../../lib/decompress_unxz.c:145,
> > from arch/arm/boot/compressed/decompress.c:50:
> > include/linux/dynamic_debug.h: In function
> > âddebug_dyndbg_module_param_cbâ:
> > include/linux/dynamic_debug.h:111:2: error: implicit declaration of
> > function âstrstrâ [-Werror=implicit-function-declaration]
> >
> > git blame shows b48420c1d3019ce8d84fb8e58f4ca86b8e3655b8 as introducing
> > this call
>
> that symbol should have been provided by line 100
>
> 98 #else
> 99
> 100 #include <linux/string.h>
> 101 #include <linux/errno.h>
> ...
> 108 static inline int ddebug_dyndbg_module_param_cb(char *param, char *val,
> 109 const char *modname)
> 110 {
> 111 if (strstr(param, "dyndbg")) {

> which has:
>
> 74 #ifndef __HAVE_ARCH_STRSTR
> 75 extern char * strstr(const char *, const char *);
> 76 #endif
> does your arch have __HAVE_ARCH_STRSTR ?
> if so, is strstr exported under different conditions ??
a git grep __HAVE_ARCH_STRSTR did not show and such defines in the arm
tree
>
> Can you send me
> arch/arm/boot/compressed/decompress.i ?
I didn't have that file after the failure, but

make arch/arm/boot/compressed/decompress.i

summoned it, also including string.o from that folder (which was present
after the failure)

I am compiling on amd64, using
export ARCH=arm
and
CONFIG_CROSS_COMPILE="arm-linux-gnueabi-"


I have had issues with the cross compiler not always being called since
the 3.5 merge window opened up, (ld reporting corrupted binary files and
gcc saying it doesn't understand arm-specific flags) and have not yet
compiled a post-v3.4 successful kernel. This could be a symptom of that.
(esp as the host arch, x86 DOES have __HAVE_ARCH_STRSTR)

--
-Shawn Landden

Attachment: string.o
Description: application/object

# 1 "arch/arm/boot/compressed/decompress.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/home/shawn/source/linux/include/linux/kconfig.h" 1



# 1 "include/generated/autoconf.h" 1
# 5 "/home/shawn/source/linux/include/linux/kconfig.h" 2
# 1 "<command-line>" 2
# 1 "arch/arm/boot/compressed/decompress.c"


# 1 "include/linux/compiler.h" 1
# 48 "include/linux/compiler.h"
# 1 "include/linux/compiler-gcc.h" 1
# 100 "include/linux/compiler-gcc.h"
# 1 "include/linux/compiler-gcc4.h" 1
# 101 "include/linux/compiler-gcc.h" 2
# 49 "include/linux/compiler.h" 2
# 66 "include/linux/compiler.h"
struct ftrace_branch_data {
const char *func;
const char *file;
unsigned line;
union {
struct {
unsigned long correct;
unsigned long incorrect;
};
struct {
unsigned long miss;
unsigned long hit;
};
unsigned long miss_hit[2];
};
};
# 4 "arch/arm/boot/compressed/decompress.c" 2
# 1 "include/linux/types.h" 1



# 1 "/home/shawn/source/linux/arch/arm/include/asm/types.h" 1



# 1 "include/asm-generic/int-ll64.h" 1
# 11 "include/asm-generic/int-ll64.h"
# 1 "arch/arm/include/generated/asm/bitsperlong.h" 1
# 1 "include/asm-generic/bitsperlong.h" 1
# 1 "arch/arm/include/generated/asm/bitsperlong.h" 2
# 12 "include/asm-generic/int-ll64.h" 2







typedef __signed__ char __s8;
typedef unsigned char __u8;

typedef __signed__ short __s16;
typedef unsigned short __u16;

typedef __signed__ int __s32;
typedef unsigned int __u32;


__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
# 42 "include/asm-generic/int-ll64.h"
typedef signed char s8;
typedef unsigned char u8;

typedef signed short s16;
typedef unsigned short u16;

typedef signed int s32;
typedef unsigned int u32;

typedef signed long long s64;
typedef unsigned long long u64;
# 5 "/home/shawn/source/linux/arch/arm/include/asm/types.h" 2
# 5 "include/linux/types.h" 2
# 17 "include/linux/types.h"
# 1 "include/linux/posix_types.h" 1



# 1 "include/linux/stddef.h" 1
# 11 "include/linux/stddef.h"
enum {
false = 0,
true = 1
};
# 5 "include/linux/posix_types.h" 2
# 36 "include/linux/posix_types.h"
typedef struct {
unsigned long fds_bits [(1024/(8 * sizeof(unsigned long)))];
} __kernel_fd_set;


typedef void (*__kernel_sighandler_t)(int);


typedef int __kernel_key_t;
typedef int __kernel_mqd_t;

# 1 "/home/shawn/source/linux/arch/arm/include/asm/posix_types.h" 1
# 22 "/home/shawn/source/linux/arch/arm/include/asm/posix_types.h"
typedef unsigned short __kernel_mode_t;


typedef unsigned short __kernel_nlink_t;


typedef unsigned short __kernel_ipc_pid_t;


typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;


typedef unsigned short __kernel_old_dev_t;


# 1 "include/asm-generic/posix_types.h" 1



# 1 "arch/arm/include/generated/asm/bitsperlong.h" 1
# 5 "include/asm-generic/posix_types.h" 2
# 14 "include/asm-generic/posix_types.h"
typedef long __kernel_long_t;
typedef unsigned long __kernel_ulong_t;



typedef __kernel_ulong_t __kernel_ino_t;
# 31 "include/asm-generic/posix_types.h"
typedef int __kernel_pid_t;
# 44 "include/asm-generic/posix_types.h"
typedef __kernel_long_t __kernel_suseconds_t;



typedef int __kernel_daddr_t;



typedef unsigned int __kernel_uid32_t;
typedef unsigned int __kernel_gid32_t;



typedef __kernel_uid_t __kernel_old_uid_t;
typedef __kernel_gid_t __kernel_old_gid_t;
# 71 "include/asm-generic/posix_types.h"
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
# 82 "include/asm-generic/posix_types.h"
typedef struct {
int val[2];
} __kernel_fsid_t;





typedef __kernel_long_t __kernel_off_t;
typedef long long __kernel_loff_t;
typedef __kernel_long_t __kernel_time_t;
typedef __kernel_long_t __kernel_clock_t;
typedef int __kernel_timer_t;
typedef int __kernel_clockid_t;
typedef char * __kernel_caddr_t;
typedef unsigned short __kernel_uid16_t;
typedef unsigned short __kernel_gid16_t;
# 39 "/home/shawn/source/linux/arch/arm/include/asm/posix_types.h" 2
# 48 "include/linux/posix_types.h" 2
# 18 "include/linux/types.h" 2



typedef __u32 __kernel_dev_t;

typedef __kernel_fd_set fd_set;
typedef __kernel_dev_t dev_t;
typedef __kernel_ino_t ino_t;
typedef __kernel_mode_t mode_t;
typedef unsigned short umode_t;
typedef __kernel_nlink_t nlink_t;
typedef __kernel_off_t off_t;
typedef __kernel_pid_t pid_t;
typedef __kernel_daddr_t daddr_t;
typedef __kernel_key_t key_t;
typedef __kernel_suseconds_t suseconds_t;
typedef __kernel_timer_t timer_t;
typedef __kernel_clockid_t clockid_t;
typedef __kernel_mqd_t mqd_t;

typedef _Bool bool;

typedef __kernel_uid32_t uid_t;
typedef __kernel_gid32_t gid_t;
typedef __kernel_uid16_t uid16_t;
typedef __kernel_gid16_t gid16_t;

typedef unsigned long uintptr_t;



typedef __kernel_old_uid_t old_uid_t;
typedef __kernel_old_gid_t old_gid_t;



typedef __kernel_loff_t loff_t;
# 63 "include/linux/types.h"
typedef __kernel_size_t size_t;




typedef __kernel_ssize_t ssize_t;




typedef __kernel_ptrdiff_t ptrdiff_t;




typedef __kernel_time_t time_t;




typedef __kernel_clock_t clock_t;




typedef __kernel_caddr_t caddr_t;



typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;


typedef unsigned char unchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;




typedef __u8 u_int8_t;
typedef __s8 int8_t;
typedef __u16 u_int16_t;
typedef __s16 int16_t;
typedef __u32 u_int32_t;
typedef __s32 int32_t;



typedef __u8 uint8_t;
typedef __u16 uint16_t;
typedef __u32 uint32_t;


typedef __u64 uint64_t;
typedef __u64 u_int64_t;
typedef __s64 int64_t;
# 139 "include/linux/types.h"
typedef u64 sector_t;
typedef u64 blkcnt_t;
# 157 "include/linux/types.h"
typedef u32 dma_addr_t;
# 178 "include/linux/types.h"
typedef __u16 __le16;
typedef __u16 __be16;
typedef __u32 __le32;
typedef __u32 __be32;
typedef __u64 __le64;
typedef __u64 __be64;

typedef __u16 __sum16;
typedef __u32 __wsum;
# 202 "include/linux/types.h"
typedef unsigned gfp_t;
typedef unsigned fmode_t;




typedef u32 phys_addr_t;


typedef phys_addr_t resource_size_t;





typedef unsigned long irq_hw_number_t;

typedef struct {
int counter;
} atomic_t;







struct list_head {
struct list_head *next, *prev;
};

struct hlist_head {
struct hlist_node *first;
};

struct hlist_node {
struct hlist_node *next, **pprev;
};

struct ustat {
__kernel_daddr_t f_tfree;
__kernel_ino_t f_tinode;
char f_fname[6];
char f_fpack[6];
};






struct rcu_head {
struct rcu_head *next;
void (*func)(struct rcu_head *head);
};
# 5 "arch/arm/boot/compressed/decompress.c" 2

# 1 "include/linux/linkage.h" 1




# 1 "/home/shawn/source/linux/arch/arm/include/asm/linkage.h" 1
# 6 "include/linux/linkage.h" 2
# 7 "arch/arm/boot/compressed/decompress.c" 2
# 1 "/home/shawn/source/linux/arch/arm/include/asm/string.h" 1
# 10 "/home/shawn/source/linux/arch/arm/include/asm/string.h"
extern char * strrchr(const char * s, int c);


extern char * strchr(const char * s, int c);


extern void * memcpy(void *, const void *, __kernel_size_t);


extern void * memmove(void *, const void *, __kernel_size_t);


extern void * memchr(const void *, int, __kernel_size_t);


extern void * memset(void *, int, __kernel_size_t);

extern void __memzero(void *ptr, __kernel_size_t n);
# 8 "arch/arm/boot/compressed/decompress.c" 2

extern unsigned long free_mem_ptr;
extern unsigned long free_mem_end_ptr;
extern void error(char *);
# 50 "arch/arm/boot/compressed/decompress.c"
# 1 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c" 1
# 107 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c"
# 1 "include/linux/decompress/mm.h" 1
# 30 "include/linux/decompress/mm.h"
unsigned long malloc_ptr;
int malloc_count;

static void *malloc(int size)
{
void *p;

if (size < 0)
return ((void *)0);
if (!malloc_ptr)
malloc_ptr = free_mem_ptr;

malloc_ptr = (malloc_ptr + 3) & ~3;

p = (void *)malloc_ptr;
malloc_ptr += size;

if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr)
return ((void *)0);

malloc_count++;
return p;
}

static void free(void *where)
{
malloc_count--;
if (!malloc_count)
malloc_ptr = free_mem_ptr;
}
# 108 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c" 2
# 145 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c"
# 1 "arch/arm/boot/compressed/../../../../lib/xz/xz_private.h" 1
# 14 "arch/arm/boot/compressed/../../../../lib/xz/xz_private.h"
# 1 "include/linux/xz.h" 1
# 52 "include/linux/xz.h"
enum xz_mode {
XZ_SINGLE,
XZ_PREALLOC,
XZ_DYNALLOC
};
# 108 "include/linux/xz.h"
enum xz_ret {
XZ_OK,
XZ_STREAM_END,
XZ_UNSUPPORTED_CHECK,
XZ_MEM_ERROR,
XZ_MEMLIMIT_ERROR,
XZ_FORMAT_ERROR,
XZ_OPTIONS_ERROR,
XZ_DATA_ERROR,
XZ_BUF_ERROR
};
# 136 "include/linux/xz.h"
struct xz_buf {
const uint8_t *in;
size_t in_pos;
size_t in_size;

uint8_t *out;
size_t out_pos;
size_t out_size;
};




struct xz_dec;
# 194 "include/linux/xz.h"
static struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max);
# 214 "include/linux/xz.h"
static enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b);
# 227 "include/linux/xz.h"
static void xz_dec_reset(struct xz_dec *s);






static void xz_dec_end(struct xz_dec *s);
# 255 "include/linux/xz.h"
static void xz_crc32_init(void);






static uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc);
# 15 "arch/arm/boot/compressed/../../../../lib/xz/xz_private.h" 2
# 1 "include/linux/kernel.h" 1



# 1 "include/linux/sysinfo.h" 1






struct sysinfo {
__kernel_long_t uptime;
__kernel_ulong_t loads[3];
__kernel_ulong_t totalram;
__kernel_ulong_t freeram;
__kernel_ulong_t sharedram;
__kernel_ulong_t bufferram;
__kernel_ulong_t totalswap;
__kernel_ulong_t freeswap;
__u16 procs;
__u16 pad;
__kernel_ulong_t totalhigh;
__kernel_ulong_t freehigh;
__u32 mem_unit;
char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)];
};
# 5 "include/linux/kernel.h" 2
# 14 "include/linux/kernel.h"
# 1 "/usr/lib/gcc/arm-linux-gnueabi/4.6/include/stdarg.h" 1 3 4
# 40 "/usr/lib/gcc/arm-linux-gnueabi/4.6/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 102 "/usr/lib/gcc/arm-linux-gnueabi/4.6/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 15 "include/linux/kernel.h" 2




# 1 "include/linux/bitops.h" 1
# 13 "include/linux/bitops.h"
extern unsigned int __sw_hweight8(unsigned int w);
extern unsigned int __sw_hweight16(unsigned int w);
extern unsigned int __sw_hweight32(unsigned int w);
extern unsigned long __sw_hweight64(__u64 w);





# 1 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h" 1
# 27 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h"
# 1 "include/linux/irqflags.h" 1
# 14 "include/linux/irqflags.h"
# 1 "include/linux/typecheck.h" 1
# 15 "include/linux/irqflags.h" 2
# 1 "/home/shawn/source/linux/arch/arm/include/asm/irqflags.h" 1





# 1 "/home/shawn/source/linux/arch/arm/include/asm/ptrace.h" 1
# 13 "/home/shawn/source/linux/arch/arm/include/asm/ptrace.h"
# 1 "/home/shawn/source/linux/arch/arm/include/asm/hwcap.h" 1
# 35 "/home/shawn/source/linux/arch/arm/include/asm/hwcap.h"
extern unsigned int elf_hwcap;
# 14 "/home/shawn/source/linux/arch/arm/include/asm/ptrace.h" 2
# 108 "/home/shawn/source/linux/arch/arm/include/asm/ptrace.h"
struct pt_regs {
unsigned long uregs[18];
};
# 166 "/home/shawn/source/linux/arch/arm/include/asm/ptrace.h"
static inline __attribute__((always_inline)) int valid_user_regs(struct pt_regs *regs)
{
unsigned long mode = regs->uregs[16] & 0x0000001f;




regs->uregs[16] &= ~(0x00000040 | 0x00000100);

if ((regs->uregs[16] & 0x00000080) == 0) {
if (mode == 0x00000010)
return 1;
if (elf_hwcap & (1 << 3) && mode == 0x00000000)
return 1;
}




regs->uregs[16] &= 0xff000000 | 0x00ff0000 | 0x0000ff00 | 0x00000020 | 0x00000010;
if (!(elf_hwcap & (1 << 3)))
regs->uregs[16] |= 0x00000010;

return 0;
}

static inline __attribute__((always_inline)) long regs_return_value(struct pt_regs *regs)
{
return regs->uregs[0];
}
# 223 "/home/shawn/source/linux/arch/arm/include/asm/ptrace.h"
extern int regs_query_register_offset(const char *name);
extern const char *regs_query_register_name(unsigned int offset);
extern bool regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr);
extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
unsigned int n);
# 238 "/home/shawn/source/linux/arch/arm/include/asm/ptrace.h"
static inline __attribute__((always_inline)) unsigned long regs_get_register(struct pt_regs *regs,
unsigned int offset)
{
if (__builtin_expect(!!(offset > (__builtin_offsetof(struct pt_regs,uregs[17]))), 0))
return 0;
return *(unsigned long *)((unsigned long)regs + offset);
}


static inline __attribute__((always_inline)) unsigned long kernel_stack_pointer(struct pt_regs *regs)
{
return regs->uregs[13];
}

static inline __attribute__((always_inline)) unsigned long user_stack_pointer(struct pt_regs *regs)
{
return regs->uregs[13];
}
# 7 "/home/shawn/source/linux/arch/arm/include/asm/irqflags.h" 2
# 49 "/home/shawn/source/linux/arch/arm/include/asm/irqflags.h"
static inline __attribute__((always_inline)) unsigned long arch_local_irq_save(void)
{
unsigned long flags, temp;

asm volatile(
" mrs %0, cpsr @ arch_local_irq_save\n"
" orr %1, %0, #128\n"
" msr cpsr_c, %1"
: "=r" (flags), "=r" (temp)
:
: "memory", "cc");
return flags;
}




static inline __attribute__((always_inline)) void arch_local_irq_enable(void)
{
unsigned long temp;
asm volatile(
" mrs %0, cpsr @ arch_local_irq_enable\n"
" bic %0, %0, #128\n"
" msr cpsr_c, %0"
: "=r" (temp)
:
: "memory", "cc");
}




static inline __attribute__((always_inline)) void arch_local_irq_disable(void)
{
unsigned long temp;
asm volatile(
" mrs %0, cpsr @ arch_local_irq_disable\n"
" orr %0, %0, #128\n"
" msr cpsr_c, %0"
: "=r" (temp)
:
: "memory", "cc");
}
# 128 "/home/shawn/source/linux/arch/arm/include/asm/irqflags.h"
static inline __attribute__((always_inline)) unsigned long arch_local_save_flags(void)
{
unsigned long flags;
asm volatile(
" mrs %0, cpsr @ local_save_flags"
: "=r" (flags) : : "memory", "cc");
return flags;
}




static inline __attribute__((always_inline)) void arch_local_irq_restore(unsigned long flags)
{
asm volatile(
" msr cpsr_c, %0 @ local_irq_restore"
:
: "r" (flags)
: "memory", "cc");
}

static inline __attribute__((always_inline)) int arch_irqs_disabled_flags(unsigned long flags)
{
return flags & 0x00000080;
}
# 16 "include/linux/irqflags.h" 2
# 28 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h" 2
# 37 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h"
static inline __attribute__((always_inline)) void ____atomic_set_bit(unsigned int bit, volatile unsigned long *p)
{
unsigned long flags;
unsigned long mask = 1UL << (bit & 31);

p += bit >> 5;

do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0);
*p |= mask;
do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0);
}

static inline __attribute__((always_inline)) void ____atomic_clear_bit(unsigned int bit, volatile unsigned long *p)
{
unsigned long flags;
unsigned long mask = 1UL << (bit & 31);

p += bit >> 5;

do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0);
*p &= ~mask;
do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0);
}

static inline __attribute__((always_inline)) void ____atomic_change_bit(unsigned int bit, volatile unsigned long *p)
{
unsigned long flags;
unsigned long mask = 1UL << (bit & 31);

p += bit >> 5;

do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0);
*p ^= mask;
do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0);
}

static inline __attribute__((always_inline)) int
____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p)
{
unsigned long flags;
unsigned int res;
unsigned long mask = 1UL << (bit & 31);

p += bit >> 5;

do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0);
res = *p;
*p = res | mask;
do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0);

return (res & mask) != 0;
}

static inline __attribute__((always_inline)) int
____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
{
unsigned long flags;
unsigned int res;
unsigned long mask = 1UL << (bit & 31);

p += bit >> 5;

do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0);
res = *p;
*p = res & ~mask;
do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0);

return (res & mask) != 0;
}

static inline __attribute__((always_inline)) int
____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
{
unsigned long flags;
unsigned int res;
unsigned long mask = 1UL << (bit & 31);

p += bit >> 5;

do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); flags = arch_local_irq_save(); } while (0);
res = *p;
*p = res ^ mask;
do { ({ unsigned long __dummy; typeof(flags) __dummy2; (void)(&__dummy == &__dummy2); 1; }); arch_local_irq_restore(flags); } while (0);

return (res & mask) != 0;
}

# 1 "include/asm-generic/bitops/non-atomic.h" 1
# 15 "include/asm-generic/bitops/non-atomic.h"
static inline __attribute__((always_inline)) void __set_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = (1UL << ((nr) % 32));
unsigned long *p = ((unsigned long *)addr) + ((nr) / 32);

*p |= mask;
}

static inline __attribute__((always_inline)) void __clear_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = (1UL << ((nr) % 32));
unsigned long *p = ((unsigned long *)addr) + ((nr) / 32);

*p &= ~mask;
}
# 40 "include/asm-generic/bitops/non-atomic.h"
static inline __attribute__((always_inline)) void __change_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = (1UL << ((nr) % 32));
unsigned long *p = ((unsigned long *)addr) + ((nr) / 32);

*p ^= mask;
}
# 57 "include/asm-generic/bitops/non-atomic.h"
static inline __attribute__((always_inline)) int __test_and_set_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = (1UL << ((nr) % 32));
unsigned long *p = ((unsigned long *)addr) + ((nr) / 32);
unsigned long old = *p;

*p = old | mask;
return (old & mask) != 0;
}
# 76 "include/asm-generic/bitops/non-atomic.h"
static inline __attribute__((always_inline)) int __test_and_clear_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = (1UL << ((nr) % 32));
unsigned long *p = ((unsigned long *)addr) + ((nr) / 32);
unsigned long old = *p;

*p = old & ~mask;
return (old & mask) != 0;
}


static inline __attribute__((always_inline)) int __test_and_change_bit(int nr,
volatile unsigned long *addr)
{
unsigned long mask = (1UL << ((nr) % 32));
unsigned long *p = ((unsigned long *)addr) + ((nr) / 32);
unsigned long old = *p;

*p = old ^ mask;
return (old & mask) != 0;
}






static inline __attribute__((always_inline)) int test_bit(int nr, const volatile unsigned long *addr)
{
return 1UL & (addr[((nr) / 32)] >> (nr & (32 -1)));
}
# 125 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h" 2
# 154 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h"
extern void _set_bit(int nr, volatile unsigned long * p);
extern void _clear_bit(int nr, volatile unsigned long * p);
extern void _change_bit(int nr, volatile unsigned long * p);
extern int _test_and_set_bit(int nr, volatile unsigned long * p);
extern int _test_and_clear_bit(int nr, volatile unsigned long * p);
extern int _test_and_change_bit(int nr, volatile unsigned long * p);




extern int _find_first_zero_bit_le(const void * p, unsigned size);
extern int _find_next_zero_bit_le(const void * p, int size, int offset);
extern int _find_first_bit_le(const unsigned long *p, unsigned size);
extern int _find_next_bit_le(const unsigned long *p, int size, int offset);




extern int _find_first_zero_bit_be(const void * p, unsigned size);
extern int _find_next_zero_bit_be(const void * p, int size, int offset);
extern int _find_first_bit_be(const unsigned long *p, unsigned size);
extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
# 227 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h"
static inline __attribute__((always_inline)) int constant_fls(int x)
{
int r = 32;

if (!x)
return 0;
if (!(x & 0xffff0000u)) {
x <<= 16;
r -= 16;
}
if (!(x & 0xff000000u)) {
x <<= 8;
r -= 8;
}
if (!(x & 0xf0000000u)) {
x <<= 4;
r -= 4;
}
if (!(x & 0xc0000000u)) {
x <<= 2;
r -= 2;
}
if (!(x & 0x80000000u)) {
x <<= 1;
r -= 1;
}
return r;
}






static inline __attribute__((always_inline)) int fls(int x)
{
int ret;

if (__builtin_constant_p(x))
return constant_fls(x);

asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
ret = 32 - ret;
return ret;
}
# 280 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h"
# 1 "include/asm-generic/bitops/fls64.h" 1
# 18 "include/asm-generic/bitops/fls64.h"
static inline __attribute__((always_inline)) __attribute__((always_inline)) int fls64(__u64 x)
{
__u32 h = x >> 32;
if (h)
return fls(h) + 32;
return fls(x);
}
# 281 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h" 2

# 1 "include/asm-generic/bitops/sched.h" 1
# 12 "include/asm-generic/bitops/sched.h"
static inline __attribute__((always_inline)) int sched_find_first_bit(const unsigned long *b)
{





if (b[0])
return (({ unsigned long __t = (b[0]); fls(__t & -__t); }) - 1);
if (b[1])
return (({ unsigned long __t = (b[1]); fls(__t & -__t); }) - 1) + 32;
if (b[2])
return (({ unsigned long __t = (b[2]); fls(__t & -__t); }) - 1) + 64;
return (({ unsigned long __t = (b[3]); fls(__t & -__t); }) - 1) + 96;



}
# 283 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h" 2
# 1 "include/asm-generic/bitops/hweight.h" 1



# 1 "include/asm-generic/bitops/arch_hweight.h" 1





static inline __attribute__((always_inline)) unsigned int __arch_hweight32(unsigned int w)
{
return __sw_hweight32(w);
}

static inline __attribute__((always_inline)) unsigned int __arch_hweight16(unsigned int w)
{
return __sw_hweight16(w);
}

static inline __attribute__((always_inline)) unsigned int __arch_hweight8(unsigned int w)
{
return __sw_hweight8(w);
}

static inline __attribute__((always_inline)) unsigned long __arch_hweight64(__u64 w)
{
return __sw_hweight64(w);
}
# 5 "include/asm-generic/bitops/hweight.h" 2
# 1 "include/asm-generic/bitops/const_hweight.h" 1
# 6 "include/asm-generic/bitops/hweight.h" 2
# 284 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h" 2
# 1 "include/asm-generic/bitops/lock.h" 1
# 285 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h" 2
# 308 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h"
# 1 "include/asm-generic/bitops/le.h" 1




# 1 "/home/shawn/source/linux/arch/arm/include/asm/byteorder.h" 1
# 21 "/home/shawn/source/linux/arch/arm/include/asm/byteorder.h"
# 1 "include/linux/byteorder/little_endian.h" 1
# 12 "include/linux/byteorder/little_endian.h"
# 1 "include/linux/swab.h" 1





# 1 "/home/shawn/source/linux/arch/arm/include/asm/swab.h" 1
# 47 "/home/shawn/source/linux/arch/arm/include/asm/swab.h"
static inline __attribute__((always_inline)) __attribute__((__const__)) __u32 __arch_swab32(__u32 x)
{
__u32 t;


if (!__builtin_constant_p(x)) {





asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x));
} else

t = x ^ ((x << 16) | (x >> 16));

x = (x << 24) | (x >> 8);
t &= ~0x00FF0000;
x ^= (t >> 8);

return x;
}
# 7 "include/linux/swab.h" 2
# 46 "include/linux/swab.h"
static inline __attribute__((always_inline)) __attribute__((__const__)) __u16 __fswab16(__u16 val)
{



return ((__u16)( (((__u16)(val) & (__u16)0x00ffU) << 8) | (((__u16)(val) & (__u16)0xff00U) >> 8)));

}

static inline __attribute__((always_inline)) __attribute__((__const__)) __u32 __fswab32(__u32 val)
{

return __arch_swab32(val);



}

static inline __attribute__((always_inline)) __attribute__((__const__)) __u64 __fswab64(__u64 val)
{



__u32 h = val >> 32;
__u32 l = val & ((1ULL << 32) - 1);
return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h)));



}

static inline __attribute__((always_inline)) __attribute__((__const__)) __u32 __fswahw32(__u32 val)
{



return ((__u32)( (((__u32)(val) & (__u32)0x0000ffffUL) << 16) | (((__u32)(val) & (__u32)0xffff0000UL) >> 16)));

}

static inline __attribute__((always_inline)) __attribute__((__const__)) __u32 __fswahb32(__u32 val)
{



return ((__u32)( (((__u32)(val) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(val) & (__u32)0xff00ff00UL) >> 8)));

}
# 148 "include/linux/swab.h"
static inline __attribute__((always_inline)) __u16 __swab16p(const __u16 *p)
{



return (__builtin_constant_p((__u16)(*p)) ? ((__u16)( (((__u16)(*p) & (__u16)0x00ffU) << 8) | (((__u16)(*p) & (__u16)0xff00U) >> 8))) : __fswab16(*p));

}





static inline __attribute__((always_inline)) __u32 __swab32p(const __u32 *p)
{



return (__builtin_constant_p((__u32)(*p)) ? ((__u32)( (((__u32)(*p) & (__u32)0x000000ffUL) << 24) | (((__u32)(*p) & (__u32)0x0000ff00UL) << 8) | (((__u32)(*p) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(*p) & (__u32)0xff000000UL) >> 24))) : __fswab32(*p));

}





static inline __attribute__((always_inline)) __u64 __swab64p(const __u64 *p)
{



return (__builtin_constant_p((__u64)(*p)) ? ((__u64)( (((__u64)(*p) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(*p) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(*p) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(*p) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(*p) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(*p) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(*p) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(*p) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(*p));

}







static inline __attribute__((always_inline)) __u32 __swahw32p(const __u32 *p)
{



return (__builtin_constant_p((__u32)(*p)) ? ((__u32)( (((__u32)(*p) & (__u32)0x0000ffffUL) << 16) | (((__u32)(*p) & (__u32)0xffff0000UL) >> 16))) : __fswahw32(*p));

}







static inline __attribute__((always_inline)) __u32 __swahb32p(const __u32 *p)
{



return (__builtin_constant_p((__u32)(*p)) ? ((__u32)( (((__u32)(*p) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(*p) & (__u32)0xff00ff00UL) >> 8))) : __fswahb32(*p));

}





static inline __attribute__((always_inline)) void __swab16s(__u16 *p)
{



*p = __swab16p(p);

}




static inline __attribute__((always_inline)) void __swab32s(__u32 *p)
{



*p = __swab32p(p);

}





static inline __attribute__((always_inline)) void __swab64s(__u64 *p)
{



*p = __swab64p(p);

}







static inline __attribute__((always_inline)) void __swahw32s(__u32 *p)
{



*p = __swahw32p(p);

}







static inline __attribute__((always_inline)) void __swahb32s(__u32 *p)
{



*p = __swahb32p(p);

}
# 13 "include/linux/byteorder/little_endian.h" 2
# 43 "include/linux/byteorder/little_endian.h"
static inline __attribute__((always_inline)) __le64 __cpu_to_le64p(const __u64 *p)
{
return ( __le64)*p;
}
static inline __attribute__((always_inline)) __u64 __le64_to_cpup(const __le64 *p)
{
return ( __u64)*p;
}
static inline __attribute__((always_inline)) __le32 __cpu_to_le32p(const __u32 *p)
{
return ( __le32)*p;
}
static inline __attribute__((always_inline)) __u32 __le32_to_cpup(const __le32 *p)
{
return ( __u32)*p;
}
static inline __attribute__((always_inline)) __le16 __cpu_to_le16p(const __u16 *p)
{
return ( __le16)*p;
}
static inline __attribute__((always_inline)) __u16 __le16_to_cpup(const __le16 *p)
{
return ( __u16)*p;
}
static inline __attribute__((always_inline)) __be64 __cpu_to_be64p(const __u64 *p)
{
return ( __be64)__swab64p(p);
}
static inline __attribute__((always_inline)) __u64 __be64_to_cpup(const __be64 *p)
{
return __swab64p((__u64 *)p);
}
static inline __attribute__((always_inline)) __be32 __cpu_to_be32p(const __u32 *p)
{
return ( __be32)__swab32p(p);
}
static inline __attribute__((always_inline)) __u32 __be32_to_cpup(const __be32 *p)
{
return __swab32p((__u32 *)p);
}
static inline __attribute__((always_inline)) __be16 __cpu_to_be16p(const __u16 *p)
{
return ( __be16)__swab16p(p);
}
static inline __attribute__((always_inline)) __u16 __be16_to_cpup(const __be16 *p)
{
return __swab16p((__u16 *)p);
}
# 105 "include/linux/byteorder/little_endian.h"
# 1 "include/linux/byteorder/generic.h" 1
# 143 "include/linux/byteorder/generic.h"
static inline __attribute__((always_inline)) void le16_add_cpu(__le16 *var, u16 val)
{
*var = (( __le16)(__u16)((( __u16)(__le16)(*var)) + val));
}

static inline __attribute__((always_inline)) void le32_add_cpu(__le32 *var, u32 val)
{
*var = (( __le32)(__u32)((( __u32)(__le32)(*var)) + val));
}

static inline __attribute__((always_inline)) void le64_add_cpu(__le64 *var, u64 val)
{
*var = (( __le64)(__u64)((( __u64)(__le64)(*var)) + val));
}

static inline __attribute__((always_inline)) void be16_add_cpu(__be16 *var, u16 val)
{
*var = (( __be16)(__builtin_constant_p((__u16)(((__builtin_constant_p((__u16)(( __u16)(__be16)(*var))) ? ((__u16)( (((__u16)(( __u16)(__be16)(*var)) & (__u16)0x00ffU) << 8) | (((__u16)(( __u16)(__be16)(*var)) & (__u16)0xff00U) >> 8))) : __fswab16(( __u16)(__be16)(*var))) + val))) ? ((__u16)( (((__u16)(((__builtin_constant_p((__u16)(( __u16)(__be16)(*var))) ? ((__u16)( (((__u16)(( __u16)(__be16)(*var)) & (__u16)0x00ffU) << 8) | (((__u16)(( __u16)(__be16)(*var)) & (__u16)0xff00U) >> 8))) : __fswab16(( __u16)(__be16)(*var))) + val)) & (__u16)0x00ffU) << 8) | (((__u16)(((__builtin_constant_p((__u16)(( __u16)(__be16)(*var))) ? ((__u16)( (((__u16)(( __u16)(__be16)(*var)) & (__u16)0x00ffU) << 8) | (((__u16)(( __u16)(__be16)(*var)) & (__u16)0xff00U) >> 8))) : __fswab16(( __u16)(__be16)(*var))) + val)) & (__u16)0xff00U) >> 8))) : __fswab16(((__builtin_constant_p((__u16)(( __u16)(__be16)(*var))) ? ((__u16)( (((__u16)(( __u16)(__be16)(*var)) & (__u16)0x00ffU) << 8) | (((__u16)(( __u16)(__be16)(*var)) & (__u16)0xff00U) >> 8))) : __fswab16(( __u16)(__be16)(*var))) + val))));
}

static inline __attribute__((always_inline)) void be32_add_cpu(__be32 *var, u32 val)
{
*var = (( __be32)(__builtin_constant_p((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val))) ? ((__u32)( (((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val)) & (__u32)0x000000ffUL) << 24) | (((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val)) & (__u32)0xff000000UL) >> 24))) : __fswab32(((__builtin_constant_p((__u32)(( __u32)(__be32)(*var))) ? ((__u32)( (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x000000ffUL) << 24) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x0000ff00UL) << 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(( __u32)(__be32)(*var)) & (__u32)0xff000000UL) >> 24))) : __fswab32(( __u32)(__be32)(*var))) + val))));
}

static inline __attribute__((always_inline)) void be64_add_cpu(__be64 *var, u64 val)
{
*var = (( __be64)(__builtin_constant_p((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val))) ? ((__u64)( (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(((__builtin_constant_p((__u64)(( __u64)(__be64)(*var))) ? ((__u64)( (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(( __u64)(__be64)(*var)) & (__u64)0xff00000000000000ULL) >> 56))) : __fswab64(( __u64)(__be64)(*var))) + val))));
}
# 106 "include/linux/byteorder/little_endian.h" 2
# 22 "/home/shawn/source/linux/arch/arm/include/asm/byteorder.h" 2
# 6 "include/asm-generic/bitops/le.h" 2





static inline __attribute__((always_inline)) unsigned long find_next_zero_bit_le(const void *addr,
unsigned long size, unsigned long offset)
{
return _find_next_zero_bit_le(addr,size,offset);
}

static inline __attribute__((always_inline)) unsigned long find_next_bit_le(const void *addr,
unsigned long size, unsigned long offset)
{
return _find_next_bit_le(addr,size,offset);
}

static inline __attribute__((always_inline)) unsigned long find_first_zero_bit_le(const void *addr,
unsigned long size)
{
return _find_first_zero_bit_le(addr,size);
}
# 52 "include/asm-generic/bitops/le.h"
static inline __attribute__((always_inline)) int test_bit_le(int nr, const void *addr)
{
return test_bit(nr ^ 0, addr);
}

static inline __attribute__((always_inline)) void __set_bit_le(int nr, void *addr)
{
__set_bit(nr ^ 0, addr);
}

static inline __attribute__((always_inline)) void __clear_bit_le(int nr, void *addr)
{
__clear_bit(nr ^ 0, addr);
}

static inline __attribute__((always_inline)) int test_and_set_bit_le(int nr, void *addr)
{
return (__builtin_constant_p(nr ^ 0) ? ____atomic_test_and_set_bit(nr ^ 0, addr) : _test_and_set_bit(nr ^ 0,addr));
}

static inline __attribute__((always_inline)) int test_and_clear_bit_le(int nr, void *addr)
{
return (__builtin_constant_p(nr ^ 0) ? ____atomic_test_and_clear_bit(nr ^ 0, addr) : _test_and_clear_bit(nr ^ 0,addr));
}

static inline __attribute__((always_inline)) int __test_and_set_bit_le(int nr, void *addr)
{
return __test_and_set_bit(nr ^ 0, addr);
}

static inline __attribute__((always_inline)) int __test_and_clear_bit_le(int nr, void *addr)
{
return __test_and_clear_bit(nr ^ 0, addr);
}
# 309 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h" 2




# 1 "include/asm-generic/bitops/ext2-atomic-setbit.h" 1
# 314 "/home/shawn/source/linux/arch/arm/include/asm/bitops.h" 2
# 23 "include/linux/bitops.h" 2
# 46 "include/linux/bitops.h"
static __inline__ __attribute__((always_inline)) int get_bitmask_order(unsigned int count)
{
int order;

order = fls(count);
return order;
}

static __inline__ __attribute__((always_inline)) int get_count_order(unsigned int count)
{
int order;

order = fls(count) - 1;
if (count & (count - 1))
order++;
return order;
}

static inline __attribute__((always_inline)) unsigned long hweight_long(unsigned long w)
{
return sizeof(w) == 4 ? (__builtin_constant_p(w) ? ((( (!!((w) & (1ULL << 0))) + (!!((w) & (1ULL << 1))) + (!!((w) & (1ULL << 2))) + (!!((w) & (1ULL << 3))) + (!!((w) & (1ULL << 4))) + (!!((w) & (1ULL << 5))) + (!!((w) & (1ULL << 6))) + (!!((w) & (1ULL << 7))) ) + ( (!!(((w) >> 8) & (1ULL << 0))) + (!!(((w) >> 8) & (1ULL << 1))) + (!!(((w) >> 8) & (1ULL << 2))) + (!!(((w) >> 8) & (1ULL << 3))) + (!!(((w) >> 8) & (1ULL << 4))) + (!!(((w) >> 8) & (1ULL << 5))) + (!!(((w) >> 8) & (1ULL << 6))) + (!!(((w) >> 8) & (1ULL << 7))) )) + (( (!!(((w) >> 16) & (1ULL << 0))) + (!!(((w) >> 16) & (1ULL << 1))) + (!!(((w) >> 16) & (1ULL << 2))) + (!!(((w) >> 16) & (1ULL << 3))) + (!!(((w) >> 16) & (1ULL << 4))) + (!!(((w) >> 16) & (1ULL << 5))) + (!!(((w) >> 16) & (1ULL << 6))) + (!!(((w) >> 16) & (1ULL << 7))) ) + ( (!!((((w) >> 16) >> 8) & (1ULL << 0))) + (!!((((w) >> 16) >> 8) & (1ULL << 1))) + (!!((((w) >> 16) >> 8) & (1ULL << 2))) + (!!((((w) >> 16) >> 8) & (1ULL << 3))) + (!!((((w) >> 16) >> 8) & (1ULL << 4))) + (!!((((w) >> 16) >> 8) & (1ULL << 5))) + (!!((((w) >> 16) >> 8) & (1ULL << 6))) + (!!((((w) >> 16) >> 8) & (1ULL << 7))) ))) : __arch_hweight32(w)) : (__builtin_constant_p(w) ? (((( (!!((w) & (1ULL << 0))) + (!!((w) & (1ULL << 1))) + (!!((w) & (1ULL << 2))) + (!!((w) & (1ULL << 3))) + (!!((w) & (1ULL << 4))) + (!!((w) & (1ULL << 5))) + (!!((w) & (1ULL << 6))) + (!!((w) & (1ULL << 7))) ) + ( (!!(((w) >> 8) & (1ULL << 0))) + (!!(((w) >> 8) & (1ULL << 1))) + (!!(((w) >> 8) & (1ULL << 2))) + (!!(((w) >> 8) & (1ULL << 3))) + (!!(((w) >> 8) & (1ULL << 4))) + (!!(((w) >> 8) & (1ULL << 5))) + (!!(((w) >> 8) & (1ULL << 6))) + (!!(((w) >> 8) & (1ULL << 7))) )) + (( (!!(((w) >> 16) & (1ULL << 0))) + (!!(((w) >> 16) & (1ULL << 1))) + (!!(((w) >> 16) & (1ULL << 2))) + (!!(((w) >> 16) & (1ULL << 3))) + (!!(((w) >> 16) & (1ULL << 4))) + (!!(((w) >> 16) & (1ULL << 5))) + (!!(((w) >> 16) & (1ULL << 6))) + (!!(((w) >> 16) & (1ULL << 7))) ) + ( (!!((((w) >> 16) >> 8) & (1ULL << 0))) + (!!((((w) >> 16) >> 8) & (1ULL << 1))) + (!!((((w) >> 16) >> 8) & (1ULL << 2))) + (!!((((w) >> 16) >> 8) & (1ULL << 3))) + (!!((((w) >> 16) >> 8) & (1ULL << 4))) + (!!((((w) >> 16) >> 8) & (1ULL << 5))) + (!!((((w) >> 16) >> 8) & (1ULL << 6))) + (!!((((w) >> 16) >> 8) & (1ULL << 7))) ))) + ((( (!!(((w) >> 32) & (1ULL << 0))) + (!!(((w) >> 32) & (1ULL << 1))) + (!!(((w) >> 32) & (1ULL << 2))) + (!!(((w) >> 32) & (1ULL << 3))) + (!!(((w) >> 32) & (1ULL << 4))) + (!!(((w) >> 32) & (1ULL << 5))) + (!!(((w) >> 32) & (1ULL << 6))) + (!!(((w) >> 32) & (1ULL << 7))) ) + ( (!!((((w) >> 32) >> 8) & (1ULL << 0))) + (!!((((w) >> 32) >> 8) & (1ULL << 1))) + (!!((((w) >> 32) >> 8) & (1ULL << 2))) + (!!((((w) >> 32) >> 8) & (1ULL << 3))) + (!!((((w) >> 32) >> 8) & (1ULL << 4))) + (!!((((w) >> 32) >> 8) & (1ULL << 5))) + (!!((((w) >> 32) >> 8) & (1ULL << 6))) + (!!((((w) >> 32) >> 8) & (1ULL << 7))) )) + (( (!!((((w) >> 32) >> 16) & (1ULL << 0))) + (!!((((w) >> 32) >> 16) & (1ULL << 1))) + (!!((((w) >> 32) >> 16) & (1ULL << 2))) + (!!((((w) >> 32) >> 16) & (1ULL << 3))) + (!!((((w) >> 32) >> 16) & (1ULL << 4))) + (!!((((w) >> 32) >> 16) & (1ULL << 5))) + (!!((((w) >> 32) >> 16) & (1ULL << 6))) + (!!((((w) >> 32) >> 16) & (1ULL << 7))) ) + ( (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 0))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 1))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 2))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 3))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 4))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 5))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 6))) + (!!(((((w) >> 32) >> 16) >> 8) & (1ULL << 7))) )))) : __arch_hweight64(w));
}






static inline __attribute__((always_inline)) __u64 rol64(__u64 word, unsigned int shift)
{
return (word << shift) | (word >> (64 - shift));
}






static inline __attribute__((always_inline)) __u64 ror64(__u64 word, unsigned int shift)
{
return (word >> shift) | (word << (64 - shift));
}






static inline __attribute__((always_inline)) __u32 rol32(__u32 word, unsigned int shift)
{
return (word << shift) | (word >> (32 - shift));
}






static inline __attribute__((always_inline)) __u32 ror32(__u32 word, unsigned int shift)
{
return (word >> shift) | (word << (32 - shift));
}






static inline __attribute__((always_inline)) __u16 rol16(__u16 word, unsigned int shift)
{
return (word << shift) | (word >> (16 - shift));
}






static inline __attribute__((always_inline)) __u16 ror16(__u16 word, unsigned int shift)
{
return (word >> shift) | (word << (16 - shift));
}






static inline __attribute__((always_inline)) __u8 rol8(__u8 word, unsigned int shift)
{
return (word << shift) | (word >> (8 - shift));
}






static inline __attribute__((always_inline)) __u8 ror8(__u8 word, unsigned int shift)
{
return (word >> shift) | (word << (8 - shift));
}






static inline __attribute__((always_inline)) __s32 sign_extend32(__u32 value, int index)
{
__u8 shift = 31 - index;
return (__s32)(value << shift) >> shift;
}

static inline __attribute__((always_inline)) unsigned fls_long(unsigned long l)
{
if (sizeof(l) == 4)
return fls(l);
return fls64(l);
}
# 175 "include/linux/bitops.h"
static inline __attribute__((always_inline)) unsigned long __ffs64(u64 word)
{

if (((u32)word) == 0UL)
return (({ unsigned long __t = ((u32)(word >> 32)); fls(__t & -__t); }) - 1) + 32;



return (({ unsigned long __t = ((unsigned long)word); fls(__t & -__t); }) - 1);
}
# 196 "include/linux/bitops.h"
extern unsigned long find_last_bit(const unsigned long *addr,
unsigned long size);
# 20 "include/linux/kernel.h" 2
# 1 "include/linux/log2.h" 1
# 21 "include/linux/log2.h"
extern __attribute__((const, noreturn))
int ____ilog2_NaN(void);
# 31 "include/linux/log2.h"
static inline __attribute__((always_inline)) __attribute__((const))
int __ilog2_u32(u32 n)
{
return fls(n) - 1;
}



static inline __attribute__((always_inline)) __attribute__((const))
int __ilog2_u64(u64 n)
{
return fls64(n) - 1;
}







static inline __attribute__((always_inline)) __attribute__((const))
bool is_power_of_2(unsigned long n)
{
return (n != 0 && ((n & (n - 1)) == 0));
}




static inline __attribute__((always_inline)) __attribute__((const))
unsigned long __roundup_pow_of_two(unsigned long n)
{
return 1UL << fls_long(n - 1);
}




static inline __attribute__((always_inline)) __attribute__((const))
unsigned long __rounddown_pow_of_two(unsigned long n)
{
return 1UL << (fls_long(n) - 1);
}
# 21 "include/linux/kernel.h" 2

# 1 "include/linux/printk.h" 1



# 1 "include/linux/init.h" 1
# 139 "include/linux/init.h"
typedef int (*initcall_t)(void);
typedef void (*exitcall_t)(void);

extern initcall_t __con_initcall_start[], __con_initcall_end[];
extern initcall_t __security_initcall_start[], __security_initcall_end[];


typedef void (*ctor_fn_t)(void);


extern int do_one_initcall(initcall_t fn);
extern char __attribute__ ((__section__(".init.data"))) boot_command_line[];
extern char *saved_command_line;
extern unsigned int reset_devices;


void setup_arch(char **);
void prepare_namespace(void);

extern void (*late_time_init)(void);

extern bool initcall_debug;
# 226 "include/linux/init.h"
struct obs_kernel_param {
const char *str;
int (*setup_func)(char *);
int early;
};
# 255 "include/linux/init.h"
void __attribute__ ((__section__(".init.text"))) __attribute__((__cold__)) __attribute__((no_instrument_function)) parse_early_param(void);
void __attribute__ ((__section__(".init.text"))) __attribute__((__cold__)) __attribute__((no_instrument_function)) parse_early_options(char *cmdline);
# 5 "include/linux/printk.h" 2

extern const char linux_banner[];
extern const char linux_proc_banner[];
# 27 "include/linux/printk.h"
extern int console_printk[];






static inline __attribute__((always_inline)) void console_silent(void)
{
(console_printk[0]) = 0;
}

static inline __attribute__((always_inline)) void console_verbose(void)
{
if ((console_printk[0]))
(console_printk[0]) = 15;
}

struct va_format {
const char *fmt;
va_list *va;
};
# 85 "include/linux/printk.h"
static inline __attribute__((always_inline)) __attribute__((format(printf, 1, 2)))
int no_printk(const char *fmt, ...)
{
return 0;
}

extern __attribute__((format(printf, 1, 2)))
void early_printk(const char *fmt, ...);

extern int printk_needs_cpu(int cpu);
extern void printk_tick(void);


__attribute__((format(printf, 5, 0)))
int vprintk_emit(int facility, int level,
const char *dict, size_t dictlen,
const char *fmt, va_list args);

__attribute__((format(printf, 1, 0)))
int vprintk(const char *fmt, va_list args);

__attribute__((format(printf, 5, 6))) __attribute__((__cold__))
int printk_emit(int facility, int level,
const char *dict, size_t dictlen,
const char *fmt, ...);

__attribute__((format(printf, 1, 2))) __attribute__((__cold__))
int printk(const char *fmt, ...);




__attribute__((format(printf, 1, 2))) __attribute__((__cold__)) int printk_sched(const char *fmt, ...);






extern int __printk_ratelimit(const char *func);

extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
unsigned int interval_msec);

extern int printk_delay_msec;
extern int dmesg_restrict;
extern int kptr_restrict;

void log_buf_kexec_setup(void);
void __attribute__ ((__section__(".init.text"))) __attribute__((__cold__)) __attribute__((no_instrument_function)) setup_log_buf(int early);
# 170 "include/linux/printk.h"
extern void dump_stack(void) __attribute__((__cold__));
# 303 "include/linux/printk.h"
extern const struct file_operations kmsg_fops;

enum {
DUMP_PREFIX_NONE,
DUMP_PREFIX_ADDRESS,
DUMP_PREFIX_OFFSET
};
extern void hex_dump_to_buffer(const void *buf, size_t len,
int rowsize, int groupsize,
char *linebuf, size_t linebuflen, bool ascii);

extern void print_hex_dump(const char *level, const char *prefix_str,
int prefix_type, int rowsize, int groupsize,
const void *buf, size_t len, bool ascii);
extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
const void *buf, size_t len);
# 23 "include/linux/kernel.h" 2
# 1 "include/linux/dynamic_debug.h" 1
# 9 "include/linux/dynamic_debug.h"
struct _ddebug {




const char *modname;
const char *function;
const char *filename;
const char *format;
unsigned int lineno:18;
# 35 "include/linux/dynamic_debug.h"
unsigned int flags:8;
} __attribute__((aligned(8)));


int ddebug_add_module(struct _ddebug *tab, unsigned int n,
const char *modname);
# 100 "include/linux/dynamic_debug.h"
# 1 "include/linux/string.h" 1
# 101 "include/linux/dynamic_debug.h" 2
# 1 "include/linux/errno.h" 1



# 1 "arch/arm/include/generated/asm/errno.h" 1
# 1 "include/asm-generic/errno.h" 1



# 1 "include/asm-generic/errno-base.h" 1
# 5 "include/asm-generic/errno.h" 2
# 1 "arch/arm/include/generated/asm/errno.h" 2
# 5 "include/linux/errno.h" 2
# 102 "include/linux/dynamic_debug.h" 2

static inline __attribute__((always_inline)) int ddebug_remove_module(const char *mod)
{
return 0;
}

static inline __attribute__((always_inline)) int ddebug_dyndbg_module_param_cb(char *param, char *val,
const char *modname)
{
if (strstr(param, "dyndbg")) {

printk("<4>" "dyndbg param is supported only in "
"CONFIG_DYNAMIC_DEBUG builds\n");
return 0;
}
return -22;
}
# 24 "include/linux/kernel.h" 2
# 108 "include/linux/kernel.h"
# 1 "/home/shawn/source/linux/arch/arm/include/asm/div64.h" 1




# 1 "/home/shawn/source/linux/arch/arm/include/asm/compiler.h" 1
# 6 "/home/shawn/source/linux/arch/arm/include/asm/div64.h" 2
# 63 "/home/shawn/source/linux/arch/arm/include/asm/div64.h"
# 1 "/home/shawn/source/linux/arch/arm/include/asm/bug.h" 1
# 59 "/home/shawn/source/linux/arch/arm/include/asm/bug.h"
# 1 "include/asm-generic/bug.h" 1
# 10 "include/asm-generic/bug.h"
struct bug_entry {

unsigned long bug_addr;





const char *file;



unsigned short line;

unsigned short flags;
};
# 64 "include/asm-generic/bug.h"
extern __attribute__((format(printf, 3, 4)))
void warn_slowpath_fmt(const char *file, const int line,
const char *fmt, ...);
extern __attribute__((format(printf, 4, 5)))
void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint,
const char *fmt, ...);
extern void warn_slowpath_null(const char *file, const int line);
# 60 "/home/shawn/source/linux/arch/arm/include/asm/bug.h" 2

struct pt_regs;
void die(const char *msg, struct pt_regs *regs, int err);

struct siginfo;
void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,
unsigned long err, unsigned long trap);
# 76 "/home/shawn/source/linux/arch/arm/include/asm/bug.h"
void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
struct pt_regs *),
int sig, int code, const char *name);

void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
struct pt_regs *),
int sig, int code, const char *name);

extern void c_backtrace(unsigned long fp, int pmode);

struct mm_struct;
extern void show_pte(struct mm_struct *mm, unsigned long addr);
extern void __show_regs(struct pt_regs *);
# 64 "/home/shawn/source/linux/arch/arm/include/asm/div64.h" 2
# 109 "include/linux/kernel.h" 2
# 137 "include/linux/kernel.h"
struct completion;
struct pt_regs;
struct user;
# 163 "include/linux/kernel.h"
static inline __attribute__((always_inline)) void __might_sleep(const char *file, int line,
int preempt_offset) { }
# 196 "include/linux/kernel.h"
static inline __attribute__((always_inline)) void might_fault(void)
{
do { do { } while (0); } while (0);
}


extern struct atomic_notifier_head panic_notifier_list;
extern long (*panic_blink)(int state);
__attribute__((format(printf, 1, 2)))
void panic(const char *fmt, ...)
__attribute__((noreturn)) __attribute__((__cold__));
extern void oops_enter(void);
extern void oops_exit(void);
void print_oops_end_marker(void);
extern int oops_may_print(void);
void do_exit(long error_code)
__attribute__((noreturn));
void complete_and_exit(struct completion *, long)
__attribute__((noreturn));


int __attribute__((warn_unused_result)) _kstrtoul(const char *s, unsigned int base, unsigned long *res);
int __attribute__((warn_unused_result)) _kstrtol(const char *s, unsigned int base, long *res);

int __attribute__((warn_unused_result)) kstrtoull(const char *s, unsigned int base, unsigned long long *res);
int __attribute__((warn_unused_result)) kstrtoll(const char *s, unsigned int base, long long *res);
static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtoul(const char *s, unsigned int base, unsigned long *res)
{




if (sizeof(unsigned long) == sizeof(unsigned long long) &&
__alignof__(unsigned long) == __alignof__(unsigned long long))
return kstrtoull(s, base, (unsigned long long *)res);
else
return _kstrtoul(s, base, res);
}

static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtol(const char *s, unsigned int base, long *res)
{




if (sizeof(long) == sizeof(long long) &&
__alignof__(long) == __alignof__(long long))
return kstrtoll(s, base, (long long *)res);
else
return _kstrtol(s, base, res);
}

int __attribute__((warn_unused_result)) kstrtouint(const char *s, unsigned int base, unsigned int *res);
int __attribute__((warn_unused_result)) kstrtoint(const char *s, unsigned int base, int *res);

static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtou64(const char *s, unsigned int base, u64 *res)
{
return kstrtoull(s, base, res);
}

static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtos64(const char *s, unsigned int base, s64 *res)
{
return kstrtoll(s, base, res);
}

static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtou32(const char *s, unsigned int base, u32 *res)
{
return kstrtouint(s, base, res);
}

static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtos32(const char *s, unsigned int base, s32 *res)
{
return kstrtoint(s, base, res);
}

int __attribute__((warn_unused_result)) kstrtou16(const char *s, unsigned int base, u16 *res);
int __attribute__((warn_unused_result)) kstrtos16(const char *s, unsigned int base, s16 *res);
int __attribute__((warn_unused_result)) kstrtou8(const char *s, unsigned int base, u8 *res);
int __attribute__((warn_unused_result)) kstrtos8(const char *s, unsigned int base, s8 *res);

int __attribute__((warn_unused_result)) kstrtoull_from_user(const char *s, size_t count, unsigned int base, unsigned long long *res);
int __attribute__((warn_unused_result)) kstrtoll_from_user(const char *s, size_t count, unsigned int base, long long *res);
int __attribute__((warn_unused_result)) kstrtoul_from_user(const char *s, size_t count, unsigned int base, unsigned long *res);
int __attribute__((warn_unused_result)) kstrtol_from_user(const char *s, size_t count, unsigned int base, long *res);
int __attribute__((warn_unused_result)) kstrtouint_from_user(const char *s, size_t count, unsigned int base, unsigned int *res);
int __attribute__((warn_unused_result)) kstrtoint_from_user(const char *s, size_t count, unsigned int base, int *res);
int __attribute__((warn_unused_result)) kstrtou16_from_user(const char *s, size_t count, unsigned int base, u16 *res);
int __attribute__((warn_unused_result)) kstrtos16_from_user(const char *s, size_t count, unsigned int base, s16 *res);
int __attribute__((warn_unused_result)) kstrtou8_from_user(const char *s, size_t count, unsigned int base, u8 *res);
int __attribute__((warn_unused_result)) kstrtos8_from_user(const char *s, size_t count, unsigned int base, s8 *res);

static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtou64_from_user(const char *s, size_t count, unsigned int base, u64 *res)
{
return kstrtoull_from_user(s, count, base, res);
}

static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtos64_from_user(const char *s, size_t count, unsigned int base, s64 *res)
{
return kstrtoll_from_user(s, count, base, res);
}

static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtou32_from_user(const char *s, size_t count, unsigned int base, u32 *res)
{
return kstrtouint_from_user(s, count, base, res);
}

static inline __attribute__((always_inline)) int __attribute__((warn_unused_result)) kstrtos32_from_user(const char *s, size_t count, unsigned int base, s32 *res)
{
return kstrtoint_from_user(s, count, base, res);
}



extern unsigned long simple_strtoul(const char *,char **,unsigned int);
extern long simple_strtol(const char *,char **,unsigned int);
extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
extern long long simple_strtoll(const char *,char **,unsigned int);





extern int num_to_str(char *buf, int size, unsigned long long num);



extern __attribute__((format(printf, 2, 3))) int sprintf(char *buf, const char * fmt, ...);
extern __attribute__((format(printf, 2, 0))) int vsprintf(char *buf, const char *, va_list);
extern __attribute__((format(printf, 3, 4)))
int snprintf(char *buf, size_t size, const char *fmt, ...);
extern __attribute__((format(printf, 3, 0)))
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
extern __attribute__((format(printf, 3, 4)))
int scnprintf(char *buf, size_t size, const char *fmt, ...);
extern __attribute__((format(printf, 3, 0)))
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
extern __attribute__((format(printf, 2, 3)))
char *kasprintf(gfp_t gfp, const char *fmt, ...);
extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);

extern __attribute__((format(scanf, 2, 3)))
int sscanf(const char *, const char *, ...);
extern __attribute__((format(scanf, 2, 0)))
int vsscanf(const char *, const char *, va_list);

extern int get_option(char **str, int *pint);
extern char *get_options(const char *str, int nints, int *ints);
extern unsigned long long memparse(const char *ptr, char **retptr);

extern int core_kernel_text(unsigned long addr);
extern int core_kernel_data(unsigned long addr);
extern int __kernel_text_address(unsigned long addr);
extern int kernel_text_address(unsigned long addr);
extern int func_ptr_is_kernel_text(void *ptr);

struct pid;
extern struct pid *session_of_pgrp(struct pid *pgrp);

unsigned long int_sqrt(unsigned long);

extern void bust_spinlocks(int yes);
extern void wake_up_klogd(void);
extern int oops_in_progress;
extern int panic_timeout;
extern int panic_on_oops;
extern int panic_on_unrecovered_nmi;
extern int panic_on_io_nmi;
extern int sysctl_panic_on_stackoverflow;
extern const char *print_tainted(void);
extern void add_taint(unsigned flag);
extern int test_taint(unsigned flag);
extern unsigned long get_taint(void);
extern int root_mountflags;

extern bool early_boot_irqs_disabled;


extern enum system_states {
SYSTEM_BOOTING,
SYSTEM_RUNNING,
SYSTEM_HALT,
SYSTEM_POWER_OFF,
SYSTEM_RESTART,
SYSTEM_SUSPEND_DISK,
} system_state;
# 396 "include/linux/kernel.h"
extern const char hex_asc[];



static inline __attribute__((always_inline)) char *hex_byte_pack(char *buf, u8 byte)
{
*buf++ = hex_asc[((byte) & 0xf0) >> 4];
*buf++ = hex_asc[((byte) & 0x0f)];
return buf;
}

static inline __attribute__((always_inline)) char * __attribute__((deprecated)) pack_hex_byte(char *buf, u8 byte)
{
return hex_byte_pack(buf, byte);
}

extern int hex_to_bin(char ch);
extern int __attribute__((warn_unused_result)) hex2bin(u8 *dst, const char *src, size_t count);
# 436 "include/linux/kernel.h"
void tracing_off_permanent(void);




enum ftrace_dump_mode {
DUMP_NONE,
DUMP_ALL,
DUMP_ORIG,
};


void tracing_on(void);
void tracing_off(void);
int tracing_is_on(void);

extern void tracing_start(void);
extern void tracing_stop(void);
extern void ftrace_off_permanent(void);

static inline __attribute__((always_inline)) __attribute__((format(printf, 1, 2)))
void ____trace_printk_check_format(const char *fmt, ...)
{
}
# 497 "include/linux/kernel.h"
extern __attribute__((format(printf, 2, 3)))
int __trace_bprintk(unsigned long ip, const char *fmt, ...);

extern __attribute__((format(printf, 2, 3)))
int __trace_printk(unsigned long ip, const char *fmt, ...);

extern void trace_dump_stack(void);
# 522 "include/linux/kernel.h"
extern int
__ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap);

extern int
__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);

extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
# 709 "include/linux/kernel.h"
extern int do_sysinfo(struct sysinfo *info);
# 16 "arch/arm/boot/compressed/../../../../lib/xz/xz_private.h" 2
# 1 "/home/shawn/source/linux/arch/arm/include/asm/unaligned.h" 1



# 1 "include/linux/unaligned/le_byteshift.h" 1





static inline __attribute__((always_inline)) u16 __get_unaligned_le16(const u8 *p)
{
return p[0] | p[1] << 8;
}

static inline __attribute__((always_inline)) u32 __get_unaligned_le32(const u8 *p)
{
return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
}

static inline __attribute__((always_inline)) u64 __get_unaligned_le64(const u8 *p)
{
return (u64)__get_unaligned_le32(p + 4) << 32 |
__get_unaligned_le32(p);
}

static inline __attribute__((always_inline)) void __put_unaligned_le16(u16 val, u8 *p)
{
*p++ = val;
*p++ = val >> 8;
}

static inline __attribute__((always_inline)) void __put_unaligned_le32(u32 val, u8 *p)
{
__put_unaligned_le16(val >> 16, p + 2);
__put_unaligned_le16(val, p);
}

static inline __attribute__((always_inline)) void __put_unaligned_le64(u64 val, u8 *p)
{
__put_unaligned_le32(val >> 32, p + 4);
__put_unaligned_le32(val, p);
}

static inline __attribute__((always_inline)) u16 get_unaligned_le16(const void *p)
{
return __get_unaligned_le16((const u8 *)p);
}

static inline __attribute__((always_inline)) u32 get_unaligned_le32(const void *p)
{
return __get_unaligned_le32((const u8 *)p);
}

static inline __attribute__((always_inline)) u64 get_unaligned_le64(const void *p)
{
return __get_unaligned_le64((const u8 *)p);
}

static inline __attribute__((always_inline)) void put_unaligned_le16(u16 val, void *p)
{
__put_unaligned_le16(val, p);
}

static inline __attribute__((always_inline)) void put_unaligned_le32(u32 val, void *p)
{
__put_unaligned_le32(val, p);
}

static inline __attribute__((always_inline)) void put_unaligned_le64(u64 val, void *p)
{
__put_unaligned_le64(val, p);
}
# 5 "/home/shawn/source/linux/arch/arm/include/asm/unaligned.h" 2
# 1 "include/linux/unaligned/be_byteshift.h" 1





static inline __attribute__((always_inline)) u16 __get_unaligned_be16(const u8 *p)
{
return p[0] << 8 | p[1];
}

static inline __attribute__((always_inline)) u32 __get_unaligned_be32(const u8 *p)
{
return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
}

static inline __attribute__((always_inline)) u64 __get_unaligned_be64(const u8 *p)
{
return (u64)__get_unaligned_be32(p) << 32 |
__get_unaligned_be32(p + 4);
}

static inline __attribute__((always_inline)) void __put_unaligned_be16(u16 val, u8 *p)
{
*p++ = val >> 8;
*p++ = val;
}

static inline __attribute__((always_inline)) void __put_unaligned_be32(u32 val, u8 *p)
{
__put_unaligned_be16(val >> 16, p);
__put_unaligned_be16(val, p + 2);
}

static inline __attribute__((always_inline)) void __put_unaligned_be64(u64 val, u8 *p)
{
__put_unaligned_be32(val >> 32, p);
__put_unaligned_be32(val, p + 4);
}

static inline __attribute__((always_inline)) u16 get_unaligned_be16(const void *p)
{
return __get_unaligned_be16((const u8 *)p);
}

static inline __attribute__((always_inline)) u32 get_unaligned_be32(const void *p)
{
return __get_unaligned_be32((const u8 *)p);
}

static inline __attribute__((always_inline)) u64 get_unaligned_be64(const void *p)
{
return __get_unaligned_be64((const u8 *)p);
}

static inline __attribute__((always_inline)) void put_unaligned_be16(u16 val, void *p)
{
__put_unaligned_be16(val, p);
}

static inline __attribute__((always_inline)) void put_unaligned_be32(u32 val, void *p)
{
__put_unaligned_be32(val, p);
}

static inline __attribute__((always_inline)) void put_unaligned_be64(u64 val, void *p)
{
__put_unaligned_be64(val, p);
}
# 6 "/home/shawn/source/linux/arch/arm/include/asm/unaligned.h" 2
# 1 "include/linux/unaligned/generic.h" 1







extern void __bad_unaligned_access_size(void);
# 7 "/home/shawn/source/linux/arch/arm/include/asm/unaligned.h" 2
# 17 "arch/arm/boot/compressed/../../../../lib/xz/xz_private.h" 2
# 109 "arch/arm/boot/compressed/../../../../lib/xz/xz_private.h"
static struct xz_dec_lzma2 *xz_dec_lzma2_create(enum xz_mode mode,
uint32_t dict_max);







static enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s,
uint8_t props);


static enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
struct xz_buf *b);


static void xz_dec_lzma2_end(struct xz_dec_lzma2 *s);






static struct xz_dec_bcj *xz_dec_bcj_create(bool single_call);







static enum xz_ret xz_dec_bcj_reset(struct xz_dec_bcj *s, uint8_t id);






static enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s,
struct xz_dec_lzma2 *lzma2,
struct xz_buf *b);
# 146 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c" 2
# 177 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c"
static bool memeq(const void *a, const void *b, size_t size)
{
const uint8_t *x = a;
const uint8_t *y = b;
size_t i;

for (i = 0; i < size; ++i)
if (x[i] != y[i])
return false;

return true;
}



static void memzero(void *buf, size_t size)
{
uint8_t *b = buf;
uint8_t *e = b + size;

while (b != e)
*b++ = '\0';
}
# 233 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c"
# 1 "arch/arm/boot/compressed/../../../../lib/xz/xz_crc32.c" 1
# 18 "arch/arm/boot/compressed/../../../../lib/xz/xz_crc32.c"
# 1 "arch/arm/boot/compressed/../../../../lib/xz/xz_private.h" 1
# 19 "arch/arm/boot/compressed/../../../../lib/xz/xz_crc32.c" 2
# 28 "arch/arm/boot/compressed/../../../../lib/xz/xz_crc32.c"
uint32_t xz_crc32_table[256];

static void xz_crc32_init(void)
{
const uint32_t poly = 0xEDB88320;

uint32_t i;
uint32_t j;
uint32_t r;

for (i = 0; i < 256; ++i) {
r = i;
for (j = 0; j < 8; ++j)
r = (r >> 1) ^ (poly & ~((r & 1) - 1));

xz_crc32_table[i] = r;
}

return;
}

static uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
{
crc = ~crc;

while (size != 0) {
crc = xz_crc32_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
--size;
}

return ~crc;
}
# 234 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c" 2
# 1 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c" 1
# 11 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
# 1 "arch/arm/boot/compressed/../../../../lib/xz/xz_stream.h" 1
# 43 "arch/arm/boot/compressed/../../../../lib/xz/xz_stream.h"
typedef uint64_t vli_type;
# 52 "arch/arm/boot/compressed/../../../../lib/xz/xz_stream.h"
enum xz_check {
XZ_CHECK_NONE = 0,
XZ_CHECK_CRC32 = 1,
XZ_CHECK_CRC64 = 4,
XZ_CHECK_SHA256 = 10
};
# 12 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c" 2


struct xz_dec_hash {
vli_type unpadded;
vli_type uncompressed;
uint32_t crc32;
};

struct xz_dec {

enum {
SEQ_STREAM_HEADER,
SEQ_BLOCK_START,
SEQ_BLOCK_HEADER,
SEQ_BLOCK_UNCOMPRESS,
SEQ_BLOCK_PADDING,
SEQ_BLOCK_CHECK,
SEQ_INDEX,
SEQ_INDEX_PADDING,
SEQ_INDEX_CRC32,
SEQ_STREAM_FOOTER
} sequence;


uint32_t pos;


vli_type vli;


size_t in_start;
size_t out_start;


uint32_t crc32;


enum xz_check check_type;


enum xz_mode mode;





bool allow_buf_error;


struct {




vli_type compressed;





vli_type uncompressed;


uint32_t size;
} block_header;


struct {

vli_type compressed;


vli_type uncompressed;


vli_type count;





struct xz_dec_hash hash;
} block;


struct {

enum {
SEQ_INDEX_COUNT,
SEQ_INDEX_UNPADDED,
SEQ_INDEX_UNCOMPRESSED
} sequence;


vli_type size;


vli_type count;





struct xz_dec_hash hash;
} index;
# 125 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
struct {
size_t pos;
size_t size;
uint8_t buf[1024];
} temp;

struct xz_dec_lzma2 *lzma2;


struct xz_dec_bcj *bcj;
bool bcj_active;

};
# 157 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
static bool fill_temp(struct xz_dec *s, struct xz_buf *b)
{
size_t copy_size = ({ size_t __min1 = (b->in_size - b->in_pos); size_t __min2 = (s->temp.size - s->temp.pos); __min1 < __min2 ? __min1: __min2; })
;

memcpy(s->temp.buf + s->temp.pos, b->in + b->in_pos, copy_size);
b->in_pos += copy_size;
s->temp.pos += copy_size;

if (s->temp.pos == s->temp.size) {
s->temp.pos = 0;
return true;
}

return false;
}


static enum xz_ret dec_vli(struct xz_dec *s, const uint8_t *in,
size_t *in_pos, size_t in_size)
{
uint8_t byte;

if (s->pos == 0)
s->vli = 0;

while (*in_pos < in_size) {
byte = in[*in_pos];
++*in_pos;

s->vli |= (vli_type)(byte & 0x7F) << s->pos;

if ((byte & 0x80) == 0) {

if (byte == 0 && s->pos != 0)
return XZ_DATA_ERROR;

s->pos = 0;
return XZ_STREAM_END;
}

s->pos += 7;
if (s->pos == 7 * (sizeof(vli_type) * 8 / 7))
return XZ_DATA_ERROR;
}

return XZ_OK;
}
# 218 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
static enum xz_ret dec_block(struct xz_dec *s, struct xz_buf *b)
{
enum xz_ret ret;

s->in_start = b->in_pos;
s->out_start = b->out_pos;


if (s->bcj_active)
ret = xz_dec_bcj_run(s->bcj, s->lzma2, b);
else

ret = xz_dec_lzma2_run(s->lzma2, b);

s->block.compressed += b->in_pos - s->in_start;
s->block.uncompressed += b->out_pos - s->out_start;





if (s->block.compressed > s->block_header.compressed
|| s->block.uncompressed
> s->block_header.uncompressed)
return XZ_DATA_ERROR;

if (s->check_type == XZ_CHECK_CRC32)
s->crc32 = xz_crc32(b->out + s->out_start,
b->out_pos - s->out_start, s->crc32);

if (ret == XZ_STREAM_END) {
if (s->block_header.compressed != ((vli_type)-1)
&& s->block_header.compressed
!= s->block.compressed)
return XZ_DATA_ERROR;

if (s->block_header.uncompressed != ((vli_type)-1)
&& s->block_header.uncompressed
!= s->block.uncompressed)
return XZ_DATA_ERROR;

s->block.hash.unpadded += s->block_header.size
+ s->block.compressed;




if (s->check_type == XZ_CHECK_CRC32)
s->block.hash.unpadded += 4;


s->block.hash.uncompressed += s->block.uncompressed;
s->block.hash.crc32 = xz_crc32(
(const uint8_t *)&s->block.hash,
sizeof(s->block.hash), s->block.hash.crc32);

++s->block.count;
}

return ret;
}


static void index_update(struct xz_dec *s, const struct xz_buf *b)
{
size_t in_used = b->in_pos - s->in_start;
s->index.size += in_used;
s->crc32 = xz_crc32(b->in + s->in_start, in_used, s->crc32);
}
# 296 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
static enum xz_ret dec_index(struct xz_dec *s, struct xz_buf *b)
{
enum xz_ret ret;

do {
ret = dec_vli(s, b->in, &b->in_pos, b->in_size);
if (ret != XZ_STREAM_END) {
index_update(s, b);
return ret;
}

switch (s->index.sequence) {
case SEQ_INDEX_COUNT:
s->index.count = s->vli;






if (s->index.count != s->block.count)
return XZ_DATA_ERROR;

s->index.sequence = SEQ_INDEX_UNPADDED;
break;

case SEQ_INDEX_UNPADDED:
s->index.hash.unpadded += s->vli;
s->index.sequence = SEQ_INDEX_UNCOMPRESSED;
break;

case SEQ_INDEX_UNCOMPRESSED:
s->index.hash.uncompressed += s->vli;
s->index.hash.crc32 = xz_crc32(
(const uint8_t *)&s->index.hash,
sizeof(s->index.hash),
s->index.hash.crc32);
--s->index.count;
s->index.sequence = SEQ_INDEX_UNPADDED;
break;
}
} while (s->index.count > 0);

return XZ_STREAM_END;
}





static enum xz_ret crc32_validate(struct xz_dec *s, struct xz_buf *b)
{
do {
if (b->in_pos == b->in_size)
return XZ_OK;

if (((s->crc32 >> s->pos) & 0xFF) != b->in[b->in_pos++])
return XZ_DATA_ERROR;

s->pos += 8;

} while (s->pos < 32);

s->crc32 = 0;
s->pos = 0;

return XZ_STREAM_END;
}
# 387 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
static enum xz_ret dec_stream_header(struct xz_dec *s)
{
if (!memeq(s->temp.buf, "\3757zXZ", 6))
return XZ_FORMAT_ERROR;

if (xz_crc32(s->temp.buf + 6, 2, 0)
!= __le32_to_cpup((const uint32_t *)(s->temp.buf + 6 + 2)))
return XZ_DATA_ERROR;

if (s->temp.buf[6] != 0)
return XZ_OPTIONS_ERROR;







s->check_type = s->temp.buf[6 + 1];
# 414 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
if (s->check_type > XZ_CHECK_CRC32)
return XZ_OPTIONS_ERROR;


return XZ_OK;
}


static enum xz_ret dec_stream_footer(struct xz_dec *s)
{
if (!memeq(s->temp.buf + 10, "YZ", 2))
return XZ_DATA_ERROR;

if (xz_crc32(s->temp.buf + 4, 6, 0) != __le32_to_cpup((const uint32_t *)(s->temp.buf)))
return XZ_DATA_ERROR;






if ((s->index.size >> 2) != __le32_to_cpup((const uint32_t *)(s->temp.buf + 4)))
return XZ_DATA_ERROR;

if (s->temp.buf[8] != 0 || s->temp.buf[9] != s->check_type)
return XZ_DATA_ERROR;





return XZ_STREAM_END;
}


static enum xz_ret dec_block_header(struct xz_dec *s)
{
enum xz_ret ret;





s->temp.size -= 4;
if (xz_crc32(s->temp.buf, s->temp.size, 0)
!= __le32_to_cpup((const uint32_t *)(s->temp.buf + s->temp.size)))
return XZ_DATA_ERROR;

s->temp.pos = 2;






if (s->temp.buf[1] & 0x3E)



return XZ_OPTIONS_ERROR;


if (s->temp.buf[1] & 0x40) {
if (dec_vli(s, s->temp.buf, &s->temp.pos, s->temp.size)
!= XZ_STREAM_END)
return XZ_DATA_ERROR;

s->block_header.compressed = s->vli;
} else {
s->block_header.compressed = ((vli_type)-1);
}


if (s->temp.buf[1] & 0x80) {
if (dec_vli(s, s->temp.buf, &s->temp.pos, s->temp.size)
!= XZ_STREAM_END)
return XZ_DATA_ERROR;

s->block_header.uncompressed = s->vli;
} else {
s->block_header.uncompressed = ((vli_type)-1);
}



s->bcj_active = s->temp.buf[1] & 0x01;
if (s->bcj_active) {
if (s->temp.size - s->temp.pos < 2)
return XZ_OPTIONS_ERROR;

ret = xz_dec_bcj_reset(s->bcj, s->temp.buf[s->temp.pos++]);
if (ret != XZ_OK)
return ret;





if (s->temp.buf[s->temp.pos++] != 0x00)
return XZ_OPTIONS_ERROR;
}



if (s->temp.size - s->temp.pos < 2)
return XZ_DATA_ERROR;


if (s->temp.buf[s->temp.pos++] != 0x21)
return XZ_OPTIONS_ERROR;


if (s->temp.buf[s->temp.pos++] != 0x01)
return XZ_OPTIONS_ERROR;


if (s->temp.size - s->temp.pos < 1)
return XZ_DATA_ERROR;

ret = xz_dec_lzma2_reset(s->lzma2, s->temp.buf[s->temp.pos++]);
if (ret != XZ_OK)
return ret;


while (s->temp.pos < s->temp.size)
if (s->temp.buf[s->temp.pos++] != 0x00)
return XZ_OPTIONS_ERROR;

s->temp.pos = 0;
s->block.compressed = 0;
s->block.uncompressed = 0;

return XZ_OK;
}

static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
{
enum xz_ret ret;





s->in_start = b->in_pos;

while (true) {
switch (s->sequence) {
case SEQ_STREAM_HEADER:
# 570 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
if (!fill_temp(s, b))
return XZ_OK;
# 580 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
s->sequence = SEQ_BLOCK_START;

ret = dec_stream_header(s);
if (ret != XZ_OK)
return ret;

case SEQ_BLOCK_START:

if (b->in_pos == b->in_size)
return XZ_OK;


if (b->in[b->in_pos] == 0) {
s->in_start = b->in_pos++;
s->sequence = SEQ_INDEX;
break;
}





s->block_header.size
= ((uint32_t)b->in[b->in_pos] + 1) * 4;

s->temp.size = s->block_header.size;
s->temp.pos = 0;
s->sequence = SEQ_BLOCK_HEADER;

case SEQ_BLOCK_HEADER:
if (!fill_temp(s, b))
return XZ_OK;

ret = dec_block_header(s);
if (ret != XZ_OK)
return ret;

s->sequence = SEQ_BLOCK_UNCOMPRESS;

case SEQ_BLOCK_UNCOMPRESS:
ret = dec_block(s, b);
if (ret != XZ_STREAM_END)
return ret;

s->sequence = SEQ_BLOCK_PADDING;

case SEQ_BLOCK_PADDING:







while (s->block.compressed & 3) {
if (b->in_pos == b->in_size)
return XZ_OK;

if (b->in[b->in_pos++] != 0)
return XZ_DATA_ERROR;

++s->block.compressed;
}

s->sequence = SEQ_BLOCK_CHECK;

case SEQ_BLOCK_CHECK:
if (s->check_type == XZ_CHECK_CRC32) {
ret = crc32_validate(s, b);
if (ret != XZ_STREAM_END)
return ret;
}






s->sequence = SEQ_BLOCK_START;
break;

case SEQ_INDEX:
ret = dec_index(s, b);
if (ret != XZ_STREAM_END)
return ret;

s->sequence = SEQ_INDEX_PADDING;

case SEQ_INDEX_PADDING:
while ((s->index.size + (b->in_pos - s->in_start))
& 3) {
if (b->in_pos == b->in_size) {
index_update(s, b);
return XZ_OK;
}

if (b->in[b->in_pos++] != 0)
return XZ_DATA_ERROR;
}


index_update(s, b);


if (!memeq(&s->block.hash, &s->index.hash,
sizeof(s->block.hash)))
return XZ_DATA_ERROR;

s->sequence = SEQ_INDEX_CRC32;

case SEQ_INDEX_CRC32:
ret = crc32_validate(s, b);
if (ret != XZ_STREAM_END)
return ret;

s->temp.size = 12;
s->sequence = SEQ_STREAM_FOOTER;

case SEQ_STREAM_FOOTER:
if (!fill_temp(s, b))
return XZ_OK;

return dec_stream_footer(s);
}
}


}
# 734 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_stream.c"
static enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b)
{
size_t in_start;
size_t out_start;
enum xz_ret ret;

if (((s->mode) == XZ_SINGLE))
xz_dec_reset(s);

in_start = b->in_pos;
out_start = b->out_pos;
ret = dec_main(s, b);

if (((s->mode) == XZ_SINGLE)) {
if (ret == XZ_OK)
ret = b->in_pos == b->in_size
? XZ_DATA_ERROR : XZ_BUF_ERROR;

if (ret != XZ_STREAM_END) {
b->in_pos = in_start;
b->out_pos = out_start;
}

} else if (ret == XZ_OK && in_start == b->in_pos
&& out_start == b->out_pos) {
if (s->allow_buf_error)
ret = XZ_BUF_ERROR;

s->allow_buf_error = true;
} else {
s->allow_buf_error = false;
}

return ret;
}

static struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max)
{
struct xz_dec *s = malloc(sizeof(*s));
if (s == ((void *)0))
return ((void *)0);

s->mode = mode;


s->bcj = xz_dec_bcj_create(((mode) == XZ_SINGLE));
if (s->bcj == ((void *)0))
goto error_bcj;


s->lzma2 = xz_dec_lzma2_create(mode, dict_max);
if (s->lzma2 == ((void *)0))
goto error_lzma2;

xz_dec_reset(s);
return s;

error_lzma2:

free(s->bcj);
error_bcj:

free(s);
return ((void *)0);
}

static void xz_dec_reset(struct xz_dec *s)
{
s->sequence = SEQ_STREAM_HEADER;
s->allow_buf_error = false;
s->pos = 0;
s->crc32 = 0;
memzero(&s->block, sizeof(s->block));
memzero(&s->index, sizeof(s->index));
s->temp.pos = 0;
s->temp.size = 12;
}

static void xz_dec_end(struct xz_dec *s)
{
if (s != ((void *)0)) {
xz_dec_lzma2_end(s->lzma2);

free(s->bcj);

free(s);
}
}
# 235 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c" 2
# 1 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c" 1
# 12 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c"
# 1 "arch/arm/boot/compressed/../../../../lib/xz/xz_lzma2.h" 1
# 42 "arch/arm/boot/compressed/../../../../lib/xz/xz_lzma2.h"
enum lzma_state {
STATE_LIT_LIT,
STATE_MATCH_LIT_LIT,
STATE_REP_LIT_LIT,
STATE_SHORTREP_LIT_LIT,
STATE_MATCH_LIT,
STATE_REP_LIT,
STATE_SHORTREP_LIT,
STATE_LIT_MATCH,
STATE_LIT_LONGREP,
STATE_LIT_SHORTREP,
STATE_NONLIT_MATCH,
STATE_NONLIT_REP
};
# 64 "arch/arm/boot/compressed/../../../../lib/xz/xz_lzma2.h"
static inline __attribute__((always_inline)) void lzma_state_literal(enum lzma_state *state)
{
if (*state <= STATE_SHORTREP_LIT_LIT)
*state = STATE_LIT_LIT;
else if (*state <= STATE_LIT_SHORTREP)
*state -= 3;
else
*state -= 6;
}


static inline __attribute__((always_inline)) void lzma_state_match(enum lzma_state *state)
{
*state = *state < 7 ? STATE_LIT_MATCH : STATE_NONLIT_MATCH;
}


static inline __attribute__((always_inline)) void lzma_state_long_rep(enum lzma_state *state)
{
*state = *state < 7 ? STATE_LIT_LONGREP : STATE_NONLIT_REP;
}


static inline __attribute__((always_inline)) void lzma_state_short_rep(enum lzma_state *state)
{
*state = *state < 7 ? STATE_LIT_SHORTREP : STATE_NONLIT_REP;
}


static inline __attribute__((always_inline)) bool lzma_state_is_literal(enum lzma_state state)
{
return state < 7;
}
# 147 "arch/arm/boot/compressed/../../../../lib/xz/xz_lzma2.h"
static inline __attribute__((always_inline)) uint32_t lzma_get_dist_state(uint32_t len)
{
return len < 4 + 2
? len - 2 : 4 - 1;
}
# 13 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c" 2
# 44 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c"
struct dictionary {

uint8_t *buf;


size_t start;


size_t pos;





size_t full;


size_t limit;






size_t end;






uint32_t size;





uint32_t size_max;






uint32_t allocated;


enum xz_mode mode;
};


struct rc_dec {
uint32_t range;
uint32_t code;





uint32_t init_bytes_left;





const uint8_t *in;
size_t in_pos;
size_t in_limit;
};


struct lzma_len_dec {

uint16_t choice;


uint16_t choice2;


uint16_t low[(1 << 4)][(1 << 3)];


uint16_t mid[(1 << 4)][(1 << 3)];


uint16_t high[(1 << 8)];
};

struct lzma_dec {

uint32_t rep0;
uint32_t rep1;
uint32_t rep2;
uint32_t rep3;


enum lzma_state state;





uint32_t len;







uint32_t lc;
uint32_t literal_pos_mask;
uint32_t pos_mask;


uint16_t is_match[12][(1 << 4)];


uint16_t is_rep[12];





uint16_t is_rep0[12];





uint16_t is_rep1[12];


uint16_t is_rep2[12];





uint16_t is_rep0_long[12][(1 << 4)];






uint16_t dist_slot[4][(1 << 6)];





uint16_t dist_special[(1 << (14 / 2)) - 14];





uint16_t dist_align[(1 << 4)];


struct lzma_len_dec match_len_dec;


struct lzma_len_dec rep_len_dec;


uint16_t literal[(1 << 4)][0x300];
};

struct lzma2_dec {

enum lzma2_seq {
SEQ_CONTROL,
SEQ_UNCOMPRESSED_1,
SEQ_UNCOMPRESSED_2,
SEQ_COMPRESSED_0,
SEQ_COMPRESSED_1,
SEQ_PROPERTIES,
SEQ_LZMA_PREPARE,
SEQ_LZMA_RUN,
SEQ_COPY
} sequence;


enum lzma2_seq next_sequence;


uint32_t uncompressed;





uint32_t compressed;





bool need_dict_reset;





bool need_props;
};

struct xz_dec_lzma2 {
# 263 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c"
struct rc_dec rc;
struct dictionary dict;
struct lzma2_dec lzma2;
struct lzma_dec lzma;





struct {
uint32_t size;
uint8_t buf[3 * 21];
} temp;
};
# 286 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c"
static void dict_reset(struct dictionary *dict, struct xz_buf *b)
{
if (((dict->mode) == XZ_SINGLE)) {
dict->buf = b->out + b->out_pos;
dict->end = b->out_size - b->out_pos;
}

dict->start = 0;
dict->pos = 0;
dict->limit = 0;
dict->full = 0;
}


static void dict_limit(struct dictionary *dict, size_t out_max)
{
if (dict->end - dict->pos <= out_max)
dict->limit = dict->end;
else
dict->limit = dict->pos + out_max;
}


static inline __attribute__((always_inline)) bool dict_has_space(const struct dictionary *dict)
{
return dict->pos < dict->limit;
}







static inline __attribute__((always_inline)) uint32_t dict_get(const struct dictionary *dict, uint32_t dist)
{
size_t offset = dict->pos - dist - 1;

if (dist >= dict->pos)
offset += dict->end;

return dict->full > 0 ? dict->buf[offset] : 0;
}




static inline __attribute__((always_inline)) void dict_put(struct dictionary *dict, uint8_t byte)
{
dict->buf[dict->pos++] = byte;

if (dict->full < dict->pos)
dict->full = dict->pos;
}






static bool dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist)
{
size_t back;
uint32_t left;

if (dist >= dict->full || dist >= dict->size)
return false;

left = ({ size_t __min1 = (dict->limit - dict->pos); size_t __min2 = (*len); __min1 < __min2 ? __min1: __min2; });
*len -= left;

back = dict->pos - dist - 1;
if (dist >= dict->pos)
back += dict->end;

do {
dict->buf[dict->pos++] = dict->buf[back++];
if (back == dict->end)
back = 0;
} while (--left > 0);

if (dict->full < dict->pos)
dict->full = dict->pos;

return true;
}


static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
uint32_t *left)
{
size_t copy_size;

while (*left > 0 && b->in_pos < b->in_size
&& b->out_pos < b->out_size) {
copy_size = ({ typeof(b->in_size - b->in_pos) _min1 = (b->in_size - b->in_pos); typeof(b->out_size - b->out_pos) _min2 = (b->out_size - b->out_pos); (void) (&_min1 == &_min2); _min1 < _min2 ? _min1 : _min2; })
;
if (copy_size > dict->end - dict->pos)
copy_size = dict->end - dict->pos;
if (copy_size > *left)
copy_size = *left;

*left -= copy_size;

memcpy(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
dict->pos += copy_size;

if (dict->full < dict->pos)
dict->full = dict->pos;

if (((dict->mode) != XZ_SINGLE)) {
if (dict->pos == dict->end)
dict->pos = 0;

memcpy(b->out + b->out_pos, b->in + b->in_pos,
copy_size);
}

dict->start = dict->pos;

b->out_pos += copy_size;
b->in_pos += copy_size;
}
}






static uint32_t dict_flush(struct dictionary *dict, struct xz_buf *b)
{
size_t copy_size = dict->pos - dict->start;

if (((dict->mode) != XZ_SINGLE)) {
if (dict->pos == dict->end)
dict->pos = 0;

memcpy(b->out + b->out_pos, dict->buf + dict->start,
copy_size);
}

dict->start = dict->pos;
b->out_pos += copy_size;
return copy_size;
}






static void rc_reset(struct rc_dec *rc)
{
rc->range = (uint32_t)-1;
rc->code = 0;
rc->init_bytes_left = 5;
}





static bool rc_read_init(struct rc_dec *rc, struct xz_buf *b)
{
while (rc->init_bytes_left > 0) {
if (b->in_pos == b->in_size)
return false;

rc->code = (rc->code << 8) + b->in[b->in_pos++];
--rc->init_bytes_left;
}

return true;
}


static inline __attribute__((always_inline)) bool rc_limit_exceeded(const struct rc_dec *rc)
{
return rc->in_pos > rc->in_limit;
}





static inline __attribute__((always_inline)) bool rc_is_finished(const struct rc_dec *rc)
{
return rc->code == 0;
}


static inline __attribute__((always_inline)) __attribute__((always_inline)) void rc_normalize(struct rc_dec *rc)
{
if (rc->range < (1 << 24)) {
rc->range <<= 8;
rc->code = (rc->code << 8) + rc->in[rc->in_pos++];
}
}
# 497 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c"
static inline __attribute__((always_inline)) __attribute__((always_inline)) int rc_bit(struct rc_dec *rc, uint16_t *prob)
{
uint32_t bound;
int bit;

rc_normalize(rc);
bound = (rc->range >> 11) * *prob;
if (rc->code < bound) {
rc->range = bound;
*prob += ((1 << 11) - *prob) >> 5;
bit = 0;
} else {
rc->range -= bound;
rc->code -= bound;
*prob -= *prob >> 5;
bit = 1;
}

return bit;
}


static inline __attribute__((always_inline)) __attribute__((always_inline)) uint32_t rc_bittree(struct rc_dec *rc,
uint16_t *probs, uint32_t limit)
{
uint32_t symbol = 1;

do {
if (rc_bit(rc, &probs[symbol]))
symbol = (symbol << 1) + 1;
else
symbol <<= 1;
} while (symbol < limit);

return symbol;
}


static inline __attribute__((always_inline)) __attribute__((always_inline)) void rc_bittree_reverse(struct rc_dec *rc,
uint16_t *probs,
uint32_t *dest, uint32_t limit)
{
uint32_t symbol = 1;
uint32_t i = 0;

do {
if (rc_bit(rc, &probs[symbol])) {
symbol = (symbol << 1) + 1;
*dest += 1 << i;
} else {
symbol <<= 1;
}
} while (++i < limit);
}


static inline __attribute__((always_inline)) void rc_direct(struct rc_dec *rc, uint32_t *dest, uint32_t limit)
{
uint32_t mask;

do {
rc_normalize(rc);
rc->range >>= 1;
rc->code -= rc->range;
mask = (uint32_t)0 - (rc->code >> 31);
rc->code += rc->range & mask;
*dest = (*dest << 1) + (mask + 1);
} while (--limit > 0);
}






static uint16_t *lzma_literal_probs(struct xz_dec_lzma2 *s)
{
uint32_t prev_byte = dict_get(&s->dict, 0);
uint32_t low = prev_byte >> (8 - s->lzma.lc);
uint32_t high = (s->dict.pos & s->lzma.literal_pos_mask) << s->lzma.lc;
return s->lzma.literal[low + high];
}


static void lzma_literal(struct xz_dec_lzma2 *s)
{
uint16_t *probs;
uint32_t symbol;
uint32_t match_byte;
uint32_t match_bit;
uint32_t offset;
uint32_t i;

probs = lzma_literal_probs(s);

if (lzma_state_is_literal(s->lzma.state)) {
symbol = rc_bittree(&s->rc, probs, 0x100);
} else {
symbol = 1;
match_byte = dict_get(&s->dict, s->lzma.rep0) << 1;
offset = 0x100;

do {
match_bit = match_byte & offset;
match_byte <<= 1;
i = offset + match_bit + symbol;

if (rc_bit(&s->rc, &probs[i])) {
symbol = (symbol << 1) + 1;
offset &= match_bit;
} else {
symbol <<= 1;
offset &= ~match_bit;
}
} while (symbol < 0x100);
}

dict_put(&s->dict, (uint8_t)symbol);
lzma_state_literal(&s->lzma.state);
}


static void lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
uint32_t pos_state)
{
uint16_t *probs;
uint32_t limit;

if (!rc_bit(&s->rc, &l->choice)) {
probs = l->low[pos_state];
limit = (1 << 3);
s->lzma.len = 2;
} else {
if (!rc_bit(&s->rc, &l->choice2)) {
probs = l->mid[pos_state];
limit = (1 << 3);
s->lzma.len = 2 + (1 << 3);
} else {
probs = l->high;
limit = (1 << 8);
s->lzma.len = 2 + (1 << 3)
+ (1 << 3);
}
}

s->lzma.len += rc_bittree(&s->rc, probs, limit) - limit;
}


static void lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
{
uint16_t *probs;
uint32_t dist_slot;
uint32_t limit;

lzma_state_match(&s->lzma.state);

s->lzma.rep3 = s->lzma.rep2;
s->lzma.rep2 = s->lzma.rep1;
s->lzma.rep1 = s->lzma.rep0;

lzma_len(s, &s->lzma.match_len_dec, pos_state);

probs = s->lzma.dist_slot[lzma_get_dist_state(s->lzma.len)];
dist_slot = rc_bittree(&s->rc, probs, (1 << 6)) - (1 << 6);

if (dist_slot < 4) {
s->lzma.rep0 = dist_slot;
} else {
limit = (dist_slot >> 1) - 1;
s->lzma.rep0 = 2 + (dist_slot & 1);

if (dist_slot < 14) {
s->lzma.rep0 <<= limit;
probs = s->lzma.dist_special + s->lzma.rep0
- dist_slot - 1;
rc_bittree_reverse(&s->rc, probs,
&s->lzma.rep0, limit);
} else {
rc_direct(&s->rc, &s->lzma.rep0, limit - 4);
s->lzma.rep0 <<= 4;
rc_bittree_reverse(&s->rc, s->lzma.dist_align,
&s->lzma.rep0, 4);
}
}
}





static void lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
{
uint32_t tmp;

if (!rc_bit(&s->rc, &s->lzma.is_rep0[s->lzma.state])) {
if (!rc_bit(&s->rc, &s->lzma.is_rep0_long[
s->lzma.state][pos_state])) {
lzma_state_short_rep(&s->lzma.state);
s->lzma.len = 1;
return;
}
} else {
if (!rc_bit(&s->rc, &s->lzma.is_rep1[s->lzma.state])) {
tmp = s->lzma.rep1;
} else {
if (!rc_bit(&s->rc, &s->lzma.is_rep2[s->lzma.state])) {
tmp = s->lzma.rep2;
} else {
tmp = s->lzma.rep3;
s->lzma.rep3 = s->lzma.rep2;
}

s->lzma.rep2 = s->lzma.rep1;
}

s->lzma.rep1 = s->lzma.rep0;
s->lzma.rep0 = tmp;
}

lzma_state_long_rep(&s->lzma.state);
lzma_len(s, &s->lzma.rep_len_dec, pos_state);
}


static bool lzma_main(struct xz_dec_lzma2 *s)
{
uint32_t pos_state;





if (dict_has_space(&s->dict) && s->lzma.len > 0)
dict_repeat(&s->dict, &s->lzma.len, s->lzma.rep0);





while (dict_has_space(&s->dict) && !rc_limit_exceeded(&s->rc)) {
pos_state = s->dict.pos & s->lzma.pos_mask;

if (!rc_bit(&s->rc, &s->lzma.is_match[
s->lzma.state][pos_state])) {
lzma_literal(s);
} else {
if (rc_bit(&s->rc, &s->lzma.is_rep[s->lzma.state]))
lzma_rep_match(s, pos_state);
else
lzma_match(s, pos_state);

if (!dict_repeat(&s->dict, &s->lzma.len, s->lzma.rep0))
return false;
}
}





rc_normalize(&s->rc);

return true;
}





static void lzma_reset(struct xz_dec_lzma2 *s)
{
uint16_t *probs;
size_t i;

s->lzma.state = STATE_LIT_LIT;
s->lzma.rep0 = 0;
s->lzma.rep1 = 0;
s->lzma.rep2 = 0;
s->lzma.rep3 = 0;
# 787 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c"
probs = s->lzma.is_match[0];
for (i = 0; i < (1846 + (1 << 4) * 0x300); ++i)
probs[i] = (1 << 11) / 2;

rc_reset(&s->rc);
}






static bool lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
{
if (props > (4 * 5 + 4) * 9 + 8)
return false;

s->lzma.pos_mask = 0;
while (props >= 9 * 5) {
props -= 9 * 5;
++s->lzma.pos_mask;
}

s->lzma.pos_mask = (1 << s->lzma.pos_mask) - 1;

s->lzma.literal_pos_mask = 0;
while (props >= 9) {
props -= 9;
++s->lzma.literal_pos_mask;
}

s->lzma.lc = props;

if (s->lzma.lc + s->lzma.literal_pos_mask > 4)
return false;

s->lzma.literal_pos_mask = (1 << s->lzma.literal_pos_mask) - 1;

lzma_reset(s);

return true;
}
# 846 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c"
static bool lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
{
size_t in_avail;
uint32_t tmp;

in_avail = b->in_size - b->in_pos;
if (s->temp.size > 0 || s->lzma2.compressed == 0) {
tmp = 2 * 21 - s->temp.size;
if (tmp > s->lzma2.compressed - s->temp.size)
tmp = s->lzma2.compressed - s->temp.size;
if (tmp > in_avail)
tmp = in_avail;

memcpy(s->temp.buf + s->temp.size, b->in + b->in_pos, tmp);

if (s->temp.size + tmp == s->lzma2.compressed) {
memzero(s->temp.buf + s->temp.size + tmp,
sizeof(s->temp.buf)
- s->temp.size - tmp);
s->rc.in_limit = s->temp.size + tmp;
} else if (s->temp.size + tmp < 21) {
s->temp.size += tmp;
b->in_pos += tmp;
return true;
} else {
s->rc.in_limit = s->temp.size + tmp - 21;
}

s->rc.in = s->temp.buf;
s->rc.in_pos = 0;

if (!lzma_main(s) || s->rc.in_pos > s->temp.size + tmp)
return false;

s->lzma2.compressed -= s->rc.in_pos;

if (s->rc.in_pos < s->temp.size) {
s->temp.size -= s->rc.in_pos;
memmove(s->temp.buf, s->temp.buf + s->rc.in_pos,
s->temp.size);
return true;
}

b->in_pos += s->rc.in_pos - s->temp.size;
s->temp.size = 0;
}

in_avail = b->in_size - b->in_pos;
if (in_avail >= 21) {
s->rc.in = b->in;
s->rc.in_pos = b->in_pos;

if (in_avail >= s->lzma2.compressed + 21)
s->rc.in_limit = b->in_pos + s->lzma2.compressed;
else
s->rc.in_limit = b->in_size - 21;

if (!lzma_main(s))
return false;

in_avail = s->rc.in_pos - b->in_pos;
if (in_avail > s->lzma2.compressed)
return false;

s->lzma2.compressed -= in_avail;
b->in_pos = s->rc.in_pos;
}

in_avail = b->in_size - b->in_pos;
if (in_avail < 21) {
if (in_avail > s->lzma2.compressed)
in_avail = s->lzma2.compressed;

memcpy(s->temp.buf, b->in + b->in_pos, in_avail);
s->temp.size = in_avail;
b->in_pos += in_avail;
}

return true;
}





static enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
struct xz_buf *b)
{
uint32_t tmp;

while (b->in_pos < b->in_size || s->lzma2.sequence == SEQ_LZMA_RUN) {
switch (s->lzma2.sequence) {
case SEQ_CONTROL:
# 970 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c"
tmp = b->in[b->in_pos++];

if (tmp == 0x00)
return XZ_STREAM_END;

if (tmp >= 0xE0 || tmp == 0x01) {
s->lzma2.need_props = true;
s->lzma2.need_dict_reset = false;
dict_reset(&s->dict, b);
} else if (s->lzma2.need_dict_reset) {
return XZ_DATA_ERROR;
}

if (tmp >= 0x80) {
s->lzma2.uncompressed = (tmp & 0x1F) << 16;
s->lzma2.sequence = SEQ_UNCOMPRESSED_1;

if (tmp >= 0xC0) {





s->lzma2.need_props = false;
s->lzma2.next_sequence
= SEQ_PROPERTIES;

} else if (s->lzma2.need_props) {
return XZ_DATA_ERROR;

} else {
s->lzma2.next_sequence
= SEQ_LZMA_PREPARE;
if (tmp >= 0xA0)
lzma_reset(s);
}
} else {
if (tmp > 0x02)
return XZ_DATA_ERROR;

s->lzma2.sequence = SEQ_COMPRESSED_0;
s->lzma2.next_sequence = SEQ_COPY;
}

break;

case SEQ_UNCOMPRESSED_1:
s->lzma2.uncompressed
+= (uint32_t)b->in[b->in_pos++] << 8;
s->lzma2.sequence = SEQ_UNCOMPRESSED_2;
break;

case SEQ_UNCOMPRESSED_2:
s->lzma2.uncompressed
+= (uint32_t)b->in[b->in_pos++] + 1;
s->lzma2.sequence = SEQ_COMPRESSED_0;
break;

case SEQ_COMPRESSED_0:
s->lzma2.compressed
= (uint32_t)b->in[b->in_pos++] << 8;
s->lzma2.sequence = SEQ_COMPRESSED_1;
break;

case SEQ_COMPRESSED_1:
s->lzma2.compressed
+= (uint32_t)b->in[b->in_pos++] + 1;
s->lzma2.sequence = s->lzma2.next_sequence;
break;

case SEQ_PROPERTIES:
if (!lzma_props(s, b->in[b->in_pos++]))
return XZ_DATA_ERROR;

s->lzma2.sequence = SEQ_LZMA_PREPARE;

case SEQ_LZMA_PREPARE:
if (s->lzma2.compressed < 5)
return XZ_DATA_ERROR;

if (!rc_read_init(&s->rc, b))
return XZ_OK;

s->lzma2.compressed -= 5;
s->lzma2.sequence = SEQ_LZMA_RUN;

case SEQ_LZMA_RUN:
# 1066 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_lzma2.c"
dict_limit(&s->dict, ({ size_t __min1 = (b->out_size - b->out_pos); size_t __min2 = (s->lzma2.uncompressed); __min1 < __min2 ? __min1: __min2; })

);
if (!lzma2_lzma(s, b))
return XZ_DATA_ERROR;

s->lzma2.uncompressed -= dict_flush(&s->dict, b);

if (s->lzma2.uncompressed == 0) {
if (s->lzma2.compressed > 0 || s->lzma.len > 0
|| !rc_is_finished(&s->rc))
return XZ_DATA_ERROR;

rc_reset(&s->rc);
s->lzma2.sequence = SEQ_CONTROL;

} else if (b->out_pos == b->out_size
|| (b->in_pos == b->in_size
&& s->temp.size
< s->lzma2.compressed)) {
return XZ_OK;
}

break;

case SEQ_COPY:
dict_uncompressed(&s->dict, b, &s->lzma2.compressed);
if (s->lzma2.compressed > 0)
return XZ_OK;

s->lzma2.sequence = SEQ_CONTROL;
break;
}
}

return XZ_OK;
}

static struct xz_dec_lzma2 *xz_dec_lzma2_create(enum xz_mode mode,
uint32_t dict_max)
{
struct xz_dec_lzma2 *s = malloc(sizeof(*s));
if (s == ((void *)0))
return ((void *)0);

s->dict.mode = mode;
s->dict.size_max = dict_max;

if (((mode) == XZ_PREALLOC)) {
s->dict.buf = malloc(dict_max);
if (s->dict.buf == ((void *)0)) {
free(s);
return ((void *)0);
}
} else if (((mode) == XZ_DYNALLOC)) {
s->dict.buf = ((void *)0);
s->dict.allocated = 0;
}

return s;
}

static enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
{

if (props > 39)
return XZ_OPTIONS_ERROR;

s->dict.size = 2 + (props & 1);
s->dict.size <<= (props >> 1) + 11;

if (((s->dict.mode) != XZ_SINGLE)) {
if (s->dict.size > s->dict.size_max)
return XZ_MEMLIMIT_ERROR;

s->dict.end = s->dict.size;

if (((s->dict.mode) == XZ_DYNALLOC)) {
if (s->dict.allocated < s->dict.size) {
do { if (s->dict.buf != ((void *)0)) free(s->dict.buf); } while (0);
s->dict.buf = malloc(s->dict.size);
if (s->dict.buf == ((void *)0)) {
s->dict.allocated = 0;
return XZ_MEM_ERROR;
}
}
}
}

s->lzma.len = 0;

s->lzma2.sequence = SEQ_CONTROL;
s->lzma2.need_dict_reset = true;

s->temp.size = 0;

return XZ_OK;
}

static void xz_dec_lzma2_end(struct xz_dec_lzma2 *s)
{
if (((s->dict.mode) != XZ_SINGLE))
do { if (s->dict.buf != ((void *)0)) free(s->dict.buf); } while (0);

free(s);
}
# 236 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c" 2
# 1 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c" 1
# 19 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c"
struct xz_dec_bcj {

enum {
BCJ_X86 = 4,
BCJ_POWERPC = 5,
BCJ_IA64 = 6,
BCJ_ARM = 7,
BCJ_ARMTHUMB = 8,
BCJ_SPARC = 9
} type;






enum xz_ret ret;


bool single_call;






uint32_t pos;


uint32_t x86_prev_mask;


uint8_t *out;
size_t out_pos;
size_t out_size;

struct {

size_t filtered;


size_t size;
# 74 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c"
uint8_t buf[16];
} temp;
};
# 265 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c"
static size_t bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
{
size_t i;
uint32_t addr;

for (i = 0; i + 4 <= size; i += 4) {
if (buf[i + 3] == 0xEB) {
addr = (uint32_t)buf[i] | ((uint32_t)buf[i + 1] << 8)
| ((uint32_t)buf[i + 2] << 16);
addr <<= 2;
addr -= s->pos + (uint32_t)i + 8;
addr >>= 2;
buf[i] = (uint8_t)addr;
buf[i + 1] = (uint8_t)(addr >> 8);
buf[i + 2] = (uint8_t)(addr >> 16);
}
}

return i;
}
# 345 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c"
static void bcj_apply(struct xz_dec_bcj *s,
uint8_t *buf, size_t *pos, size_t size)
{
size_t filtered;

buf += *pos;
size -= *pos;

switch (s->type) {
# 370 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c"
case BCJ_ARM:
filtered = bcj_arm(s, buf, size);
break;
# 384 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c"
default:

filtered = 0;
break;
}

*pos += filtered;
s->pos += filtered;
}






static void bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b)
{
size_t copy_size;

copy_size = ({ size_t __min1 = (s->temp.filtered); size_t __min2 = (b->out_size - b->out_pos); __min1 < __min2 ? __min1: __min2; });
memcpy(b->out + b->out_pos, s->temp.buf, copy_size);
b->out_pos += copy_size;

s->temp.filtered -= copy_size;
s->temp.size -= copy_size;
memmove(s->temp.buf, s->temp.buf + copy_size, s->temp.size);
}






static enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s,
struct xz_dec_lzma2 *lzma2,
struct xz_buf *b)
{
size_t out_start;






if (s->temp.filtered > 0) {
bcj_flush(s, b);
if (s->temp.filtered > 0)
return XZ_OK;

if (s->ret == XZ_STREAM_END)
return XZ_STREAM_END;
}
# 449 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c"
if (s->temp.size < b->out_size - b->out_pos || s->temp.size == 0) {
out_start = b->out_pos;
memcpy(b->out + b->out_pos, s->temp.buf, s->temp.size);
b->out_pos += s->temp.size;

s->ret = xz_dec_lzma2_run(lzma2, b);
if (s->ret != XZ_STREAM_END
&& (s->ret != XZ_OK || s->single_call))
return s->ret;

bcj_apply(s, b->out, &out_start, b->out_pos);






if (s->ret == XZ_STREAM_END)
return XZ_STREAM_END;

s->temp.size = b->out_pos - out_start;
b->out_pos -= s->temp.size;
memcpy(s->temp.buf, b->out + b->out_pos, s->temp.size);






if (b->out_pos + s->temp.size < b->out_size)
return XZ_OK;
}
# 490 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c"
if (b->out_pos < b->out_size) {

s->out = b->out;
s->out_pos = b->out_pos;
s->out_size = b->out_size;
b->out = s->temp.buf;
b->out_pos = s->temp.size;
b->out_size = sizeof(s->temp.buf);

s->ret = xz_dec_lzma2_run(lzma2, b);

s->temp.size = b->out_pos;
b->out = s->out;
b->out_pos = s->out_pos;
b->out_size = s->out_size;

if (s->ret != XZ_OK && s->ret != XZ_STREAM_END)
return s->ret;

bcj_apply(s, s->temp.buf, &s->temp.filtered, s->temp.size);






if (s->ret == XZ_STREAM_END)
s->temp.filtered = s->temp.size;

bcj_flush(s, b);
if (s->temp.filtered > 0)
return XZ_OK;
}

return s->ret;
}

static struct xz_dec_bcj *xz_dec_bcj_create(bool single_call)
{
struct xz_dec_bcj *s = malloc(sizeof(*s));
if (s != ((void *)0))
s->single_call = single_call;

return s;
}

static enum xz_ret xz_dec_bcj_reset(struct xz_dec_bcj *s, uint8_t id)
{
switch (id) {
# 549 "arch/arm/boot/compressed/../../../../lib/xz/xz_dec_bcj.c"
case BCJ_ARM:







break;

default:

return XZ_OPTIONS_ERROR;
}

s->type = id;
s->ret = XZ_OK;
s->pos = 0;
s->x86_prev_mask = 0;
s->temp.filtered = 0;
s->temp.size = 0;

return XZ_OK;
}
# 237 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c" 2
# 251 "arch/arm/boot/compressed/../../../../lib/decompress_unxz.c"
static int unxz(unsigned char *in, int in_size,
int (*fill)(void *dest, unsigned int size),
int (*flush)(void *src, unsigned int size),
unsigned char *out, int *in_used,
void (*error)(char *x))
{
struct xz_buf b;
struct xz_dec *s;
enum xz_ret ret;
bool must_free_in = false;


xz_crc32_init();


if (in_used != ((void *)0))
*in_used = 0;

if (fill == ((void *)0) && flush == ((void *)0))
s = xz_dec_init(XZ_SINGLE, 0);
else
s = xz_dec_init(XZ_DYNALLOC, (uint32_t)-1);

if (s == ((void *)0))
goto error_alloc_state;

if (flush == ((void *)0)) {
b.out = out;
b.out_size = (size_t)-1;
} else {
b.out_size = 4096;
b.out = malloc(4096);
if (b.out == ((void *)0))
goto error_alloc_out;
}

if (in == ((void *)0)) {
must_free_in = true;
in = malloc(4096);
if (in == ((void *)0))
goto error_alloc_in;
}

b.in = in;
b.in_pos = 0;
b.in_size = in_size;
b.out_pos = 0;

if (fill == ((void *)0) && flush == ((void *)0)) {
ret = xz_dec_run(s, &b);
} else {
do {
if (b.in_pos == b.in_size && fill != ((void *)0)) {
if (in_used != ((void *)0))
*in_used += b.in_pos;

b.in_pos = 0;

in_size = fill(in, 4096);
if (in_size < 0) {





ret = XZ_BUF_ERROR;
break;
}

b.in_size = in_size;
}

ret = xz_dec_run(s, &b);

if (flush != ((void *)0) && (b.out_pos == b.out_size
|| (ret != XZ_OK && b.out_pos > 0))) {





if (flush(b.out, b.out_pos) != (int)b.out_pos)
ret = XZ_BUF_ERROR;

b.out_pos = 0;
}
} while (ret == XZ_OK);

if (must_free_in)
free(in);

if (flush != ((void *)0))
free(b.out);
}

if (in_used != ((void *)0))
*in_used += b.in_pos;

xz_dec_end(s);

switch (ret) {
case XZ_STREAM_END:
return 0;

case XZ_MEM_ERROR:

error("XZ decompressor ran out of memory");
break;

case XZ_FORMAT_ERROR:
error("Input is not in the XZ format (wrong magic bytes)");
break;

case XZ_OPTIONS_ERROR:
error("Input was encoded with settings that are not "
"supported by this XZ decoder");
break;

case XZ_DATA_ERROR:
case XZ_BUF_ERROR:
error("XZ-compressed data is corrupt");
break;

default:
error("Bug in the XZ decompressor");
break;
}

return -1;

error_alloc_in:
if (flush != ((void *)0))
free(b.out);

error_alloc_out:
xz_dec_end(s);

error_alloc_state:
error("XZ decompressor ran out of memory");
return -1;
}
# 51 "arch/arm/boot/compressed/decompress.c" 2


int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
{
return unxz(input, len, ((void *)0), ((void *)0), output, ((void *)0), error);
}