diff --git a/libc/Android.mk b/libc/Android.mk old mode 100644 new mode 100755 index 9610c1400..86e54d742 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -45,9 +45,10 @@ libc_common_src_files := \ stdio/wbuf.c \ stdlib/atexit.c \ stdlib/ctype_.c \ - stdlib/exit.c \ + stdlib/_Exit.c \ stdlib/getenv.c \ stdlib/putenv.c \ + stdlib/quick_exit.c \ stdlib/setenv.c \ stdlib/strtod.c \ stdlib/strtoimax.c \ @@ -342,6 +343,7 @@ libc_upstream_netbsd_src_files := \ upstream-netbsd/libc/stdlib/div.c \ upstream-netbsd/libc/stdlib/drand48.c \ upstream-netbsd/libc/stdlib/erand48.c \ + upstream-netbsd/libc/stdlib/exit.c \ upstream-netbsd/libc/stdlib/jrand48.c \ upstream-netbsd/libc/stdlib/ldiv.c \ upstream-netbsd/libc/stdlib/lldiv.c \ @@ -358,24 +360,18 @@ libc_upstream_netbsd_src_files := \ upstream-netbsd/libc/string/strcasestr.c \ upstream-netbsd/libc/string/strcoll.c \ upstream-netbsd/libc/string/strxfrm.c \ + upstream-netbsd/libc/thread-stub/__isthreaded.c \ upstream-netbsd/libc/unistd/killpg.c \ # Architecture specific source files go here # ========================================================= ifeq ($(TARGET_ARCH),arm) libc_common_src_files += \ - bionic/memmove.c.arm \ - string/bcopy.c \ - string/strncmp.c \ - string/strncat.c \ string/strncpy.c \ bionic/strchr.cpp \ string/strrchr.c \ - bionic/memchr.c \ bionic/memrchr.c \ string/index.c \ - bionic/strnlen.c \ - string/strlcat.c \ string/strlcpy.c \ upstream-freebsd/lib/libc/string/wcschr.c \ upstream-freebsd/lib/libc/string/wcsrchr.c \ @@ -413,6 +409,8 @@ libc_static_common_src_files += \ bionic/pthread_create.cpp \ bionic/pthread_key.cpp \ +libc_common_src_files += \ + bionic/memchr.c endif # x86 ifeq ($(TARGET_ARCH),mips) @@ -529,6 +527,10 @@ ifeq ($(TARGET_ARCH),x86) endif endif # x86 +ifeq ($(ARCH_ARM_HAVE_ARMV7A),true) + libc_common_cflags += -DNEON_UNALIGNED_ACCESS -DNEON_MEMCPY_ALIGNMENT_DIVIDER=224 +endif + ifeq ($(TARGET_ARCH),mips) ifneq ($(ARCH_MIPS_HAS_FPU),true) libc_common_cflags += -DSOFTFLOAT diff --git a/libc/arch-arm/arm.mk b/libc/arch-arm/arm.mk index e87ef3803..532058dce 100644 --- a/libc/arch-arm/arm.mk +++ b/libc/arch-arm/arm.mk @@ -14,6 +14,10 @@ _LIBC_ARCH_COMMON_SRC_FILES := \ arch-arm/bionic/_setjmp.S \ arch-arm/bionic/setjmp.S \ arch-arm/bionic/sigsetjmp.S \ + arch-arm/bionic/strlcat.S \ + arch-arm/bionic/strncmp.S \ + arch-arm/bionic/strncat.S \ + arch-arm/bionic/strnlen.S \ arch-arm/bionic/syscall.S \ arch-arm/bionic/tgkill.S \ arch-arm/bionic/tkill.S \ @@ -21,10 +25,11 @@ _LIBC_ARCH_COMMON_SRC_FILES := \ # These are used by the static and dynamic versions of the libc # respectively. _LIBC_ARCH_STATIC_SRC_FILES := \ - arch-arm/bionic/exidx_static.c + arch-arm/bionic/exidx_static.c \ + bionic/dl_iterate_phdr_static.c \ _LIBC_ARCH_DYNAMIC_SRC_FILES := \ - arch-arm/bionic/exidx_dynamic.c + arch-arm/bionic/exidx_dynamic.c \ # Remove the C++ fortify function implementations for which there is an # arm assembler version. @@ -38,7 +43,7 @@ libc_common_src_files := \ $(filter-out $(_LIBC_FORTIFY_FILES_TO_REMOVE),$(libc_common_src_files)) ifeq ($(strip $(wildcard bionic/libc/arch-arm/$(TARGET_CPU_VARIANT)/$(TARGET_CPU_VARIANT).mk)),) -$(error "TARGET_CPU_VARIANT not set or set to an unknown value. Possible values are cortex-a7, cortex-a8, cortex-a9, cortex-a15, krait. Use generic for devices that do not have a CPU similar to any of the supported cpu variants.") +$(error "TARGET_CPU_VARIANT not set or set to an unknown value. Possible values are cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a15, krait, scorpion. Use generic for devices that do not have a CPU similar to any of the supported cpu variants.") endif include bionic/libc/arch-arm/$(TARGET_CPU_VARIANT)/$(TARGET_CPU_VARIANT).mk diff --git a/libc/arch-arm/bionic/memcmp16.S b/libc/arch-arm/bionic/memcmp16.S index 99c9b8842..823944131 100644 --- a/libc/arch-arm/bionic/memcmp16.S +++ b/libc/arch-arm/bionic/memcmp16.S @@ -32,15 +32,15 @@ /* * Optimized memcmp16() for ARM9. * This would not be optimal on XScale or ARM11, where more prefetching - * and use of PLD will be needed. + * and use of pld will be needed. * The 2 major optimzations here are * (1) The main loop compares 16 bytes at a time * (2) The loads are scheduled in a way they won't stall */ ENTRY(__memcmp16) - PLD (r0, #0) - PLD (r1, #0) + pld [r0, #0] + pld [r1, #0] /* take of the case where length is nul or the buffers are the same */ cmp r0, r1 @@ -62,13 +62,13 @@ ENTRY(__memcmp16) bpl 0f /* small blocks (less then 12 words) */ - PLD (r0, #32) - PLD (r1, #32) + pld [r0, #32] + pld [r1, #32] 1: ldrh r0, [r3], #2 ldrh ip, [r1], #2 subs r0, r0, ip - bxne lr + bxne lr subs r2, r2, #1 bne 1b bx lr @@ -81,7 +81,7 @@ ENTRY(__memcmp16) /* align first pointer to word boundary */ tst r3, #2 beq 0f - + ldrh r0, [r3], #2 ldrh ip, [r1], #2 sub r2, r2, #1 @@ -109,10 +109,10 @@ ENTRY(__memcmp16) ldr ip, [r1] subs r2, r2, #(16 + 2) bmi 1f - + 0: - PLD (r3, #64) - PLD (r1, #64) + pld [r3, #64] + pld [r1, #64] ldr r0, [r3], #4 ldr lr, [r1, #4]! eors r0, r0, ip @@ -137,14 +137,14 @@ ENTRY(__memcmp16) ldreq r0, [r3], #4 ldreq ip, [r1, #4]! eoreqs r0, r0, lr - bne 2f + bne 2f subs r2, r2, #16 bhs 0b /* do we have at least 2 words left? */ 1: adds r2, r2, #(16 - 2 + 2) bmi 4f - + /* finish off 2 words at a time */ 3: ldr r0, [r3], #4 ldr ip, [r1], #4 @@ -193,8 +193,8 @@ ENTRY(__memcmp16) sub r2, r2, #8 6: - PLD (r3, #64) - PLD (r1, #64) + pld [r3, #64] + pld [r1, #64] mov ip, lr, lsr #16 ldr lr, [r1], #4 ldr r0, [r3], #4 diff --git a/libc/arch-arm/bionic/memcpy.S b/libc/arch-arm/bionic/memcpy.S index 0dc86d54a..f25b3e356 100644 --- a/libc/arch-arm/bionic/memcpy.S +++ b/libc/arch-arm/bionic/memcpy.S @@ -352,9 +352,9 @@ ENTRY(memcpy) // preload the destination because we'll align it to a cache line // with small writes. Also start the source "pump". - PLD (r0, #0) - PLD (r1, #0) - PLD (r1, #32) + pld [r0, #0] + pld [r1, #0] + pld [r1, #32] /* it simplifies things to take care of len<4 early */ cmp r2, #4 @@ -442,7 +442,7 @@ cached_aligned32: add r12, r12, #64 1: ldmia r1!, { r4-r11 } - PLD (r12, #64) + pld [r12, #64] subs r2, r2, #32 // NOTE: if r12 is more than 64 ahead of r1, the following ldrhi @@ -563,7 +563,7 @@ loop16: ldr r12, [r1], #4 1: mov r4, r12 ldmia r1!, { r5,r6,r7, r8,r9,r10,r11} - PLD (r1, #64) + pld [r1, #64] subs r2, r2, #32 ldrhs r12, [r1], #4 orr r3, r3, r4, lsl #16 @@ -590,7 +590,7 @@ loop8: ldr r12, [r1], #4 1: mov r4, r12 ldmia r1!, { r5,r6,r7, r8,r9,r10,r11} - PLD (r1, #64) + pld [r1, #64] subs r2, r2, #32 ldrhs r12, [r1], #4 orr r3, r3, r4, lsl #24 @@ -617,7 +617,7 @@ loop24: ldr r12, [r1], #4 1: mov r4, r12 ldmia r1!, { r5,r6,r7, r8,r9,r10,r11} - PLD (r1, #64) + pld [r1, #64] subs r2, r2, #32 ldrhs r12, [r1], #4 orr r3, r3, r4, lsl #8 diff --git a/libc/arch-arm/bionic/strcmp.S b/libc/arch-arm/bionic/strcmp.S index 764a531e2..42d41d143 100644 --- a/libc/arch-arm/bionic/strcmp.S +++ b/libc/arch-arm/bionic/strcmp.S @@ -52,8 +52,8 @@ #define magic2(REG) REG, lsl #7 ENTRY(strcmp) - PLD(r0, #0) - PLD(r1, #0) + pld [r0, #0] + pld [r1, #0] eor r2, r0, r1 tst r2, #3 @@ -88,8 +88,8 @@ ENTRY(strcmp) orr r4, r4, r4, lsl #16 .p2align 2 4: - PLD(r0, #8) - PLD(r1, #8) + pld [r0, #8] + pld [r1, #8] sub r2, ip, magic1(r4) cmp ip, r3 itttt eq diff --git a/libc/arch-arm/bionic/strlcat.S b/libc/arch-arm/bionic/strlcat.S new file mode 100644 index 000000000..f326bbff6 --- /dev/null +++ b/libc/arch-arm/bionic/strlcat.S @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas of 3am Software Foundry. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +/* LINTSTUB: size_t strlcat(char *, const char *, size_t) */ +ENTRY(strlcat) + adds r3, r2, r0 /* point to just end of dst */ + mov ip, r0 /* need to keep r0 for a while */ +1: cmp ip, r3 /* still within dst? */ + beq 3f /* no, get length of src */ + ldrb r2, [ip], #1 /* load next byte */ + cmp r2, #0 /* was it a NUL? */ + bne 1b /* no, get next byte */ + + sub r0, ip, r0 /* get actual length of dst */ + subs r0, r0, #1 /* account for the trailing NUL */ + subs r3, r3, #1 /* back up to last byte in dst */ + sub ip, ip, #1 /* back up over the NUL */ + +2: ldrb r2, [r1], #1 /* load next byte from append */ +#if defined(__thumb__) && defined(_ARM_ARCH_T2) + cbz r2, 5f /* was it a NUL? yes, end of append */ +#else + cmp r2, #0 /* was it a NUL? */ + beq 5f /* yes, end of append */ +#endif + adds r0, r0, #1 /* count another byte */ + cmp ip, r3 /* do we have enough room for it? */ + bge 2b + strb r2, [ip], #1 /* yes, store it */ + b 2b /* get next byte from append */ + +3: subs r0, r3, r0 /* move size to return value */ +4: ldrb r2, [r1], #1 /* load next byte from append */ +#if defined(__thumb__) && defined(_ARM_ARCH_T2) + cbz r2, 6f /* was it a NUL? yes, we're done */ +#else + RETc(eq) /* yes, we're done */ +#endif + adds r0, r0, #1 /* add one to return value */ + b 4b /* get next byte from append */ + +5: movs r2, #0 /* NUL */ + strb r2, [ip] /* append final NUL */ +6: RET /* return */ +END(strlcat) diff --git a/libc/arch-arm/bionic/strncat.S b/libc/arch-arm/bionic/strncat.S new file mode 100644 index 000000000..fdda4546a --- /dev/null +++ b/libc/arch-arm/bionic/strncat.S @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas of 3am Software Foundry. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +/* LINTSTUB: char *strncat(char *, const char *, size_t) */ +ENTRY(strncat) + teq r2, #0 /* count is 0? */ + RETc(eq) /* yes, just return dst */ + mov ip, r0 /* need to preserve r0 */ +1: ldrb r3, [ip], #1 /* load next byte */ + teq r3, #0 /* was it a NUL? */ + bne 1b /* no, get next byte */ + sub ip, ip, #1 /* back up one to the NUL */ +2: subs r2, r2, #1 /* subtract 1 from the count */ + blt 3f /* <0? write terminating NUL */ + ldrb r3, [r1], #1 /* load next byte from append */ + strb r3, [ip], #1 /* store it */ + teq r3, #0 /* was it a NUL? */ + bne 2b /* no, get next byte */ + RET /* return */ +3: mov r3, #0 /* load a NUL */ + strb r3, [ip] /* store it */ + RET /* return */ +END(strncat) diff --git a/libc/arch-arm/bionic/strncmp.S b/libc/arch-arm/bionic/strncmp.S new file mode 100644 index 000000000..2cc4d013b --- /dev/null +++ b/libc/arch-arm/bionic/strncmp.S @@ -0,0 +1,75 @@ +/* $NetBSD: strncmp.S,v 1.2 2013/08/19 00:57:25 matt Exp $ */ + +/* + * Copyright (c) 2002 ARM Ltd + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the company may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +ENTRY(strncmp) +/* if ((len - 1) < 0) return 0 */ + subs r2, r2, #1 +#ifdef __thumb__ + bmi 5f +#else + movmi r0, #0 + RETc(mi) +#endif + +/* ip == last src address to compare */ +#ifdef __thumb__ + adds r3, r0, r2 + mov ip, r3 + subs r1, r1, r0 +#else + add ip, r0, r2 +#endif +1: +#ifdef __thumb__ + ldrb r2, [r0] + ldrb r3, [r1, r0] + adds r0, r0, #1 + cmp ip, r0 /* exhausted length? */ + bcc 4f /* yes, we're done */ + cmp r2, #1 /* NUL? */ + bcc 4f /* yes, we're done */ + cmp r2, r3 /* different? */ +#else + ldrb r2, [r0], #1 + ldrb r3, [r1], #1 + cmp ip, r0 + cmpcs r2, #1 + cmpcs r2, r3 +#endif + beq 1b +4: subs r0, r2, r3 + RET +#ifdef __thumb__ +5: movs r0, #0 + RET +#endif +END(strncmp) diff --git a/libc/arch-arm/bionic/strnlen.S b/libc/arch-arm/bionic/strnlen.S new file mode 100644 index 000000000..b0993bfd5 --- /dev/null +++ b/libc/arch-arm/bionic/strnlen.S @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas of 3am Software Foundry. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include + +/* LINTSTUB: size_t strnlen(const char *, size_t) */ +ENTRY(strnlen) + adds r3, r0, #1 /* start of src + NUL */ +#ifdef __thumb__ + adds r2, r0, r1 /* &src[maxlen] */ + mov ip, r2 +#else + adds ip, r0, r1 /* &src[maxlen] */ +#endif +1: cmp r0, ip /* is this of string? */ + beq 2f /* yes it is */ +#ifdef __thumb__ + ldrb r2, [r0] /* read a byte */ + adds r0, r0, #1 /* advance to next byte */ +#else + ldrb r2, [r0], #1 /* read a byte */ +#endif + cmp r2, #0 /* is it a NUL? */ + bne 1b /* no, get next byte */ + subs r0, r0, r3 /* get difference between start and end */ + RET /* return */ +2: mov r0, r1 /* get maxlen */ + RET /* return */ +END(strnlen) diff --git a/libc/arch-arm/cortex-a15/bionic/memchr.S b/libc/arch-arm/cortex-a15/bionic/memchr.S new file mode 100644 index 000000000..918bc69e2 --- /dev/null +++ b/libc/arch-arm/cortex-a15/bionic/memchr.S @@ -0,0 +1,153 @@ +/* Copyright (c) 2010-2011, Linaro Limited + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Linaro Limited nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + Written by Dave Gilbert + Adapted to work inside Bionic by Bernhard Rosenkränzer + + This memchr routine is optimised on a Cortex-A9 and should work on + all ARMv7 processors. It has a fast past for short sizes, and has + an optimised path for large data sets; the worst case is finding the + match early in a large data set. + + */ + +// Prototype: void *memchr(const void *s, int c, size_t n); + +#include +#include "private/libc_events.h" + + .syntax unified + .arch armv7-a + +@ this lets us check a flag in a 00/ff byte easily in either endianness +#ifdef __ARMEB__ +#define CHARTSTMASK(c) 1<<(31-(c*8)) +#else +#define CHARTSTMASK(c) 1<<(c*8) +#endif + .text + .thumb + +@ --------------------------------------------------------------------------- +ENTRY(memchr) + .thumb_func + .align 2 + .p2align 4,,15 + @ r0 = start of memory to scan + @ r1 = character to look for + @ r2 = length + @ returns r0 = pointer to character or NULL if not found + and r1,r1,#0xff @ Don't think we can trust the caller to actually pass a char + + cmp r2,#16 @ If it's short don't bother with anything clever + blt 20f + + tst r0, #7 @ If it's already aligned skip the next bit + beq 10f + + @ Work up to an aligned point +5: + ldrb r3, [r0],#1 + subs r2, r2, #1 + cmp r3, r1 + beq 50f @ If it matches exit found + tst r0, #7 + bne 5b @ If not aligned yet then do next byte + +10: + @ At this point, we are aligned, we know we have at least 8 bytes to work with + push {r4,r5,r6,r7} + orr r1, r1, r1, lsl #8 @ expand the match word across to all bytes + orr r1, r1, r1, lsl #16 + bic r4, r2, #7 @ Number of double words to work with + mvns r7, #0 @ all F's + movs r3, #0 + +15: + ldmia r0!,{r5,r6} + subs r4, r4, #8 + eor r5,r5, r1 @ Get it so that r5,r6 have 00's where the bytes match the target + eor r6,r6, r1 + uadd8 r5, r5, r7 @ Parallel add 0xff - sets the GE bits for anything that wasn't 0 + sel r5, r3, r7 @ bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION + uadd8 r6, r6, r7 @ Parallel add 0xff - sets the GE bits for anything that wasn't 0 + sel r6, r5, r7 @ chained....bytes are 00 for none-00 bytes, or ff for 00 bytes - NOTE INVERSION + cbnz r6, 60f + bne 15b @ (Flags from the subs above) If not run out of bytes then go around again + + pop {r4,r5,r6,r7} + and r1,r1,#0xff @ Get r1 back to a single character from the expansion above + and r2,r2,#7 @ Leave the count remaining as the number after the double words have been done + +20: + cbz r2, 40f @ 0 length or hit the end already then not found + +21: @ Post aligned section, or just a short call + ldrb r3,[r0],#1 + subs r2,r2,#1 + eor r3,r3,r1 @ r3 = 0 if match - doesn't break flags from sub + cbz r3, 50f + bne 21b @ on r2 flags + +40: + movs r0,#0 @ not found + bx lr + +50: + subs r0,r0,#1 @ found + bx lr + +60: @ We're here because the fast path found a hit - now we have to track down exactly which word it was + @ r0 points to the start of the double word after the one that was tested + @ r5 has the 00/ff pattern for the first word, r6 has the chained value + cmp r5, #0 + itte eq + moveq r5, r6 @ the end is in the 2nd word + subeq r0,r0,#3 @ Points to 2nd byte of 2nd word + subne r0,r0,#7 @ or 2nd byte of 1st word + + @ r0 currently points to the 3rd byte of the word containing the hit + tst r5, # CHARTSTMASK(0) @ 1st character + bne 61f + adds r0,r0,#1 + tst r5, # CHARTSTMASK(1) @ 2nd character + ittt eq + addeq r0,r0,#1 + tsteq r5, # (3<<15) @ 2nd & 3rd character + @ If not the 3rd must be the last one + addeq r0,r0,#1 + +61: + pop {r4,r5,r6,r7} + subs r0,r0,#1 + bx lr +END(memchr) diff --git a/libc/arch-arm/cortex-a15/bionic/strlen.S b/libc/arch-arm/cortex-a15/bionic/strlen.S index 08f6d193b..75f23745b 100644 --- a/libc/arch-arm/cortex-a15/bionic/strlen.S +++ b/libc/arch-arm/cortex-a15/bionic/strlen.S @@ -1,165 +1,146 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. +/* Copyright (c) 2010-2011,2013 Linaro Limited + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Linaro Limited nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + /* - * Copyright (c) 2013 ARM Ltd - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the company may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Assumes: + ARMv6T2, AArch32 + + Adapted to Bionic by Bernhard Rosenkränzer */ #include - .syntax unified - - .thumb - .thumb_func +#ifdef __ARMEB__ +#define S2LO lsl +#define S2HI lsr +#else +#define S2LO lsr +#define S2HI lsl +#endif + + .text + /* This code requires Thumb. */ + .thumb + .syntax unified + +/* Parameters and result. */ +#define srcin r0 +#define result r0 + +/* Internal variables. */ +#define src r1 +#define data1a r2 +#define data1b r3 +#define const_m1 r12 +#define const_0 r4 +#define tmp1 r4 /* Overlaps const_0 */ +#define tmp2 r5 ENTRY(strlen) - pld [r0, #0] - mov r1, r0 - - ands r3, r0, #7 - beq mainloop - - // Align to a double word (64 bits). - rsb r3, r3, #8 - lsls ip, r3, #31 - beq align_to_32 - - ldrb r2, [r1], #1 - cbz r2, update_count_and_return - -align_to_32: - bcc align_to_64 - ands ip, r3, #2 - beq align_to_64 - - ldrb r2, [r1], #1 - cbz r2, update_count_and_return - ldrb r2, [r1], #1 - cbz r2, update_count_and_return - -align_to_64: - tst r3, #4 - beq mainloop - ldr r3, [r1], #4 - - sub ip, r3, #0x01010101 - bic ip, ip, r3 - ands ip, ip, #0x80808080 - bne zero_in_second_register - - .p2align 2 -mainloop: - ldrd r2, r3, [r1], #8 - - pld [r1, #64] - - sub ip, r2, #0x01010101 - bic ip, ip, r2 - ands ip, ip, #0x80808080 - bne zero_in_first_register - - sub ip, r3, #0x01010101 - bic ip, ip, r3 - ands ip, ip, #0x80808080 - bne zero_in_second_register - b mainloop - -update_count_and_return: - sub r0, r1, r0 - sub r0, r0, #1 - bx lr - -zero_in_first_register: - sub r0, r1, r0 - lsls r3, ip, #17 - bne sub8_and_return - bcs sub7_and_return - lsls ip, ip, #1 - bne sub6_and_return - - sub r0, r0, #5 - bx lr - -sub8_and_return: - sub r0, r0, #8 - bx lr - -sub7_and_return: - sub r0, r0, #7 - bx lr - -sub6_and_return: - sub r0, r0, #6 - bx lr - -zero_in_second_register: - sub r0, r1, r0 - lsls r3, ip, #17 - bne sub4_and_return - bcs sub3_and_return - lsls ip, ip, #1 - bne sub2_and_return - - sub r0, r0, #1 - bx lr - -sub4_and_return: - sub r0, r0, #4 - bx lr - -sub3_and_return: - sub r0, r0, #3 - bx lr - -sub2_and_return: - sub r0, r0, #2 - bx lr + .p2align 6 + pld [srcin, #0] + strd r4, r5, [sp, #-8]! + bic src, srcin, #7 + mvn const_m1, #0 + ands tmp1, srcin, #7 /* (8 - bytes) to alignment. */ + pld [src, #32] + bne.w misaligned8 + mov const_0, #0 + mov result, #-8 +loop_aligned: + /* Bytes 0-7. */ + ldrd data1a, data1b, [src] + pld [src, #64] + add result, result, #8 +start_realigned: + uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */ + sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */ + uadd8 data1b, data1b, const_m1 + sel data1b, data1a, const_m1 /* Only used if d1a == 0. */ + cbnz data1b, null_found + + /* Bytes 8-15. */ + ldrd data1a, data1b, [src, #8] + uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */ + add result, result, #8 + sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */ + uadd8 data1b, data1b, const_m1 + sel data1b, data1a, const_m1 /* Only used if d1a == 0. */ + cbnz data1b, null_found + + /* Bytes 16-23. */ + ldrd data1a, data1b, [src, #16] + uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */ + add result, result, #8 + sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */ + uadd8 data1b, data1b, const_m1 + sel data1b, data1a, const_m1 /* Only used if d1a == 0. */ + cbnz data1b, null_found + + /* Bytes 24-31. */ + ldrd data1a, data1b, [src, #24] + add src, src, #32 + uadd8 data1a, data1a, const_m1 /* Saturating GE<0:3> set. */ + add result, result, #8 + sel data1a, const_0, const_m1 /* Select based on GE<0:3>. */ + uadd8 data1b, data1b, const_m1 + sel data1b, data1a, const_m1 /* Only used if d1a == 0. */ + cmp data1b, #0 + beq loop_aligned + +null_found: + cmp data1a, #0 + itt eq + addeq result, result, #4 + moveq data1a, data1b +#ifndef __ARMEB__ + rev data1a, data1a +#endif + clz data1a, data1a + ldrd r4, r5, [sp], #8 + add result, result, data1a, lsr #3 /* Bits -> Bytes. */ + bx lr + +misaligned8: + ldrd data1a, data1b, [src] + and tmp2, tmp1, #3 + rsb result, tmp1, #0 + lsl tmp2, tmp2, #3 /* Bytes -> bits. */ + tst tmp1, #4 + pld [src, #64] + S2HI tmp2, const_m1, tmp2 + orn data1a, data1a, tmp2 + itt ne + ornne data1b, data1b, tmp2 + movne data1a, const_m1 + mov const_0, #0 + b start_realigned END(strlen) diff --git a/libc/arch-arm/cortex-a15/cortex-a15.mk b/libc/arch-arm/cortex-a15/cortex-a15.mk index c62e7e72a..bc45cccd0 100644 --- a/libc/arch-arm/cortex-a15/cortex-a15.mk +++ b/libc/arch-arm/cortex-a15/cortex-a15.mk @@ -1,10 +1,13 @@ $(call libc-add-cpu-variant-src,MEMCPY,arch-arm/cortex-a15/bionic/memcpy.S) $(call libc-add-cpu-variant-src,MEMSET,arch-arm/cortex-a15/bionic/memset.S) +$(call libc-add-cpu-variant-src,MEMMOVE,arch-arm/krait/bionic/memmove.S) +$(call libc-add-cpu-variant-src,BCOPY,) $(call libc-add-cpu-variant-src,STRCAT,arch-arm/cortex-a15/bionic/strcat.S) $(call libc-add-cpu-variant-src,STRCMP,arch-arm/cortex-a15/bionic/strcmp.S) $(call libc-add-cpu-variant-src,STRCPY,arch-arm/cortex-a15/bionic/strcpy.S) $(call libc-add-cpu-variant-src,STRLEN,arch-arm/cortex-a15/bionic/strlen.S) $(call libc-add-cpu-variant-src,__STRCAT_CHK,arch-arm/cortex-a15/bionic/__strcat_chk.S) $(call libc-add-cpu-variant-src,__STRCPY_CHK,arch-arm/cortex-a15/bionic/__strcpy_chk.S) +$(call libc-add-cpu-variant-src,MEMCHR,arch-arm/cortex-a15/bionic/memchr.S) include bionic/libc/arch-arm/generic/generic.mk diff --git a/libc/arch-arm/cortex-a5/cortex-a5.mk b/libc/arch-arm/cortex-a5/cortex-a5.mk new file mode 100644 index 000000000..944db2caa --- /dev/null +++ b/libc/arch-arm/cortex-a5/cortex-a5.mk @@ -0,0 +1 @@ +include bionic/libc/arch-arm/cortex-a9/cortex-a9.mk diff --git a/libc/arch-arm/generic/bionic/memcpy.S b/libc/arch-arm/generic/bionic/memcpy.S index 24373d815..f08817b5c 100644 --- a/libc/arch-arm/generic/bionic/memcpy.S +++ b/libc/arch-arm/generic/bionic/memcpy.S @@ -57,9 +57,9 @@ ENTRY(memcpy) // preload the destination because we'll align it to a cache line // with small writes. Also start the source "pump". - PLD (r0, #0) - PLD (r1, #0) - PLD (r1, #32) + pld [r0, #0] + pld [r1, #0] + pld [r1, #32] /* it simplifies things to take care of len<4 early */ cmp r2, #4 @@ -147,7 +147,7 @@ cached_aligned32: add r12, r12, #64 1: ldmia r1!, { r4-r11 } - PLD (r12, #64) + pld [r12, #64] subs r2, r2, #32 // NOTE: if r12 is more than 64 ahead of r1, the following ldrhi @@ -268,7 +268,7 @@ loop16: ldr r12, [r1], #4 1: mov r4, r12 ldmia r1!, { r5,r6,r7, r8,r9,r10,r11} - PLD (r1, #64) + pld [r1, #64] subs r2, r2, #32 ldrhs r12, [r1], #4 orr r3, r3, r4, lsl #16 @@ -295,7 +295,7 @@ loop8: ldr r12, [r1], #4 1: mov r4, r12 ldmia r1!, { r5,r6,r7, r8,r9,r10,r11} - PLD (r1, #64) + pld [r1, #64] subs r2, r2, #32 ldrhs r12, [r1], #4 orr r3, r3, r4, lsl #24 @@ -322,7 +322,7 @@ loop24: ldr r12, [r1], #4 1: mov r4, r12 ldmia r1!, { r5,r6,r7, r8,r9,r10,r11} - PLD (r1, #64) + pld [r1, #64] subs r2, r2, #32 ldrhs r12, [r1], #4 orr r3, r3, r4, lsl #8 diff --git a/libc/arch-arm/generic/bionic/strcmp.S b/libc/arch-arm/generic/bionic/strcmp.S index 764a531e2..42d41d143 100644 --- a/libc/arch-arm/generic/bionic/strcmp.S +++ b/libc/arch-arm/generic/bionic/strcmp.S @@ -52,8 +52,8 @@ #define magic2(REG) REG, lsl #7 ENTRY(strcmp) - PLD(r0, #0) - PLD(r1, #0) + pld [r0, #0] + pld [r1, #0] eor r2, r0, r1 tst r2, #3 @@ -88,8 +88,8 @@ ENTRY(strcmp) orr r4, r4, r4, lsl #16 .p2align 2 4: - PLD(r0, #8) - PLD(r1, #8) + pld [r0, #8] + pld [r1, #8] sub r2, ip, magic1(r4) cmp ip, r3 itttt eq diff --git a/libc/arch-arm/generic/bionic/strcpy.S b/libc/arch-arm/generic/bionic/strcpy.S index 21dafda7e..cc997f448 100644 --- a/libc/arch-arm/generic/bionic/strcpy.S +++ b/libc/arch-arm/generic/bionic/strcpy.S @@ -33,7 +33,7 @@ #include ENTRY(strcpy) - PLD(r1, #0) + pld [r1, #0] eor r2, r0, r1 mov ip, r0 tst r2, #3 @@ -62,7 +62,7 @@ ENTRY(strcpy) load stalls. */ .p2align 2 2: - PLD(r1, #8) + pld [r1, #8] ldr r4, [r1], #4 sub r2, r3, r5 bics r2, r2, r3 diff --git a/libc/arch-arm/generic/bionic/strlen.c b/libc/arch-arm/generic/bionic/strlen.c index 824cf78d0..811e1e0b1 100644 --- a/libc/arch-arm/generic/bionic/strlen.c +++ b/libc/arch-arm/generic/bionic/strlen.c @@ -63,9 +63,7 @@ size_t strlen(const char *s) "ldr %[v], [%[s]], #4 \n" "sub %[l], %[l], %[s] \n" "0: \n" -#if __ARM_HAVE_PLD "pld [%[s], #64] \n" -#endif "sub %[t], %[v], %[mask], lsr #7\n" "and %[t], %[t], %[mask] \n" "bics %[t], %[t], %[v] \n" diff --git a/libc/arch-arm/generic/generic.mk b/libc/arch-arm/generic/generic.mk index e2300039f..b3ed69dbf 100644 --- a/libc/arch-arm/generic/generic.mk +++ b/libc/arch-arm/generic/generic.mk @@ -2,7 +2,10 @@ $(call libc-add-cpu-variant-src,MEMCPY,arch-arm/generic/bionic/memcpy.S) $(call libc-add-cpu-variant-src,MEMSET,arch-arm/generic/bionic/memset.S) $(call libc-add-cpu-variant-src,STRCAT,string/strcat.c) $(call libc-add-cpu-variant-src,STRCMP,arch-arm/generic/bionic/strcmp.S) +$(call libc-add-cpu-variant-src,MEMMOVE,bionic/memmove.c.arm) +$(call libc-add-cpu-variant-src,BCOPY,string/bcopy.c.arm) $(call libc-add-cpu-variant-src,STRCPY,arch-arm/generic/bionic/strcpy.S) $(call libc-add-cpu-variant-src,STRLEN,arch-arm/generic/bionic/strlen.c) $(call libc-add-cpu-variant-src,__STRCAT_CHK,bionic/__strcat_chk.cpp) $(call libc-add-cpu-variant-src,__STRCPY_CHK,bionic/__strcpy_chk.cpp) +$(call libc-add-cpu-variant-src,MEMCHR,bionic/memchr.c) diff --git a/libc/arch-arm/include/machine/asm.h b/libc/arch-arm/include/machine/asm.h index 047e54d17..b48a50f8b 100644 --- a/libc/arch-arm/include/machine/asm.h +++ b/libc/arch-arm/include/machine/asm.h @@ -141,4 +141,9 @@ .stabs __STRING(_/**/sym),1,0,0,0 #endif /* __STDC__ */ +#define RET bx lr +#define RETeq bxeq lr +#define RETne bxne lr +#define RETc(c) bx##c lr + #endif /* !_ARM_ASM_H_ */ diff --git a/libc/arch-arm/include/machine/cpu-features.h b/libc/arch-arm/include/machine/cpu-features.h index 80d3fda64..fc5a8fd14 100644 --- a/libc/arch-arm/include/machine/cpu-features.h +++ b/libc/arch-arm/include/machine/cpu-features.h @@ -34,133 +34,29 @@ * * This is done to abstract us from the various ARM Architecture * quirks and alphabet soup. - * - * IMPORTANT: We have no intention to support anything below an ARMv4T ! */ /* __ARM_ARCH__ is a number corresponding to the ARM revision - * we're going to support - * - * it looks like our toolchain doesn't define __ARM_ARCH__ + * we're going to support. Our toolchain doesn't define __ARM_ARCH__ * so try to guess it. - * - * - * */ #ifndef __ARM_ARCH__ - # if defined __ARM_ARCH_7__ || defined __ARM_ARCH_7A__ || \ - defined __ARM_ARCH_7R__ || defined __ARM_ARCH_7M__ - + defined __ARM_ARCH_7R__ || defined __ARM_ARCH_7M__ # define __ARM_ARCH__ 7 - # elif defined __ARM_ARCH_6__ || defined __ARM_ARCH_6J__ || \ - defined __ARM_ARCH_6K__ || defined __ARM_ARCH_6Z__ || \ - defined __ARM_ARCH_6KZ__ || defined __ARM_ARCH_6T2__ -# + defined __ARM_ARCH_6K__ || defined __ARM_ARCH_6Z__ || \ + defined __ARM_ARCH_6KZ__ || defined __ARM_ARCH_6T2__ # define __ARM_ARCH__ 6 -# -# elif defined __ARM_ARCH_5__ || defined __ARM_ARCH_5T__ || \ - defined __ARM_ARCH_5TE__ || defined __ARM_ARCH_5TEJ__ -# -# define __ARM_ARCH__ 5 -# -# elif defined __ARM_ARCH_4T__ -# -# define __ARM_ARCH__ 4 -# -# elif defined __ARM_ARCH_4__ -# error ARMv4 is not supported, please use ARMv4T at a minimum # else # error Unknown or unsupported ARM architecture # endif #endif -/* experimental feature used to check that our ARMv4 workarounds - * work correctly without a real ARMv4 machine */ -#ifdef BIONIC_EXPERIMENTAL_FORCE_ARMV4 -# undef __ARM_ARCH__ -# define __ARM_ARCH__ 4 -#endif - -/* define __ARM_HAVE_5TE if we have the ARMv5TE instructions */ -#if __ARM_ARCH__ > 5 -# define __ARM_HAVE_5TE 1 -#elif __ARM_ARCH__ == 5 -# if defined __ARM_ARCH_5TE__ || defined __ARM_ARCH_5TEJ__ -# define __ARM_HAVE_5TE 1 -# endif -#endif - -/* instructions introduced in ARMv5 */ -#if __ARM_ARCH__ >= 5 -# define __ARM_HAVE_BLX 1 -# define __ARM_HAVE_CLZ 1 -# define __ARM_HAVE_LDC2 1 -# define __ARM_HAVE_MCR2 1 -# define __ARM_HAVE_MRC2 1 -# define __ARM_HAVE_STC2 1 -#endif - -/* ARMv5TE introduces a few instructions */ -#if __ARM_HAVE_5TE -# define __ARM_HAVE_PLD 1 -# define __ARM_HAVE_MCRR 1 -# define __ARM_HAVE_MRRC 1 -#endif - /* define __ARM_HAVE_HALFWORD_MULTIPLY when half-word multiply instructions * this means variants of: smul, smulw, smla, smlaw, smlal */ -#if __ARM_HAVE_5TE -# define __ARM_HAVE_HALFWORD_MULTIPLY 1 -#endif - -/* define __ARM_HAVE_PAIR_LOAD_STORE when 64-bit memory loads and stored - * into/from a pair of 32-bit registers is supported throuhg 'ldrd' and 'strd' - */ -#if __ARM_HAVE_5TE -# define __ARM_HAVE_PAIR_LOAD_STORE 1 -#endif - -/* define __ARM_HAVE_SATURATED_ARITHMETIC is you have the saturated integer - * arithmetic instructions: qdd, qdadd, qsub, qdsub - */ -#if __ARM_HAVE_5TE -# define __ARM_HAVE_SATURATED_ARITHMETIC 1 -#endif - -/* define __ARM_HAVE_PC_INTERWORK when a direct assignment to the - * pc register will switch into thumb/ARM mode depending on bit 0 - * of the new instruction address. Before ARMv5, this was not the - * case, and you have to write: - * - * mov r0, [] - * bx r0 - * - * instead of: - * - * ldr pc, [] - * - * note that this affects any instruction that explicitly changes the - * value of the pc register, including ldm { ...,pc } or 'add pc, #offset' - */ -#if __ARM_ARCH__ >= 5 -# define __ARM_HAVE_PC_INTERWORK -#endif - -/* define __ARM_HAVE_LDREX_STREX for ARMv6 and ARMv7 architecture to be - * used in replacement of deprecated swp instruction - */ -#if __ARM_ARCH__ >= 6 -# define __ARM_HAVE_LDREX_STREX -#endif - -/* define __ARM_HAVE_DMB for ARMv7 architecture - */ -#if __ARM_ARCH__ >= 7 -# define __ARM_HAVE_DMB -#endif +#define __ARM_HAVE_HALFWORD_MULTIPLY 1 /* define __ARM_HAVE_LDREXD for ARMv7 architecture * (also present in ARMv6K, but not implemented in ARMv7-M, neither of which @@ -184,18 +80,4 @@ # define __ARM_HAVE_NEON #endif -/* Assembly-only macros */ -#ifdef __ASSEMBLY__ - -/* define a handy PLD(address) macro since the cache preload - * is an optional opcode - */ -#if __ARM_HAVE_PLD -# define PLD(reg,offset) pld [reg, offset] -#else -# define PLD(reg,offset) /* nothing */ -#endif - -#endif /* ! __ASSEMBLY__ */ - #endif /* _ARM_MACHINE_CPU_FEATURES_H */ diff --git a/libc/arch-arm/include/machine/endian.h b/libc/arch-arm/include/machine/endian.h index 7cba3b942..8d9723d7a 100644 --- a/libc/arch-arm/include/machine/endian.h +++ b/libc/arch-arm/include/machine/endian.h @@ -33,15 +33,6 @@ #ifdef __GNUC__ -/* - * REV and REV16 weren't available on ARM5 or ARM4. - * We don't include because it pollutes the - * namespace with macros like PLD. - */ -#if !defined __ARM_ARCH_5__ && !defined __ARM_ARCH_5T__ && \ - !defined __ARM_ARCH_5TE__ && !defined __ARM_ARCH_5TEJ__ && \ - !defined __ARM_ARCH_4T__ && !defined __ARM_ARCH_4__ - /* According to RealView Assembler User's Guide, REV and REV16 are available * in Thumb code and 16-bit instructions when used in Thumb-2 code. * @@ -55,13 +46,13 @@ */ #define __swap16md(x) ({ \ register u_int16_t _x = (x); \ - __asm volatile ("rev16 %0, %0" : "+l" (_x)); \ + __asm__ __volatile__("rev16 %0, %0" : "+l" (_x)); \ _x; \ }) #define __swap32md(x) ({ \ register u_int32_t _x = (x); \ - __asm volatile ("rev %0, %0" : "+l" (_x)); \ + __asm__ __volatile__("rev %0, %0" : "+l" (_x)); \ _x; \ }) @@ -74,7 +65,6 @@ /* Tell sys/endian.h we have MD variants of the swap macros. */ #define MD_SWAP -#endif /* __ARM_ARCH__ */ #endif /* __GNUC__ */ #if defined(__ARMEB__) diff --git a/libc/arch-arm/krait/bionic/memcpy_base.S b/libc/arch-arm/krait/bionic/memcpy_base.S index 009c8f92f..e80e738e7 100644 --- a/libc/arch-arm/krait/bionic/memcpy_base.S +++ b/libc/arch-arm/krait/bionic/memcpy_base.S @@ -1,127 +1,215 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ +/*************************************************************************** + Copyright (c) 2009-2013 The Linux Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of The Linux Foundation nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************/ + +/* Assumes neon instructions and a cache line size of 64 bytes. */ +#include +#include /* - * This code assumes it is running on a processor that supports all arm v7 - * instructions, that supports neon instructions, and that has a 32 byte - * cache line. + * These default settings are good for all Krait-based systems + * as of this writing, but they can be overridden in: + * device///BoardConfig.mk + * by setting the following: + * TARGET_USE_KRAIT_BIONIC_OPTIMIZATION := true + * TARGET_USE_KRAIT_PLD_SET := true + * TARGET_KRAIT_BIONIC_PLDOFFS := + * TARGET_KRAIT_BIONIC_PLDSIZE := + * TARGET_KRAIT_BIONIC_PLDTHRESH := + * TARGET_KRAIT_BIONIC_BBTHRESH := */ -// Assumes neon instructions and a cache line size of 32 bytes. +#ifndef PLDOFFS +#define PLDOFFS (10) +#endif +#ifndef PLDTHRESH +#define PLDTHRESH (PLDOFFS) +#endif +#ifndef BBTHRESH +#define BBTHRESH (4096/64) +#endif +#if (PLDOFFS < 1) +#error Routine does not support offsets less than 1 +#endif +#if (PLDTHRESH < PLDOFFS) +#error PLD threshold must be greater than or equal to the PLD offset +#endif +#ifndef PLDSIZE +#define PLDSIZE (64) +#endif + .text + .fpu neon ENTRY(MEMCPY_BASE) +MEMCPY_BASE_ALIGNED: .cfi_startproc - .save {r0, lr} + .save {r0, r9, r10, lr} .cfi_def_cfa_offset 8 - .cfi_rel_offset r0, 0 - .cfi_rel_offset lr, 4 - - /* do we have at least 16-bytes to copy (needed for alignment below) */ - cmp r2, #16 - blo 5f - - /* align destination to cache-line for the write-buffer */ - rsb r3, r0, #0 - ands r3, r3, #0xF - beq 2f - - /* copy up to 15-bytes (count in r3) */ - sub r2, r2, r3 - movs ip, r3, lsl #31 - itt mi - ldrbmi lr, [r1], #1 - strbmi lr, [r0], #1 - itttt cs - ldrbcs ip, [r1], #1 - ldrbcs lr, [r1], #1 - strbcs ip, [r0], #1 - strbcs lr, [r0], #1 - movs ip, r3, lsl #29 - bge 1f - // copies 4 bytes, destination 32-bits aligned - vld4.8 {d0[0], d1[0], d2[0], d3[0]}, [r1]! - vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]! -1: bcc 2f - // copies 8 bytes, destination 64-bits aligned - vld1.8 {d0}, [r1]! - vst1.8 {d0}, [r0, :64]! - -2: /* make sure we have at least 64 bytes to copy */ - subs r2, r2, #64 - blo 2f - -1: /* The main loop copies 64 bytes at a time */ - vld1.8 {d0 - d3}, [r1]! - vld1.8 {d4 - d7}, [r1]! - pld [r1, #(32*8)] - subs r2, r2, #64 - vst1.8 {d0 - d3}, [r0, :128]! - vst1.8 {d4 - d7}, [r0, :128]! - bhs 1b - -2: /* fix-up the remaining count and make sure we have >= 32 bytes left */ - adds r2, r2, #32 - blo 4f - - /* Copy 32 bytes. These cache lines were already preloaded */ - vld1.8 {d0 - d3}, [r1]! - sub r2, r2, #32 - vst1.8 {d0 - d3}, [r0, :128]! - -4: /* less than 32 left */ - add r2, r2, #32 - tst r2, #0x10 - beq 5f - // copies 16 bytes, 128-bits aligned - vld1.8 {d0, d1}, [r1]! - vst1.8 {d0, d1}, [r0, :128]! - -5: /* copy up to 15-bytes (count in r2) */ - movs ip, r2, lsl #29 - bcc 1f - vld1.8 {d0}, [r1]! - vst1.8 {d0}, [r0]! -1: bge 2f - vld4.8 {d0[0], d1[0], d2[0], d3[0]}, [r1]! - vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0]! -2: movs ip, r2, lsl #31 - itt mi - ldrbmi r3, [r1], #1 - strbmi r3, [r0], #1 - itttt cs - ldrbcs ip, [r1], #1 - ldrbcs lr, [r1], #1 - strbcs ip, [r0], #1 - strbcs lr, [r0], #1 - - ldmfd sp!, {r0, lr} - bx lr + .cfi_rel_offset r0, 0 + .cfi_rel_offset lr, 4 + cmp r2, #4 + blt .Lneon_lt4 + cmp r2, #16 + blt .Lneon_lt16 + cmp r2, #32 + blt .Lneon_16 + cmp r2, #64 + blt .Lneon_copy_32_a + + mov r12, r2, lsr #6 + cmp r12, #PLDTHRESH + ble .Lneon_copy_64_loop_nopld + + push {r9, r10} + .cfi_adjust_cfa_offset 8 + .cfi_rel_offset r9, 0 + .cfi_rel_offset r10, 4 + + cmp r12, #BBTHRESH + ble .Lneon_prime_pump + + add lr, r0, #0x400 + add r9, r1, #(PLDOFFS*PLDSIZE) + sub lr, lr, r9 + lsl lr, lr, #21 + lsr lr, lr, #21 + add lr, lr, #(PLDOFFS*PLDSIZE) + cmp r12, lr, lsr #6 + ble .Lneon_prime_pump + itt gt + movgt r9, #(PLDOFFS) + rsbsgt r9, r9, lr, lsr #6 + ble .Lneon_prime_pump + + add r10, r1, lr + bic r10, #0x3F + + sub r12, r12, lr, lsr #6 + + cmp r9, r12 + itee le + suble r12, r12, r9 + movgt r9, r12 + movgt r12, #0 + + pld [r1, #((PLDOFFS-1)*PLDSIZE)] +.Lneon_copy_64_loop_outer_doublepld: + pld [r1, #((PLDOFFS)*PLDSIZE)] + vld1.32 {q0, q1}, [r1]! + vld1.32 {q2, q3}, [r1]! + ldr r3, [r10] + subs r9, r9, #1 + vst1.32 {q0, q1}, [r0]! + vst1.32 {q2, q3}, [r0]! + add r10, #64 + bne .Lneon_copy_64_loop_outer_doublepld + cmp r12, #0 + beq .Lneon_pop_before_nopld + + cmp r12, #(512*1024/64) + blt .Lneon_copy_64_loop_outer + +.Lneon_copy_64_loop_ddr: + vld1.32 {q0, q1}, [r1]! + vld1.32 {q2, q3}, [r1]! + pld [r10] + subs r12, r12, #1 + vst1.32 {q0, q1}, [r0]! + vst1.32 {q2, q3}, [r0]! + add r10, #64 + bne .Lneon_copy_64_loop_ddr + b .Lneon_pop_before_nopld + +.Lneon_prime_pump: + mov lr, #(PLDOFFS*PLDSIZE) + add r10, r1, #(PLDOFFS*PLDSIZE) + bic r10, #0x3F + sub r12, r12, #PLDOFFS + ldr r3, [r10, #(-1*PLDSIZE)] +.Lneon_copy_64_loop_outer: + vld1.32 {q0, q1}, [r1]! + vld1.32 {q2, q3}, [r1]! + ldr r3, [r10] + subs r12, r12, #1 + vst1.32 {q0, q1}, [r0]! + vst1.32 {q2, q3}, [r0]! + add r10, #64 + bne .Lneon_copy_64_loop_outer +.Lneon_pop_before_nopld: + mov r12, lr, lsr #6 + pop {r9, r10} + .cfi_restore r9 + .cfi_restore r10 + .cfi_adjust_cfa_offset -8 + +.Lneon_copy_64_loop_nopld: + vld1.32 {q8, q9}, [r1]! + vld1.32 {q10, q11}, [r1]! + subs r12, r12, #1 + vst1.32 {q8, q9}, [r0]! + vst1.32 {q10, q11}, [r0]! + bne .Lneon_copy_64_loop_nopld + ands r2, r2, #0x3f + .cfi_restore r0 + .cfi_adjust_cfa_offset -4 + beq .Lneon_exit +.Lneon_copy_32_a: + movs r3, r2, lsl #27 + bcc .Lneon_16 + vld1.32 {q0,q1}, [r1]! + vst1.32 {q0,q1}, [r0]! +.Lneon_16: + bpl .Lneon_lt16 + vld1.32 {q8}, [r1]! + vst1.32 {q8}, [r0]! + ands r2, r2, #0x0f + beq .Lneon_exit +.Lneon_lt16: + movs r3, r2, lsl #29 + itttt cs + ldrcs r3, [r1], #4 + strcs r3, [r0], #4 + ldrcs r3, [r1], #4 + strcs r3, [r0], #4 + itt mi + ldrmi r3, [r1], #4 + strmi r3, [r0], #4 +.Lneon_lt4: + movs r2, r2, lsl #31 + itt cs + ldrhcs r3, [r1], #2 + strhcs r3, [r0], #2 + itt mi + ldrbmi r3, [r1] + strbmi r3, [r0] +.Lneon_exit: + pop {r0, lr} + bx lr .cfi_endproc END(MEMCPY_BASE) + diff --git a/libc/arch-arm/krait/bionic/memmove.S b/libc/arch-arm/krait/bionic/memmove.S new file mode 100644 index 000000000..24fcec28f --- /dev/null +++ b/libc/arch-arm/krait/bionic/memmove.S @@ -0,0 +1,219 @@ +/*************************************************************************** + Copyright (c) 2009-2014 The Linux Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of The Linux Foundation nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************/ + +/*************************************************************************** + * Neon memmove: Attempts to do a memmove with Neon registers if possible, + * Inputs: + * dest: The destination buffer + * src: The source buffer + * n: The size of the buffer to transfer + * Outputs: + * + ***************************************************************************/ + +#include +#include +/* + * These can be overridden in: + * device///BoardConfig.mk + * by setting the following: + * TARGET_USE_KRAIT_BIONIC_OPTIMIZATION := true + * TARGET_USE_KRAIT_PLD_SET := true + * TARGET_KRAIT_BIONIC_PLDOFFS := + * TARGET_KRAIT_BIONIC_PLDSIZE := + * TARGET_KRAIT_BIONIC_PLDTHRESH := + */ +#ifndef PLDOFFS +#define PLDOFFS (10) +#endif +#ifndef PLDTHRESH +#define PLDTHRESH (PLDOFFS) +#endif +#if (PLDOFFS < 5) +#error Routine does not support offsets less than 5 +#endif +#if (PLDTHRESH < PLDOFFS) +#error PLD threshold must be greater than or equal to the PLD offset +#endif +#ifndef PLDSIZE +#define PLDSIZE (64) +#endif + + .text + .syntax unified + .fpu neon + .thumb + .thumb_func + +ENTRY(bcopy) + .cfi_startproc + mov r12, r0 + mov r0, r1 + mov r1, r12 + // Fall through to memmove + .cfi_endproc +END(bcopy) + +ENTRY(memmove) +_memmove_words: + .cfi_startproc + .save {r0, lr} + cmp r2, #0 + it ne + subsne r12, r0, r1 // Warning: do not combine these "it" blocks + it eq + bxeq lr +// memmove only if r1 < r0 < r1+r2 + cmp r0, r1 + itt ge + addge r12, r1, r2 + cmpge r12, r0 + it le + ble memcpy + cmp r2, #4 + it le + ble .Lneon_b2f_smallcopy_loop + push {r0, lr} + add r0, r0, r2 + add r1, r1, r2 + cmp r2, #64 + it ge + bge .Lneon_b2f_copy_64 + cmp r2, #32 + it ge + bge .Lneon_b2f_copy_32 + cmp r2, #8 + it ge + bge .Lneon_b2f_copy_8 + b .Lneon_b2f_copy_1 +.Lneon_b2f_copy_64: + mov r12, r2, lsr #6 + add r0, r0, #32 + add r1, r1, #32 + cmp r12, #PLDTHRESH + it le + ble .Lneon_b2f_copy_64_loop_nopld + sub r12, #PLDOFFS + sub lr, r1, #(PLDOFFS)*PLDSIZE +.Lneon_b2f_copy_64_loop_outer: + pld [lr] + sub r1, r1, #96 + sub r0, r0, #96 + vld1.32 {q0, q1}, [r1]! + vld1.32 {q2, q3}, [r1] + sub lr, lr, #64 + subs r12, r12, #1 + vst1.32 {q0, q1}, [r0]! + vst1.32 {q2, q3}, [r0] + it ne + bne .Lneon_b2f_copy_64_loop_outer + mov r12, #PLDOFFS +.Lneon_b2f_copy_64_loop_nopld: + sub r1, r1, #96 + sub r0, r0, #96 + vld1.32 {q8, q9}, [r1]! + vld1.32 {q10, q11}, [r1] + subs r12, r12, #1 + vst1.32 {q8, q9}, [r0]! + vst1.32 {q10, q11}, [r0] + it ne + bne .Lneon_b2f_copy_64_loop_nopld + ands r2, r2, #0x3f + it eq + beq .Lneon_memmove_done + sub r1, r1, #32 + sub r0, r0, #32 + cmp r2, #32 + it lt + blt .Lneon_b2f_copy_8 +.Lneon_b2f_copy_32: + sub r1, r1, #32 + sub r0, r0, #32 + vld1.32 {q0, q1}, [r1] + vst1.32 {q0, q1}, [r0] + ands r2, r2, #0x1f + it eq + beq .Lneon_memmove_done +.Lneon_b2f_copy_8: + movs r12, r2, lsr #0x3 + it eq + beq .Lneon_b2f_copy_1 +.Lneon_b2f_copy_8_loop: + sub r1, r1, #8 + sub r0, r0, #8 + vld1.32 {d0}, [r1] + subs r12, r12, #1 + vst1.32 {d0}, [r0] + it ne + bne .Lneon_b2f_copy_8_loop + ands r2, r2, #0x7 + beq .Lneon_memmove_done +.Lneon_b2f_copy_1: + movs r12, r2, lsl #29 + itttt mi + submi r1, r1, #4 + submi r0, r0, #4 + ldrmi r3, [r1] + strmi r3, [r0] + movs r2, r2, lsl #31 + itttt cs + subcs r1, r1, #2 + subcs r0, r0, #2 + ldrhcs r3, [r1] + strhcs r3, [r0] + itttt mi + submi r1, r1, #1 + submi r0, r0, #1 + ldrbmi r12, [r1] + strbmi r12, [r0] +.Lneon_memmove_done: + pop {r0, pc} +.Lneon_b2f_smallcopy_loop: + // 4 bytes or less + add r1, r1, r2 + add r0, r0, r2 + movs r12, r2, lsl #29 + itttt mi + submi r1, r1, #4 + submi r0, r0, #4 + ldrmi r3, [r1] + strmi r3, [r0] + movs r2, r2, lsl #31 + itttt cs + subcs r1, r1, #2 + subcs r0, r0, #2 + ldrhcs r3, [r1] + strhcs r3, [r0] + itttt mi + submi r1, r1, #1 + submi r0, r0, #1 + ldrbmi r12, [r1] + strbmi r12, [r0] + bx lr + .cfi_endproc +END(memmove) + diff --git a/libc/arch-arm/krait/krait.mk b/libc/arch-arm/krait/krait.mk index 29ab743c6..868ad4c0e 100644 --- a/libc/arch-arm/krait/krait.mk +++ b/libc/arch-arm/krait/krait.mk @@ -1,6 +1,12 @@ -$(call libc-add-cpu-variant-src,MEMCPY,arch-arm/krait/bionic/memcpy.S) +ifeq ($(TARGET_USE_KINGFISHER_OPTIMIZATION),true) + $(call libc-add-cpu-variant-src,MEMCPY,arch-arm/cortex-a9/bionic/memcpy.S) +else + $(call libc-add-cpu-variant-src,MEMCPY,arch-arm/krait/bionic/memcpy.S) +endif $(call libc-add-cpu-variant-src,MEMSET,arch-arm/krait/bionic/memset.S) $(call libc-add-cpu-variant-src,STRCMP,arch-arm/krait/bionic/strcmp.S) +$(call libc-add-cpu-variant-src,MEMMOVE,arch-arm/krait/bionic/memmove.S) +$(call libc-add-cpu-variant-src,BCOPY,) $(call libc-add-cpu-variant-src,__STRCAT_CHK,arch-arm/krait/bionic/__strcat_chk.S) $(call libc-add-cpu-variant-src,__STRCPY_CHK,arch-arm/krait/bionic/__strcpy_chk.S) # Use cortex-a15 versions of strcat/strcpy/strlen. diff --git a/libc/arch-arm/scorpion/scorpion.mk b/libc/arch-arm/scorpion/scorpion.mk new file mode 100644 index 000000000..fb893f0f8 --- /dev/null +++ b/libc/arch-arm/scorpion/scorpion.mk @@ -0,0 +1,13 @@ +$(call libc-add-cpu-variant-src,MEMCPY,arch-arm/cortex-a15/bionic/memcpy.S) +$(call libc-add-cpu-variant-src,MEMSET,arch-arm/krait/bionic/memset.S) +$(call libc-add-cpu-variant-src,STRCMP,arch-arm/krait/bionic/strcmp.S) +$(call libc-add-cpu-variant-src,MEMMOVE,arch-arm/krait/bionic/memmove.S) +$(call libc-add-cpu-variant-src,BCOPY,) +# Use cortex-a15 versions of strcat/strcpy/strlen. +$(call libc-add-cpu-variant-src,STRCAT,arch-arm/cortex-a15/bionic/strcat.S) +$(call libc-add-cpu-variant-src,STRCPY,arch-arm/cortex-a15/bionic/strcpy.S) +$(call libc-add-cpu-variant-src,STRLEN,arch-arm/cortex-a15/bionic/strlen.S) +$(call libc-add-cpu-variant-src,__STRCAT_CHK,arch-arm/cortex-a15/bionic/__strcat_chk.S) +$(call libc-add-cpu-variant-src,__STRCPY_CHK,arch-arm/cortex-a15/bionic/__strcpy_chk.S) + +include bionic/libc/arch-arm/generic/generic.mk diff --git a/libc/arch-mips/bionic/syscall.S b/libc/arch-mips/bionic/syscall.S new file mode 100644 index 000000000..af5bcc9ab --- /dev/null +++ b/libc/arch-mips/bionic/syscall.S @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + .text + .globl syscall + .align 4 + .ent syscall + +/* + * The caller is only required to allocate 16 bytes of stack for a0-a3. + * syscall has up to 6 arguments, so we need space for the extra two arguments. + */ +#define STACKSIZE 2*4 + +syscall: + .set noreorder + .cpload $t9 + move $v0, $a0 + move $a0, $a1 + move $a1, $a2 + move $a2, $a3 + lw $a3, 16($sp) + lw $t0, 20($sp) + lw $t1, 24($sp) + subu $sp, STACKSIZE + sw $t0, 16($sp) + sw $t1, 20($sp) + syscall + addu $sp, STACKSIZE + bnez $a3, 1f + move $a0, $v0 + j $ra + nop +1: + la $t9,__set_errno + j $t9 + nop + .set reorder + .end syscall diff --git a/libc/arch-x86/x86.mk b/libc/arch-x86/x86.mk index 19c14023a..526bd342d 100644 --- a/libc/arch-x86/x86.mk +++ b/libc/arch-x86/x86.mk @@ -10,6 +10,7 @@ _LIBC_ARCH_COMMON_SRC_FILES := \ arch-x86/bionic/sigsetjmp.S \ arch-x86/bionic/syscall.S \ arch-x86/bionic/vfork.S \ + arch-x86/string/ffs.S ifeq ($(ARCH_X86_HAVE_SSSE3),true) @@ -82,6 +83,7 @@ _LIBC_ARCH_COMMON_SRC_FILES += \ upstream-freebsd/lib/libc/string/wcscmp.c endif + _LIBC_ARCH_STATIC_SRC_FILES := \ bionic/dl_iterate_phdr_static.c \ diff --git a/libc/bionic/__fgets_chk.cpp b/libc/bionic/__fgets_chk.cpp index 429eda515..569d2ac0c 100644 --- a/libc/bionic/__fgets_chk.cpp +++ b/libc/bionic/__fgets_chk.cpp @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ +#undef _FORTIFY_SOURCE + #include #include #include "libc_logging.h" diff --git a/libc/bionic/__memmove_chk.cpp b/libc/bionic/__memmove_chk.cpp index 49a059782..fd1a5f5cf 100644 --- a/libc/bionic/__memmove_chk.cpp +++ b/libc/bionic/__memmove_chk.cpp @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ +#undef _FORTIFY_SOURCE + #include #include #include "libc_logging.h" diff --git a/libc/bionic/__memset_chk.cpp b/libc/bionic/__memset_chk.cpp index f7a5f241e..818ebc004 100644 --- a/libc/bionic/__memset_chk.cpp +++ b/libc/bionic/__memset_chk.cpp @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ +#undef _FORTIFY_SOURCE + #include #include #include "libc_logging.h" diff --git a/libc/bionic/__strlcat_chk.cpp b/libc/bionic/__strlcat_chk.cpp index 25c67adca..d380246d4 100644 --- a/libc/bionic/__strlcat_chk.cpp +++ b/libc/bionic/__strlcat_chk.cpp @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ +#undef _FORTIFY_SOURCE + #include #include #include "libc_logging.h" diff --git a/libc/bionic/__strlcpy_chk.cpp b/libc/bionic/__strlcpy_chk.cpp index f6b11fc57..1b35e3881 100644 --- a/libc/bionic/__strlcpy_chk.cpp +++ b/libc/bionic/__strlcpy_chk.cpp @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ +#undef _FORTIFY_SOURCE + #include #include #include "libc_logging.h" diff --git a/libc/bionic/__strlen_chk.cpp b/libc/bionic/__strlen_chk.cpp index 151a497a6..8fe63c443 100644 --- a/libc/bionic/__strlen_chk.cpp +++ b/libc/bionic/__strlen_chk.cpp @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ +#undef _FORTIFY_SOURCE + #include #include #include "libc_logging.h" diff --git a/libc/bionic/__strncpy_chk.cpp b/libc/bionic/__strncpy_chk.cpp index b01879cba..ea16b4c26 100644 --- a/libc/bionic/__strncpy_chk.cpp +++ b/libc/bionic/__strncpy_chk.cpp @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ +#undef _FORTIFY_SOURCE + #include #include #include "libc_logging.h" diff --git a/libc/bionic/__vsnprintf_chk.cpp b/libc/bionic/__vsnprintf_chk.cpp index 2d3a81ecb..e38c852c3 100644 --- a/libc/bionic/__vsnprintf_chk.cpp +++ b/libc/bionic/__vsnprintf_chk.cpp @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ +#undef _FORTIFY_SOURCE + #include #include #include diff --git a/libc/bionic/__vsprintf_chk.cpp b/libc/bionic/__vsprintf_chk.cpp index 12b0ca6ab..3250b6835 100644 --- a/libc/bionic/__vsprintf_chk.cpp +++ b/libc/bionic/__vsprintf_chk.cpp @@ -26,6 +26,8 @@ * SUCH DAMAGE. */ +#undef _FORTIFY_SOURCE + #include #include #include diff --git a/libc/bionic/pathconf.c b/libc/bionic/pathconf.c index 26b580ffa..cf812720b 100644 --- a/libc/bionic/pathconf.c +++ b/libc/bionic/pathconf.c @@ -25,11 +25,10 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ + #include #include #include -#include -#include #include /* these may not be defined yet by our headers */ @@ -82,14 +81,12 @@ __filesizebits( struct statfs* s ) static long __link_max( struct statfs* s ) { - /* constant values were taken from official kernel headers. - * I don't think this justified bringing in et al - * into our cleaned-up kernel three - */ + // These constant values were taken from kernel headers. + // They're not available in uapi headers. static const struct { uint32_t type; int max; } knownMax[] = { - { EXT2_SUPER_MAGIC, EXT2_LINK_MAX }, - { EXT3_SUPER_MAGIC, EXT3_LINK_MAX }, + { EXT2_SUPER_MAGIC, 32000 }, + { EXT3_SUPER_MAGIC, 32000 }, { MINIX_SUPER_MAGIC, 250 }, { MINIX2_SUPER_MAGIC, 65530 }, { REISERFS_SUPER_MAGIC, 0xffff - 1000 }, diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index 92e2c27f0..49e0534ff 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -936,7 +936,7 @@ int pthread_mutex_lock_timeout_np_impl(pthread_mutex_t *mutex, unsigned msecs) * thread. */ if (MUTEX_STATE_BITS_IS_LOCKED_CONTENDED(mvalue)) { - if (__futex_wait_ex(&mutex->value, shared, mvalue, &ts) == ETIMEDOUT) { + if (__futex_wait_ex(&mutex->value, shared, mvalue, &ts) == (-ETIMEDOUT)) { return EBUSY; } mvalue = mutex->value; diff --git a/libc/bionic/pthread_detach.cpp b/libc/bionic/pthread_detach.cpp index 95f11ac97..a8608e3a7 100644 --- a/libc/bionic/pthread_detach.cpp +++ b/libc/bionic/pthread_detach.cpp @@ -44,6 +44,12 @@ int pthread_detach(pthread_t t) { return 0; // Already being joined; silently do nothing, like glibc. } + if (thread->tid == 0) { + // Already exited; clean up. + _pthread_internal_remove_locked(thread.get()); + return 0; + } + thread->attr.flags |= PTHREAD_ATTR_FLAG_DETACHED; return 0; } diff --git a/libc/include/errno.h b/libc/include/errno.h index 2e5ce5f67..06c1af2ee 100644 --- a/libc/include/errno.h +++ b/libc/include/errno.h @@ -41,11 +41,15 @@ __BEGIN_DECLS #endif /* internal function returning the address of the thread-specific errno */ +__attribute__((const)) extern volatile int* __errno(void); /* a macro expanding to the errno l-value */ #define errno (*__errno()) +/* bionic's errno has glibc's __errno_location behavior */ +#define __errno_location errno + __END_DECLS #endif /* _ERRNO_H */ diff --git a/libc/include/link.h b/libc/include/link.h index 842b4483d..0edf5df9a 100644 --- a/libc/include/link.h +++ b/libc/include/link.h @@ -43,11 +43,11 @@ struct dl_phdr_info { ElfW(Half) dlpi_phnum; }; +int dl_iterate_phdr(int (*cb)(struct dl_phdr_info*, size_t, void*), void*); + #ifdef __arm__ typedef long unsigned int* _Unwind_Ptr; _Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount); -#else -int dl_iterate_phdr(int (*cb)(struct dl_phdr_info*, size_t, void*), void*); #endif __END_DECLS diff --git a/libc/include/pthread.h b/libc/include/pthread.h index dbdee7044..38d340055 100644 --- a/libc/include/pthread.h +++ b/libc/include/pthread.h @@ -146,6 +146,7 @@ void pthread_exit(void * retval); int pthread_join(pthread_t thid, void ** ret_val); int pthread_detach(pthread_t thid); +__attribute__((const)) pthread_t pthread_self(void); int pthread_equal(pthread_t one, pthread_t two); diff --git a/libc/include/resolv.h b/libc/include/resolv.h index 36b93ee1e..896198af1 100644 --- a/libc/include/resolv.h +++ b/libc/include/resolv.h @@ -40,7 +40,7 @@ __BEGIN_DECLS struct res_state; -extern struct __res_state *__res_state(void); +extern struct __res_state *__res_state(void) __attribute__((const)); #define _res (*__res_state()) #define b64_ntop __b64_ntop diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h index 9fa84c1d3..2edd7707e 100644 --- a/libc/include/stdlib.h +++ b/libc/include/stdlib.h @@ -152,6 +152,18 @@ typedef struct { extern lldiv_t lldiv(long long, long long); +#if __ISO_C_VISIBLE >= 1999 +extern __noreturn void _Exit(int); +#endif /*__ISO_C_VISIBLE >= 1999 */ + +/* + * If we're in a mode greater than C99, expose C11 functions + */ +#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L +int at_quick_exit(void (*)(void)); +extern __noreturn void quick_exit(int); +#endif /* __ISO_C_VISIBLE >= 2011 */ + #if 1 /* MISSING FROM BIONIC - ENABLED FOR STLPort and libstdc++-v3 */ /* make STLPort happy */ extern int mblen(const char *, size_t); diff --git a/libc/include/sys/_types.h b/libc/include/sys/_types.h index 7b99e06cc..9a992ae36 100644 --- a/libc/include/sys/_types.h +++ b/libc/include/sys/_types.h @@ -34,9 +34,6 @@ #ifndef _SYS__TYPES_H_ #define _SYS__TYPES_H_ -#undef __KERNEL_STRICT_NAMES -#define __KERNEL_STRICT_NAMES 1 - #include typedef unsigned long __cpuid_t; /* CPU id */ @@ -69,9 +66,4 @@ typedef union { __int64_t __mbstateL; /* for alignment */ } __mbstate_t; -/* BIONIC: if we're using non-cleaned up user-level kernel headers, - * this will prevent many type declaration conflicts - */ -#define __KERNEL_STRICT_NAMES 1 - #endif /* !_SYS__TYPES_H_ */ diff --git a/libc/include/sys/param.h b/libc/include/sys/param.h index 0bfdc5d7b..32dc45464 100644 --- a/libc/include/sys/param.h +++ b/libc/include/sys/param.h @@ -37,6 +37,19 @@ #define ALIGNBYTES 3 #define ALIGN(p) (((unsigned int)(p) + ALIGNBYTES) &~ ALIGNBYTES) -#define powerof2(x) ((((x)-1)&(x))==0) +/* Macros for counting and rounding. */ +#ifndef howmany +#define howmany(x, y) (((x)+((y)-1))/(y)) +#endif +#define nitems(x) (sizeof((x)) / sizeof((x)[0])) +#define rounddown(x, y) (((x)/(y))*(y)) +#define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */ +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ +#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ +#define powerof2(x) ((((x)-1)&(x))==0) + +/* Macros for min/max. */ +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MAX(a,b) (((a)>(b))?(a):(b)) #endif /* _SYS_PARAM_H_ */ diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h index a0ce405b4..bee132991 100644 --- a/libc/include/sys/types.h +++ b/libc/include/sys/types.h @@ -59,7 +59,6 @@ typedef __kernel_id_t id_t; typedef __kernel_ino_t ino_t; typedef __kernel_key_t key_t; typedef __kernel_mode_t mode_t; -typedef __kernel_nlink_t nlink_t; #ifndef _OFF_T_DEFINED_ #define _OFF_T_DEFINED_ typedef __kernel_off_t off_t; @@ -69,6 +68,8 @@ typedef loff_t off64_t; /* GLibc-specific */ typedef __kernel_pid_t pid_t; +typedef __nlink_t nlink_t; + /* while POSIX wants these in , we * declare then in instead */ #if 0 diff --git a/libc/kernel/arch-arm/asm/unistd.h b/libc/kernel/arch-arm/asm/unistd.h index d2612e87a..d043df664 100644 --- a/libc/kernel/arch-arm/asm/unistd.h +++ b/libc/kernel/arch-arm/asm/unistd.h @@ -466,7 +466,7 @@ #define __ARM_NR_usr32 (__ARM_NR_BASE+4) #define __ARM_NR_set_tls (__ARM_NR_BASE+5) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ -#ifdef __ARM_EABI__ +#if defined(__ARM_EABI__) && !defined(__KERNEL__) #undef __NR_time #undef __NR_umount #undef __NR_stime diff --git a/libc/kernel/arch-mips/asm/compiler.h b/libc/kernel/arch-mips/asm/compiler.h index e31f272d2..c2b9fa6dd 100644 --- a/libc/kernel/arch-mips/asm/compiler.h +++ b/libc/kernel/arch-mips/asm/compiler.h @@ -18,7 +18,7 @@ ****************************************************************************/ #ifndef _ASM_COMPILER_H #define _ASM_COMPILER_H -#if __GNUC__ > (3 || __GNUC__ == (3 && __GNUC_MINOR__ >= 4)) +#if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4 #define GCC_IMM_ASM() "n" /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define GCC_REG_ACCUM "$0" diff --git a/libc/kernel/common/asm-generic/swab.h b/libc/kernel/common/asm-generic/swab.h index 8279332d3..bcbc94ffd 100644 --- a/libc/kernel/common/asm-generic/swab.h +++ b/libc/kernel/common/asm-generic/swab.h @@ -21,7 +21,7 @@ #include #if __BITS_PER_LONG == 32 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ -#if defined(__GNUC__) && (!defined(__STRICT_ANSI__) || defined(__KERNEL__)) +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) #define __SWAB_64_THRU_32__ #endif #endif diff --git a/libc/kernel/common/linux/backing-dev.h b/libc/kernel/common/linux/backing-dev.h index 2024bdc6d..d3335f97d 100644 --- a/libc/kernel/common/linux/backing-dev.h +++ b/libc/kernel/common/linux/backing-dev.h @@ -49,7 +49,7 @@ struct backing_dev_info { #define BDI_CAP_WRITE_MAP 0x00000020 #define BDI_CAP_EXEC_MAP 0x00000040 #define BDI_CAP_VMFLAGS (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) -#if defined(VM_MAYREAD) && BDI_CAP_READ_MAP != (VM_MAYREAD || BDI_CAP_WRITE_MAP != (VM_MAYWRITE || BDI_CAP_EXEC_MAP != VM_MAYEXEC)) +#if defined(VM_MAYREAD) && (BDI_CAP_READ_MAP != VM_MAYREAD || BDI_CAP_WRITE_MAP != VM_MAYWRITE || BDI_CAP_EXEC_MAP != VM_MAYEXEC) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #error please change backing_dev_info::capabilities flags #endif diff --git a/libc/kernel/common/linux/input.h b/libc/kernel/common/linux/input.h index 8a76d2a86..2ba14973f 100644 --- a/libc/kernel/common/linux/input.h +++ b/libc/kernel/common/linux/input.h @@ -123,899 +123,907 @@ struct input_keymap_entry { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SYN_MT_REPORT 2 #define SYN_DROPPED 3 +#define SYN_TIME_SEC 4 +#define SYN_TIME_NSEC 5 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_RESERVED 0 #define KEY_ESC 1 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_1 2 #define KEY_2 3 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_3 4 #define KEY_4 5 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_5 6 #define KEY_6 7 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_7 8 #define KEY_8 9 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_9 10 #define KEY_0 11 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_MINUS 12 #define KEY_EQUAL 13 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_BACKSPACE 14 #define KEY_TAB 15 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_Q 16 #define KEY_W 17 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_E 18 #define KEY_R 19 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_T 20 #define KEY_Y 21 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_U 22 #define KEY_I 23 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_O 24 #define KEY_P 25 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_LEFTBRACE 26 #define KEY_RIGHTBRACE 27 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_ENTER 28 #define KEY_LEFTCTRL 29 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_A 30 #define KEY_S 31 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_D 32 #define KEY_F 33 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_G 34 #define KEY_H 35 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_J 36 #define KEY_K 37 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_L 38 #define KEY_SEMICOLON 39 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_APOSTROPHE 40 #define KEY_GRAVE 41 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_LEFTSHIFT 42 #define KEY_BACKSLASH 43 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_Z 44 #define KEY_X 45 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_C 46 #define KEY_V 47 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_B 48 #define KEY_N 49 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_M 50 #define KEY_COMMA 51 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DOT 52 #define KEY_SLASH 53 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_RIGHTSHIFT 54 #define KEY_KPASTERISK 55 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_LEFTALT 56 #define KEY_SPACE 57 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CAPSLOCK 58 #define KEY_F1 59 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F2 60 #define KEY_F3 61 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F4 62 #define KEY_F5 63 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F6 64 #define KEY_F7 65 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F8 66 #define KEY_F9 67 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F10 68 #define KEY_NUMLOCK 69 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SCROLLLOCK 70 #define KEY_KP7 71 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KP8 72 #define KEY_KP9 73 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KPMINUS 74 #define KEY_KP4 75 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KP5 76 #define KEY_KP6 77 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KPPLUS 78 #define KEY_KP1 79 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KP2 80 #define KEY_KP3 81 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KP0 82 #define KEY_KPDOT 83 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_ZENKAKUHANKAKU 85 #define KEY_102ND 86 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F11 87 #define KEY_F12 88 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_RO 89 #define KEY_KATAKANA 90 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_HIRAGANA 91 #define KEY_HENKAN 92 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KATAKANAHIRAGANA 93 #define KEY_MUHENKAN 94 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KPJPCOMMA 95 #define KEY_KPENTER 96 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_RIGHTCTRL 97 #define KEY_KPSLASH 98 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SYSRQ 99 #define KEY_RIGHTALT 100 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_LINEFEED 101 #define KEY_HOME 102 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_UP 103 #define KEY_PAGEUP 104 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_LEFT 105 #define KEY_RIGHT 106 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_END 107 #define KEY_DOWN 108 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PAGEDOWN 109 #define KEY_INSERT 110 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DELETE 111 #define KEY_MACRO 112 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_MUTE 113 #define KEY_VOLUMEDOWN 114 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_VOLUMEUP 115 #define KEY_POWER 116 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KPEQUAL 117 #define KEY_KPPLUSMINUS 118 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PAUSE 119 #define KEY_SCALE 120 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KPCOMMA 121 #define KEY_HANGEUL 122 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_HANGUEL KEY_HANGEUL #define KEY_HANJA 123 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_YEN 124 #define KEY_LEFTMETA 125 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_RIGHTMETA 126 #define KEY_COMPOSE 127 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_STOP 128 #define KEY_AGAIN 129 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PROPS 130 #define KEY_UNDO 131 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FRONT 132 #define KEY_COPY 133 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_OPEN 134 #define KEY_PASTE 135 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FIND 136 #define KEY_CUT 137 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_HELP 138 #define KEY_MENU 139 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CALC 140 #define KEY_SETUP 141 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SLEEP 142 #define KEY_WAKEUP 143 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FILE 144 #define KEY_SENDFILE 145 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DELETEFILE 146 #define KEY_XFER 147 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PROG1 148 #define KEY_PROG2 149 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_WWW 150 #define KEY_MSDOS 151 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_COFFEE 152 #define KEY_SCREENLOCK KEY_COFFEE -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DIRECTION 153 #define KEY_CYCLEWINDOWS 154 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_MAIL 155 #define KEY_BOOKMARKS 156 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_COMPUTER 157 #define KEY_BACK 158 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FORWARD 159 #define KEY_CLOSECD 160 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_EJECTCD 161 #define KEY_EJECTCLOSECD 162 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_NEXTSONG 163 #define KEY_PLAYPAUSE 164 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PREVIOUSSONG 165 #define KEY_STOPCD 166 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_RECORD 167 #define KEY_REWIND 168 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PHONE 169 #define KEY_ISO 170 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CONFIG 171 #define KEY_HOMEPAGE 172 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_REFRESH 173 #define KEY_EXIT 174 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_MOVE 175 #define KEY_EDIT 176 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SCROLLUP 177 #define KEY_SCROLLDOWN 178 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KPLEFTPAREN 179 #define KEY_KPRIGHTPAREN 180 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_NEW 181 #define KEY_REDO 182 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F13 183 #define KEY_F14 184 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F15 185 #define KEY_F16 186 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F17 187 #define KEY_F18 188 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F19 189 #define KEY_F20 190 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F21 191 #define KEY_F22 192 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_F23 193 #define KEY_F24 194 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PLAYCD 200 #define KEY_PAUSECD 201 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PROG3 202 #define KEY_PROG4 203 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DASHBOARD 204 #define KEY_SUSPEND 205 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CLOSE 206 #define KEY_PLAY 207 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FASTFORWARD 208 #define KEY_BASSBOOST 209 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PRINT 210 #define KEY_HP 211 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CAMERA 212 #define KEY_SOUND 213 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_QUESTION 214 #define KEY_EMAIL 215 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CHAT 216 #define KEY_SEARCH 217 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CONNECT 218 #define KEY_FINANCE 219 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SPORT 220 #define KEY_SHOP 221 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_ALTERASE 222 #define KEY_CANCEL 223 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_BRIGHTNESSDOWN 224 #define KEY_BRIGHTNESSUP 225 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_MEDIA 226 #define KEY_SWITCHVIDEOMODE 227 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KBDILLUMTOGGLE 228 #define KEY_KBDILLUMDOWN 229 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KBDILLUMUP 230 #define KEY_SEND 231 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_REPLY 232 #define KEY_FORWARDMAIL 233 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SAVE 234 #define KEY_DOCUMENTS 235 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_BATTERY 236 #define KEY_BLUETOOTH 237 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_WLAN 238 #define KEY_UWB 239 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_UNKNOWN 240 #define KEY_VIDEO_NEXT 241 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_VIDEO_PREV 242 #define KEY_BRIGHTNESS_CYCLE 243 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_BRIGHTNESS_ZERO 244 #define KEY_DISPLAY_OFF 245 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_WIMAX 246 #define KEY_RFKILL 247 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_MICMUTE 248 #define BTN_MISC 0x100 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_0 0x100 #define BTN_1 0x101 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_2 0x102 #define BTN_3 0x103 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_4 0x104 #define BTN_5 0x105 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_6 0x106 #define BTN_7 0x107 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_8 0x108 #define BTN_9 0x109 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_MOUSE 0x110 #define BTN_LEFT 0x110 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_RIGHT 0x111 #define BTN_MIDDLE 0x112 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_SIDE 0x113 #define BTN_EXTRA 0x114 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_FORWARD 0x115 #define BTN_BACK 0x116 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TASK 0x117 #define BTN_JOYSTICK 0x120 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER 0x120 #define BTN_THUMB 0x121 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_THUMB2 0x122 #define BTN_TOP 0x123 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TOP2 0x124 #define BTN_PINKIE 0x125 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_BASE 0x126 #define BTN_BASE2 0x127 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_BASE3 0x128 #define BTN_BASE4 0x129 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_BASE5 0x12a #define BTN_BASE6 0x12b -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_DEAD 0x12f #define BTN_GAMEPAD 0x130 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_A 0x130 #define BTN_B 0x131 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_C 0x132 #define BTN_X 0x133 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_Y 0x134 #define BTN_Z 0x135 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TL 0x136 #define BTN_TR 0x137 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TL2 0x138 #define BTN_TR2 0x139 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_SELECT 0x13a #define BTN_START 0x13b +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_MODE 0x13c #define BTN_THUMBL 0x13d -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_THUMBR 0x13e #define BTN_DIGI 0x140 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TOOL_PEN 0x140 #define BTN_TOOL_RUBBER 0x141 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TOOL_BRUSH 0x142 #define BTN_TOOL_PENCIL 0x143 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TOOL_AIRBRUSH 0x144 #define BTN_TOOL_FINGER 0x145 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TOOL_MOUSE 0x146 #define BTN_TOOL_LENS 0x147 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TOOL_QUINTTAP 0x148 #define BTN_TOUCH 0x14a -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_STYLUS 0x14b #define BTN_STYLUS2 0x14c +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TOOL_DOUBLETAP 0x14d #define BTN_TOOL_TRIPLETAP 0x14e -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TOOL_QUADTAP 0x14f #define BTN_WHEEL 0x150 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_GEAR_DOWN 0x150 #define BTN_GEAR_UP 0x151 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_OK 0x160 #define KEY_SELECT 0x161 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_GOTO 0x162 #define KEY_CLEAR 0x163 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_POWER2 0x164 #define KEY_OPTION 0x165 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_INFO 0x166 #define KEY_TIME 0x167 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_VENDOR 0x168 #define KEY_ARCHIVE 0x169 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PROGRAM 0x16a #define KEY_CHANNEL 0x16b -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FAVORITES 0x16c #define KEY_EPG 0x16d +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PVR 0x16e #define KEY_MHP 0x16f -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_LANGUAGE 0x170 #define KEY_TITLE 0x171 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SUBTITLE 0x172 #define KEY_ANGLE 0x173 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_ZOOM 0x174 #define KEY_MODE 0x175 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_KEYBOARD 0x176 #define KEY_SCREEN 0x177 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PC 0x178 #define KEY_TV 0x179 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_TV2 0x17a #define KEY_VCR 0x17b -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_VCR2 0x17c #define KEY_SAT 0x17d +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SAT2 0x17e #define KEY_CD 0x17f -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_TAPE 0x180 #define KEY_RADIO 0x181 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_TUNER 0x182 #define KEY_PLAYER 0x183 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_TEXT 0x184 #define KEY_DVD 0x185 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_AUX 0x186 #define KEY_MP3 0x187 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_AUDIO 0x188 #define KEY_VIDEO 0x189 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DIRECTORY 0x18a #define KEY_LIST 0x18b -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_MEMO 0x18c #define KEY_CALENDAR 0x18d +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_RED 0x18e #define KEY_GREEN 0x18f -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_YELLOW 0x190 #define KEY_BLUE 0x191 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CHANNELUP 0x192 #define KEY_CHANNELDOWN 0x193 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FIRST 0x194 #define KEY_LAST 0x195 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_AB 0x196 #define KEY_NEXT 0x197 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_RESTART 0x198 #define KEY_SLOW 0x199 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SHUFFLE 0x19a #define KEY_BREAK 0x19b -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_PREVIOUS 0x19c #define KEY_DIGITS 0x19d +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_TEEN 0x19e #define KEY_TWEN 0x19f -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_VIDEOPHONE 0x1a0 #define KEY_GAMES 0x1a1 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_ZOOMIN 0x1a2 #define KEY_ZOOMOUT 0x1a3 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_ZOOMRESET 0x1a4 #define KEY_WORDPROCESSOR 0x1a5 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_EDITOR 0x1a6 #define KEY_SPREADSHEET 0x1a7 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_GRAPHICSEDITOR 0x1a8 #define KEY_PRESENTATION 0x1a9 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DATABASE 0x1aa #define KEY_NEWS 0x1ab -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_VOICEMAIL 0x1ac #define KEY_ADDRESSBOOK 0x1ad +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_MESSENGER 0x1ae #define KEY_DISPLAYTOGGLE 0x1af -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_SPELLCHECK 0x1b0 #define KEY_LOGOFF 0x1b1 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DOLLAR 0x1b2 #define KEY_EURO 0x1b3 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FRAMEBACK 0x1b4 #define KEY_FRAMEFORWARD 0x1b5 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CONTEXT_MENU 0x1b6 #define KEY_MEDIA_REPEAT 0x1b7 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_10CHANNELSUP 0x1b8 #define KEY_10CHANNELSDOWN 0x1b9 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_IMAGES 0x1ba #define KEY_DEL_EOL 0x1c0 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DEL_EOS 0x1c1 #define KEY_INS_LINE 0x1c2 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_DEL_LINE 0x1c3 #define KEY_FN 0x1d0 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_ESC 0x1d1 #define KEY_FN_F1 0x1d2 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_F2 0x1d3 #define KEY_FN_F3 0x1d4 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_F4 0x1d5 #define KEY_FN_F5 0x1d6 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_F6 0x1d7 #define KEY_FN_F7 0x1d8 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_F8 0x1d9 #define KEY_FN_F9 0x1da +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_F10 0x1db #define KEY_FN_F11 0x1dc -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_F12 0x1dd #define KEY_FN_1 0x1de +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_2 0x1df #define KEY_FN_D 0x1e0 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_E 0x1e1 #define KEY_FN_F 0x1e2 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_FN_S 0x1e3 #define KEY_FN_B 0x1e4 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_BRL_DOT1 0x1f1 #define KEY_BRL_DOT2 0x1f2 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_BRL_DOT3 0x1f3 #define KEY_BRL_DOT4 0x1f4 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_BRL_DOT5 0x1f5 #define KEY_BRL_DOT6 0x1f6 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_BRL_DOT7 0x1f7 #define KEY_BRL_DOT8 0x1f8 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_BRL_DOT9 0x1f9 #define KEY_BRL_DOT10 0x1fa +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_NUMERIC_0 0x200 #define KEY_NUMERIC_1 0x201 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_NUMERIC_2 0x202 #define KEY_NUMERIC_3 0x203 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_NUMERIC_4 0x204 #define KEY_NUMERIC_5 0x205 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_NUMERIC_6 0x206 #define KEY_NUMERIC_7 0x207 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_NUMERIC_8 0x208 #define KEY_NUMERIC_9 0x209 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_NUMERIC_STAR 0x20a #define KEY_NUMERIC_POUND 0x20b +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KEY_CAMERA_SNAPSHOT 0x2fe #define KEY_CAMERA_FOCUS 0x210 #define KEY_WPS_BUTTON 0x211 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_TOUCHPAD_TOGGLE 0x212 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_TOUCHPAD_ON 0x213 #define KEY_TOUCHPAD_OFF 0x214 #define KEY_CAMERA_ZOOMIN 0x215 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CAMERA_ZOOMOUT 0x216 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CAMERA_UP 0x217 #define KEY_CAMERA_DOWN 0x218 #define KEY_CAMERA_LEFT 0x219 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CAMERA_RIGHT 0x21a +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0 #define BTN_TRIGGER_HAPPY2 0x2c1 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY3 0x2c2 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY4 0x2c3 #define BTN_TRIGGER_HAPPY5 0x2c4 #define BTN_TRIGGER_HAPPY6 0x2c5 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY7 0x2c6 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY8 0x2c7 #define BTN_TRIGGER_HAPPY9 0x2c8 #define BTN_TRIGGER_HAPPY10 0x2c9 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY11 0x2ca +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY12 0x2cb #define BTN_TRIGGER_HAPPY13 0x2cc #define BTN_TRIGGER_HAPPY14 0x2cd -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY15 0x2ce +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY16 0x2cf #define BTN_TRIGGER_HAPPY17 0x2d0 #define BTN_TRIGGER_HAPPY18 0x2d1 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY19 0x2d2 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY20 0x2d3 #define BTN_TRIGGER_HAPPY21 0x2d4 #define BTN_TRIGGER_HAPPY22 0x2d5 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY23 0x2d6 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY24 0x2d7 #define BTN_TRIGGER_HAPPY25 0x2d8 #define BTN_TRIGGER_HAPPY26 0x2d9 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY27 0x2da +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY28 0x2db #define BTN_TRIGGER_HAPPY29 0x2dc #define BTN_TRIGGER_HAPPY30 0x2dd -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY31 0x2de +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY32 0x2df #define BTN_TRIGGER_HAPPY33 0x2e0 #define BTN_TRIGGER_HAPPY34 0x2e1 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY35 0x2e2 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY36 0x2e3 #define BTN_TRIGGER_HAPPY37 0x2e4 #define BTN_TRIGGER_HAPPY38 0x2e5 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY39 0x2e6 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BTN_TRIGGER_HAPPY40 0x2e7 #define KEY_MIN_INTERESTING KEY_MUTE #define KEY_MAX 0x2ff -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define KEY_CNT (KEY_MAX+1) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define REL_X 0x00 #define REL_Y 0x01 #define REL_Z 0x02 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define REL_RX 0x03 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define REL_RY 0x04 #define REL_RZ 0x05 #define REL_HWHEEL 0x06 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define REL_DIAL 0x07 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define REL_WHEEL 0x08 #define REL_MISC 0x09 #define REL_MAX 0x0f -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define REL_CNT (REL_MAX+1) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_X 0x00 #define ABS_Y 0x01 #define ABS_Z 0x02 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_RX 0x03 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_RY 0x04 #define ABS_RZ 0x05 #define ABS_THROTTLE 0x06 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_RUDDER 0x07 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_WHEEL 0x08 #define ABS_GAS 0x09 #define ABS_BRAKE 0x0a -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_HAT0X 0x10 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_HAT0Y 0x11 #define ABS_HAT1X 0x12 #define ABS_HAT1Y 0x13 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_HAT2X 0x14 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_HAT2Y 0x15 #define ABS_HAT3X 0x16 #define ABS_HAT3Y 0x17 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_PRESSURE 0x18 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_DISTANCE 0x19 #define ABS_TILT_X 0x1a #define ABS_TILT_Y 0x1b -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_TOOL_WIDTH 0x1c +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_VOLUME 0x20 #define ABS_MISC 0x28 #define ABS_MT_SLOT 0x2f -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_MT_TOUCH_MAJOR 0x30 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_MT_TOUCH_MINOR 0x31 #define ABS_MT_WIDTH_MAJOR 0x32 #define ABS_MT_WIDTH_MINOR 0x33 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_MT_ORIENTATION 0x34 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_MT_POSITION_X 0x35 #define ABS_MT_POSITION_Y 0x36 #define ABS_MT_TOOL_TYPE 0x37 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_MT_BLOB_ID 0x38 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_MT_TRACKING_ID 0x39 #define ABS_MT_PRESSURE 0x3a #define ABS_MT_DISTANCE 0x3b -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_MAX 0x3f +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ABS_CNT (ABS_MAX+1) #define SW_LID 0x00 #define SW_TABLET_MODE 0x01 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SW_HEADPHONE_INSERT 0x02 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SW_RFKILL_ALL 0x03 #define SW_RADIO SW_RFKILL_ALL #define SW_MICROPHONE_INSERT 0x04 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SW_DOCK 0x05 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SW_LINEOUT_INSERT 0x06 #define SW_JACK_PHYSICAL_INSERT 0x07 #define SW_VIDEOOUT_INSERT 0x08 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SW_CAMERA_LENS_COVER 0x09 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SW_KEYPAD_SLIDE 0x0a #define SW_FRONT_PROXIMITY 0x0b #define SW_ROTATE_LOCK 0x0c -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SW_LINEIN_INSERT 0x0d -#define SW_MAX 0x0f +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SW_HPHL_OVERCURRENT 0x0e +#define SW_HPHR_OVERCURRENT 0x0f +#define SW_UNSUPPORT_INSERT 0x10 +#define SW_MAX 0x20 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SW_CNT (SW_MAX+1) #define MSC_SERIAL 0x00 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define MSC_PULSELED 0x01 #define MSC_GESTURE 0x02 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define MSC_RAW 0x03 #define MSC_SCAN 0x04 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define MSC_MAX 0x07 #define MSC_CNT (MSC_MAX+1) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define LED_NUML 0x00 #define LED_CAPSL 0x01 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define LED_SCROLLL 0x02 #define LED_COMPOSE 0x03 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define LED_KANA 0x04 #define LED_SLEEP 0x05 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define LED_SUSPEND 0x06 #define LED_MUTE 0x07 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define LED_MISC 0x08 #define LED_MAIL 0x09 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define LED_CHARGING 0x0a #define LED_MAX 0x0f +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define LED_CNT (LED_MAX+1) #define REP_DELAY 0x00 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define REP_PERIOD 0x01 #define REP_MAX 0x01 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define REP_CNT (REP_MAX+1) #define SND_CLICK 0x00 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SND_BELL 0x01 #define SND_TONE 0x02 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SND_MAX 0x07 #define SND_CNT (SND_MAX+1) -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ID_BUS 0 #define ID_VENDOR 1 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ID_PRODUCT 2 #define ID_VERSION 3 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_PCI 0x01 #define BUS_ISAPNP 0x02 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_USB 0x03 #define BUS_HIL 0x04 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_BLUETOOTH 0x05 #define BUS_VIRTUAL 0x06 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_ISA 0x10 #define BUS_I8042 0x11 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_XTKBD 0x12 #define BUS_RS232 0x13 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_GAMEPORT 0x14 #define BUS_PARPORT 0x15 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_AMIGA 0x16 #define BUS_ADB 0x17 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_I2C 0x18 #define BUS_HOST 0x19 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_GSC 0x1A #define BUS_ATARI 0x1B +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define BUS_SPI 0x1C #define MT_TOOL_FINGER 0 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define MT_TOOL_PEN 1 #define MT_TOOL_MAX 1 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_STATUS_STOPPED 0x00 #define FF_STATUS_PLAYING 0x01 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_STATUS_MAX 0x01 struct ff_replay { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 length; __u16 delay; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; struct ff_trigger { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 button; __u16 interval; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; struct ff_envelope { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 attack_length; __u16 attack_level; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 fade_length; __u16 fade_level; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; struct ff_constant_effect { -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __s16 level; struct ff_envelope envelope; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; struct ff_ramp_effect { -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __s16 start_level; __s16 end_level; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ff_envelope envelope; }; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ff_condition_effect { __u16 right_saturation; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 left_saturation; __s16 right_coeff; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __s16 left_coeff; __u16 deadband; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __s16 center; }; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ff_periodic_effect { __u16 waveform; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 period; __s16 magnitude; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __s16 offset; __u16 phase; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ff_envelope envelope; __u32 custom_len; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __s16 __user *custom_data; }; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ff_rumble_effect { __u16 strong_magnitude; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 weak_magnitude; }; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ff_effect { __u16 type; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __s16 id; __u16 direction; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ff_trigger trigger; struct ff_replay replay; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ union { struct ff_constant_effect constant; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ff_ramp_effect ramp; struct ff_periodic_effect periodic; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ff_condition_effect condition[2]; struct ff_rumble_effect rumble; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ } u; }; -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_RUMBLE 0x50 #define FF_PERIODIC 0x51 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_CONSTANT 0x52 #define FF_SPRING 0x53 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_FRICTION 0x54 #define FF_DAMPER 0x55 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_INERTIA 0x56 #define FF_RAMP 0x57 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_EFFECT_MIN FF_RUMBLE #define FF_EFFECT_MAX FF_RAMP +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_SQUARE 0x58 #define FF_TRIANGLE 0x59 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_SINE 0x5a #define FF_SAW_UP 0x5b +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_SAW_DOWN 0x5c #define FF_CUSTOM 0x5d -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_WAVEFORM_MIN FF_SQUARE #define FF_WAVEFORM_MAX FF_CUSTOM +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_GAIN 0x60 #define FF_AUTOCENTER 0x61 -/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FF_MAX 0x7f #define FF_CNT (FF_MAX+1) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #endif diff --git a/libc/kernel/common/linux/jiffies.h b/libc/kernel/common/linux/jiffies.h index c221bf487..b2452a211 100644 --- a/libc/kernel/common/linux/jiffies.h +++ b/libc/kernel/common/linux/jiffies.h @@ -26,7 +26,7 @@ #include #include /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ -#if HZ >= (12 && HZ < 24) +#if HZ >= 12 && HZ < 24 #define SHIFT_HZ 4 #elif HZ >= 24 && HZ < 48 #define SHIFT_HZ 5 @@ -91,22 +91,22 @@ #define MAX_SEC_IN_JIFFIES (SH_DIV((MAX_JIFFY_OFFSET >> SEC_JIFFIE_SC) * TICK_NSEC, NSEC_PER_SEC, 1) - 1) #endif /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ -#if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)) +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) #else #endif /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ -#if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ)) +#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) #else #endif /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ -#if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)) +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) #else #endif /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ -#if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ)) +#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) #else #endif diff --git a/libc/kernel/common/linux/ktime.h b/libc/kernel/common/linux/ktime.h index d3f167f78..4afae7a09 100644 --- a/libc/kernel/common/linux/ktime.h +++ b/libc/kernel/common/linux/ktime.h @@ -23,7 +23,7 @@ /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ typedef union { s64 tv64; -#if BITS_PER_LONG != (64 && !defined(CONFIG_KTIME_SCALAR)) +#if BITS_PER_LONG != 64 struct { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #ifdef __BIG_ENDIAN diff --git a/libc/kernel/common/linux/soundcard.h b/libc/kernel/common/linux/soundcard.h index 7159f623e..868992426 100644 --- a/libc/kernel/common/linux/soundcard.h +++ b/libc/kernel/common/linux/soundcard.h @@ -784,7 +784,7 @@ typedef struct mixer_vol_table { #define TMR_SPP 10 #define TMR_TIMESIG 11 #define LOCL_STARTAUDIO 1 -#if !defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL) || defined(USE_SEQ_MACROS) +#if !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL) || defined(USE_SEQ_MACROS) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() #define SEQ_PM_DEFINES int __foo_bar___ diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py index b8aa7755b..4c37d2c6d 100644 --- a/libc/kernel/tools/cpp.py +++ b/libc/kernel/tools/cpp.py @@ -127,71 +127,6 @@ class BadExpectedToken(Exception): def __init__(self,msg): print msg -##################################################################################### -##################################################################################### -##### ##### -##### C P P T O K E N C U R S O R ##### -##### ##### -##################################################################################### -##################################################################################### - -class TokenCursor: - """a small class to iterate over a list of Token objects""" - def __init__(self,tokens): - self.tokens = tokens - self.n = 0 - self.count = len(tokens) - - def set(self,n): - """set the current position""" - if n < 0: - n = 0 - if n > self.count: - n = self.count - self.n = n - - def peekId(self): - """retrieve the id of the current token""" - if (self.n >= self.count): - return None - return self.tokens[self.n].id - - def peek(self): - """retrieve the current token. does not change position""" - if (self.n >= self.count): - return None - return self.tokens[self.n] - - def skip(self): - """increase current token position""" - if (self.n < self.count): - self.n += 1 - - def skipSpaces(self): - """skip over all space tokens, this includes tokSPACE and tokLN""" - while 1: - tok = self.peekId() - if tok != tokSPACE and tok != tokLN: - break - self.skip() - - def skipIfId(self,id): - """skip an optional token""" - if self.peekId() == id: - self.skip() - - def expectId(self,id): - """raise an exception if the current token hasn't a given id. - otherwise skip over it""" - tok = self.peek() - if tok.id != id: - raise BadExpectedToken, "%d:%d: '%s' expected, received '%s'" % (tok.lineno, tok.colno, id, tok.id) - self.skip() - - def remain(self): - """return the list of remaining tokens""" - return self.tokens[self.n:] - ##################################################################################### ##################################################################################### @@ -346,7 +281,6 @@ def nextRealToken(self,tok): while 1: c = self.nextChar() if c == tokEOF: - #print "## EOF after '%s'" % value return tok.set(tokEOF,value) if c == '/' and prev_c == '*': break @@ -354,7 +288,6 @@ def nextRealToken(self,tok): value += c value += "/" - #print "## COMMENT: '%s'" % value return tok.set(tokSPACE,value) c = '/' @@ -567,7 +500,6 @@ def expectList(self,list): self.expect(item) def test_CppTokenizer(): - print "running CppTokenizer tests" tester = CppTokenizerTester() tester.setTokenizer( CppLineTokenizer("#an/example && (01923_xy)") ) @@ -616,343 +548,6 @@ def test_CppTokenizer(): ##################################################################################### ##################################################################################### -# Cpp expressions are modeled by tuples of the form (op,arg) or (op,arg1,arg2), etc.. -# op is an "operator" string - -class Expr: - """a class used to model a CPP expression""" - opInteger = "int" - opIdent = "ident" - opCall = "call" - opDefined = "defined" - opTest = "?" - opLogicNot = "!" - opNot = "~" - opNeg = "[-]" - opUnaryPlus = "[+]" - opAdd = "+" - opSub = "-" - opMul = "*" - opDiv = "/" - opMod = "%" - opAnd = "&" - opOr = "|" - opXor = "^" - opLogicAnd = "&&" - opLogicOr = "||" - opEqual = "==" - opNotEqual = "!=" - opLess = "<" - opLessEq = "<=" - opGreater = ">" - opGreaterEq = ">=" - opShl = "<<" - opShr = ">>" - - unaries = [ opLogicNot, opNot, opNeg, opUnaryPlus ] - binaries = [ opAdd, opSub, opMul, opDiv, opMod, opAnd, opOr, opXor, opLogicAnd, opLogicOr, - opEqual, opNotEqual, opLess, opLessEq, opGreater, opGreaterEq ] - - precedences = { - opTest: 0, - opLogicOr: 1, - opLogicNot: 2, - opOr : 3, - opXor: 4, - opAnd: 5, - opEqual: 6, opNotEqual: 6, - opLess:7, opLessEq:7, opGreater:7, opGreaterEq:7, - opShl:8, opShr:8, - opAdd:9, opSub:9, - opMul:10, opDiv:10, opMod:10, - opLogicNot:11, - opNot: 12, - } - - def __init__(self,op): - self.op = op - - def __repr__(self): - return "(%s)" % self.op - - def __str__(self): - return "operator(%s)" % self.op - - def precedence(self): - """return the precedence of a given operator""" - return Expr.precedences.get(self.op, 1000) - - def isUnary(self): - return self.op in Expr.unaries - - def isBinary(self): - return self.op in Expr.binaries - - def isDefined(self): - return self.op is opDefined - - def toInt(self): - """return the integer value of a given expression. only valid for integer expressions - will return None otherwise""" - return None - -class IntExpr(Expr): - def __init__(self,value): - Expr.__init__(self,opInteger) - self.arg = value - - def __repr__(self): - return "(int %s)" % self.arg - - def __str__(self): - return self.arg - - def toInt(self): - s = self.arg # string value - # get rid of U or L suffixes - while len(s) > 0 and s[-1] in "LUlu": - s = s[:-1] - return string.atoi(s) - -class IdentExpr(Expr): - def __init__(self,name): - Expr.__init__(self,opIdent) - self.name = name - - def __repr__(self): - return "(ident %s)" % self.name - - def __str__(self): - return self.name - -class CallExpr(Expr): - def __init__(self,funcname,params): - Expr.__init__(self,opCall) - self.funcname = funcname - self.params = params - - def __repr__(self): - result = "(call %s [" % self.funcname - comma = "" - for param in self.params: - result += "%s%s" % (comma, repr(param)) - comma = "," - result += "])" - return result - - def __str__(self): - result = "%s(" % self.funcname - comma = "" - for param in self.params: - result += "%s%s" % (comma, str(param)) - comma = "," - - result += ")" - return result - -class TestExpr(Expr): - def __init__(self,cond,iftrue,iffalse): - Expr.__init__(self,opTest) - self.cond = cond - self.iftrue = iftrue - self.iffalse = iffalse - - def __repr__(self): - return "(?: %s %s %s)" % (repr(self.cond),repr(self.iftrue),repr(self.iffalse)) - - def __str__(self): - return "(%s) ? (%s) : (%s)" % (self.cond, self.iftrue, self.iffalse) - -class SingleArgExpr(Expr): - def __init__(self,op,arg): - Expr.__init__(self,op) - self.arg = arg - - def __repr__(self): - return "(%s %s)" % (self.op, repr(self.arg)) - -class DefinedExpr(SingleArgExpr): - def __init__(self,op,macroname): - SingleArgExpr.__init__(self.opDefined,macroname) - - def __str__(self): - return "defined(%s)" % self.arg - - -class UnaryExpr(SingleArgExpr): - def __init__(self,op,arg,opstr=None): - SingleArgExpr.__init__(self,op,arg) - if not opstr: - opstr = op - self.opstr = opstr - - def __str__(self): - arg_s = str(self.arg) - arg_prec = self.arg.precedence() - self_prec = self.precedence() - if arg_prec < self_prec: - return "%s(%s)" % (self.opstr,arg_s) - else: - return "%s%s" % (self.opstr, arg_s) - -class TwoArgExpr(Expr): - def __init__(self,op,arg1,arg2): - Expr.__init__(self,op) - self.arg1 = arg1 - self.arg2 = arg2 - - def __repr__(self): - return "(%s %s %s)" % (self.op, repr(self.arg1), repr(self.arg2)) - -class BinaryExpr(TwoArgExpr): - def __init__(self,op,arg1,arg2,opstr=None): - TwoArgExpr.__init__(self,op,arg1,arg2) - if not opstr: - opstr = op - self.opstr = opstr - - def __str__(self): - arg1_s = str(self.arg1) - arg2_s = str(self.arg2) - arg1_prec = self.arg1.precedence() - arg2_prec = self.arg2.precedence() - self_prec = self.precedence() - - result = "" - if arg1_prec < self_prec: - result += "(%s)" % arg1_s - else: - result += arg1_s - - result += " %s " % self.opstr - - if arg2_prec < self_prec: - result += "(%s)" % arg2_s - else: - result += arg2_s - - return result - -##################################################################################### -##################################################################################### -##### ##### -##### C P P E X P R E S S I O N P A R S E R ##### -##### ##### -##################################################################################### -##################################################################################### - - -class ExprParser: - """a class used to convert a list of tokens into a cpp Expr object""" - - re_octal = re.compile(r"\s*\(0[0-7]+\).*") - re_decimal = re.compile(r"\s*\(\d+[ulUL]*\).*") - re_hexadecimal = re.compile(r"\s*\(0[xX][0-9a-fA-F]*\).*") - - def __init__(self,tokens): - self.tok = tokens - self.n = len(self.tok) - self.i = 0 - - def mark(self): - return self.i - - def release(self,pos): - self.i = pos - - def peekId(self): - if self.i < self.n: - return self.tok[self.i].id - return None - - def peek(self): - if self.i < self.n: - return self.tok[self.i] - return None - - def skip(self): - if self.i < self.n: - self.i += 1 - - def skipOptional(self,id): - if self.i < self.n and self.tok[self.i].id == id: - self.i += 1 - - def skipSpaces(self): - i = self.i - n = self.n - tok = self.tok - while i < n and (tok[i] == tokSPACE or tok[i] == tokLN): - i += 1 - self.i = i - - # all the isXXX functions returns a (expr,nextpos) pair if a match is found - # or None if not - - def is_integer(self): - id = self.tok[self.i].id - c = id[0] - if c < '0' or c > '9': - return None - - m = ExprParser.re_octal.match(id) - if m: - return (IntExpr(id), m.end(1)) - - m = ExprParser.re_decimal.match(id) - if m: - return (IntExpr(id), m.end(1)) - - m = ExprParser.re_hexadecimal(id) - if m: - return (IntExpr(id), m.end(1)) - - return None - - def is_defined(self): - id = self.tok[self.i].id - if id != "defined": - return None - - pos = self.mark() - - use_paren = 0 - if self.peekId() == tokLPAREN: - self.skip() - use_paren = 1 - - if self.peekId() != tokIDENT: - self.throw( BadExpectedToken, "identifier expected") - - macroname = self.peek().value - self.skip() - if use_paren: - self.skipSpaces() - if self.peekId() != tokRPAREN: - self.throw( BadExpectedToken, "missing right-paren after 'defined' directive") - self.skip() - - i = self.i - return (DefinedExpr(macroname),i+1) - - def is_call_or_ident(self): - pass - - def parse(self, i): - return None - -##################################################################################### -##################################################################################### -##### ##### -##### C P P E X P R E S S I O N S ##### -##### ##### -##################################################################################### -##################################################################################### - -class CppInvalidExpression(Exception): - """an exception raised when an invalid/unsupported cpp expression is detected""" - pass - class CppExpr: """a class that models the condition of #if directives into an expression tree. each node in the tree is of the form (op,arg) or (op,arg1,arg2) @@ -973,69 +568,70 @@ class CppExpr: "!":11, "~":12 } + re_cpp_constant = re.compile(r"((\d|\w|_)+)") + def __init__(self, tokens): """initialize a CppExpr. 'tokens' must be a CppToken list""" self.tok = tokens self.n = len(tokens) + self.i = 0 if debugCppExpr: print "CppExpr: trying to parse %s" % repr(tokens) - expr = self.is_expr(0) + self.expr = self.parseExpression(0) if debugCppExpr: - print "CppExpr: got " + repr(expr) - self.expr = expr[0] + print "CppExpr: got " + repr(self.expr) + if self.i != self.n: + print 'crap at end of input (%d != %d)' % (self.i, self.n) + raise - re_cpp_constant = re.compile(r"((\d|\w|_)+)") - def throw(self,exception,i,msg): - if i < self.n: - tok = self.tok[i] + def throw(self, exception, msg): + if self.i < self.n: + tok = self.tok[self.i] print "%d:%d: %s" % (tok.lineno,tok.colno,msg) else: print "EOF: %s" % msg - raise exception + raise exception(msg) - def skip_spaces(self,i): + + def skip_spaces(self): """skip spaces in input token list""" - while i < self.n: - t = self.tok[i] + while self.i < self.n: + t = self.tok[self.i] if t.id != tokSPACE and t.id != tokLN: break - i += 1 - return i + self.i += 1 - def expectId(self,i,id): + + def expectId(self, id): """check that a given token id is at the current position, then skip over it""" - i = self.skip_spaces(i) - if i >= self.n or self.tok[i].id != id: - self.throw(BadExpectedToken,i,"### expecting '%s' in expression, got '%s'" % (id, self.tok[i].id)) - return i+1 - - def expectIdent(self,i): - i = self.skip_spaces(i) - if i >= self.n or self.tok[i].id != tokIDENT: - self.throw(BadExpectedToken,i,"### expecting identifier in expression, got '%s'" % (id, self.tok[i].id)) - return i+1 - - # the is_xxxxx function returns either None or a pair (e,nextpos) - # where 'e' is an expression tuple (e.g. (op,arg)) and 'nextpos' is - # the corresponding next position in the input token list - # - - def is_decimal(self,i): - v = self.tok[i].value[:] + self.skip_spaces() + if self.i >= self.n or self.tok[self.i].id != id: + self.throw(BadExpectedToken,self.i,"### expecting '%s' in expression, got '%s'" % (id, self.tok[self.i].id)) + self.i += 1 + + + def expectIdent(self): + self.skip_spaces() + if self.i >= self.n or self.tok[self.i].id != tokIDENT: + self.throw(BadExpectedToken, self.i,"### expecting identifier in expression, got '%s'" % (id, self.tok[self.i].id)) + self.i += 1 + + + def is_decimal(self): + v = self.tok[self.i].value[:] while len(v) > 0 and v[-1] in "ULul": v = v[:-1] for digit in v: if not digit.isdigit(): return None - # for an integer expression tuple, the argument - # is simply the value as an integer - val = string.atoi(v) - return ("int", val), i+1 + self.i += 1 + return ("int", string.atoi(v)) - def is_hexadecimal(self,i): - v = self.tok[i].value[:] + + def is_hexadecimal(self): + v = self.tok[self.i].value[:] while len(v) > 0 and v[-1] in "ULul": v = v[:-1] if len(v) > 2 and (v[0:2] == "0x" or v[0:2] == "0X"): @@ -1043,217 +639,186 @@ def is_hexadecimal(self,i): if not digit in "0123456789abcdefABCDEF": return None - # for an hex expression tuple, the argument + # for a hex expression tuple, the argument # is the value as an integer - val = int(v[2:], 16) - return ("hex", val), i+1 + self.i += 1 + return ("hex", int(v[2:], 16)) return None - def is_integer(self,i): - if self.tok[i].id != tokNUMBER: + + def is_integer(self): + if self.tok[self.i].id != tokNUMBER: return None - c = self.is_decimal(i) + c = self.is_decimal() if c: return c - c = self.is_hexadecimal(i) + c = self.is_hexadecimal() if c: return c return None - def is_number(self,i): - t = self.tok[i] - if t.id == tokMINUS and i+1 < self.n: - c = self.is_integer(i+1) + + def is_number(self): + t = self.tok[self.i] + if t.id == tokMINUS and self.i+1 < self.n: + self.i += 1 + c = self.is_integer() if c: - e, i2 = c - op, val = e - return (op, -val), i2 - if t.id == tokPLUS and i+1 < self.n: - c = self.is_integer(i+1) + op, val = c + return (op, -val) + if t.id == tokPLUS and self.i+1 < self.n: + c = self.is_integer() if c: return c - return self.is_integer(i) - + return self.is_integer() - def is_alnum(self,i): - """test wether a given token is alpha-numeric""" - i = self.skip_spaces(i) - if i >= self.n: - return None - t = self.tok[i] - m = CppExpr.re_cpp_constant.match(t.id) - if m: - #print "... alnum '%s'" % m.group(1) - r = m.group(1) - return ("ident", r), i+1 - return None - def is_defined(self,i): - t = self.tok[i] + def is_defined(self): + t = self.tok[self.i] if t.id != tokDEFINED: return None # we have the defined keyword, check the rest - i = self.skip_spaces(i+1) + self.i += 1 + self.skip_spaces() use_parens = 0 - if i < self.n and self.tok[i].id == tokLPAREN: + if self.i < self.n and self.tok[self.i].id == tokLPAREN: use_parens = 1 - i = self.skip_spaces(i+1) + self.i += 1 + self.skip_spaces() - if i >= self.n: + if self.i >= self.n: self.throw(CppConstantExpected,i,"### 'defined' must be followed by macro name or left paren") - t = self.tok[i] + t = self.tok[self.i] if t.id != tokIDENT: self.throw(CppConstantExpected,i,"### 'defined' must be followed by macro name") - i += 1 + self.i += 1 if use_parens: - i = self.expectId(i,tokRPAREN) + self.expectId(tokRPAREN) - return ("defined",t.value), i + return ("defined", t.value) - def is_call_or_ident(self,i): - i = self.skip_spaces(i) - if i >= self.n: + def is_call_or_ident(self): + self.skip_spaces() + if self.i >= self.n: return None - t = self.tok[i] + t = self.tok[self.i] if t.id != tokIDENT: return None name = t.value - i = self.skip_spaces(i+1) - if i >= self.n or self.tok[i].id != tokLPAREN: - return ("ident", name), i + self.i += 1 + self.skip_spaces() + if self.i >= self.n or self.tok[self.i].id != tokLPAREN: + return ("ident", name) params = [] depth = 1 - i += 1 - j = i - while i < self.n: - id = self.tok[i].id + self.i += 1 + j = self.i + while self.i < self.n: + id = self.tok[self.i].id if id == tokLPAREN: depth += 1 elif depth == 1 and (id == tokCOMMA or id == tokRPAREN): - while j < i and self.tok[j].id == tokSPACE: + while j < self.i and self.tok[j].id == tokSPACE: j += 1 - k = i + k = self.i while k > j and self.tok[k-1].id == tokSPACE: k -= 1 param = self.tok[j:k] - params.append( param ) + params.append(param) if id == tokRPAREN: break - j = i+1 + j = self.i+1 elif id == tokRPAREN: depth -= 1 - i += 1 + self.i += 1 - if i >= self.n: + if self.i >= self.n: return None - return ("call", (name, params)), i+1 - - def is_token(self,i,token): - i = self.skip_spaces(i) - if i >= self.n or self.tok[i].id != token: - return None - return token, i+1 + self.i += 1 + return ("call", (name, params)) - def is_value(self,i): - t = self.tok[i] - if t.id == tokSTRING: - return ("string", t.value), i+1 + # Implements the "precedence climbing" algorithm from http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm. + # The "classic" algorithm would be fine if we were using a tool to generate the parser, but we're not. + # Dijkstra's "shunting yard" algorithm hasn't been necessary yet. + def parseExpression(self, minPrecedence): + self.skip_spaces() + if self.i >= self.n: + return None - c = self.is_number(i) - if c: return c + node = self.parsePrimary() + while self.token() != None and self.isBinary(self.token()) and self.precedence(self.token()) >= minPrecedence: + op = self.token() + self.nextToken() + rhs = self.parseExpression(self.precedence(op) + 1) + node = (op.id, node, rhs) + + return node + + + def parsePrimary(self): + op = self.token() + if self.isUnary(op): + self.nextToken() + return (op.id, self.parseExpression(self.precedence(op))) + + primary = None + if op.id == tokLPAREN: + self.nextToken() + primary = self.parseExpression(0) + self.expectId(tokRPAREN) + elif op.id == tokNUMBER: + primary = self.is_number() + elif op.id == tokIDENT: + primary = self.is_call_or_ident() + elif op.id == tokDEFINED: + primary = self.is_defined() + else: + self.throw(BadExpectedToken, "didn't expect to see a %s in factor" % (self.tok[self.i].id)) - c = self.is_defined(i) - if c: return c + self.skip_spaces() - c = self.is_call_or_ident(i) - if c: return c + return primary; - i = self.skip_spaces(i) - if i >= self.n or self.tok[i].id != tokLPAREN: - return None - popcount = 1 - i2 = i+1 - while i2 < self.n: - t = self.tok[i2] - if t.id == tokLPAREN: - popcount += 1 - elif t.id == tokRPAREN: - popcount -= 1 - if popcount == 0: - break - i2 += 1 + def isBinary(self, token): + return token.id in self.binaries - if popcount != 0: - self.throw(CppInvalidExpression, i, "expression missing closing parenthesis") - if debugCppExpr: - print "CppExpr: trying to parse sub-expression %s" % repr(self.tok[i+1:i2]) - oldcount = self.n - self.n = i2 - c = self.is_expr(i+1) - self.n = oldcount - if not c: - self.throw(CppInvalidExpression, i, "invalid expression within parenthesis") - - e, i = c - return e, i2+1 - - def is_unary(self,i): - i = self.skip_spaces(i) - if i >= self.n: - return None + def isUnary(self, token): + return token.id in self.unaries - t = self.tok[i] - if t.id in CppExpr.unaries: - c = self.is_unary(i+1) - if not c: - self.throw(CppInvalidExpression, i, "%s operator must be followed by value" % t.id) - e, i = c - return (t.id, e), i - return self.is_value(i) + def precedence(self, token): + return self.precedences.get(token.id) - def is_binary(self,i): - i = self.skip_spaces(i) - if i >= self.n: - return None - c = self.is_unary(i) - if not c: + def token(self): + if self.i >= self.n: return None + return self.tok[self.i] - e1, i2 = c - i2 = self.skip_spaces(i2) - if i2 >= self.n: - return c - t = self.tok[i2] - if t.id in CppExpr.binaries: - c = self.is_binary(i2+1) - if not c: - self.throw(CppInvalidExpression, i,"### %s operator must be followed by value" % t.id ) - e2, i3 = c - return (t.id, e1, e2), i3 - - return None + def nextToken(self): + self.i += 1 + self.skip_spaces() + if self.i >= self.n: + return None + return self.tok[self.i] - def is_expr(self,i): - return self.is_binary(i) - def dump_node(self,e): + def dump_node(self, e): op = e[0] line = "(" + op if op == "int": @@ -1287,7 +852,7 @@ def dump_node(self,e): def __repr__(self): return self.dump_node(self.expr) - def source_node(self,e): + def source_node(self, e): op = e[0] if op == "int": return "%d" % e[1] @@ -1337,10 +902,10 @@ def int_node(self,e): def toInt(self): return self.int_node(self.expr) - def optimize_node(self,e,macros={}): + def optimize_node(self, e, macros={}): op = e[0] if op == "defined": - name = e[1] + op, name = e if macros.has_key(name): if macros[name] == kCppUndefinedMacro: return ("int", 0) @@ -1350,6 +915,19 @@ def optimize_node(self,e,macros={}): if kernel_remove_config_macros and name.startswith("CONFIG_"): return ("int", 0) + return e + + elif op == "ident": + op, name = e + if macros.has_key(name): + try: + value = int(macros[name]) + expanded = ("int", value) + except: + expanded = ("ident", macros[name]) + return self.optimize_node(expanded, macros) + return e + elif op == "!": op, v = e v = self.optimize_node(v, macros) @@ -1358,6 +936,7 @@ def optimize_node(self,e,macros={}): return ("int", 1) else: return ("int", 0) + return ('!', v) elif op == "&&": op, l, r = e @@ -1370,6 +949,12 @@ def optimize_node(self,e,macros={}): return ("int", 0) else: return r + elif ri != None: + if ri == 0: + return ("int", 0) + else: + return l + return (op, l, r) elif op == "||": op, l, r = e @@ -1387,41 +972,13 @@ def optimize_node(self,e,macros={}): return l else: return ("int", 1) - return e - - def optimize(self,macros={}): - self.expr = self.optimize_node(self.expr,macros) - - def removePrefixedNode(self,e,prefix,names): - op = e[0] - if op == "defined": - name = e[1] - if name.startswith(prefix): - if names.has_key[name] and names[name] == "y": - return ("int", 1) - else: - return ("int", 0) - - elif op in CppExpr.unaries: - op, v = e - v = self.removePrefixedNode(v,prefix,names) - return (op, v) - elif op in CppExpr.binaries: - op, v1, v2 = e - v1 = self.removePrefixedNode(v1,prefix,names) - v2 = self.removePrefixedNode(v2,prefix,names) - return (op, v1, v2) - elif op == "call": - func, params = e[1] - params2 = [] - for param in params: - params2.append( self.removePrefixedNode(param,prefix,names) ) - return (op, (func, params2)) + return (op, l, r) - return e + else: + return e - def removePrefixed(self,prefix,names={}): - self.expr = self.removePrefixedNode(self.expr,prefix,names) + def optimize(self,macros={}): + self.expr = self.optimize_node(self.expr, macros) def is_equal_node(self,e1,e2): if e1[0] != e2[0] or len(e1) != len(e2): @@ -1438,85 +995,97 @@ def is_equal(self,other): def test_cpp_expr(expr, expected): e = CppExpr( CppLineTokenizer( expr ).toTokenList() ) - #print repr(e.expr) s1 = repr(e) if s1 != expected: - print "KO: expression '%s' generates '%s', should be '%s'" % (expr, s1, expected) - else: - #print "OK: expression '%s'" % expr - pass + print "[FAIL]: expression '%s' generates '%s', should be '%s'" % (expr, s1, expected) + global failure_count + failure_count += 1 def test_cpp_expr_optim(expr, expected, macros={}): e = CppExpr( CppLineTokenizer( expr ).toTokenList() ) e.optimize(macros) - s1 = repr(e) if s1 != expected: - print "KO: optimized expression '%s' generates '%s', should be '%s'" % (expr, s1, expected) - else: - #print "OK: optmized expression '%s'" % expr - pass + print "[FAIL]: optimized expression '%s' generates '%s' with macros %s, should be '%s'" % (expr, s1, macros, expected) + global failure_count + failure_count += 1 def test_cpp_expr_source(expr, expected): e = CppExpr( CppLineTokenizer( expr ).toTokenList() ) s1 = str(e) if s1 != expected: - print "KO: source expression '%s' generates '%s', should be '%s'" % (expr, s1, expected) - else: - #print "OK: source expression '%s'" % expr - pass + print "[FAIL]: source expression '%s' generates '%s', should be '%s'" % (expr, s1, expected) + global failure_count + failure_count += 1 def test_CppExpr(): - print "testing CppExpr" - test_cpp_expr( "0", "(int 0)" ) - test_cpp_expr( "1", "(int 1)" ) - test_cpp_expr( "1 && 1", "(&& (int 1) (int 1))" ) - test_cpp_expr( "1 && 0", "(&& (int 1) (int 0))" ) - test_cpp_expr( "EXAMPLE", "(ident EXAMPLE)" ) - test_cpp_expr( "EXAMPLE - 3", "(- (ident EXAMPLE) (int 3))" ) - test_cpp_expr( "defined(EXAMPLE)", "(defined EXAMPLE)" ) - test_cpp_expr( "!defined(EXAMPLE)", "(! (defined EXAMPLE))" ) - test_cpp_expr( "defined(ABC) || defined(BINGO)", "(|| (defined ABC) (defined BINGO))" ) - test_cpp_expr( "FOO(BAR)", "(call FOO [BAR])" ) - - test_cpp_expr_optim( "0", "(int 0)" ) - test_cpp_expr_optim( "1", "(int 1)" ) - test_cpp_expr_optim( "1 && 1", "(int 1)" ) - test_cpp_expr_optim( "1 && 0", "(int 0)" ) - test_cpp_expr_optim( "0 && 1", "(int 0)" ) - test_cpp_expr_optim( "0 && 0", "(int 0)" ) - test_cpp_expr_optim( "1 || 1", "(int 1)" ) - test_cpp_expr_optim( "1 || 0", "(int 1)" ) - test_cpp_expr_optim( "0 || 1", "(int 1)" ) - test_cpp_expr_optim( "0 || 0", "(int 0)" ) - test_cpp_expr_optim( "EXAMPLE", "(ident EXAMPLE)" ) - test_cpp_expr_optim( "EXAMPLE - 3", "(- (ident EXAMPLE) (int 3))" ) - test_cpp_expr_optim( "defined(EXAMPLE)", "(defined EXAMPLE)" ) - test_cpp_expr_optim( "defined(EXAMPLE)", "(int 1)", { "EXAMPLE": "XOWOE" } ) - test_cpp_expr_optim( "defined(EXAMPLE)", "(int 0)", { "EXAMPLE": kCppUndefinedMacro} ) - test_cpp_expr_optim( "!defined(EXAMPLE)", "(! (defined EXAMPLE))" ) - test_cpp_expr_optim( "!defined(EXAMPLE)", "(int 0)", { "EXAMPLE" : "XOWOE" } ) - test_cpp_expr_optim( "!defined(EXAMPLE)", "(int 1)", { "EXAMPLE" : kCppUndefinedMacro } ) - test_cpp_expr_optim( "defined(ABC) || defined(BINGO)", "(|| (defined ABC) (defined BINGO))" ) - test_cpp_expr_optim( "defined(ABC) || defined(BINGO)", "(int 1)", { "ABC" : "1" } ) - test_cpp_expr_optim( "defined(ABC) || defined(BINGO)", "(int 1)", { "BINGO" : "1" } ) - test_cpp_expr_optim( "defined(ABC) || defined(BINGO)", "(defined ABC)", { "BINGO" : kCppUndefinedMacro } ) - test_cpp_expr_optim( "defined(ABC) || defined(BINGO)", "(int 0)", { "ABC" : kCppUndefinedMacro, "BINGO" : kCppUndefinedMacro } ) - - test_cpp_expr_source( "0", "0" ) - test_cpp_expr_source( "1", "1" ) - test_cpp_expr_source( "1 && 1", "1 && 1" ) - test_cpp_expr_source( "1 && 0", "1 && 0" ) - test_cpp_expr_source( "0 && 1", "0 && 1" ) - test_cpp_expr_source( "0 && 0", "0 && 0" ) - test_cpp_expr_source( "1 || 1", "1 || 1" ) - test_cpp_expr_source( "1 || 0", "1 || 0" ) - test_cpp_expr_source( "0 || 1", "0 || 1" ) - test_cpp_expr_source( "0 || 0", "0 || 0" ) - test_cpp_expr_source( "EXAMPLE", "EXAMPLE" ) - test_cpp_expr_source( "EXAMPLE - 3", "EXAMPLE - 3" ) - test_cpp_expr_source( "defined(EXAMPLE)", "defined(EXAMPLE)" ) - test_cpp_expr_source( "defined EXAMPLE", "defined(EXAMPLE)" ) + test_cpp_expr("0", "(int 0)") + test_cpp_expr("1", "(int 1)") + test_cpp_expr("(0)", "(int 0)") + test_cpp_expr("1 && 1", "(&& (int 1) (int 1))") + test_cpp_expr("1 && 0", "(&& (int 1) (int 0))") + test_cpp_expr("EXAMPLE", "(ident EXAMPLE)") + test_cpp_expr("EXAMPLE - 3", "(- (ident EXAMPLE) (int 3))") + test_cpp_expr("defined(EXAMPLE)", "(defined EXAMPLE)") + test_cpp_expr("defined ( EXAMPLE ) ", "(defined EXAMPLE)") + test_cpp_expr("!defined(EXAMPLE)", "(! (defined EXAMPLE))") + test_cpp_expr("defined(ABC) || defined(BINGO)", "(|| (defined ABC) (defined BINGO))") + test_cpp_expr("FOO(BAR)", "(call FOO [BAR])") + test_cpp_expr("A == 1 || defined(B)", "(|| (== (ident A) (int 1)) (defined B))") + + test_cpp_expr_optim("0", "(int 0)") + test_cpp_expr_optim("1", "(int 1)") + test_cpp_expr_optim("1 && 1", "(int 1)") + test_cpp_expr_optim("1 && 0", "(int 0)") + test_cpp_expr_optim("0 && 1", "(int 0)") + test_cpp_expr_optim("0 && 0", "(int 0)") + test_cpp_expr_optim("1 || 1", "(int 1)") + test_cpp_expr_optim("1 || 0", "(int 1)") + test_cpp_expr_optim("0 || 1", "(int 1)") + test_cpp_expr_optim("0 || 0", "(int 0)") + test_cpp_expr_optim("A", "(ident A)") + test_cpp_expr_optim("A", "(int 1)", { "A": 1 }) + test_cpp_expr_optim("A || B", "(int 1)", { "A": 1 }) + test_cpp_expr_optim("A || B", "(int 1)", { "B": 1 }) + test_cpp_expr_optim("A && B", "(ident B)", { "A": 1 }) + test_cpp_expr_optim("A && B", "(ident A)", { "B": 1 }) + test_cpp_expr_optim("A && B", "(&& (ident A) (ident B))") + test_cpp_expr_optim("EXAMPLE", "(ident EXAMPLE)") + test_cpp_expr_optim("EXAMPLE - 3", "(- (ident EXAMPLE) (int 3))") + test_cpp_expr_optim("defined(EXAMPLE)", "(defined EXAMPLE)") + test_cpp_expr_optim("defined(EXAMPLE)", "(defined XOWOE)", { "EXAMPLE": "XOWOE" }) + test_cpp_expr_optim("defined(EXAMPLE)", "(int 0)", { "EXAMPLE": kCppUndefinedMacro}) + test_cpp_expr_optim("!defined(EXAMPLE)", "(! (defined EXAMPLE))") + test_cpp_expr_optim("!defined(EXAMPLE)", "(! (defined XOWOE))", { "EXAMPLE" : "XOWOE" }) + test_cpp_expr_optim("!defined(EXAMPLE)", "(int 1)", { "EXAMPLE" : kCppUndefinedMacro }) + test_cpp_expr_optim("defined(A) || defined(B)", "(|| (defined A) (defined B))") + test_cpp_expr_optim("defined(A) || defined(B)", "(int 1)", { "A" : "1" }) + test_cpp_expr_optim("defined(A) || defined(B)", "(int 1)", { "B" : "1" }) + test_cpp_expr_optim("defined(A) || defined(B)", "(defined A)", { "B" : kCppUndefinedMacro }) + test_cpp_expr_optim("defined(A) || defined(B)", "(int 0)", { "A" : kCppUndefinedMacro, "B" : kCppUndefinedMacro }) + test_cpp_expr_optim("defined(A) && defined(B)", "(&& (defined A) (defined B))") + test_cpp_expr_optim("defined(A) && defined(B)", "(defined B)", { "A" : "1" }) + test_cpp_expr_optim("defined(A) && defined(B)", "(defined A)", { "B" : "1" }) + test_cpp_expr_optim("defined(A) && defined(B)", "(int 0)", { "B" : kCppUndefinedMacro }) + test_cpp_expr_optim("defined(A) && defined(B)", "(int 0)", { "A" : kCppUndefinedMacro }) + test_cpp_expr_optim("A == 1 || defined(B)", "(|| (== (ident A) (int 1)) (defined B))" ) + test_cpp_expr_optim("defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)", "(|| (! (defined __GLIBC__)) (< (ident __GLIBC__) (int 2)))", { "__KERNEL__": kCppUndefinedMacro }) + + test_cpp_expr_source("0", "0") + test_cpp_expr_source("1", "1") + test_cpp_expr_source("1 && 1", "1 && 1") + test_cpp_expr_source("1 && 0", "1 && 0") + test_cpp_expr_source("0 && 1", "0 && 1") + test_cpp_expr_source("0 && 0", "0 && 0") + test_cpp_expr_source("1 || 1", "1 || 1") + test_cpp_expr_source("1 || 0", "1 || 0") + test_cpp_expr_source("0 || 1", "0 || 1") + test_cpp_expr_source("0 || 0", "0 || 0") + test_cpp_expr_source("EXAMPLE", "EXAMPLE") + test_cpp_expr_source("EXAMPLE - 3", "EXAMPLE - 3") + test_cpp_expr_source("defined(EXAMPLE)", "defined(EXAMPLE)") + test_cpp_expr_source("defined EXAMPLE", "defined(EXAMPLE)") + test_cpp_expr_source("A == 1 || defined(B)", "A == 1 || defined(B)") ##################################################################################### @@ -1588,7 +1157,6 @@ def isInclude(self): if self.directive != "include": return None - #print "iii " + repr(self.tokens) if self.tokens[0].id == tokSTRING: # a double-quote include, that's easy return self.tokens[0].value @@ -1637,15 +1205,12 @@ def removeWhiteSpace(self): if tok.id == tokLN: old_line = line old_space = space - #print "N line=%d space=%d ii=%d" % (line, space, ii) ii += 1 line = ii space = -1 if old_space == old_line: # line only contains spaces - #print "-s" continue if ii-1 == old_line: # line is empty - #print "-e" continue tokens.append(tok) continue @@ -1773,11 +1338,6 @@ def removeMacroDefines(self,macros): """remove known macro definitions from a BlockList""" self.blocks = remove_macro_defines(self.blocks,macros) - def removePrefixed(self,prefix,names): - for b in self.blocks: - if b.isIf(): - b.expr.removePrefixed(prefix,names) - def removeWhiteSpace(self): for b in self.blocks: b.removeWhiteSpace() @@ -1877,7 +1437,6 @@ def removeVarsAndFuncs(self,knownStatics=set()): # Is it a new type definition, then start recording it if tok.value in [ 'struct', 'typedef', 'enum', 'union', '__extension__' ]: - #print "$$$ keep type declr" + repr(b.tokens[i:]) state = 1 i = i+1 continue @@ -2221,6 +1780,14 @@ def test_optimizeAll(): #define GOOD_3 #endif +#if defined(__KERNEL__) +#define BAD_KERNEL +#endif + +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) +#define X +#endif + #if 0 #if 1 #define BAD_6 @@ -2235,41 +1802,40 @@ def test_optimizeAll(): #define GOOD_3 + +#if !defined(__GLIBC__) || __GLIBC__ < 2 +#define X +#endif + """ - print "running test_BlockList.optimizeAll" out = StringOutput() lines = string.split(text, '\n') list = BlockParser().parse( CppLinesTokenizer(lines) ) #D_setlevel(2) list.optimizeAll( {"__KERNEL__":kCppUndefinedMacro} ) - #print repr(list) list.write(out) if out.get() != expected: - print "KO: macro optimization failed\n" + print "[FAIL]: macro optimization failed\n" print "<<<< expecting '", print expected, print "'\n>>>> result '" print out.get(), print "'\n----" + global failure_count + failure_count += 1 -##################################################################################### -##################################################################################### -##### ##### -##### ##### -##### ##### -##################################################################################### -##################################################################################### +# -- Always run the unit tests. def runUnitTests(): """run all unit tests for this program""" - print "running unit tests" test_CppTokenizer() test_CppExpr() test_optimizeAll() test_BlockParser() - print "OK" -if __name__ == "__main__": - runUnitTests() +failure_count = 0 +runUnitTests() +if failure_count != 0: + sys.exit(1) diff --git a/libc/kernel/tools/kernel.py b/libc/kernel/tools/kernel.py index c20398533..b6418a8c6 100644 --- a/libc/kernel/tools/kernel.py +++ b/libc/kernel/tools/kernel.py @@ -132,7 +132,6 @@ def parseFile(self, path, arch=None, kernel_root=None): list = cpp.BlockParser().parseFile(path) if list: - #list.removePrefixed("CONFIG_",self.config) macros = kernel_known_macros.copy() if kernel_root: macros.update(self.config) diff --git a/libc/kernel/uapi/asm-arm/asm/auxvec.h b/libc/kernel/uapi/asm-arm/asm/auxvec.h new file mode 100644 index 000000000..2fa0e6b18 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/auxvec.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/bitsperlong.h b/libc/kernel/uapi/asm-arm/asm/bitsperlong.h new file mode 100644 index 000000000..5dc506001 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/bitsperlong.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/byteorder.h b/libc/kernel/uapi/asm-arm/asm/byteorder.h new file mode 100644 index 000000000..0d2bdf3fb --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/byteorder.h @@ -0,0 +1,28 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __ASM_ARM_BYTEORDER_H +#define __ASM_ARM_BYTEORDER_H +#ifdef __ARMEB__ +#include +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#else +#include +#endif +#endif +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ diff --git a/libc/kernel/uapi/asm-arm/asm/errno.h b/libc/kernel/uapi/asm-arm/asm/errno.h new file mode 100644 index 000000000..392cd94bf --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/errno.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/fcntl.h b/libc/kernel/uapi/asm-arm/asm/fcntl.h new file mode 100644 index 000000000..995d14516 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/fcntl.h @@ -0,0 +1,28 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _ARM_FCNTL_H +#define _ARM_FCNTL_H +#define O_DIRECTORY 040000 +#define O_NOFOLLOW 0100000 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define O_DIRECT 0200000 +#define O_LARGEFILE 0400000 +#include +#endif +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ diff --git a/libc/kernel/uapi/asm-arm/asm/hwcap.h b/libc/kernel/uapi/asm-arm/asm/hwcap.h new file mode 100644 index 000000000..59a72624b --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/hwcap.h @@ -0,0 +1,49 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _UAPI__ASMARM_HWCAP_H +#define _UAPI__ASMARM_HWCAP_H +#define HWCAP_SWP (1 << 0) +#define HWCAP_HALF (1 << 1) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define HWCAP_THUMB (1 << 2) +#define HWCAP_26BIT (1 << 3) +#define HWCAP_FAST_MULT (1 << 4) +#define HWCAP_FPA (1 << 5) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define HWCAP_VFP (1 << 6) +#define HWCAP_EDSP (1 << 7) +#define HWCAP_JAVA (1 << 8) +#define HWCAP_IWMMXT (1 << 9) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define HWCAP_CRUNCH (1 << 10) +#define HWCAP_THUMBEE (1 << 11) +#define HWCAP_NEON (1 << 12) +#define HWCAP_VFPv3 (1 << 13) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define HWCAP_VFPv3D16 (1 << 14) +#define HWCAP_TLS (1 << 15) +#define HWCAP_VFPv4 (1 << 16) +#define HWCAP_IDIVA (1 << 17) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define HWCAP_IDIVT (1 << 18) +#define HWCAP_VFPD32 (1 << 19) +#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) +#define HWCAP_LPAE (1 << 20) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/ioctl.h b/libc/kernel/uapi/asm-arm/asm/ioctl.h new file mode 100644 index 000000000..7b7bd3779 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/ioctl.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/ioctls.h b/libc/kernel/uapi/asm-arm/asm/ioctls.h new file mode 100644 index 000000000..2c59181b2 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/ioctls.h @@ -0,0 +1,24 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __ASM_ARM_IOCTLS_H +#define __ASM_ARM_IOCTLS_H +#define FIOQSIZE 0x545E +#include +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/ipcbuf.h b/libc/kernel/uapi/asm-arm/asm/ipcbuf.h new file mode 100644 index 000000000..0021f1438 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/ipcbuf.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/kvm.h b/libc/kernel/uapi/asm-arm/asm/kvm.h new file mode 100644 index 000000000..31a2a2f9c --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/kvm.h @@ -0,0 +1,160 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __ARM_KVM_H__ +#define __ARM_KVM_H__ +#include +#include +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __KVM_HAVE_GUEST_DEBUG +#define __KVM_HAVE_IRQ_LINE +#define KVM_REG_SIZE(id) (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) +#define KVM_ARM_SVC_sp svc_regs[0] +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_SVC_lr svc_regs[1] +#define KVM_ARM_SVC_spsr svc_regs[2] +#define KVM_ARM_ABT_sp abt_regs[0] +#define KVM_ARM_ABT_lr abt_regs[1] +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_ABT_spsr abt_regs[2] +#define KVM_ARM_UND_sp und_regs[0] +#define KVM_ARM_UND_lr und_regs[1] +#define KVM_ARM_UND_spsr und_regs[2] +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_IRQ_sp irq_regs[0] +#define KVM_ARM_IRQ_lr irq_regs[1] +#define KVM_ARM_IRQ_spsr irq_regs[2] +#define KVM_ARM_FIQ_r8 fiq_regs[0] +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_FIQ_r9 fiq_regs[1] +#define KVM_ARM_FIQ_r10 fiq_regs[2] +#define KVM_ARM_FIQ_fp fiq_regs[3] +#define KVM_ARM_FIQ_ip fiq_regs[4] +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_FIQ_sp fiq_regs[5] +#define KVM_ARM_FIQ_lr fiq_regs[6] +#define KVM_ARM_FIQ_spsr fiq_regs[7] +struct kvm_regs { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + struct pt_regs usr_regs; + unsigned long svc_regs[3]; + unsigned long abt_regs[3]; + unsigned long und_regs[3]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long irq_regs[3]; + unsigned long fiq_regs[8]; +}; +#define KVM_ARM_TARGET_CORTEX_A15 0 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_NUM_TARGETS 1 +#define KVM_ARM_DEVICE_TYPE_SHIFT 0 +#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT) +#define KVM_ARM_DEVICE_ID_SHIFT 16 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT) +#define KVM_ARM_DEVICE_VGIC_V2 0 +#define KVM_VGIC_V2_ADDR_TYPE_DIST 0 +#define KVM_VGIC_V2_ADDR_TYPE_CPU 1 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_VGIC_V2_DIST_SIZE 0x1000 +#define KVM_VGIC_V2_CPU_SIZE 0x2000 +#define KVM_ARM_VCPU_POWER_OFF 0 +struct kvm_vcpu_init { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 target; + __u32 features[7]; +}; +struct kvm_sregs { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct kvm_fpu { +}; +struct kvm_guest_debug_arch { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct kvm_debug_exit_arch { +}; +struct kvm_sync_regs { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct kvm_arch_memory_slot { +}; +#define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_REG_ARM_COPROC_SHIFT 16 +#define KVM_REG_ARM_32_OPC2_MASK 0x0000000000000007 +#define KVM_REG_ARM_32_OPC2_SHIFT 0 +#define KVM_REG_ARM_OPC1_MASK 0x0000000000000078 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_REG_ARM_OPC1_SHIFT 3 +#define KVM_REG_ARM_CRM_MASK 0x0000000000000780 +#define KVM_REG_ARM_CRM_SHIFT 7 +#define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_REG_ARM_32_CRN_SHIFT 11 +#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / 4) +#define KVM_REG_ARM_DEMUX (0x0011 << KVM_REG_ARM_COPROC_SHIFT) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_REG_ARM_DEMUX_ID_MASK 0x000000000000FF00 +#define KVM_REG_ARM_DEMUX_ID_SHIFT 8 +#define KVM_REG_ARM_DEMUX_ID_CCSIDR (0x00 << KVM_REG_ARM_DEMUX_ID_SHIFT) +#define KVM_REG_ARM_DEMUX_VAL_MASK 0x00000000000000FF +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_REG_ARM_DEMUX_VAL_SHIFT 0 +#define KVM_REG_ARM_VFP (0x0012 << KVM_REG_ARM_COPROC_SHIFT) +#define KVM_REG_ARM_VFP_MASK 0x000000000000FFFF +#define KVM_REG_ARM_VFP_BASE_REG 0x0 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_REG_ARM_VFP_FPSID 0x1000 +#define KVM_REG_ARM_VFP_FPSCR 0x1001 +#define KVM_REG_ARM_VFP_MVFR1 0x1006 +#define KVM_REG_ARM_VFP_MVFR0 0x1007 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_REG_ARM_VFP_FPEXC 0x1008 +#define KVM_REG_ARM_VFP_FPINST 0x1009 +#define KVM_REG_ARM_VFP_FPINST2 0x100A +#define KVM_ARM_IRQ_TYPE_SHIFT 24 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_IRQ_TYPE_MASK 0xff +#define KVM_ARM_IRQ_VCPU_SHIFT 16 +#define KVM_ARM_IRQ_VCPU_MASK 0xff +#define KVM_ARM_IRQ_NUM_SHIFT 0 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_IRQ_NUM_MASK 0xffff +#define KVM_ARM_IRQ_TYPE_CPU 0 +#define KVM_ARM_IRQ_TYPE_SPI 1 +#define KVM_ARM_IRQ_TYPE_PPI 2 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_ARM_IRQ_CPU_IRQ 0 +#define KVM_ARM_IRQ_CPU_FIQ 1 +#define KVM_ARM_IRQ_GIC_MAX 127 +#define KVM_PSCI_FN_BASE 0x95c1ba5e +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) +#define KVM_PSCI_FN_CPU_SUSPEND KVM_PSCI_FN(0) +#define KVM_PSCI_FN_CPU_OFF KVM_PSCI_FN(1) +#define KVM_PSCI_FN_CPU_ON KVM_PSCI_FN(2) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_PSCI_FN_MIGRATE KVM_PSCI_FN(3) +#define KVM_PSCI_RET_SUCCESS 0 +#define KVM_PSCI_RET_NI ((unsigned long)-1) +#define KVM_PSCI_RET_INVAL ((unsigned long)-2) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define KVM_PSCI_RET_DENIED ((unsigned long)-3) +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/kvm_para.h b/libc/kernel/uapi/asm-arm/asm/kvm_para.h new file mode 100644 index 000000000..e19f7a0f5 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/kvm_para.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/mman.h b/libc/kernel/uapi/asm-arm/asm/mman.h new file mode 100644 index 000000000..40f0e9773 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/mman.h @@ -0,0 +1,20 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include +#define arch_mmap_check(addr, len, flags) (((flags) & MAP_FIXED && (addr) < FIRST_USER_ADDRESS) ? -EINVAL : 0) diff --git a/libc/kernel/uapi/asm-arm/asm/msgbuf.h b/libc/kernel/uapi/asm-arm/asm/msgbuf.h new file mode 100644 index 000000000..7809e3cea --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/msgbuf.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/param.h b/libc/kernel/uapi/asm-arm/asm/param.h new file mode 100644 index 000000000..5ccf935cc --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/param.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/poll.h b/libc/kernel/uapi/asm-arm/asm/poll.h new file mode 100644 index 000000000..d7e8adca9 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/poll.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/posix_types.h b/libc/kernel/uapi/asm-arm/asm/posix_types.h new file mode 100644 index 000000000..5e436e160 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/posix_types.h @@ -0,0 +1,34 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __ARCH_ARM_POSIX_TYPES_H +#define __ARCH_ARM_POSIX_TYPES_H +typedef unsigned short __kernel_mode_t; +#define __kernel_mode_t __kernel_mode_t +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +typedef unsigned short __kernel_ipc_pid_t; +#define __kernel_ipc_pid_t __kernel_ipc_pid_t +typedef unsigned short __kernel_uid_t; +typedef unsigned short __kernel_gid_t; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __kernel_uid_t __kernel_uid_t +typedef unsigned short __kernel_old_dev_t; +#define __kernel_old_dev_t __kernel_old_dev_t +#include +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/ptrace.h b/libc/kernel/uapi/asm-arm/asm/ptrace.h new file mode 100644 index 000000000..9d39d4917 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/ptrace.h @@ -0,0 +1,120 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _UAPI__ASM_ARM_PTRACE_H +#define _UAPI__ASM_ARM_PTRACE_H +#include +#define PTRACE_GETREGS 12 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +#define PTRACE_GETWMMXREGS 18 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PTRACE_SETWMMXREGS 19 +#define PTRACE_OLDSETOPTIONS 21 +#define PTRACE_GET_THREAD_AREA 22 +#define PTRACE_SET_SYSCALL 23 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PTRACE_GETCRUNCHREGS 25 +#define PTRACE_SETCRUNCHREGS 26 +#define PTRACE_GETVFPREGS 27 +#define PTRACE_SETVFPREGS 28 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PTRACE_GETHBPREGS 29 +#define PTRACE_SETHBPREGS 30 +#define USR26_MODE 0x00000000 +#define FIQ26_MODE 0x00000001 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define IRQ26_MODE 0x00000002 +#define SVC26_MODE 0x00000003 +#define USR_MODE 0x00000010 +#define SVC_MODE 0x00000013 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define FIQ_MODE 0x00000011 +#define IRQ_MODE 0x00000012 +#define ABT_MODE 0x00000017 +#define HYP_MODE 0x0000001a +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define UND_MODE 0x0000001b +#define SYSTEM_MODE 0x0000001f +#define MODE32_BIT 0x00000010 +#define MODE_MASK 0x0000001f +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4_PSR_T_BIT 0x00000020 +#define V7M_PSR_T_BIT 0x01000000 +#define PSR_T_BIT V4_PSR_T_BIT +#define PSR_F_BIT 0x00000040 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PSR_I_BIT 0x00000080 +#define PSR_A_BIT 0x00000100 +#define PSR_E_BIT 0x00000200 +#define PSR_J_BIT 0x01000000 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PSR_Q_BIT 0x08000000 +#define PSR_V_BIT 0x10000000 +#define PSR_C_BIT 0x20000000 +#define PSR_Z_BIT 0x40000000 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PSR_N_BIT 0x80000000 +#define PSR_f 0xff000000 +#define PSR_s 0x00ff0000 +#define PSR_x 0x0000ff00 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PSR_c 0x000000ff +#define APSR_MASK 0xf80f0000 +#define PSR_ISET_MASK 0x01000010 +#define PSR_IT_MASK 0x0600fc00 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PSR_ENDIAN_MASK 0x00000200 +#define PSR_ENDSTATE 0 +#define PT_TEXT_ADDR 0x10000 +#define PT_DATA_ADDR 0x10004 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define PT_TEXT_END_ADDR 0x10008 +#ifndef __ASSEMBLY__ +struct pt_regs { + long uregs[18]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#define ARM_cpsr uregs[16] +#define ARM_pc uregs[15] +#define ARM_lr uregs[14] +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ARM_sp uregs[13] +#define ARM_ip uregs[12] +#define ARM_fp uregs[11] +#define ARM_r10 uregs[10] +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ARM_r9 uregs[9] +#define ARM_r8 uregs[8] +#define ARM_r7 uregs[7] +#define ARM_r6 uregs[6] +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ARM_r5 uregs[5] +#define ARM_r4 uregs[4] +#define ARM_r3 uregs[3] +#define ARM_r2 uregs[2] +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ARM_r1 uregs[1] +#define ARM_r0 uregs[0] +#define ARM_ORIG_r0 uregs[17] +#define ARM_VFPREGS_SIZE ( 32 * 8 + 4 ) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/resource.h b/libc/kernel/uapi/asm-arm/asm/resource.h new file mode 100644 index 000000000..371adb52f --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/resource.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/sembuf.h b/libc/kernel/uapi/asm-arm/asm/sembuf.h new file mode 100644 index 000000000..6ce6549b0 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/sembuf.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/setup.h b/libc/kernel/uapi/asm-arm/asm/setup.h new file mode 100644 index 000000000..0f2a18b58 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/setup.h @@ -0,0 +1,155 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _UAPI__ASMARM_SETUP_H +#define _UAPI__ASMARM_SETUP_H +#include +#define COMMAND_LINE_SIZE 1024 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ATAG_NONE 0x00000000 +struct tag_header { + __u32 size; + __u32 tag; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#define ATAG_CORE 0x54410001 +struct tag_core { + __u32 flags; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 pagesize; + __u32 rootdev; +}; +#define ATAG_MEM 0x54410002 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct tag_mem32 { + __u32 size; + __u32 start; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ATAG_VIDEOTEXT 0x54410003 +struct tag_videotext { + __u8 x; + __u8 y; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u16 video_page; + __u8 video_mode; + __u8 video_cols; + __u16 video_ega_bx; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u8 video_lines; + __u8 video_isvga; + __u16 video_points; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ATAG_RAMDISK 0x54410004 +struct tag_ramdisk { + __u32 flags; + __u32 size; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 start; +}; +#define ATAG_INITRD 0x54410005 +#define ATAG_INITRD2 0x54420005 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct tag_initrd { + __u32 start; + __u32 size; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define ATAG_SERIAL 0x54410006 +struct tag_serialnr { + __u32 low; + __u32 high; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#define ATAG_REVISION 0x54410007 +struct tag_revision { + __u32 rev; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#define ATAG_VIDEOLFB 0x54410008 +struct tag_videolfb { + __u16 lfb_width; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u16 lfb_height; + __u16 lfb_depth; + __u16 lfb_linelength; + __u32 lfb_base; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 lfb_size; + __u8 red_size; + __u8 red_pos; + __u8 green_size; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u8 green_pos; + __u8 blue_size; + __u8 blue_pos; + __u8 rsvd_size; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u8 rsvd_pos; +}; +#define ATAG_CMDLINE 0x54410009 +struct tag_cmdline { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + char cmdline[1]; +}; +#define ATAG_ACORN 0x41000101 +struct tag_acorn { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 memc_control_reg; + __u32 vram_pages; + __u8 sounddefault; + __u8 adfsdrives; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#define ATAG_MEMCLK 0x41000402 +struct tag_memclk { + __u32 fmemclk; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct tag { + struct tag_header hdr; + union { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + struct tag_core core; + struct tag_mem32 mem; + struct tag_videotext videotext; + struct tag_ramdisk ramdisk; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + struct tag_initrd initrd; + struct tag_serialnr serialnr; + struct tag_revision revision; + struct tag_videolfb videolfb; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + struct tag_cmdline cmdline; + struct tag_acorn acorn; + struct tag_memclk memclk; + } u; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct tagtable { + __u32 tag; + int (*parse)(const struct tag *); +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#define tag_member_present(tag,member) ((unsigned long)(&((struct tag *)0L)->member + 1) <= (tag)->hdr.size * 4) +#define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size)) +#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define for_each_tag(t,base) for (t = base; t->hdr.size; t = tag_next(t)) +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/shmbuf.h b/libc/kernel/uapi/asm-arm/asm/shmbuf.h new file mode 100644 index 000000000..fe8b1bea0 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/shmbuf.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/sigcontext.h b/libc/kernel/uapi/asm-arm/asm/sigcontext.h new file mode 100644 index 000000000..bda233947 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/sigcontext.h @@ -0,0 +1,50 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _ASMARM_SIGCONTEXT_H +#define _ASMARM_SIGCONTEXT_H +struct sigcontext { + unsigned long trap_no; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long error_code; + unsigned long oldmask; + unsigned long arm_r0; + unsigned long arm_r1; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long arm_r2; + unsigned long arm_r3; + unsigned long arm_r4; + unsigned long arm_r5; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long arm_r6; + unsigned long arm_r7; + unsigned long arm_r8; + unsigned long arm_r9; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long arm_r10; + unsigned long arm_fp; + unsigned long arm_ip; + unsigned long arm_sp; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long arm_lr; + unsigned long arm_pc; + unsigned long arm_cpsr; + unsigned long fault_address; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/siginfo.h b/libc/kernel/uapi/asm-arm/asm/siginfo.h new file mode 100644 index 000000000..a31ebb2d6 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/siginfo.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/signal.h b/libc/kernel/uapi/asm-arm/asm/signal.h new file mode 100644 index 000000000..9297a7003 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/signal.h @@ -0,0 +1,110 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _UAPI_ASMARM_SIGNAL_H +#define _UAPI_ASMARM_SIGNAL_H +#include +struct siginfo; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define NSIG 32 +typedef unsigned long sigset_t; +#define SIGHUP 1 +#define SIGINT 2 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SIGIOT 6 +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SIGPOLL SIGIO +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED 31 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SIGRTMIN 32 +#define SIGRTMAX _NSIG +#define SIGSWI 32 +#define SA_NOCLDSTOP 0x00000001 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SA_NOCLDWAIT 0x00000002 +#define SA_SIGINFO 0x00000004 +#define SA_THIRTYTWO 0x02000000 +#define SA_RESTORER 0x04000000 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#include +struct sigaction { + union { + __sighandler_t _sa_handler; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + void (*_sa_sigaction)(int, struct siginfo *, void *); + } _u; + sigset_t sa_mask; + unsigned long sa_flags; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + void (*sa_restorer)(void); +}; +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +typedef struct sigaltstack { + void __user *ss_sp; + int ss_flags; + size_t ss_size; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +} stack_t; +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/socket.h b/libc/kernel/uapi/asm-arm/asm/socket.h new file mode 100644 index 000000000..50a9874cc --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/socket.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/sockios.h b/libc/kernel/uapi/asm-arm/asm/sockios.h new file mode 100644 index 000000000..710db92bb --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/sockios.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/stat.h b/libc/kernel/uapi/asm-arm/asm/stat.h new file mode 100644 index 000000000..d8188bf52 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/stat.h @@ -0,0 +1,104 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _ASMARM_STAT_H +#define _ASMARM_STAT_H +struct __old_kernel_stat { + unsigned short st_dev; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned short st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned short st_gid; + unsigned short st_rdev; + unsigned long st_size; + unsigned long st_atime; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long st_mtime; + unsigned long st_ctime; +}; +#define STAT_HAVE_NSEC +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct stat { +#ifdef __ARMEB__ + unsigned short st_dev; + unsigned short __pad1; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#else + unsigned long st_dev; +#endif + unsigned long st_ino; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#ifdef __ARMEB__ + unsigned short st_rdev; + unsigned short __pad2; +#else +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long st_rdev; +#endif + unsigned long st_size; + unsigned long st_blksize; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long st_blocks; + unsigned long st_atime; + unsigned long st_atime_nsec; + unsigned long st_mtime; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long st_mtime_nsec; + unsigned long st_ctime; + unsigned long st_ctime_nsec; + unsigned long __unused4; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long __unused5; +}; +struct stat64 { + unsigned long long st_dev; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned char __pad0[4]; +#define STAT64_HAS_BROKEN_ST_INO 1 + unsigned long __st_ino; + unsigned int st_mode; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned int st_nlink; + unsigned long st_uid; + unsigned long st_gid; + unsigned long long st_rdev; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned char __pad3[4]; + long long st_size; + unsigned long st_blksize; + unsigned long long st_blocks; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long st_atime; + unsigned long st_atime_nsec; + unsigned long st_mtime; + unsigned long st_mtime_nsec; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long st_ctime; + unsigned long st_ctime_nsec; + unsigned long long st_ino; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/statfs.h b/libc/kernel/uapi/asm-arm/asm/statfs.h new file mode 100644 index 000000000..d1f3b8192 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/statfs.h @@ -0,0 +1,24 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _ASMARM_STATFS_H +#define _ASMARM_STATFS_H +#define ARCH_PACK_STATFS64 __attribute__((packed,aligned(4))) +#include +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/swab.h b/libc/kernel/uapi/asm-arm/asm/swab.h new file mode 100644 index 000000000..2703324f3 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/swab.h @@ -0,0 +1,31 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _UAPI__ASM_ARM_SWAB_H +#define _UAPI__ASM_ARM_SWAB_H +#include +#include +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#ifndef __STRICT_ANSI__ +#define __SWAB_64_THRU_32__ +#endif +#ifndef __thumb__ +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif +#define __arch_swab32 __arch_swab32 +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/termbits.h b/libc/kernel/uapi/asm-arm/asm/termbits.h new file mode 100644 index 000000000..42af6fe24 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/termbits.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/termios.h b/libc/kernel/uapi/asm-arm/asm/termios.h new file mode 100644 index 000000000..feca4c60e --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/termios.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/types.h b/libc/kernel/uapi/asm-arm/asm/types.h new file mode 100644 index 000000000..8250f4345 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/types.h @@ -0,0 +1,19 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include diff --git a/libc/kernel/uapi/asm-arm/asm/unistd.h b/libc/kernel/uapi/asm-arm/asm/unistd.h new file mode 100644 index 000000000..f99bfb100 --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/unistd.h @@ -0,0 +1,489 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _UAPI__ASM_ARM_UNISTD_H +#define _UAPI__ASM_ARM_UNISTD_H +#define __NR_OABI_SYSCALL_BASE 0x900000 +#if defined(__thumb__) || defined(__ARM_EABI__) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_SYSCALL_BASE 0 +#else +#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE +#endif +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_restart_syscall (__NR_SYSCALL_BASE+ 0) +#define __NR_exit (__NR_SYSCALL_BASE+ 1) +#define __NR_fork (__NR_SYSCALL_BASE+ 2) +#define __NR_read (__NR_SYSCALL_BASE+ 3) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_write (__NR_SYSCALL_BASE+ 4) +#define __NR_open (__NR_SYSCALL_BASE+ 5) +#define __NR_close (__NR_SYSCALL_BASE+ 6) +#define __NR_creat (__NR_SYSCALL_BASE+ 8) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_link (__NR_SYSCALL_BASE+ 9) +#define __NR_unlink (__NR_SYSCALL_BASE+ 10) +#define __NR_execve (__NR_SYSCALL_BASE+ 11) +#define __NR_chdir (__NR_SYSCALL_BASE+ 12) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_time (__NR_SYSCALL_BASE+ 13) +#define __NR_mknod (__NR_SYSCALL_BASE+ 14) +#define __NR_chmod (__NR_SYSCALL_BASE+ 15) +#define __NR_lchown (__NR_SYSCALL_BASE+ 16) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_lseek (__NR_SYSCALL_BASE+ 19) +#define __NR_getpid (__NR_SYSCALL_BASE+ 20) +#define __NR_mount (__NR_SYSCALL_BASE+ 21) +#define __NR_umount (__NR_SYSCALL_BASE+ 22) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setuid (__NR_SYSCALL_BASE+ 23) +#define __NR_getuid (__NR_SYSCALL_BASE+ 24) +#define __NR_stime (__NR_SYSCALL_BASE+ 25) +#define __NR_ptrace (__NR_SYSCALL_BASE+ 26) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_alarm (__NR_SYSCALL_BASE+ 27) +#define __NR_pause (__NR_SYSCALL_BASE+ 29) +#define __NR_utime (__NR_SYSCALL_BASE+ 30) +#define __NR_access (__NR_SYSCALL_BASE+ 33) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_nice (__NR_SYSCALL_BASE+ 34) +#define __NR_sync (__NR_SYSCALL_BASE+ 36) +#define __NR_kill (__NR_SYSCALL_BASE+ 37) +#define __NR_rename (__NR_SYSCALL_BASE+ 38) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mkdir (__NR_SYSCALL_BASE+ 39) +#define __NR_rmdir (__NR_SYSCALL_BASE+ 40) +#define __NR_dup (__NR_SYSCALL_BASE+ 41) +#define __NR_pipe (__NR_SYSCALL_BASE+ 42) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_times (__NR_SYSCALL_BASE+ 43) +#define __NR_brk (__NR_SYSCALL_BASE+ 45) +#define __NR_setgid (__NR_SYSCALL_BASE+ 46) +#define __NR_getgid (__NR_SYSCALL_BASE+ 47) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_geteuid (__NR_SYSCALL_BASE+ 49) +#define __NR_getegid (__NR_SYSCALL_BASE+ 50) +#define __NR_acct (__NR_SYSCALL_BASE+ 51) +#define __NR_umount2 (__NR_SYSCALL_BASE+ 52) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_ioctl (__NR_SYSCALL_BASE+ 54) +#define __NR_fcntl (__NR_SYSCALL_BASE+ 55) +#define __NR_setpgid (__NR_SYSCALL_BASE+ 57) +#define __NR_umask (__NR_SYSCALL_BASE+ 60) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_chroot (__NR_SYSCALL_BASE+ 61) +#define __NR_ustat (__NR_SYSCALL_BASE+ 62) +#define __NR_dup2 (__NR_SYSCALL_BASE+ 63) +#define __NR_getppid (__NR_SYSCALL_BASE+ 64) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getpgrp (__NR_SYSCALL_BASE+ 65) +#define __NR_setsid (__NR_SYSCALL_BASE+ 66) +#define __NR_sigaction (__NR_SYSCALL_BASE+ 67) +#define __NR_setreuid (__NR_SYSCALL_BASE+ 70) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setregid (__NR_SYSCALL_BASE+ 71) +#define __NR_sigsuspend (__NR_SYSCALL_BASE+ 72) +#define __NR_sigpending (__NR_SYSCALL_BASE+ 73) +#define __NR_sethostname (__NR_SYSCALL_BASE+ 74) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setrlimit (__NR_SYSCALL_BASE+ 75) +#define __NR_getrlimit (__NR_SYSCALL_BASE+ 76) +#define __NR_getrusage (__NR_SYSCALL_BASE+ 77) +#define __NR_gettimeofday (__NR_SYSCALL_BASE+ 78) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_settimeofday (__NR_SYSCALL_BASE+ 79) +#define __NR_getgroups (__NR_SYSCALL_BASE+ 80) +#define __NR_setgroups (__NR_SYSCALL_BASE+ 81) +#define __NR_select (__NR_SYSCALL_BASE+ 82) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_symlink (__NR_SYSCALL_BASE+ 83) +#define __NR_readlink (__NR_SYSCALL_BASE+ 85) +#define __NR_uselib (__NR_SYSCALL_BASE+ 86) +#define __NR_swapon (__NR_SYSCALL_BASE+ 87) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_reboot (__NR_SYSCALL_BASE+ 88) +#define __NR_readdir (__NR_SYSCALL_BASE+ 89) +#define __NR_mmap (__NR_SYSCALL_BASE+ 90) +#define __NR_munmap (__NR_SYSCALL_BASE+ 91) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_truncate (__NR_SYSCALL_BASE+ 92) +#define __NR_ftruncate (__NR_SYSCALL_BASE+ 93) +#define __NR_fchmod (__NR_SYSCALL_BASE+ 94) +#define __NR_fchown (__NR_SYSCALL_BASE+ 95) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getpriority (__NR_SYSCALL_BASE+ 96) +#define __NR_setpriority (__NR_SYSCALL_BASE+ 97) +#define __NR_statfs (__NR_SYSCALL_BASE+ 99) +#define __NR_fstatfs (__NR_SYSCALL_BASE+100) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_socketcall (__NR_SYSCALL_BASE+102) +#define __NR_syslog (__NR_SYSCALL_BASE+103) +#define __NR_setitimer (__NR_SYSCALL_BASE+104) +#define __NR_getitimer (__NR_SYSCALL_BASE+105) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_stat (__NR_SYSCALL_BASE+106) +#define __NR_lstat (__NR_SYSCALL_BASE+107) +#define __NR_fstat (__NR_SYSCALL_BASE+108) +#define __NR_vhangup (__NR_SYSCALL_BASE+111) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_syscall (__NR_SYSCALL_BASE+113) +#define __NR_wait4 (__NR_SYSCALL_BASE+114) +#define __NR_swapoff (__NR_SYSCALL_BASE+115) +#define __NR_sysinfo (__NR_SYSCALL_BASE+116) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_ipc (__NR_SYSCALL_BASE+117) +#define __NR_fsync (__NR_SYSCALL_BASE+118) +#define __NR_sigreturn (__NR_SYSCALL_BASE+119) +#define __NR_clone (__NR_SYSCALL_BASE+120) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setdomainname (__NR_SYSCALL_BASE+121) +#define __NR_uname (__NR_SYSCALL_BASE+122) +#define __NR_adjtimex (__NR_SYSCALL_BASE+124) +#define __NR_mprotect (__NR_SYSCALL_BASE+125) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_sigprocmask (__NR_SYSCALL_BASE+126) +#define __NR_init_module (__NR_SYSCALL_BASE+128) +#define __NR_delete_module (__NR_SYSCALL_BASE+129) +#define __NR_quotactl (__NR_SYSCALL_BASE+131) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getpgid (__NR_SYSCALL_BASE+132) +#define __NR_fchdir (__NR_SYSCALL_BASE+133) +#define __NR_bdflush (__NR_SYSCALL_BASE+134) +#define __NR_sysfs (__NR_SYSCALL_BASE+135) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_personality (__NR_SYSCALL_BASE+136) +#define __NR_setfsuid (__NR_SYSCALL_BASE+138) +#define __NR_setfsgid (__NR_SYSCALL_BASE+139) +#define __NR__llseek (__NR_SYSCALL_BASE+140) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getdents (__NR_SYSCALL_BASE+141) +#define __NR__newselect (__NR_SYSCALL_BASE+142) +#define __NR_flock (__NR_SYSCALL_BASE+143) +#define __NR_msync (__NR_SYSCALL_BASE+144) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_readv (__NR_SYSCALL_BASE+145) +#define __NR_writev (__NR_SYSCALL_BASE+146) +#define __NR_getsid (__NR_SYSCALL_BASE+147) +#define __NR_fdatasync (__NR_SYSCALL_BASE+148) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR__sysctl (__NR_SYSCALL_BASE+149) +#define __NR_mlock (__NR_SYSCALL_BASE+150) +#define __NR_munlock (__NR_SYSCALL_BASE+151) +#define __NR_mlockall (__NR_SYSCALL_BASE+152) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_munlockall (__NR_SYSCALL_BASE+153) +#define __NR_sched_setparam (__NR_SYSCALL_BASE+154) +#define __NR_sched_getparam (__NR_SYSCALL_BASE+155) +#define __NR_sched_setscheduler (__NR_SYSCALL_BASE+156) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_sched_getscheduler (__NR_SYSCALL_BASE+157) +#define __NR_sched_yield (__NR_SYSCALL_BASE+158) +#define __NR_sched_get_priority_max (__NR_SYSCALL_BASE+159) +#define __NR_sched_get_priority_min (__NR_SYSCALL_BASE+160) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE+161) +#define __NR_nanosleep (__NR_SYSCALL_BASE+162) +#define __NR_mremap (__NR_SYSCALL_BASE+163) +#define __NR_setresuid (__NR_SYSCALL_BASE+164) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getresuid (__NR_SYSCALL_BASE+165) +#define __NR_poll (__NR_SYSCALL_BASE+168) +#define __NR_nfsservctl (__NR_SYSCALL_BASE+169) +#define __NR_setresgid (__NR_SYSCALL_BASE+170) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getresgid (__NR_SYSCALL_BASE+171) +#define __NR_prctl (__NR_SYSCALL_BASE+172) +#define __NR_rt_sigreturn (__NR_SYSCALL_BASE+173) +#define __NR_rt_sigaction (__NR_SYSCALL_BASE+174) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE+175) +#define __NR_rt_sigpending (__NR_SYSCALL_BASE+176) +#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177) +#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179) +#define __NR_pread64 (__NR_SYSCALL_BASE+180) +#define __NR_pwrite64 (__NR_SYSCALL_BASE+181) +#define __NR_chown (__NR_SYSCALL_BASE+182) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getcwd (__NR_SYSCALL_BASE+183) +#define __NR_capget (__NR_SYSCALL_BASE+184) +#define __NR_capset (__NR_SYSCALL_BASE+185) +#define __NR_sigaltstack (__NR_SYSCALL_BASE+186) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_sendfile (__NR_SYSCALL_BASE+187) +#define __NR_vfork (__NR_SYSCALL_BASE+190) +#define __NR_ugetrlimit (__NR_SYSCALL_BASE+191) +#define __NR_mmap2 (__NR_SYSCALL_BASE+192) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_truncate64 (__NR_SYSCALL_BASE+193) +#define __NR_ftruncate64 (__NR_SYSCALL_BASE+194) +#define __NR_stat64 (__NR_SYSCALL_BASE+195) +#define __NR_lstat64 (__NR_SYSCALL_BASE+196) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fstat64 (__NR_SYSCALL_BASE+197) +#define __NR_lchown32 (__NR_SYSCALL_BASE+198) +#define __NR_getuid32 (__NR_SYSCALL_BASE+199) +#define __NR_getgid32 (__NR_SYSCALL_BASE+200) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_geteuid32 (__NR_SYSCALL_BASE+201) +#define __NR_getegid32 (__NR_SYSCALL_BASE+202) +#define __NR_setreuid32 (__NR_SYSCALL_BASE+203) +#define __NR_setregid32 (__NR_SYSCALL_BASE+204) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getgroups32 (__NR_SYSCALL_BASE+205) +#define __NR_setgroups32 (__NR_SYSCALL_BASE+206) +#define __NR_fchown32 (__NR_SYSCALL_BASE+207) +#define __NR_setresuid32 (__NR_SYSCALL_BASE+208) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getresuid32 (__NR_SYSCALL_BASE+209) +#define __NR_setresgid32 (__NR_SYSCALL_BASE+210) +#define __NR_getresgid32 (__NR_SYSCALL_BASE+211) +#define __NR_chown32 (__NR_SYSCALL_BASE+212) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setuid32 (__NR_SYSCALL_BASE+213) +#define __NR_setgid32 (__NR_SYSCALL_BASE+214) +#define __NR_setfsuid32 (__NR_SYSCALL_BASE+215) +#define __NR_setfsgid32 (__NR_SYSCALL_BASE+216) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getdents64 (__NR_SYSCALL_BASE+217) +#define __NR_pivot_root (__NR_SYSCALL_BASE+218) +#define __NR_mincore (__NR_SYSCALL_BASE+219) +#define __NR_madvise (__NR_SYSCALL_BASE+220) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fcntl64 (__NR_SYSCALL_BASE+221) +#define __NR_gettid (__NR_SYSCALL_BASE+224) +#define __NR_readahead (__NR_SYSCALL_BASE+225) +#define __NR_setxattr (__NR_SYSCALL_BASE+226) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_lsetxattr (__NR_SYSCALL_BASE+227) +#define __NR_fsetxattr (__NR_SYSCALL_BASE+228) +#define __NR_getxattr (__NR_SYSCALL_BASE+229) +#define __NR_lgetxattr (__NR_SYSCALL_BASE+230) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fgetxattr (__NR_SYSCALL_BASE+231) +#define __NR_listxattr (__NR_SYSCALL_BASE+232) +#define __NR_llistxattr (__NR_SYSCALL_BASE+233) +#define __NR_flistxattr (__NR_SYSCALL_BASE+234) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_removexattr (__NR_SYSCALL_BASE+235) +#define __NR_lremovexattr (__NR_SYSCALL_BASE+236) +#define __NR_fremovexattr (__NR_SYSCALL_BASE+237) +#define __NR_tkill (__NR_SYSCALL_BASE+238) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_sendfile64 (__NR_SYSCALL_BASE+239) +#define __NR_futex (__NR_SYSCALL_BASE+240) +#define __NR_sched_setaffinity (__NR_SYSCALL_BASE+241) +#define __NR_sched_getaffinity (__NR_SYSCALL_BASE+242) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_io_setup (__NR_SYSCALL_BASE+243) +#define __NR_io_destroy (__NR_SYSCALL_BASE+244) +#define __NR_io_getevents (__NR_SYSCALL_BASE+245) +#define __NR_io_submit (__NR_SYSCALL_BASE+246) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_io_cancel (__NR_SYSCALL_BASE+247) +#define __NR_exit_group (__NR_SYSCALL_BASE+248) +#define __NR_lookup_dcookie (__NR_SYSCALL_BASE+249) +#define __NR_epoll_create (__NR_SYSCALL_BASE+250) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_epoll_ctl (__NR_SYSCALL_BASE+251) +#define __NR_epoll_wait (__NR_SYSCALL_BASE+252) +#define __NR_remap_file_pages (__NR_SYSCALL_BASE+253) +#define __NR_set_tid_address (__NR_SYSCALL_BASE+256) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_timer_create (__NR_SYSCALL_BASE+257) +#define __NR_timer_settime (__NR_SYSCALL_BASE+258) +#define __NR_timer_gettime (__NR_SYSCALL_BASE+259) +#define __NR_timer_getoverrun (__NR_SYSCALL_BASE+260) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_timer_delete (__NR_SYSCALL_BASE+261) +#define __NR_clock_settime (__NR_SYSCALL_BASE+262) +#define __NR_clock_gettime (__NR_SYSCALL_BASE+263) +#define __NR_clock_getres (__NR_SYSCALL_BASE+264) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_clock_nanosleep (__NR_SYSCALL_BASE+265) +#define __NR_statfs64 (__NR_SYSCALL_BASE+266) +#define __NR_fstatfs64 (__NR_SYSCALL_BASE+267) +#define __NR_tgkill (__NR_SYSCALL_BASE+268) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_utimes (__NR_SYSCALL_BASE+269) +#define __NR_arm_fadvise64_64 (__NR_SYSCALL_BASE+270) +#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE+271) +#define __NR_pciconfig_read (__NR_SYSCALL_BASE+272) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_pciconfig_write (__NR_SYSCALL_BASE+273) +#define __NR_mq_open (__NR_SYSCALL_BASE+274) +#define __NR_mq_unlink (__NR_SYSCALL_BASE+275) +#define __NR_mq_timedsend (__NR_SYSCALL_BASE+276) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mq_timedreceive (__NR_SYSCALL_BASE+277) +#define __NR_mq_notify (__NR_SYSCALL_BASE+278) +#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279) +#define __NR_waitid (__NR_SYSCALL_BASE+280) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_socket (__NR_SYSCALL_BASE+281) +#define __NR_bind (__NR_SYSCALL_BASE+282) +#define __NR_connect (__NR_SYSCALL_BASE+283) +#define __NR_listen (__NR_SYSCALL_BASE+284) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_accept (__NR_SYSCALL_BASE+285) +#define __NR_getsockname (__NR_SYSCALL_BASE+286) +#define __NR_getpeername (__NR_SYSCALL_BASE+287) +#define __NR_socketpair (__NR_SYSCALL_BASE+288) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_send (__NR_SYSCALL_BASE+289) +#define __NR_sendto (__NR_SYSCALL_BASE+290) +#define __NR_recv (__NR_SYSCALL_BASE+291) +#define __NR_recvfrom (__NR_SYSCALL_BASE+292) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_shutdown (__NR_SYSCALL_BASE+293) +#define __NR_setsockopt (__NR_SYSCALL_BASE+294) +#define __NR_getsockopt (__NR_SYSCALL_BASE+295) +#define __NR_sendmsg (__NR_SYSCALL_BASE+296) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_recvmsg (__NR_SYSCALL_BASE+297) +#define __NR_semop (__NR_SYSCALL_BASE+298) +#define __NR_semget (__NR_SYSCALL_BASE+299) +#define __NR_semctl (__NR_SYSCALL_BASE+300) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_msgsnd (__NR_SYSCALL_BASE+301) +#define __NR_msgrcv (__NR_SYSCALL_BASE+302) +#define __NR_msgget (__NR_SYSCALL_BASE+303) +#define __NR_msgctl (__NR_SYSCALL_BASE+304) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_shmat (__NR_SYSCALL_BASE+305) +#define __NR_shmdt (__NR_SYSCALL_BASE+306) +#define __NR_shmget (__NR_SYSCALL_BASE+307) +#define __NR_shmctl (__NR_SYSCALL_BASE+308) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_add_key (__NR_SYSCALL_BASE+309) +#define __NR_request_key (__NR_SYSCALL_BASE+310) +#define __NR_keyctl (__NR_SYSCALL_BASE+311) +#define __NR_semtimedop (__NR_SYSCALL_BASE+312) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_vserver (__NR_SYSCALL_BASE+313) +#define __NR_ioprio_set (__NR_SYSCALL_BASE+314) +#define __NR_ioprio_get (__NR_SYSCALL_BASE+315) +#define __NR_inotify_init (__NR_SYSCALL_BASE+316) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317) +#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318) +#define __NR_mbind (__NR_SYSCALL_BASE+319) +#define __NR_get_mempolicy (__NR_SYSCALL_BASE+320) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_set_mempolicy (__NR_SYSCALL_BASE+321) +#define __NR_openat (__NR_SYSCALL_BASE+322) +#define __NR_mkdirat (__NR_SYSCALL_BASE+323) +#define __NR_mknodat (__NR_SYSCALL_BASE+324) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fchownat (__NR_SYSCALL_BASE+325) +#define __NR_futimesat (__NR_SYSCALL_BASE+326) +#define __NR_fstatat64 (__NR_SYSCALL_BASE+327) +#define __NR_unlinkat (__NR_SYSCALL_BASE+328) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_renameat (__NR_SYSCALL_BASE+329) +#define __NR_linkat (__NR_SYSCALL_BASE+330) +#define __NR_symlinkat (__NR_SYSCALL_BASE+331) +#define __NR_readlinkat (__NR_SYSCALL_BASE+332) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fchmodat (__NR_SYSCALL_BASE+333) +#define __NR_faccessat (__NR_SYSCALL_BASE+334) +#define __NR_pselect6 (__NR_SYSCALL_BASE+335) +#define __NR_ppoll (__NR_SYSCALL_BASE+336) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_unshare (__NR_SYSCALL_BASE+337) +#define __NR_set_robust_list (__NR_SYSCALL_BASE+338) +#define __NR_get_robust_list (__NR_SYSCALL_BASE+339) +#define __NR_splice (__NR_SYSCALL_BASE+340) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE+341) +#define __NR_sync_file_range2 __NR_arm_sync_file_range +#define __NR_tee (__NR_SYSCALL_BASE+342) +#define __NR_vmsplice (__NR_SYSCALL_BASE+343) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_move_pages (__NR_SYSCALL_BASE+344) +#define __NR_getcpu (__NR_SYSCALL_BASE+345) +#define __NR_epoll_pwait (__NR_SYSCALL_BASE+346) +#define __NR_kexec_load (__NR_SYSCALL_BASE+347) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_utimensat (__NR_SYSCALL_BASE+348) +#define __NR_signalfd (__NR_SYSCALL_BASE+349) +#define __NR_timerfd_create (__NR_SYSCALL_BASE+350) +#define __NR_eventfd (__NR_SYSCALL_BASE+351) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fallocate (__NR_SYSCALL_BASE+352) +#define __NR_timerfd_settime (__NR_SYSCALL_BASE+353) +#define __NR_timerfd_gettime (__NR_SYSCALL_BASE+354) +#define __NR_signalfd4 (__NR_SYSCALL_BASE+355) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_eventfd2 (__NR_SYSCALL_BASE+356) +#define __NR_epoll_create1 (__NR_SYSCALL_BASE+357) +#define __NR_dup3 (__NR_SYSCALL_BASE+358) +#define __NR_pipe2 (__NR_SYSCALL_BASE+359) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_inotify_init1 (__NR_SYSCALL_BASE+360) +#define __NR_preadv (__NR_SYSCALL_BASE+361) +#define __NR_pwritev (__NR_SYSCALL_BASE+362) +#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_perf_event_open (__NR_SYSCALL_BASE+364) +#define __NR_recvmmsg (__NR_SYSCALL_BASE+365) +#define __NR_accept4 (__NR_SYSCALL_BASE+366) +#define __NR_fanotify_init (__NR_SYSCALL_BASE+367) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fanotify_mark (__NR_SYSCALL_BASE+368) +#define __NR_prlimit64 (__NR_SYSCALL_BASE+369) +#define __NR_name_to_handle_at (__NR_SYSCALL_BASE+370) +#define __NR_open_by_handle_at (__NR_SYSCALL_BASE+371) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_clock_adjtime (__NR_SYSCALL_BASE+372) +#define __NR_syncfs (__NR_SYSCALL_BASE+373) +#define __NR_sendmmsg (__NR_SYSCALL_BASE+374) +#define __NR_setns (__NR_SYSCALL_BASE+375) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_process_vm_readv (__NR_SYSCALL_BASE+376) +#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) +#define __NR_kcmp (__NR_SYSCALL_BASE+378) +#define __NR_finit_module (__NR_SYSCALL_BASE+379) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000) +#define __ARM_NR_breakpoint (__ARM_NR_BASE+1) +#define __ARM_NR_cacheflush (__ARM_NR_BASE+2) +#define __ARM_NR_usr26 (__ARM_NR_BASE+3) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __ARM_NR_usr32 (__ARM_NR_BASE+4) +#define __ARM_NR_set_tls (__ARM_NR_BASE+5) +#ifdef __ARM_EABI__ +#undef __NR_time +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#undef __NR_umount +#undef __NR_stime +#undef __NR_alarm +#undef __NR_utime +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#undef __NR_getrlimit +#undef __NR_select +#undef __NR_readdir +#undef __NR_mmap +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#undef __NR_socketcall +#undef __NR_syscall +#undef __NR_ipc +#endif +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif diff --git a/libc/kernel/uapi/asm-arm/asm/user.h b/libc/kernel/uapi/asm-arm/asm/user.h new file mode 100644 index 000000000..91d3490be --- /dev/null +++ b/libc/kernel/uapi/asm-arm/asm/user.h @@ -0,0 +1,80 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _ARM_USER_H +#define _ARM_USER_H +#include +#include +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct user_fp { + struct fp_reg { + unsigned int sign1:1; + unsigned int unused:15; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned int sign2:1; + unsigned int exponent:14; + unsigned int j:1; + unsigned int mantissa1:31; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned int mantissa0:32; + } fpregs[8]; + unsigned int fpsr:32; + unsigned int fpcr:32; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned char ftype[8]; + unsigned int init_flag; +}; +struct user{ +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + struct pt_regs regs; + int u_fpvalid; + unsigned long int u_tsize; + unsigned long int u_dsize; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long int u_ssize; + unsigned long start_code; + unsigned long start_stack; + long int signal; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + int reserved; + unsigned long u_ar0; + unsigned long magic; + char u_comm[32]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + int u_debugreg[8]; + struct user_fp u_fp; + struct user_fp_struct * u_fp0; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define NBPG PAGE_SIZE +#define UPAGES 1 +#define HOST_TEXT_START_ADDR (u.start_code) +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct user_vfp { + unsigned long long fpregs[32]; + unsigned long fpscr; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct user_vfp_exc { + unsigned long fpexc; + unsigned long fpinst; + unsigned long fpinst2; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#endif diff --git a/libc/kernel/uapi/asm-generic/stat.h b/libc/kernel/uapi/asm-generic/stat.h new file mode 100644 index 000000000..a94c69d61 --- /dev/null +++ b/libc/kernel/uapi/asm-generic/stat.h @@ -0,0 +1,81 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __ASM_GENERIC_STAT_H +#define __ASM_GENERIC_STAT_H +#include +#define STAT_HAVE_NSEC 1 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct stat { + unsigned long st_dev; + unsigned long st_ino; + unsigned int st_mode; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned long st_rdev; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long __pad1; + long st_size; + int st_blksize; + int __pad2; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + long st_blocks; + long st_atime; + unsigned long st_atime_nsec; + long st_mtime; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long st_mtime_nsec; + long st_ctime; + unsigned long st_ctime_nsec; + unsigned int __unused4; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned int __unused5; +}; +#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64) +struct stat64 { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned long long st_dev; + unsigned long long st_ino; + unsigned int st_mode; + unsigned int st_nlink; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + unsigned int st_uid; + unsigned int st_gid; + unsigned long long st_rdev; + unsigned long long __pad1; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + long long st_size; + int st_blksize; + int __pad2; + long long st_blocks; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + int st_atime; + unsigned int st_atime_nsec; + int st_mtime; + unsigned int st_mtime_nsec; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + int st_ctime; + unsigned int st_ctime_nsec; + unsigned int __unused4; + unsigned int __unused5; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#endif +#endif diff --git a/libc/kernel/uapi/asm-generic/swab.h b/libc/kernel/uapi/asm-generic/swab.h new file mode 100644 index 000000000..bcbc94ffd --- /dev/null +++ b/libc/kernel/uapi/asm-generic/swab.h @@ -0,0 +1,29 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _ASM_GENERIC_SWAB_H +#define _ASM_GENERIC_SWAB_H +#include +#if __BITS_PER_LONG == 32 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +#define __SWAB_64_THRU_32__ +#endif +#endif +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif diff --git a/libc/kernel/uapi/asm-generic/unistd.h b/libc/kernel/uapi/asm-generic/unistd.h new file mode 100644 index 000000000..781941bb4 --- /dev/null +++ b/libc/kernel/uapi/asm-generic/unistd.h @@ -0,0 +1,516 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#include +#ifndef __SYSCALL +#define __SYSCALL(x, y) +#endif +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT) +#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32) +#else +#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif +#ifdef __SYSCALL_COMPAT +#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp) +#define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#else +#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys) +#define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64) +#endif +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_io_setup 0 +#define __NR_io_destroy 1 +#define __NR_io_submit 2 +#define __NR_io_cancel 3 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_io_getevents 4 +#define __NR_setxattr 5 +#define __NR_lsetxattr 6 +#define __NR_fsetxattr 7 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getxattr 8 +#define __NR_lgetxattr 9 +#define __NR_fgetxattr 10 +#define __NR_listxattr 11 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_llistxattr 12 +#define __NR_flistxattr 13 +#define __NR_removexattr 14 +#define __NR_lremovexattr 15 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fremovexattr 16 +#define __NR_getcwd 17 +#define __NR_lookup_dcookie 18 +#define __NR_eventfd2 19 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_epoll_create1 20 +#define __NR_epoll_ctl 21 +#define __NR_epoll_pwait 22 +#define __NR_dup 23 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_dup3 24 +#define __NR3264_fcntl 25 +#define __NR_inotify_init1 26 +#define __NR_inotify_add_watch 27 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_inotify_rm_watch 28 +#define __NR_ioctl 29 +#define __NR_ioprio_set 30 +#define __NR_ioprio_get 31 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_flock 32 +#define __NR_mknodat 33 +#define __NR_mkdirat 34 +#define __NR_unlinkat 35 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_symlinkat 36 +#define __NR_linkat 37 +#define __NR_renameat 38 +#define __NR_umount2 39 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mount 40 +#define __NR_pivot_root 41 +#define __NR_nfsservctl 42 +#define __NR3264_statfs 43 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR3264_fstatfs 44 +#define __NR3264_truncate 45 +#define __NR3264_ftruncate 46 +#define __NR_fallocate 47 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_faccessat 48 +#define __NR_chdir 49 +#define __NR_fchdir 50 +#define __NR_chroot 51 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fchmod 52 +#define __NR_fchmodat 53 +#define __NR_fchownat 54 +#define __NR_fchown 55 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_openat 56 +#define __NR_close 57 +#define __NR_vhangup 58 +#define __NR_pipe2 59 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_quotactl 60 +#define __NR_getdents64 61 +#define __NR3264_lseek 62 +#define __NR_read 63 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_write 64 +#define __NR_readv 65 +#define __NR_writev 66 +#define __NR_pread64 67 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_pwrite64 68 +#define __NR_preadv 69 +#define __NR_pwritev 70 +#define __NR3264_sendfile 71 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_pselect6 72 +#define __NR_ppoll 73 +#define __NR_signalfd4 74 +#define __NR_vmsplice 75 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_splice 76 +#define __NR_tee 77 +#define __NR_readlinkat 78 +#define __NR3264_fstatat 79 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR3264_fstat 80 +#define __NR_sync 81 +#define __NR_fsync 82 +#define __NR_fdatasync 83 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#ifdef __ARCH_WANT_SYNC_FILE_RANGE2 +#define __NR_sync_file_range2 84 +#else +#define __NR_sync_file_range 84 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif +#define __NR_timerfd_create 85 +#define __NR_timerfd_settime 86 +#define __NR_timerfd_gettime 87 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_utimensat 88 +#define __NR_acct 89 +#define __NR_capget 90 +#define __NR_capset 91 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_personality 92 +#define __NR_exit 93 +#define __NR_exit_group 94 +#define __NR_waitid 95 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_set_tid_address 96 +#define __NR_unshare 97 +#define __NR_futex 98 +#define __NR_set_robust_list 99 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_get_robust_list 100 +#define __NR_nanosleep 101 +#define __NR_getitimer 102 +#define __NR_setitimer 103 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_kexec_load 104 +#define __NR_init_module 105 +#define __NR_delete_module 106 +#define __NR_timer_create 107 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_timer_gettime 108 +#define __NR_timer_getoverrun 109 +#define __NR_timer_settime 110 +#define __NR_timer_delete 111 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_clock_settime 112 +#define __NR_clock_gettime 113 +#define __NR_clock_getres 114 +#define __NR_clock_nanosleep 115 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_syslog 116 +#define __NR_ptrace 117 +#define __NR_sched_setparam 118 +#define __NR_sched_setscheduler 119 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_sched_getscheduler 120 +#define __NR_sched_getparam 121 +#define __NR_sched_setaffinity 122 +#define __NR_sched_getaffinity 123 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_sched_yield 124 +#define __NR_sched_get_priority_max 125 +#define __NR_sched_get_priority_min 126 +#define __NR_sched_rr_get_interval 127 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_restart_syscall 128 +#define __NR_kill 129 +#define __NR_tkill 130 +#define __NR_tgkill 131 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_sigaltstack 132 +#define __NR_rt_sigsuspend 133 +#define __NR_rt_sigaction 134 +#define __NR_rt_sigprocmask 135 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_rt_sigpending 136 +#define __NR_rt_sigtimedwait 137 +#define __NR_rt_sigqueueinfo 138 +#define __NR_rt_sigreturn 139 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setpriority 140 +#define __NR_getpriority 141 +#define __NR_reboot 142 +#define __NR_setregid 143 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setgid 144 +#define __NR_setreuid 145 +#define __NR_setuid 146 +#define __NR_setresuid 147 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getresuid 148 +#define __NR_setresgid 149 +#define __NR_getresgid 150 +#define __NR_setfsuid 151 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setfsgid 152 +#define __NR_times 153 +#define __NR_setpgid 154 +#define __NR_getpgid 155 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getsid 156 +#define __NR_setsid 157 +#define __NR_getgroups 158 +#define __NR_setgroups 159 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_uname 160 +#define __NR_sethostname 161 +#define __NR_setdomainname 162 +#define __NR_getrlimit 163 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setrlimit 164 +#define __NR_getrusage 165 +#define __NR_umask 166 +#define __NR_prctl 167 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getcpu 168 +#define __NR_gettimeofday 169 +#define __NR_settimeofday 170 +#define __NR_adjtimex 171 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getpid 172 +#define __NR_getppid 173 +#define __NR_getuid 174 +#define __NR_geteuid 175 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getgid 176 +#define __NR_getegid 177 +#define __NR_gettid 178 +#define __NR_sysinfo 179 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mq_open 180 +#define __NR_mq_unlink 181 +#define __NR_mq_timedsend 182 +#define __NR_mq_timedreceive 183 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mq_notify 184 +#define __NR_mq_getsetattr 185 +#define __NR_msgget 186 +#define __NR_msgctl 187 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_msgrcv 188 +#define __NR_msgsnd 189 +#define __NR_semget 190 +#define __NR_semctl 191 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_semtimedop 192 +#define __NR_semop 193 +#define __NR_shmget 194 +#define __NR_shmctl 195 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_shmat 196 +#define __NR_shmdt 197 +#define __NR_socket 198 +#define __NR_socketpair 199 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_bind 200 +#define __NR_listen 201 +#define __NR_accept 202 +#define __NR_connect 203 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_getsockname 204 +#define __NR_getpeername 205 +#define __NR_sendto 206 +#define __NR_recvfrom 207 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_setsockopt 208 +#define __NR_getsockopt 209 +#define __NR_shutdown 210 +#define __NR_sendmsg 211 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_recvmsg 212 +#define __NR_readahead 213 +#define __NR_brk 214 +#define __NR_munmap 215 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mremap 216 +#define __NR_add_key 217 +#define __NR_request_key 218 +#define __NR_keyctl 219 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_clone 220 +#define __NR_execve 221 +#define __NR3264_mmap 222 +#define __NR3264_fadvise64 223 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#ifndef __ARCH_NOMMU +#define __NR_swapon 224 +#define __NR_swapoff 225 +#define __NR_mprotect 226 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_msync 227 +#define __NR_mlock 228 +#define __NR_munlock 229 +#define __NR_mlockall 230 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_munlockall 231 +#define __NR_mincore 232 +#define __NR_madvise 233 +#define __NR_remap_file_pages 234 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mbind 235 +#define __NR_get_mempolicy 236 +#define __NR_set_mempolicy 237 +#define __NR_migrate_pages 238 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_move_pages 239 +#endif +#define __NR_rt_tgsigqueueinfo 240 +#define __NR_perf_event_open 241 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_accept4 242 +#define __NR_recvmmsg 243 +#define __NR_arch_specific_syscall 244 +#define __NR_wait4 260 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_prlimit64 261 +#define __NR_fanotify_init 262 +#define __NR_fanotify_mark 263 +#define __NR_name_to_handle_at 264 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_open_by_handle_at 265 +#define __NR_clock_adjtime 266 +#define __NR_syncfs 267 +#define __NR_setns 268 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_sendmmsg 269 +#define __NR_process_vm_readv 270 +#define __NR_process_vm_writev 271 +#define __NR_kcmp 272 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_finit_module 273 +#undef __NR_syscalls +#define __NR_syscalls 274 +#ifdef __ARCH_WANT_SYSCALL_NO_AT +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_open 1024 +#define __NR_link 1025 +#define __NR_unlink 1026 +#define __NR_mknod 1027 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_chmod 1028 +#define __NR_chown 1029 +#define __NR_mkdir 1030 +#define __NR_rmdir 1031 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_lchown 1032 +#define __NR_access 1033 +#define __NR_rename 1034 +#define __NR_readlink 1035 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_symlink 1036 +#define __NR_utimes 1037 +#define __NR3264_stat 1038 +#define __NR3264_lstat 1039 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#undef __NR_syscalls +#define __NR_syscalls (__NR3264_lstat+1) +#endif +#ifdef __ARCH_WANT_SYSCALL_NO_FLAGS +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_pipe 1040 +#define __NR_dup2 1041 +#define __NR_epoll_create 1042 +#define __NR_inotify_init 1043 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_eventfd 1044 +#define __NR_signalfd 1045 +#undef __NR_syscalls +#define __NR_syscalls (__NR_signalfd+1) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif +#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && defined(__ARCH_WANT_SYSCALL_OFF_T) +#define __NR_sendfile 1046 +#define __NR_ftruncate 1047 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_truncate 1048 +#define __NR_stat 1049 +#define __NR_lstat 1050 +#define __NR_fstat 1051 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_fcntl 1052 +#define __NR_fadvise64 1053 +#define __ARCH_WANT_SYS_FADVISE64 +#define __NR_newfstatat 1054 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __ARCH_WANT_SYS_NEWFSTATAT +#define __NR_fstatfs 1055 +#define __NR_statfs 1056 +#define __NR_lseek 1057 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mmap 1058 +#undef __NR_syscalls +#define __NR_syscalls (__NR_mmap+1) +#endif +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#ifdef __ARCH_WANT_SYSCALL_DEPRECATED +#define __NR_alarm 1059 +#define __ARCH_WANT_SYS_ALARM +#define __NR_getpgrp 1060 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __ARCH_WANT_SYS_GETPGRP +#define __NR_pause 1061 +#define __ARCH_WANT_SYS_PAUSE +#define __NR_time 1062 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __ARCH_WANT_SYS_TIME +#define __ARCH_WANT_COMPAT_SYS_TIME +#define __NR_utime 1063 +#define __ARCH_WANT_SYS_UTIME +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_creat 1064 +#define __NR_getdents 1065 +#define __ARCH_WANT_SYS_GETDENTS +#define __NR_futimesat 1066 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_select 1067 +#define __ARCH_WANT_SYS_SELECT +#define __NR_poll 1068 +#define __NR_epoll_wait 1069 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_ustat 1070 +#define __NR_vfork 1071 +#define __NR_oldwait4 1072 +#define __NR_recv 1073 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_send 1074 +#define __NR_bdflush 1075 +#define __NR_umount 1076 +#define __ARCH_WANT_SYS_OLDUMOUNT +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_uselib 1077 +#define __NR__sysctl 1078 +#define __NR_fork 1079 +#undef __NR_syscalls +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_syscalls (__NR_fork+1) +#endif +#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT) +#define __NR_fcntl __NR3264_fcntl +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_statfs __NR3264_statfs +#define __NR_fstatfs __NR3264_fstatfs +#define __NR_truncate __NR3264_truncate +#define __NR_ftruncate __NR3264_ftruncate +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_lseek __NR3264_lseek +#define __NR_sendfile __NR3264_sendfile +#define __NR_newfstatat __NR3264_fstatat +#define __NR_fstat __NR3264_fstat +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mmap __NR3264_mmap +#define __NR_fadvise64 __NR3264_fadvise64 +#ifdef __NR3264_stat +#define __NR_stat __NR3264_stat +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_lstat __NR3264_lstat +#endif +#else +#define __NR_fcntl64 __NR3264_fcntl +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_statfs64 __NR3264_statfs +#define __NR_fstatfs64 __NR3264_fstatfs +#define __NR_truncate64 __NR3264_truncate +#define __NR_ftruncate64 __NR3264_ftruncate +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_llseek __NR3264_lseek +#define __NR_sendfile64 __NR3264_sendfile +#define __NR_fstatat64 __NR3264_fstatat +#define __NR_fstat64 __NR3264_fstat +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_mmap2 __NR3264_mmap +#define __NR_fadvise64_64 __NR3264_fadvise64 +#ifdef __NR3264_stat +#define __NR_stat64 __NR3264_stat +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define __NR_lstat64 __NR3264_lstat +#endif +#endif diff --git a/libc/kernel/uapi/linux/compiler.h b/libc/kernel/uapi/linux/compiler.h new file mode 100644 index 000000000..8e89655c8 --- /dev/null +++ b/libc/kernel/uapi/linux/compiler.h @@ -0,0 +1,18 @@ +#ifndef _UAPI_LINUX_COMPILER_H +#define _UAPI_LINUX_COMPILER_H + +/* + * This file is not currently in the Linux kernel tree. + * Upstream uapi headers refer to but there is + * no such uapi file. We've sent this upstream, and are optimistically + * adding it to bionic in the meantime. This should be replaced by + * a scrubbed header from external/kernel-headers when possible. + * + * An alternative to this file is to check in a symbolic link to the + * non-uapi . That's fine for building bionic too. + */ + +#define __user +#define __force + +#endif /* _UAPI_LINUX_COMPILER_H */ diff --git a/libc/kernel/uapi/linux/v4l2-dv-timings.h b/libc/kernel/uapi/linux/v4l2-dv-timings.h new file mode 100644 index 000000000..2c9ec8941 --- /dev/null +++ b/libc/kernel/uapi/linux/v4l2-dv-timings.h @@ -0,0 +1,158 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _V4L2_DV_TIMINGS_H +#define _V4L2_DV_TIMINGS_H +#if __GNUC__ < 4 || __GNUC__ == 4 && __GNUC_MINOR__ < 6 +#define V4L2_INIT_BT_TIMINGS(_width, args...) { .bt = { _width , ## args } } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#else +#define V4L2_INIT_BT_TIMINGS(_width, args...) .bt = { _width , ## args } +#endif +#define V4L2_DV_BT_CEA_640X480P59_94 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, 25175000, 16, 96, 48, 10, 2, 33, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_CEA_720X480I59_94 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(720, 480, 1, 0, 13500000, 19, 62, 57, 4, 3, 15, 4, 3, 16, V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) } +#define V4L2_DV_BT_CEA_720X480P59_94 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, 27000000, 16, 62, 60, 9, 6, 30, 0, 0, 0, V4L2_DV_BT_STD_CEA861, 0) } +#define V4L2_DV_BT_CEA_720X576I50 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(720, 576, 1, 0, 13500000, 12, 63, 69, 2, 3, 19, 2, 3, 20, V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) } +#define V4L2_DV_BT_CEA_720X576P50 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, 27000000, 12, 64, 68, 5, 5, 39, 0, 0, 0, V4L2_DV_BT_STD_CEA861, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_CEA_1280X720P24 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 59400000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) } +#define V4L2_DV_BT_CEA_1280X720P25 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 74250000, 2420, 40, 220, 5, 5, 20, 0, 0, 0, V4L2_DV_BT_STD_CEA861, 0) } +#define V4L2_DV_BT_CEA_1280X720P30 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 74250000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) } +#define V4L2_DV_BT_CEA_1280X720P50 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 74250000, 440, 40, 220, 5, 5, 20, 0, 0, 0, V4L2_DV_BT_STD_CEA861, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_CEA_1280X720P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 720, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 74250000, 110, 40, 220, 5, 5, 20, 0, 0, 0, V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) } +#define V4L2_DV_BT_CEA_1920X1080P24 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 74250000, 638, 44, 148, 4, 5, 36, 0, 0, 0, V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) } +#define V4L2_DV_BT_CEA_1920X1080P25 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 74250000, 528, 44, 148, 4, 5, 36, 0, 0, 0, V4L2_DV_BT_STD_CEA861, 0) } +#define V4L2_DV_BT_CEA_1920X1080P30 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 74250000, 88, 44, 148, 4, 5, 36, 0, 0, 0, V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_CEA_1920X1080I50 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1080, 1, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 74250000, 528, 44, 148, 2, 5, 15, 2, 5, 16, V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) } +#define V4L2_DV_BT_CEA_1920X1080P50 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 148500000, 528, 44, 148, 4, 5, 36, 0, 0, 0, V4L2_DV_BT_STD_CEA861, 0) } +#define V4L2_DV_BT_CEA_1920X1080I60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1080, 1, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 74250000, 88, 44, 148, 2, 5, 15, 2, 5, 16, V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_HALF_LINE) } +#define V4L2_DV_BT_CEA_1920X1080P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1080, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 148500000, 88, 44, 148, 4, 5, 36, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_640X350P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(640, 350, 0, V4L2_DV_HSYNC_POS_POL, 31500000, 32, 64, 96, 32, 3, 60, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_640X400P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(640, 400, 0, V4L2_DV_VSYNC_POS_POL, 31500000, 32, 64, 96, 1, 3, 41, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_720X400P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(720, 400, 0, V4L2_DV_VSYNC_POS_POL, 35500000, 36, 72, 108, 1, 3, 42, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_640X480P60 V4L2_DV_BT_CEA_640X480P59_94 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_640X480P72 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, 31500000, 24, 40, 128, 9, 3, 28, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_640X480P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, 31500000, 16, 64, 120, 1, 3, 16, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_640X480P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, 36000000, 56, 56, 80, 1, 3, 25, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_800X600P56 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 36000000, 24, 72, 128, 1, 2, 22, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_800X600P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 40000000, 40, 128, 88, 1, 4, 23, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_800X600P72 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 50000000, 56, 120, 64, 37, 6, 23, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_800X600P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 49500000, 16, 80, 160, 1, 3, 21, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_800X600P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 56250000, 32, 64, 152, 1, 3, 27, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_800X600P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL, 73250000, 48, 32, 80, 3, 4, 29, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_848X480P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(848, 480, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 33750000, 16, 112, 112, 6, 8, 23, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1024X768I43 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1024, 768, 1, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 44900000, 8, 176, 56, 0, 4, 20, 0, 4, 21, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1024X768P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, 65000000, 24, 136, 160, 3, 6, 29, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1024X768P70 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, 75000000, 24, 136, 144, 3, 6, 29, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1024X768P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1024, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 78750000, 16, 96, 176, 1, 3, 28, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1024X768P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1024, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 94500000, 48, 96, 208, 1, 3, 36, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1024X768P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1024, 768, 0, V4L2_DV_HSYNC_POS_POL, 115500000, 48, 32, 80, 3, 4, 38, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1152X864P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1152, 864, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 108000000, 64, 128, 256, 1, 3, 32, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1280X720P60 V4L2_DV_BT_CEA_1280X720P60 +#define V4L2_DV_BT_DMT_1280X768P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, 68250000, 48, 32, 80, 3, 7, 12, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1280X768P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, 79500000, 64, 128, 192, 3, 7, 20, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1280X768P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, 102250000, 80, 128, 208, 3, 7, 27, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1280X768P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, 117500000, 80, 136, 216, 3, 7, 31, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1280X768P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, 140250000, 48, 32, 80, 3, 7, 35, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1280X800P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, 71000000, 48, 32, 80, 3, 6, 14, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1280X800P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, 83500000, 72, 128, 200, 3, 6, 22, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1280X800P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, 106500000, 80, 128, 208, 3, 6, 29, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1280X800P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, 122500000, 80, 136, 216, 3, 6, 34, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1280X800P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, 146250000, 48, 32, 80, 3, 6, 38, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1280X960P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 960, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 108000000, 96, 112, 312, 1, 3, 36, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1280X960P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 960, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 148500000, 64, 160, 224, 1, 3, 47, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1280X960P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 960, 0, V4L2_DV_HSYNC_POS_POL, 175500000, 48, 32, 80, 3, 4, 50, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1280X1024P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 1024, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 108000000, 48, 112, 248, 1, 3, 38, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1280X1024P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 1024, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 135000000, 16, 144, 248, 1, 3, 38, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1280X1024P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 1024, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 157500000, 64, 160, 224, 1, 3, 44, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1280X1024P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1280, 1024, 0, V4L2_DV_HSYNC_POS_POL, 187250000, 48, 32, 80, 3, 7, 50, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1360X768P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1360, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 85500000, 64, 112, 256, 3, 6, 18, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1360X768P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1360, 768, 0, V4L2_DV_HSYNC_POS_POL, 148250000, 48, 32, 80, 3, 5, 37, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1366X768P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1366, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 85500000, 70, 143, 213, 3, 3, 24, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1366X768P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1366, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 72000000, 14, 56, 64, 1, 3, 28, 0, 0, 0, V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1400X1050P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, 101000000, 48, 32, 80, 3, 4, 23, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1400X1050P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, 121750000, 88, 144, 232, 3, 4, 32, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1400X1050P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, 156000000, 104, 144, 248, 3, 4, 42, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1400X1050P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, 179500000, 104, 152, 256, 3, 4, 48, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1400X1050P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, 208000000, 48, 32, 80, 3, 4, 55, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1440X900P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, 88750000, 48, 32, 80, 3, 6, 17, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1440X900P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, 106500000, 80, 152, 232, 3, 6, 25, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1440X900P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, 136750000, 96, 152, 248, 3, 6, 33, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1440X900P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, 157000000, 104, 152, 256, 3, 6, 39, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1440X900P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, 182750000, 48, 32, 80, 3, 6, 44, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1600X900P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1600, 900, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 108000000, 24, 80, 96, 1, 3, 96, 0, 0, 0, V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1600X1200P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 162000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1600X1200P65 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 175500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1600X1200P70 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 189000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1600X1200P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 202500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1600X1200P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 229500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1600X1200P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL, 268250000, 48, 32, 80, 3, 4, 64, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1680X1050P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, 119000000, 48, 32, 80, 3, 6, 21, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1680X1050P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, 146250000, 104, 176, 280, 3, 6, 30, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1680X1050P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, 187000000, 120, 176, 296, 3, 6, 40, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1680X1050P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, 214750000, 128, 176, 304, 3, 6, 46, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1680X1050P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, 245500000, 48, 32, 80, 3, 6, 53, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1792X1344P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, 204750000, 128, 200, 328, 1, 3, 46, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1792X1344P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, 261000000, 96, 216, 352, 1, 3, 69, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1792X1344P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_HSYNC_POS_POL, 333250000, 48, 32, 80, 3, 4, 72, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1856X1392P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, 218250000, 96, 224, 352, 1, 3, 43, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1856X1392P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, 288000000, 128, 224, 352, 1, 3, 104, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1856X1392P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_HSYNC_POS_POL, 356500000, 48, 32, 80, 3, 4, 75, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1920X1080P60 V4L2_DV_BT_CEA_1920X1080P60 +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1920X1200P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, 154000000, 48, 32, 80, 3, 6, 26, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1920X1200P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, 193250000, 136, 200, 336, 3, 6, 36, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1920X1200P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, 245250000, 136, 208, 344, 3, 6, 46, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_1920X1200P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, 281250000, 144, 208, 352, 3, 6, 53, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_1920X1200P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, 317000000, 48, 32, 80, 3, 6, 62, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1920X1440P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, 234000000, 128, 208, 344, 1, 3, 56, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1920X1440P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, 297000000, 144, 224, 352, 1, 3, 56, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#define V4L2_DV_BT_DMT_1920X1440P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_HSYNC_POS_POL, 380500000, 48, 32, 80, 3, 4, 78, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_2048X1152P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(2048, 1152, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 162000000, 26, 80, 96, 1, 3, 44, 0, 0, 0, V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_2560X1600P60_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, 268500000, 48, 32, 80, 3, 6, 37, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_2560X1600P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, 348500000, 192, 280, 472, 3, 6, 49, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_2560X1600P75 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, 443250000, 208, 280, 488, 3, 6, 63, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define V4L2_DV_BT_DMT_2560X1600P85 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, 505250000, 208, 280, 488, 3, 6, 73, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) } +#define V4L2_DV_BT_DMT_2560X1600P120_RB { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, 552750000, 48, 32, 80, 3, 6, 85, 0, 0, 0, V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, V4L2_DV_FL_REDUCED_BLANKING) } +#define V4L2_DV_BT_DMT_1366X768P60 { .type = V4L2_DV_BT_656_1120, V4L2_INIT_BT_TIMINGS(1366, 768, 0, V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, 85500000, 70, 143, 213, 3, 3, 24, 0, 0, 0, V4L2_DV_BT_STD_DMT, 0) } +#endif +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ diff --git a/libc/netbsd/nameser/ns_name.c b/libc/netbsd/nameser/ns_name.c index 85d2f6053..d3606560d 100644 --- a/libc/netbsd/nameser/ns_name.c +++ b/libc/netbsd/nameser/ns_name.c @@ -430,11 +430,12 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src, } if (len < 0) len = srcp - src + 1; - srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff)); - if (srcp < msg || srcp >= eom) { /* Out of range. */ + l = (((n & 0x3f) << 8) | (*srcp & 0xff)); + if (l >= eom - msg) { /* Out of range. */ errno = EMSGSIZE; return (-1); } + srcp = msg + l; checked += 2; /* * Check for loops in the compressed name; diff --git a/libc/netbsd/net/getaddrinfo.c b/libc/netbsd/net/getaddrinfo.c index 937c42350..76549fa0c 100644 --- a/libc/netbsd/net/getaddrinfo.c +++ b/libc/netbsd/net/getaddrinfo.c @@ -1865,19 +1865,19 @@ _rfc6724_sort(struct addrinfo *list_sentinel) free(elems); } -static bool _using_default_dns(const char *iface) +static int _using_default_dns(const char *iface) { char buf[IF_NAMESIZE+1]; size_t if_len; // common case - if (iface == NULL || *iface == '\0') return true; + if (iface == NULL || *iface == '\0') return 1; if_len = _resolv_get_default_iface(buf, sizeof(buf)); - if (if_len != 0 && if_len + 1 <= sizeof(buf)) { - if (strcmp(buf, iface) == 0) return true; + if (if_len + 1 <= sizeof(buf)) { + if (strcmp(buf, iface) != 0) return 0; } - return false; + return 1; } /*ARGSUSED*/ diff --git a/libc/private/bionic_atomic_arm.h b/libc/private/bionic_atomic_arm.h index 3bb639e0e..3957d465a 100644 --- a/libc/private/bionic_atomic_arm.h +++ b/libc/private/bionic_atomic_arm.h @@ -16,198 +16,64 @@ #ifndef BIONIC_ATOMIC_ARM_H #define BIONIC_ATOMIC_ARM_H -#include - -/* Some of the harware instructions used below are not available in Thumb-1 - * mode (they are if you build in ARM or Thumb-2 mode though). To solve this - * problem, we're going to use the same technique than libatomics_ops, - * which is to temporarily switch to ARM, do the operation, then switch - * back to Thumb-1. - * - * This results in two 'bx' jumps, just like a normal function call, but - * everything is kept inlined, avoids loading or computing the function's - * address, and prevents a little I-cache trashing too. - * - * However, it is highly recommended to avoid compiling any C library source - * file that use these functions in Thumb-1 mode. - * - * Define three helper macros to implement this: - */ -#if defined(__thumb__) && !defined(__thumb2__) -# define __ATOMIC_SWITCH_TO_ARM \ - "adr r3, 5f\n" \ - "bx r3\n" \ - ".align\n" \ - ".arm\n" \ - "5:\n" -/* note: the leading \n below is intentional */ -# define __ATOMIC_SWITCH_TO_THUMB \ - "\n" \ - "adr r3, 6f\n" \ - "bx r3\n" \ - ".thumb" \ - "6:\n" - -# define __ATOMIC_CLOBBERS "r3" /* list of clobbered registers */ - -/* Warn the user that ARM mode should really be preferred! */ -# warning Rebuilding this source file in ARM mode is highly recommended for performance!! - +__ATOMIC_INLINE__ void __bionic_memory_barrier(void) { +#if defined(ANDROID_SMP) && ANDROID_SMP == 1 + __asm__ __volatile__ ( "dmb" : : : "memory" ); #else -# define __ATOMIC_SWITCH_TO_ARM /* nothing */ -# define __ATOMIC_SWITCH_TO_THUMB /* nothing */ -# define __ATOMIC_CLOBBERS /* nothing */ + /* A simple compiler barrier. */ + __asm__ __volatile__ ( "" : : : "memory" ); #endif - - -/* Define a full memory barrier, this is only needed if we build the - * platform for a multi-core device. For the record, using a 'dmb' - * instruction on a Nexus One device can take up to 180 ns even if - * it is completely un-necessary on this device. - * - * NOTE: This is where the platform and NDK headers atomic headers are - * going to diverge. With the NDK, we don't know if the generated - * code is going to run on a single or multi-core device, so we - * need to be cautious. - * - * I.e. on single-core devices, the helper immediately returns, - * on multi-core devices, it uses "dmb" or any other means to - * perform a full-memory barrier. - * - * There are three cases to consider for the platform: - * - * - multi-core ARMv7-A => use the 'dmb' hardware instruction - * - multi-core ARMv6 => use the coprocessor - * - single core ARMv6+ => do not use any hardware barrier - */ -#if defined(ANDROID_SMP) && ANDROID_SMP == 1 - -/* Sanity check, multi-core is only supported starting from ARMv6 */ -# if __ARM_ARCH__ < 6 -# error ANDROID_SMP should not be set to 1 for an ARM architecture less than 6 -# endif - -# ifdef __ARM_HAVE_DMB -/* For ARMv7-A, we can use the 'dmb' instruction directly */ -__ATOMIC_INLINE__ void -__bionic_memory_barrier(void) -{ - /* Note: we always build in ARM or Thumb-2 on ARMv7-A, so don't - * bother with __ATOMIC_SWITCH_TO_ARM */ - __asm__ __volatile__ ( "dmb" : : : "memory" ); -} -# else /* !__ARM_HAVE_DMB */ -/* Otherwise, i.e. for multi-core ARMv6, we need to use the coprocessor, - * which requires the use of a general-purpose register, which is slightly - * less efficient. - */ -__ATOMIC_INLINE__ void -__bionic_memory_barrier(void) -{ - __asm__ __volatile__ ( - __SWITCH_TO_ARM - "mcr p15, 0, %0, c7, c10, 5" - __SWITCH_TO_THUMB - : : "r" (0) : __ATOMIC_CLOBBERS "memory"); } -# endif /* !__ARM_HAVE_DMB */ -#else /* !ANDROID_SMP */ -__ATOMIC_INLINE__ void -__bionic_memory_barrier(void) -{ - /* A simple compiler barrier */ - __asm__ __volatile__ ( "" : : : "memory" ); -} -#endif /* !ANDROID_SMP */ - -#ifndef __ARM_HAVE_LDREX_STREX -#error Only ARM devices which have LDREX / STREX are supported -#endif /* Compare-and-swap, without any explicit barriers. Note that this functions * returns 0 on success, and 1 on failure. The opposite convention is typically * used on other platforms. */ -__ATOMIC_INLINE__ int -__bionic_cmpxchg(int32_t old_value, int32_t new_value, volatile int32_t* ptr) -{ - int32_t prev, status; - do { - __asm__ __volatile__ ( - __ATOMIC_SWITCH_TO_ARM - "ldrex %0, [%3]\n" - "mov %1, #0\n" - "teq %0, %4\n" +__ATOMIC_INLINE__ int __bionic_cmpxchg(int32_t old_value, int32_t new_value, volatile int32_t* ptr) { + int32_t prev, status; + do { + __asm__ __volatile__ ( + "ldrex %0, [%3]\n" + "mov %1, #0\n" + "teq %0, %4\n" #ifdef __thumb2__ - "it eq\n" + "it eq\n" #endif - "strexeq %1, %5, [%3]" - __ATOMIC_SWITCH_TO_THUMB - : "=&r" (prev), "=&r" (status), "+m"(*ptr) - : "r" (ptr), "Ir" (old_value), "r" (new_value) - : __ATOMIC_CLOBBERS "cc"); - } while (__builtin_expect(status != 0, 0)); - return prev != old_value; -} - -/* Swap operation, without any explicit barriers. */ -__ATOMIC_INLINE__ int32_t -__bionic_swap(int32_t new_value, volatile int32_t* ptr) -{ - int32_t prev, status; - do { - __asm__ __volatile__ ( - __ATOMIC_SWITCH_TO_ARM - "ldrex %0, [%3]\n" - "strex %1, %4, [%3]" - __ATOMIC_SWITCH_TO_THUMB - : "=&r" (prev), "=&r" (status), "+m" (*ptr) - : "r" (ptr), "r" (new_value) - : __ATOMIC_CLOBBERS "cc"); - } while (__builtin_expect(status != 0, 0)); - return prev; + "strexeq %1, %5, [%3]" + : "=&r" (prev), "=&r" (status), "+m"(*ptr) + : "r" (ptr), "Ir" (old_value), "r" (new_value) + : "cc"); + } while (__builtin_expect(status != 0, 0)); + return prev != old_value; } -/* Atomic increment - without any barriers - * This returns the old value - */ -__ATOMIC_INLINE__ int32_t -__bionic_atomic_inc(volatile int32_t* ptr) -{ - int32_t prev, tmp, status; - do { - __asm__ __volatile__ ( - __ATOMIC_SWITCH_TO_ARM - "ldrex %0, [%4]\n" - "add %1, %0, #1\n" - "strex %2, %1, [%4]" - __ATOMIC_SWITCH_TO_THUMB - : "=&r" (prev), "=&r" (tmp), "=&r" (status), "+m"(*ptr) - : "r" (ptr) - : __ATOMIC_CLOBBERS "cc"); - } while (__builtin_expect(status != 0, 0)); - return prev; +/* Swap, without any explicit barriers. */ +__ATOMIC_INLINE__ int32_t __bionic_swap(int32_t new_value, volatile int32_t* ptr) { + int32_t prev, status; + do { + __asm__ __volatile__ ( + "ldrex %0, [%3]\n" + "strex %1, %4, [%3]" + : "=&r" (prev), "=&r" (status), "+m" (*ptr) + : "r" (ptr), "r" (new_value) + : "cc"); + } while (__builtin_expect(status != 0, 0)); + return prev; } -/* Atomic decrement - without any barriers - * This returns the old value. - */ -__ATOMIC_INLINE__ int32_t -__bionic_atomic_dec(volatile int32_t* ptr) -{ - int32_t prev, tmp, status; - do { - __asm__ __volatile__ ( - __ATOMIC_SWITCH_TO_ARM - "ldrex %0, [%4]\n" - "sub %1, %0, #1\n" - "strex %2, %1, [%4]" - __ATOMIC_SWITCH_TO_THUMB - : "=&r" (prev), "=&r" (tmp), "=&r" (status), "+m"(*ptr) - : "r" (ptr) - : __ATOMIC_CLOBBERS "cc"); - } while (__builtin_expect(status != 0, 0)); - return prev; +/* Atomic decrement, without explicit barriers. */ +__ATOMIC_INLINE__ int32_t __bionic_atomic_dec(volatile int32_t* ptr) { + int32_t prev, tmp, status; + do { + __asm__ __volatile__ ( + "ldrex %0, [%4]\n" + "sub %1, %0, #1\n" + "strex %2, %1, [%4]" + : "=&r" (prev), "=&r" (tmp), "=&r" (status), "+m"(*ptr) + : "r" (ptr) + : "cc"); + } while (__builtin_expect(status != 0, 0)); + return prev; } #endif /* SYS_ATOMICS_ARM_H */ diff --git a/libc/private/bionic_atomic_gcc_builtin.h b/libc/private/bionic_atomic_gcc_builtin.h index 2919f7fef..9e5e5aacd 100644 --- a/libc/private/bionic_atomic_gcc_builtin.h +++ b/libc/private/bionic_atomic_gcc_builtin.h @@ -16,46 +16,35 @@ #ifndef BIONIC_ATOMIC_GCC_BUILTIN_H #define BIONIC_ATOMIC_GCC_BUILTIN_H -/* This header file is used by default if we don't have optimized atomic +/* + * This header file is used by default if we don't have optimized atomic * routines for a given platform. See bionic_atomic_arm.h and * bionic_atomic_x86.h for examples. + * + * Note that the GCC builtins include barriers that aren't present in + * the architecture-specific assembler versions. */ -__ATOMIC_INLINE__ void -__bionic_memory_barrier(void) -{ - __sync_synchronize(); -} - -__ATOMIC_INLINE__ int -__bionic_cmpxchg(int32_t old_value, int32_t new_value, volatile int32_t* ptr) -{ - /* We must return 0 on success */ - return __sync_val_compare_and_swap(ptr, old_value, new_value) != old_value; +__ATOMIC_INLINE__ void __bionic_memory_barrier(void) { + __sync_synchronize(); } -__ATOMIC_INLINE__ int32_t -__bionic_swap(int32_t new_value, volatile int32_t* ptr) -{ - int32_t old_value; - do { - old_value = *ptr; - } while (__sync_val_compare_and_swap(ptr, old_value, new_value) != old_value); - return old_value; +__ATOMIC_INLINE__ int __bionic_cmpxchg(int32_t old_value, int32_t new_value, volatile int32_t* ptr) { + /* We must return 0 on success. */ + return __sync_val_compare_and_swap(ptr, old_value, new_value) != old_value; } -__ATOMIC_INLINE__ int32_t -__bionic_atomic_inc(volatile int32_t* ptr) -{ - /* We must return the old value */ - return __sync_fetch_and_add(ptr, 1); +__ATOMIC_INLINE__ int32_t __bionic_swap(int32_t new_value, volatile int32_t* ptr) { + int32_t old_value; + do { + old_value = *ptr; + } while (__sync_val_compare_and_swap(ptr, old_value, new_value) != old_value); + return old_value; } -__ATOMIC_INLINE__ int32_t -__bionic_atomic_dec(volatile int32_t* ptr) -{ - /* We must return the old value */ - return __sync_fetch_and_add(ptr, -1); +__ATOMIC_INLINE__ int32_t __bionic_atomic_dec(volatile int32_t* ptr) { + /* We must return the old value. */ + return __sync_fetch_and_add(ptr, -1); } #endif /* BIONIC_ATOMIC_GCC_BUILTIN_H */ diff --git a/libc/private/bionic_atomic_inline.h b/libc/private/bionic_atomic_inline.h index 6819af6b3..4936fe15d 100644 --- a/libc/private/bionic_atomic_inline.h +++ b/libc/private/bionic_atomic_inline.h @@ -23,11 +23,6 @@ * memory barrier needs to be issued inline rather than as a function * call. * - * Most code should not use these. - * - * Anything that does include this file must set ANDROID_SMP to either - * 0 or 1, indicating compilation for UP or SMP, respectively. - * * Macros defined in this header: * * void ANDROID_MEMBAR_FULL(void) diff --git a/libc/private/bionic_atomic_mips.h b/libc/private/bionic_atomic_mips.h index 28fe88dd0..5e081161d 100644 --- a/libc/private/bionic_atomic_mips.h +++ b/libc/private/bionic_atomic_mips.h @@ -19,84 +19,58 @@ /* Define a full memory barrier, this is only needed if we build the * platform for a multi-core device. */ + +__ATOMIC_INLINE__ void __bionic_memory_barrier() { #if defined(ANDROID_SMP) && ANDROID_SMP == 1 -__ATOMIC_INLINE__ void -__bionic_memory_barrier() -{ - __asm__ __volatile__ ( "sync" : : : "memory" ); -} + __asm__ __volatile__ ( "sync" : : : "memory" ); #else -__ATOMIC_INLINE__ void -__bionic_memory_barrier() -{ - /* A simple compiler barrier */ - __asm__ __volatile__ ( "" : : : "memory" ); -} + /* A simple compiler barrier. */ + __asm__ __volatile__ ( "" : : : "memory" ); #endif +} /* Compare-and-swap, without any explicit barriers. Note that this function * returns 0 on success, and 1 on failure. The opposite convention is typically * used on other platforms. */ -__ATOMIC_INLINE__ int -__bionic_cmpxchg(int32_t old_value, int32_t new_value, volatile int32_t* ptr) -{ - int32_t prev, status; - __asm__ __volatile__ ("1: move %[status], %[new_value] \n" - " ll %[prev], 0(%[ptr]) \n" - " bne %[old_value], %[prev], 2f \n" - " sc %[status], 0(%[ptr]) \n" - " beqz %[status], 1b \n" - "2: \n" - : [prev]"=&r"(prev), [status]"=&r"(status), "+m"(*ptr) - : [new_value]"r"(new_value), [old_value]"r"(old_value), [ptr]"r"(ptr) - : "memory"); - return prev != old_value; +__ATOMIC_INLINE__ int __bionic_cmpxchg(int32_t old_value, int32_t new_value, volatile int32_t* ptr) { + int32_t prev, status; + __asm__ __volatile__ ("1: move %[status], %[new_value] \n" + " ll %[prev], 0(%[ptr]) \n" + " bne %[old_value], %[prev], 2f \n" + " sc %[status], 0(%[ptr]) \n" + " beqz %[status], 1b \n" + "2: \n" + : [prev]"=&r"(prev), [status]"=&r"(status), "+m"(*ptr) + : [new_value]"r"(new_value), [old_value]"r"(old_value), [ptr]"r"(ptr) + : "memory"); + return prev != old_value; } - -/* Swap, without any explicit barriers */ -__ATOMIC_INLINE__ int32_t -__bionic_swap(int32_t new_value, volatile int32_t *ptr) -{ - int32_t prev, status; - __asm__ __volatile__ ("1: move %[status], %[new_value] \n" - " ll %[prev], 0(%[ptr]) \n" - " sc %[status], 0(%[ptr]) \n" - " beqz %[status], 1b \n" - : [prev]"=&r"(prev), [status]"=&r"(status), "+m"(*ptr) - : [ptr]"r"(ptr), [new_value]"r"(new_value) - : "memory"); - return prev; +/* Swap, without any explicit barriers. */ +__ATOMIC_INLINE__ int32_t __bionic_swap(int32_t new_value, volatile int32_t* ptr) { + int32_t prev, status; + __asm__ __volatile__ ("1: move %[status], %[new_value] \n" + " ll %[prev], 0(%[ptr]) \n" + " sc %[status], 0(%[ptr]) \n" + " beqz %[status], 1b \n" + : [prev]"=&r"(prev), [status]"=&r"(status), "+m"(*ptr) + : [ptr]"r"(ptr), [new_value]"r"(new_value) + : "memory"); + return prev; } -/* Atomic increment, without explicit barriers */ -__ATOMIC_INLINE__ int32_t -__bionic_atomic_inc(volatile int32_t *ptr) -{ - int32_t prev, status; - __asm__ __volatile__ ("1: ll %[prev], 0(%[ptr]) \n" - " addiu %[status], %[prev], 1 \n" - " sc %[status], 0(%[ptr]) \n" - " beqz %[status], 1b \n" - : [prev]"=&r" (prev), [status]"=&r"(status), "+m" (*ptr) - : [ptr]"r"(ptr) - : "memory"); - return prev; +/* Atomic decrement, without explicit barriers. */ +__ATOMIC_INLINE__ int32_t __bionic_atomic_dec(volatile int32_t* ptr) { + int32_t prev, status; + __asm__ __volatile__ ("1: ll %[prev], 0(%[ptr]) \n" + " addiu %[status], %[prev], -1 \n" + " sc %[status], 0(%[ptr]) \n" + " beqz %[status], 1b \n" + : [prev]"=&r" (prev), [status]"=&r"(status), "+m" (*ptr) + : [ptr]"r"(ptr) + : "memory"); + return prev; } -/* Atomic decrement, without explicit barriers */ -__ATOMIC_INLINE__ int32_t -__bionic_atomic_dec(volatile int32_t *ptr) -{ - int32_t prev, status; - __asm__ __volatile__ ("1: ll %[prev], 0(%[ptr]) \n" - " addiu %[status], %[prev], -1 \n" - " sc %[status], 0(%[ptr]) \n" - " beqz %[status], 1b \n" - : [prev]"=&r" (prev), [status]"=&r"(status), "+m" (*ptr) - : [ptr]"r"(ptr) - : "memory"); - return prev; -} #endif /* BIONIC_ATOMIC_MIPS_H */ diff --git a/libc/private/bionic_atomic_x86.h b/libc/private/bionic_atomic_x86.h index aca0c4b56..89639c8b2 100644 --- a/libc/private/bionic_atomic_x86.h +++ b/libc/private/bionic_atomic_x86.h @@ -19,28 +19,20 @@ /* Define a full memory barrier, this is only needed if we build the * platform for a multi-core device. */ +__ATOMIC_INLINE__ void __bionic_memory_barrier() { #if defined(ANDROID_SMP) && ANDROID_SMP == 1 -__ATOMIC_INLINE__ void -__bionic_memory_barrier() -{ - __asm__ __volatile__ ( "mfence" : : : "memory" ); -} + __asm__ __volatile__ ( "mfence" : : : "memory" ); #else -__ATOMIC_INLINE__ void -__bionic_memory_barrier() -{ - /* A simple compiler barrier */ - __asm__ __volatile__ ( "" : : : "memory" ); -} + /* A simple compiler barrier. */ + __asm__ __volatile__ ( "" : : : "memory" ); #endif +} /* Compare-and-swap, without any explicit barriers. Note that this function * returns 0 on success, and 1 on failure. The opposite convention is typically * used on other platforms. */ -__ATOMIC_INLINE__ int -__bionic_cmpxchg(int32_t old_value, int32_t new_value, volatile int32_t* ptr) -{ +__ATOMIC_INLINE__ int __bionic_cmpxchg(int32_t old_value, int32_t new_value, volatile int32_t* ptr) { int32_t prev; __asm__ __volatile__ ("lock; cmpxchgl %1, %2" : "=a" (prev) @@ -49,40 +41,23 @@ __bionic_cmpxchg(int32_t old_value, int32_t new_value, volatile int32_t* ptr) return prev != old_value; } - -/* Swap, without any explicit barriers */ -__ATOMIC_INLINE__ int32_t -__bionic_swap(int32_t new_value, volatile int32_t *ptr) -{ - __asm__ __volatile__ ("xchgl %1, %0" - : "=r" (new_value) - : "m" (*ptr), "0" (new_value) - : "memory"); - return new_value; -} - -/* Atomic increment, without explicit barriers */ -__ATOMIC_INLINE__ int32_t -__bionic_atomic_inc(volatile int32_t *ptr) -{ - int increment = 1; - __asm__ __volatile__ ("lock; xaddl %0, %1" - : "+r" (increment), "+m" (*ptr) - : : "memory"); - /* increment now holds the old value of *ptr */ - return increment; +/* Swap, without any explicit barriers. */ +__ATOMIC_INLINE__ int32_t __bionic_swap(int32_t new_value, volatile int32_t *ptr) { + __asm__ __volatile__ ("xchgl %1, %0" + : "=r" (new_value) + : "m" (*ptr), "0" (new_value) + : "memory"); + return new_value; } -/* Atomic decrement, without explicit barriers */ -__ATOMIC_INLINE__ int32_t -__bionic_atomic_dec(volatile int32_t *ptr) -{ - int increment = -1; - __asm__ __volatile__ ("lock; xaddl %0, %1" - : "+r" (increment), "+m" (*ptr) - : : "memory"); - /* increment now holds the old value of *ptr */ - return increment; +/* Atomic decrement, without explicit barriers. */ +__ATOMIC_INLINE__ int32_t __bionic_atomic_dec(volatile int32_t* ptr) { + int increment = -1; + __asm__ __volatile__ ("lock; xaddl %0, %1" + : "+r" (increment), "+m" (*ptr) + : : "memory"); + /* increment now holds the old value of *ptr */ + return increment; } #endif /* BIONIC_ATOMIC_X86_H */ diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h index d15b1ca06..c415540aa 100644 --- a/libc/private/bionic_tls.h +++ b/libc/private/bionic_tls.h @@ -94,8 +94,7 @@ extern int __set_tls(void* ptr); (volatile void*) __val; }) #elif defined(__mips__) # define __get_tls() \ - /* On mips32r1, this goes via a kernel illegal instruction trap that's optimized for v1. */ \ - ({ register unsigned int __val asm("v1"); \ + ({ register unsigned int __val; \ asm (" .set push\n" \ " .set mips32r2\n" \ " rdhwr %0,$29\n" \ diff --git a/libc/stdlib/_Exit.c b/libc/stdlib/_Exit.c new file mode 100644 index 000000000..e7f0f5104 --- /dev/null +++ b/libc/stdlib/_Exit.c @@ -0,0 +1,22 @@ +/* + * This file is in the public domain. Written by Garrett A. Wollman, + * 2002-09-07. + * + * $FreeBSD$ + */ + +#include +#include + +/* + * ISO C99 added this function to provide for Standard C applications + * which needed something like POSIX _exit(). A new interface was created + * in case it turned out that _exit() was insufficient to meet the + * requirements of ISO C. (That's probably not the case, but here + * is where you would put the extra code if it were.) + */ +void +_Exit(int code) +{ + _exit(code); +} diff --git a/libc/stdlib/quick_exit.c b/libc/stdlib/quick_exit.c new file mode 100644 index 000000000..ba556c46b --- /dev/null +++ b/libc/stdlib/quick_exit.c @@ -0,0 +1,80 @@ +/*- + * Copyright (c) 2011 David Chisnall + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +/** + * Linked list of quick exit handlers. This is simpler than the atexit() + * version, because it is not required to support C++ destructors or + * DSO-specific cleanups. + */ +struct quick_exit_handler { + struct quick_exit_handler *next; + void (*cleanup)(void); +}; + +/** + * Lock protecting the handlers list. + */ +static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER; +/** + * Stack of cleanup handlers. These will be invoked in reverse order when + */ +static struct quick_exit_handler *handlers; + +int +at_quick_exit(void (*func)(void)) +{ + struct quick_exit_handler *h; + + h = malloc(sizeof(*h)); + + if (NULL == h) + return (1); + h->cleanup = func; + pthread_mutex_lock(&atexit_mutex); + h->next = handlers; + handlers = h; + pthread_mutex_unlock(&atexit_mutex); + return (0); +} + +void +quick_exit(int status) +{ + struct quick_exit_handler *h; + + /* + * XXX: The C++ spec requires us to call std::terminate if there is an + * exception here. + */ + for (h = handlers; NULL != h; h = h->next) + h->cleanup(); + _Exit(status); +} diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c index b23eca468..c6821fa12 100644 --- a/libc/tzcode/localtime.c +++ b/libc/tzcode/localtime.c @@ -371,9 +371,8 @@ tzload(register const char* name, register struct state* const sp, goto oops; int toread; fid = __bionic_open_tzdata(name, &toread); - if (fid < 0) { - return -1; - } + if (fid < 0) + goto oops; nread = read(fid, up->buf, toread); if (close(fid) < 0 || nread <= 0) goto oops; diff --git a/libc/unistd/abort.c b/libc/unistd/abort.c new file mode 100644 index 000000000..4a349bdd3 --- /dev/null +++ b/libc/unistd/abort.c @@ -0,0 +1,92 @@ +/* $OpenBSD: abort.c,v 1.14 2005/08/08 08:05:36 espie Exp $ */ +/* + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include "thread_private.h" +#include "atexit.h" + +#ifdef __arm__ +__LIBC_HIDDEN__ void +__libc_android_abort(void) +#else +void +abort(void) +#endif +{ + struct atexit *p = __atexit; + static int cleanup_called = 0; + sigset_t mask; + + + sigfillset(&mask); + /* + * don't block SIGABRT to give any handler a chance; we ignore + * any errors -- X311J doesn't allow abort to return anyway. + */ + sigdelset(&mask, SIGABRT); + + (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); + + /* + * POSIX requires we flush stdio buffers on abort + */ + if (cleanup_called == 0) { + while (p != NULL && p->next != NULL) + p = p->next; + /* the check for fn_dso == NULL is mostly paranoia */ + if (p != NULL && p->fns[0].fn_dso == NULL && + p->fns[0].fn_ptr.std_func != NULL) { + cleanup_called = 1; + (*p->fns[0].fn_ptr.std_func)(); + } + } + + raise(SIGABRT); + + /* + * if SIGABRT ignored, or caught and the handler returns, do + * it again, only harder. + */ + { + struct sigaction sa; + + sa.sa_handler = SIG_DFL; + sa.sa_flags = SA_RESTART; + sigemptyset(&sa.sa_mask); + + (void)sigaction( SIGABRT, &sa, &sa ); + } + + (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL); + raise(SIGABRT); + _exit(1); +} diff --git a/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c b/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c index 9f7f6d5ae..ea334df60 100644 --- a/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c +++ b/libc/upstream-freebsd/lib/libc/stdlib/getopt_long.c @@ -111,21 +111,21 @@ static int nonopt_start = -1; /* first non option argument (for permute) */ static int nonopt_end = -1; /* first option after non options (for permute) */ /* Error messages */ -static const char recargchar[] = "option requires an argument -- %c"; -static const char illoptchar[] = "illegal option -- %c"; /* From P1003.2 */ +static const char recargchar[] = "option requires an argument -- %c\n"; +static const char illoptchar[] = "illegal option -- %c\n"; /* From P1003.2 */ #ifdef GNU_COMPATIBLE static int dash_prefix = NO_PREFIX; -static const char gnuoptchar[] = "invalid option -- %c"; +static const char gnuoptchar[] = "invalid option -- %c\n"; -static const char recargstring[] = "option `%s%s' requires an argument"; -static const char ambig[] = "option `%s%.*s' is ambiguous"; -static const char noarg[] = "option `%s%.*s' doesn't allow an argument"; -static const char illoptstring[] = "unrecognized option `%s%s'"; +static const char recargstring[] = "option `%s%s' requires an argument\n"; +static const char ambig[] = "option `%s%.*s' is ambiguous\n"; +static const char noarg[] = "option `%s%.*s' doesn't allow an argument\n"; +static const char illoptstring[] = "unrecognized option `%s%s'\n"; #else -static const char recargstring[] = "option requires an argument -- %s"; -static const char ambig[] = "ambiguous option -- %.*s"; -static const char noarg[] = "option doesn't take an argument -- %.*s"; -static const char illoptstring[] = "unknown option -- %s"; +static const char recargstring[] = "option requires an argument -- %s\n"; +static const char ambig[] = "ambiguous option -- %.*s\n"; +static const char noarg[] = "option doesn't take an argument -- %.*s\n"; +static const char illoptstring[] = "unknown option -- %s\n"; #endif /* diff --git a/libc/stdlib/exit.c b/libc/upstream-netbsd/libc/stdlib/exit.c similarity index 71% rename from libc/stdlib/exit.c rename to libc/upstream-netbsd/libc/stdlib/exit.c index 83fe3d2de..67e6adf1b 100644 --- a/libc/stdlib/exit.c +++ b/libc/upstream-netbsd/libc/stdlib/exit.c @@ -1,7 +1,8 @@ -/* $OpenBSD: exit.c,v 1.12 2007/09/03 14:40:16 millert Exp $ */ +/* $NetBSD: exit.c,v 1.15 2011/05/18 19:36:36 dsl Exp $ */ + /*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,21 +29,23 @@ * SUCH DAMAGE. */ -#include -#include +#include +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)exit.c 8.1 (Berkeley) 6/4/93"; +#else +__RCSID("$NetBSD: exit.c,v 1.15 2011/05/18 19:36:36 dsl Exp $"); +#endif +#endif /* LIBC_SCCS and not lint */ + #include #include +#ifdef _LIBC +#include "reentrant.h" #include "atexit.h" -#include "thread_private.h" +#endif -/* - * This variable is zero until a process has created a thread. - * It is used to avoid calling locking functions in libc when they - * are not required. By default, libc is intended to be(come) - * thread-safe, but without a (significant) penalty to non-threaded - * processes. - */ -int __isthreaded = 0; +void (*__cleanup)(void); /* * Exit, flushing stdio buffers if necessary. @@ -50,10 +53,11 @@ int __isthreaded = 0; void exit(int status) { - /* - * Call functions registered by atexit() or _cxa_atexit() - * (including the stdio cleanup routine) and then _exit(). - */ + +#ifdef _LIBC __cxa_finalize(NULL); +#endif + if (__cleanup) + (*__cleanup)(); _exit(status); } diff --git a/libc/upstream-netbsd/libc/thread-stub/__isthreaded.c b/libc/upstream-netbsd/libc/thread-stub/__isthreaded.c new file mode 100644 index 000000000..50c1b6f4e --- /dev/null +++ b/libc/upstream-netbsd/libc/thread-stub/__isthreaded.c @@ -0,0 +1,37 @@ +/* $NetBSD: __isthreaded.c,v 1.3 2009/12/01 01:33:25 explorer Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Michael Graff. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: __isthreaded.c,v 1.3 2009/12/01 01:33:25 explorer Exp $"); +#endif /* LIBC_SCCS and not lint */ + +int __isthreaded = 0; diff --git a/libdl/libdl.c b/libdl/libdl.c index 378f521b6..548364cba 100644 --- a/libdl/libdl.c +++ b/libdl/libdl.c @@ -30,12 +30,8 @@ void android_update_LD_LIBRARY_PATH(const char* ld_library_path) { } void *dl_unwind_find_exidx(void *pc, int *pcount) { return 0; } -#elif defined(__i386__) || defined(__mips__) +#endif /* we munge the cb definition so we don't have to include any headers here. * It won't affect anything since these are just symbols anyway */ int dl_iterate_phdr(int (*cb)(void *info, void *size, void *data), void *data) { return 0; } - -#else -#error Unsupported architecture. Only mips, arm and x86 are supported. -#endif diff --git a/libm/Android.mk b/libm/Android.mk index 0d2c843ae..933556333 100644 --- a/libm/Android.mk +++ b/libm/Android.mk @@ -14,6 +14,8 @@ libm_common_src_files += \ upstream-freebsd/lib/msun/bsdsrc/b_exp.c \ upstream-freebsd/lib/msun/bsdsrc/b_log.c \ upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c \ + upstream-freebsd/lib/msun/src/catrig.c \ + upstream-freebsd/lib/msun/src/catrigf.c \ upstream-freebsd/lib/msun/src/e_acos.c \ upstream-freebsd/lib/msun/src/e_acosf.c \ upstream-freebsd/lib/msun/src/e_acosh.c \ @@ -62,8 +64,6 @@ libm_common_src_files += \ upstream-freebsd/lib/msun/src/e_scalbf.c \ upstream-freebsd/lib/msun/src/e_sinh.c \ upstream-freebsd/lib/msun/src/e_sinhf.c \ - upstream-freebsd/lib/msun/src/e_sqrt.c \ - upstream-freebsd/lib/msun/src/e_sqrtf.c \ upstream-freebsd/lib/msun/src/k_cos.c \ upstream-freebsd/lib/msun/src/k_cosf.c \ upstream-freebsd/lib/msun/src/k_exp.c \ @@ -93,7 +93,6 @@ libm_common_src_files += \ upstream-freebsd/lib/msun/src/s_conjf.c \ upstream-freebsd/lib/msun/src/s_copysign.c \ upstream-freebsd/lib/msun/src/s_copysignf.c \ - upstream-freebsd/lib/msun/src/s_cos.c \ upstream-freebsd/lib/msun/src/s_cosf.c \ upstream-freebsd/lib/msun/src/s_cproj.c \ upstream-freebsd/lib/msun/src/s_cprojf.c \ @@ -163,7 +162,6 @@ libm_common_src_files += \ upstream-freebsd/lib/msun/src/s_signgam.c \ upstream-freebsd/lib/msun/src/s_significand.c \ upstream-freebsd/lib/msun/src/s_significandf.c \ - upstream-freebsd/lib/msun/src/s_sin.c \ upstream-freebsd/lib/msun/src/s_sinf.c \ upstream-freebsd/lib/msun/src/s_tan.c \ upstream-freebsd/lib/msun/src/s_tanf.c \ @@ -175,18 +173,22 @@ libm_common_src_files += \ upstream-freebsd/lib/msun/src/w_cabs.c \ upstream-freebsd/lib/msun/src/w_cabsf.c \ upstream-freebsd/lib/msun/src/w_drem.c \ - upstream-freebsd/lib/msun/src/w_dremf.c \ + upstream-freebsd/lib/msun/src/w_dremf.c libm_common_src_files += fake_long_double.c # TODO: on Android, "long double" is "double". # upstream-freebsd/lib/msun/src/e_acosl.c \ +# upstream-freebsd/lib/msun/src/e_acoshl.c \ # upstream-freebsd/lib/msun/src/e_asinl.c \ +# upstream-freebsd/lib/msun/src/e_asinhl.c \ # upstream-freebsd/lib/msun/src/e_atan2l.c \ +# upstream-freebsd/lib/msun/src/e_atanhl.c \ # upstream-freebsd/lib/msun/src/e_fmodl.c \ # upstream-freebsd/lib/msun/src/e_hypotl.c \ # upstream-freebsd/lib/msun/src/e_remainderl.c \ # upstream-freebsd/lib/msun/src/e_sqrtl.c \ +# upstream-freebsd/lib/msun/src/imprecise.c \ # upstream-freebsd/lib/msun/src/s_atanl.c \ # upstream-freebsd/lib/msun/src/s_cbrtl.c \ # upstream-freebsd/lib/msun/src/s_ceill.c \ @@ -222,6 +224,31 @@ libm_common_includes := $(LOCAL_PATH)/upstream-freebsd/lib/msun/src/ libm_arm_includes := $(LOCAL_PATH)/arm libm_arm_src_files := arm/fenv.c +ifeq ($(TARGET_CPU_VARIANT),krait) + libm_arm_src_files += \ + arm/e_pow.S \ + arm/s_cos.S \ + arm/s_sin.S \ + arm/e_sqrtf.S \ + arm/e_sqrt.S + libm_arm_cflags += -DKRAIT_NEON_OPTIMIZATION -fno-if-conversion +else + ifeq ($(TARGET_USE_QCOM_BIONIC_OPTIMIZATION),true) + libm_arm_src_files += \ + arm/e_pow.S \ + arm/s_cos.S \ + arm/s_sin.S \ + arm/e_sqrtf.S \ + arm/e_sqrt.S + libm_arm_cflags += -DKRAIT_NEON_OPTIMIZATION -fno-if-conversion + else + libm_common_src_files += \ + upstream-freebsd/lib/msun/src/s_cos.c \ + upstream-freebsd/lib/msun/src/s_sin.c \ + upstream-freebsd/lib/msun/src/e_sqrtf.c \ + upstream-freebsd/lib/msun/src/e_sqrt.c + endif +endif libm_x86_includes := $(LOCAL_PATH)/i386 $(LOCAL_PATH)/i387 libm_x86_src_files := i387/fenv.c diff --git a/libm/arm/e_pow.S b/libm/arm/e_pow.S new file mode 100644 index 000000000..0e6240d0d --- /dev/null +++ b/libm/arm/e_pow.S @@ -0,0 +1,459 @@ +@ Copyright (c) 2009-2013 The Linux Foundation. All rights reserved. +@ +@ Redistribution and use in source and binary forms, with or without +@ modification, are permitted provided that the following conditions are met: +@ * Redistributions of source code must retain the above copyright +@ notice, this list of conditions and the following disclaimer. +@ * Redistributions in binary form must reproduce the above copyright +@ notice, this list of conditions and the following disclaimer in the +@ documentation and/or other materials provided with the distribution. +@ * Neither the name of The Linux Foundation nor the names of its contributors may +@ be used to endorse or promote products derived from this software +@ without specific prior written permission. +@ +@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +@ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +@ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +@ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +@ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +@ POSSIBILITY OF SUCH DAMAGE. + + +#include +#include + +@ Values which exist the program lifetime: +#define HIGH_WORD_MASK d31 +#define EXPONENT_MASK d30 +#define int_1 d29 +#define double_1 d28 +@ sign and 2^int_n fixup: +#define maxrange r12 +#define expadjustment d7 +#define literals r10 +@ Values which exist within both polynomial implementations: +#define int_n d2 +#define int_n_low s4 +#define int_n_high s5 +#define double_n d3 +#define k1 d27 +#define k2 d26 +#define k3 d25 +#define k4 d24 +@ Values which cross the boundaries between polynomial implementations: +#define ss d16 +#define ss2 d17 +#define ss4 d18 +#define Result d0 +#define Return_hw r1 +#define Return_lw r0 +#define ylg2x d0 +@ Intermediate values only needed sometimes: +@ initial (sorted in approximate order of availability for overwriting): +#define x_hw r1 +#define x_lw r0 +#define y_hw r3 +#define y_lw r2 +#define x d0 +#define bp d4 +#define y d1 +@ log series: +#define u d19 +#define v d20 +#define lg2coeff d21 +#define bpa d5 +#define bpb d3 +#define lg2const d6 +#define xmantissa r8 +#define twoto1o5 r4 +#define twoto3o5 r5 +#define ix r6 +#define iEXP_MASK r7 +@ exp input setup: +#define twoto1o8mask d3 +#define twoto1o4mask d4 +#define twoto1o2mask d1 +#define ylg2x_round_offset d16 +#define ylg2x_temp d17 +#define yn_temp d18 +#define yn_round_offset d19 +#define ln2 d5 +@ Careful, overwriting HIGH_WORD_MASK, reset it if you need it again ... +#define rounded_exponent d31 +@ exp series: +#define k5 d23 +#define k6 d22 +#define k7 d21 +#define k8 d20 +#define ss3 d19 +@ overwrite double_1 (we're done with it by now) +#define k0 d28 +#define twoto1o4 d6 + +@instructions that gas doesn't like to encode correctly: +#define vmov_f64 fconstd +#define vmov_f32 fconsts +#define vmovne_f64 fconstdne + +#define KRAIT_NO_AAPCS_VFP_MODE + +ENTRY(pow) +#if defined(KRAIT_NO_AAPCS_VFP_MODE) + @ ARM ABI has inputs coming in via r registers, lets move to a d register + vmov x, x_lw, x_hw +#endif + push {r4, r5, r6, r7, r8, r9, r10, lr} + + movw maxrange, #0x0000 + movt maxrange, #0x4010 + + @ pre-staged bp values + vldr bpa, .LbpA + vldr bpb, .LbpB + @ load two fifths into constant term in case we need it due to offsets + vldr lg2const, .Ltwofifths + + @ bp is initially 1.0, may adjust later based on x value + vmov_f64 bp, #0x70 + + @ extract the mantissa from x for scaled value comparisons + lsl xmantissa, x_hw, #12 + + @ twoto1o5 = 2^(1/5) (input bracketing) + movw twoto1o5, #0x186c + movt twoto1o5, #0x2611 + @ twoto3o5 = 2^(3/5) (input bracketing) + movw twoto3o5, #0x003b + movt twoto3o5, #0x8406 + + @ finish extracting xmantissa + orr xmantissa, xmantissa, x_lw, lsr #20 + + @ begin preparing a mask for normalization + vmov.i64 HIGH_WORD_MASK, #0xffffffff00000000 + + @ double_1 = (double) 1.0 + vmov_f64 double_1, #0x70 + +#if defined(KRAIT_NO_AAPCS_VFP_MODE) + @ move y from r registers to a d register + vmov y, y_lw, y_hw +#endif + + cmp xmantissa, twoto1o5 + + vshl.i64 EXPONENT_MASK, HIGH_WORD_MASK, #20 + vshr.u64 int_1, HIGH_WORD_MASK, #63 + + adr literals, .LliteralTable + + bhi .Lxgt2to1over5 + @ zero out lg2 constant term if don't offset our input + vsub.f64 lg2const, lg2const, lg2const + b .Lxle2to1over5 + +.Lxgt2to1over5: + @ if normalized x > 2^(1/5), bp = 1 + (2^(2/5)-1) = 2^(2/5) + vadd.f64 bp, bp, bpa + +.Lxle2to1over5: + @ will need ln2 for various things + vldr ln2, .Lln2 + + cmp xmantissa, twoto3o5 +@@@@ X Value Normalization @@@@ + + @ ss = abs(x) 2^(-1024) + vbic.i64 ss, x, EXPONENT_MASK + + @ N = (floor(log2(x)) + 0x3ff) * 2^52 + vand.i64 int_n, x, EXPONENT_MASK + + bls .Lxle2to3over5 + @ if normalized x > 2^(3/5), bp = 2^(2/5) + (2^(4/5) - 2^(2/5) = 2^(4/5) + vadd.f64 bp, bp, bpb + vadd.f64 lg2const, lg2const, lg2const + +.Lxle2to3over5: + + cmp x_hw, maxrange + cmpls y_hw, maxrange + movt maxrange, #0x3f00 + cmpls maxrange, x_hw + + @ load log2 polynomial series constants + vldm literals!, {k4, k3, k2, k1} + + @ s = abs(x) 2^(-floor(log2(x))) (normalize abs(x) to around 1) + vorr.i64 ss, ss, double_1 + +@@@@ 3/2 (Log(bp(1+s)/(1-s))) input computation (s = (x-bp)/(x+bp)) @@@@ + + vsub.f64 u, ss, bp + vadd.f64 v, ss, bp + + bhi .LuseFullImpl + + @ s = (x-1)/(x+1) + vdiv.f64 ss, u, v + + @ load 2/(3log2) into lg2coeff + vldr lg2coeff, .Ltwooverthreeln2 + + @ N = floor(log2(x)) * 2^52 + vsub.i64 int_n, int_n, double_1 + +@@@@ 3/2 (Log(bp(1+s)/(1-s))) polynomial series @@@@ + + @ ss2 = ((x-dp)/(x+dp))^2 + vmul.f64 ss2, ss, ss + @ ylg2x = 3.0 + vmov_f64 ylg2x, #8 + vmul.f64 ss4, ss2, ss2 + + @ todo: useful later for two-way clamp + vmul.f64 lg2coeff, lg2coeff, y + + @ N = floor(log2(x)) + vshr.s64 int_n, int_n, #52 + + @ k3 = ss^2 * L4 + L3 + vmla.f64 k3, ss2, k4 + + @ k1 = ss^2 * L2 + L1 + vmla.f64 k1, ss2, k2 + + @ scale ss by 2/(3 ln 2) + vmul.f64 lg2coeff, ss, lg2coeff + + @ ylg2x = 3.0 + s^2 + vadd.f64 ylg2x, ylg2x, ss2 + + vcvt.f64.s32 double_n, int_n_low + + @ k1 = s^4 (s^2 L4 + L3) + s^2 L2 + L1 + vmla.f64 k1, ss4, k3 + + @ add in constant term + vadd.f64 double_n, lg2const + + @ ylg2x = 3.0 + s^2 + s^4 (s^4 (s^2 L4 + L3) + s^2 L2 + L1) + vmla.f64 ylg2x, ss4, k1 + + @ ylg2x = y 2 s / (3 ln(2)) (3.0 + s^2 + s^4 (s^4(s^2 L4 + L3) + s^2 L2 + L1) + vmul.f64 ylg2x, lg2coeff, ylg2x + +@@@@ Compute input to Exp(s) (s = y(n + log2(x)) - (floor(8 yn + 1)/8 + floor(8 ylog2(x) + 1)/8) @@@@@ + + @ mask to extract bit 1 (2^-2 from our fixed-point representation) + vshl.u64 twoto1o4mask, int_1, #1 + + @ double_n = y * n + vmul.f64 double_n, double_n, y + + @ Load 2^(1/4) for later computations + vldr twoto1o4, .Ltwoto1o4 + + @ either add or subtract one based on the sign of double_n and ylg2x + vshr.s64 ylg2x_round_offset, ylg2x, #62 + vshr.s64 yn_round_offset, double_n, #62 + + @ move unmodified y*lg2x into temp space + vmov ylg2x_temp, ylg2x + @ compute floor(8 y * n + 1)/8 + @ and floor(8 y (log2(x)) + 1)/8 + vcvt.s32.f64 ylg2x, ylg2x, #3 + @ move unmodified y*n into temp space + vmov yn_temp, double_n + vcvt.s32.f64 double_n, double_n, #3 + + @ load exp polynomial series constants + vldm literals!, {k8, k7, k6, k5, k4, k3, k2, k1} + + @ mask to extract bit 2 (2^-1 from our fixed-point representation) + vshl.u64 twoto1o2mask, int_1, #2 + + @ make rounding offsets either 1 or -1 instead of 0 or -2 + vorr.u64 ylg2x_round_offset, ylg2x_round_offset, int_1 + vorr.u64 yn_round_offset, yn_round_offset, int_1 + + @ round up to the nearest 1/8th + vadd.s32 ylg2x, ylg2x, ylg2x_round_offset + vadd.s32 double_n, double_n, yn_round_offset + + @ clear out round-up bit for y log2(x) + vbic.s32 ylg2x, ylg2x, int_1 + @ clear out round-up bit for yn + vbic.s32 double_n, double_n, int_1 + @ add together the (fixed precision) rounded parts + vadd.s64 rounded_exponent, double_n, ylg2x + @ turn int_n into a double with value 2^int_n + vshl.i64 int_n, rounded_exponent, #49 + @ compute masks for 2^(1/4) and 2^(1/2) fixups for fractional part of fixed-precision rounded values: + vand.u64 twoto1o4mask, twoto1o4mask, rounded_exponent + vand.u64 twoto1o2mask, twoto1o2mask, rounded_exponent + + @ convert back into floating point, double_n now holds (double) floor(8 y * n + 1)/8 + @ ylg2x now holds (double) floor(8 y * log2(x) + 1)/8 + vcvt.f64.s32 ylg2x, ylg2x, #3 + vcvt.f64.s32 double_n, double_n, #3 + + @ put the 2 bit (0.5) through the roof of twoto1o2mask (make it 0x0 or 0xffffffffffffffff) + vqshl.u64 twoto1o2mask, twoto1o2mask, #62 + @ put the 1 bit (0.25) through the roof of twoto1o4mask (make it 0x0 or 0xffffffffffffffff) + vqshl.u64 twoto1o4mask, twoto1o4mask, #63 + + @ center y*log2(x) fractional part between -0.125 and 0.125 by subtracting (double) floor(8 y * log2(x) + 1)/8 + vsub.f64 ylg2x_temp, ylg2x_temp, ylg2x + @ center y*n fractional part between -0.125 and 0.125 by subtracting (double) floor(8 y * n + 1)/8 + vsub.f64 yn_temp, yn_temp, double_n + + @ Add fractional parts of yn and y log2(x) together + vadd.f64 ss, ylg2x_temp, yn_temp + + @ Result = 1.0 (offset for exp(s) series) + vmov_f64 Result, #0x70 + + @ multiply fractional part of y * log2(x) by ln(2) + vmul.f64 ss, ln2, ss + +@@@@ 10th order polynomial series for Exp(s) @@@@ + + @ ss2 = (ss)^2 + vmul.f64 ss2, ss, ss + + @ twoto1o2mask = twoto1o2mask & twoto1o4 + vand.u64 twoto1o2mask, twoto1o2mask, twoto1o4 + @ twoto1o2mask = twoto1o2mask & twoto1o4 + vand.u64 twoto1o4mask, twoto1o4mask, twoto1o4 + + @ Result = 1.0 + ss + vadd.f64 Result, Result, ss + + @ k7 = ss k8 + k7 + vmla.f64 k7, ss, k8 + + @ ss4 = (ss*ss) * (ss*ss) + vmul.f64 ss4, ss2, ss2 + + @ twoto1o2mask = twoto1o2mask | (double) 1.0 - results in either 1.0 or 2^(1/4) in twoto1o2mask + vorr.u64 twoto1o2mask, twoto1o2mask, double_1 + @ twoto1o2mask = twoto1o4mask | (double) 1.0 - results in either 1.0 or 2^(1/4) in twoto1o4mask + vorr.u64 twoto1o4mask, twoto1o4mask, double_1 + + @ TODO: should setup sign here, expadjustment = 1.0 + vmov_f64 expadjustment, #0x70 + + @ ss3 = (ss*ss) * ss + vmul.f64 ss3, ss2, ss + + @ k0 = 1/2 (first non-unity coefficient) + vmov_f64 k0, #0x60 + + @ Mask out non-exponent bits to make sure we have just 2^int_n + vand.i64 int_n, int_n, EXPONENT_MASK + + @ square twoto1o2mask to get 1.0 or 2^(1/2) + vmul.f64 twoto1o2mask, twoto1o2mask, twoto1o2mask + @ multiply twoto2o4mask into the exponent output adjustment value + vmul.f64 expadjustment, expadjustment, twoto1o4mask + + @ k5 = ss k6 + k5 + vmla.f64 k5, ss, k6 + + @ k3 = ss k4 + k3 + vmla.f64 k3, ss, k4 + + @ k1 = ss k2 + k1 + vmla.f64 k1, ss, k2 + + @ multiply twoto1o2mask into exponent output adjustment value + vmul.f64 expadjustment, expadjustment, twoto1o2mask + + @ k5 = ss^2 ( ss k8 + k7 ) + ss k6 + k5 + vmla.f64 k5, ss2, k7 + + @ k1 = ss^2 ( ss k4 + k3 ) + ss k2 + k1 + vmla.f64 k1, ss2, k3 + + @ Result = 1.0 + ss + 1/2 ss^2 + vmla.f64 Result, ss2, k0 + + @ Adjust int_n so that it's a double precision value that can be multiplied by Result + vadd.i64 expadjustment, int_n, expadjustment + + @ k1 = ss^4 ( ss^2 ( ss k8 + k7 ) + ss k6 + k5 ) + ss^2 ( ss k4 + k3 ) + ss k2 + k1 + vmla.f64 k1, ss4, k5 + + @ Result = 1.0 + ss + 1/2 ss^2 + ss^3 ( ss^4 ( ss^2 ( ss k8 + k7 ) + ss k6 + k5 ) + ss^2 ( ss k4 + k3 ) + ss k2 + k1 ) + vmla.f64 Result, ss3, k1 + + @ multiply by adjustment (sign*(rounding ? sqrt(2) : 1) * 2^int_n) + vmul.f64 Result, expadjustment, Result + +.LleavePow: +#if defined(KRAIT_NO_AAPCS_VFP_MODE) + @ return Result (FP) + vmov Return_lw, Return_hw, Result +#endif +.LleavePowDirect: + @ leave directly returning whatever is in Return_lw and Return_hw + pop {r4, r5, r6, r7, r8, r9, r10, pc} + +.LuseFullImpl: + pop {r4, r5, r6, r7, r8, r9, r10, lr} + b __full_ieee754_pow + +.align 6 +.LliteralTable: +@ Least-sqares tuned constants for 11th order (log2((1+s)/(1-s)): +.LL4: @ ~3/11 + .long 0x53a79915, 0x3fd1b108 +.LL3: @ ~1/3 + .long 0x9ca0567a, 0x3fd554fa +.LL2: @ ~3/7 + .long 0x1408e660, 0x3fdb6db7 +.LL1: @ ~3/5 + .long 0x332D4313, 0x3fe33333 + +@ Least-squares tuned constants for 10th order exp(s): +.LE10: @ ~1/3628800 + .long 0x25c7ba0a, 0x3e92819b +.LE9: @ ~1/362880 + .long 0x9499b49c, 0x3ec72294 +.LE8: @ ~1/40320 + .long 0xabb79d95, 0x3efa019f +.LE7: @ ~1/5040 + .long 0x8723aeaa, 0x3f2a019f +.LE6: @ ~1/720 + .long 0x16c76a94, 0x3f56c16c +.LE5: @ ~1/120 + .long 0x11185da8, 0x3f811111 +.LE4: @ ~1/24 + .long 0x5555551c, 0x3fa55555 +.LE3: @ ~1/6 + .long 0x555554db, 0x3fc55555 + +.LbpA: @ (2^(2/5) - 1) + .long 0x4ee54db1, 0x3fd472d1 + +.LbpB: @ (2^(4/5) - 2^(2/5)) + .long 0x1c8a36cf, 0x3fdafb62 + +.Ltwofifths: @ + .long 0x9999999a, 0x3fd99999 + +.Ltwooverthreeln2: + .long 0xDC3A03FD, 0x3FEEC709 + +.Lln2: @ ln(2) + .long 0xFEFA39EF, 0x3FE62E42 + +.Ltwoto1o4: @ 2^1/4 + .long 0x0a31b715, 0x3ff306fe +END(pow) diff --git a/libm/arm/e_sqrt.S b/libm/arm/e_sqrt.S new file mode 100644 index 000000000..28dc64715 --- /dev/null +++ b/libm/arm/e_sqrt.S @@ -0,0 +1,36 @@ +@ Copyright (c) 2013, The Linux Foundation. All rights reserved. +@ +@ Redistribution and use in source and binary forms, with or without +@ modification, are permitted provided that the following conditions are +@ met: +@ * Redistributions of source code must retain the above copyright +@ notice, this list of conditions and the following disclaimer. +@ * Redistributions in binary form must reproduce the above +@ copyright notice, this list of conditions and the following +@ disclaimer in the documentation and/or other materials provided +@ with the distribution. +@ * Neither the name of The Linux Foundation nor the names of its +@ contributors may be used to endorse or promote products derived +@ from this software without specific prior written permission. +@ +@ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +@ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +@ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +@ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +@ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +ENTRY(sqrt) + vmov.f64 d0, r0, r1 + vsqrt.f64 d0, d0 + vmov.f64 r0, r1, d0 + bx lr +END(sqrt) diff --git a/libm/arm/e_sqrtf.S b/libm/arm/e_sqrtf.S new file mode 100644 index 000000000..4f2e4a033 --- /dev/null +++ b/libm/arm/e_sqrtf.S @@ -0,0 +1,36 @@ +@ Copyright (c) 2013, The Linux Foundation. All rights reserved. +@ +@ Redistribution and use in source and binary forms, with or without +@ modification, are permitted provided that the following conditions are +@ met: +@ * Redistributions of source code must retain the above copyright +@ notice, this list of conditions and the following disclaimer. +@ * Redistributions in binary form must reproduce the above +@ copyright notice, this list of conditions and the following +@ disclaimer in the documentation and/or other materials provided +@ with the distribution. +@ * Neither the name of The Linux Foundation nor the names of its +@ contributors may be used to endorse or promote products derived +@ from this software without specific prior written permission. +@ +@ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +@ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +@ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +@ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +@ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +ENTRY(sqrtf) + vmov.f32 s0, r0 + vsqrt.f32 s0, s0 + vmov.f32 r0, s0 + bx lr +END(sqrtf) diff --git a/libm/arm/s_cos.S b/libm/arm/s_cos.S new file mode 100644 index 000000000..13ff2d50b --- /dev/null +++ b/libm/arm/s_cos.S @@ -0,0 +1,419 @@ +@ Copyright (c) 2012, The Linux Foundation. All rights reserved. +@ +@ Redistribution and use in source and binary forms, with or without +@ modification, are permitted provided that the following conditions are +@ met: +@ * Redistributions of source code must retain the above copyright +@ notice, this list of conditions and the following disclaimer. +@ * Redistributions in binary form must reproduce the above +@ copyright notice, this list of conditions and the following +@ disclaimer in the documentation and/or other materials provided +@ with the distribution. +@ * Neither the name of The Linux Foundation nor the names of its +@ contributors may be used to endorse or promote products derived +@ from this software without specific prior written permission. +@ +@ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +@ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +@ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +@ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +@ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +@ +@ Additional notices preserved for attributions purposes only. +@ +@ ==================================================== +@ Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. +@ +@ Developed at SunSoft, a Sun Microsystems, Inc. business. +@ Permission to use, copy, modify, and distribute this +@ software is freely granted, provided that this notice +@ is preserved. +@ ==================================================== +@ +@ ==================================================== +@ Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. +@ +@ Developed at SunPro, a Sun Microsystems, Inc. business. +@ Permission to use, copy, modify, and distribute this +@ software is freely granted, provided that this notice +@ is preserved. +@ ==================================================== + +#include +#include + +#define vmov_f64 fconstd + +ENTRY(cos) + push {r4, r6, r7, lr} + vmov d0, r0, r1 + mov r2, r0 + mov r3, r1 + movw r1, #0x21fb + movt r1, #0x3fe9 + mov r4, r3 + bic r3, r3, #0x80000000 + sub sp, sp, #48 + cmp r3, r1 + bgt .Lxgtpio4 + cmp r3, #0x3e400000 + bge .Lxnottiny + vcvt.s32.f64 s15, d0 + vmov r3, s15 + cmp r3, #0 + beq .Lreturnone +.Lxnottiny: + vmov.i64 d1, #0 + bl __kernel_cos +.Lleave_cos: + vmov r0, r1, d0 +.Lleave_cos_direct: + add sp, sp, #48 + pop {r4, r6, r7, pc} +.Lxgtpio4: + movw r2, #0xffff + movt r2, #0x7fef + cmp r3, r2 + bgt .LxisNaN + movw r0, #0xd97b + movt r0, #0x4002 + cmp r3, r0 + movw r2, #0x21fb + bgt .Lxge3pio4 + cmp r4, #0 + movt r2, #0x3ff9 + ble .Lsmallxisnegative + vldr d16, .Lpio2_1 + cmp r3, r2 + vsub.f64 d16, d0, d16 + beq .Lxnearpio2 + vldr d17, .Lpio2_1t +.Lfinalizesmallxremainder: + vsub.f64 d0, d16, d17 + vsub.f64 d16, d16, d0 + vstr d0, [sp, #8] + vsub.f64 d1, d16, d17 + vstr d1, [sp, #16] +.Lnmod3is1: + mov r0, #1 + bl __kernel_sin + vneg.f64 d0, d0 + b .Lleave_cos +.Lreturnone: + mov r0, #0 + movw r1, #0x0000 + movt r1, #0x3ff0 + vmov_f64 d0, #0x70 + b .Lleave_cos_direct +.LxisNaN: + vsub.f64 d0, d0, d0 + b .Lleave_cos +.Lxge3pio4: + movt r2, #0x4139 + cmp r3, r2 + bgt .Lxgigantic + vmov_f64 d3, #0x60 + vldr d2, .Linvpio2 + vldr d18, .Lpio2_1 + vabs.f64 d16, d0 + vmla.f64 d3, d16, d2 + vcvt.s32.f64 s3, d3 + vcvt.f64.s32 d17, s3 + vmov r0, s3 + cmp r0, #31 + vmls.f64 d16, d17, d18 + vldr d18, .Lpio2_1t + vmul.f64 d18, d17, d18 + bgt .Lcomputeremainder + ldr r2, .Lnpio2_hw_ptr + sub lr, r0, #1 +.LPICnpio2_hw0: + add r12, pc, r2 + ldr r1, [r12, lr, lsl #2] + cmp r3, r1 + beq .Lcomputeremainder +.Lfinishthirditeration: + vsub.f64 d0, d16, d18 + vstr d0, [sp, #8] +.Lfinishcomputingremainder: + vsub.f64 d16, d16, d0 + cmp r4, #0 + vsub.f64 d1, d16, d18 + vstr d1, [sp, #16] + blt .Lhandlenegativex +.Lselectregion: + and r0, r0, #3 + cmp r0, #1 + beq .Lnmod3is1 + cmp r0, #2 + beq .Lnmod3is2 + cmp r0, #0 + bne .Lnmod3is0 + bl __kernel_cos + b .Lleave_cos +.Lxgigantic: + asr r2, r3, #20 + vmov r6, r7, d0 + sub r2, r2, #1040 + mov r0, r6 + sub r2, r2, #6 + vldr d16, .Ltwo24 + sub r1, r3, r2, lsl #20 + vmov d18, r0, r1 + vcvt.s32.f64 s15, d18 + add r1, sp, #48 + mov r3, #3 + vcvt.f64.s32 d17, s15 + vsub.f64 d18, d18, d17 + vstr d17, [sp, #24] + vmul.f64 d18, d18, d16 + vcvt.s32.f64 s15, d18 + vcvt.f64.s32 d17, s15 + vsub.f64 d18, d18, d17 + vstr d17, [sp, #32] + vmul.f64 d16, d18, d16 + fcmpzd d16 + vstmdb r1!, {d16} + vmrs APSR_nzcv, fpscr + bne .Lprocessnonzeroterm +.Lskipzeroterms: + vldmdb r1!, {d16} + sub r3, r3, #1 + fcmpzd d16 + vmrs APSR_nzcv, fpscr + beq .Lskipzeroterms +.Lprocessnonzeroterm: + ldr r12, .Ltwo_over_pi_ptr + add r0, sp, #24 + add r1, sp, #8 +.LPICtwo_over_pi0: + add lr, pc, r12 + mov r12, #2 + str lr, [sp, #4] + str r12, [sp] + bl __kernel_rem_pio2 + cmp r4, #0 + vldr d0, [sp, #8] + blt .Lhandlenegativxalso + vldr d1, [sp, #16] + b .Lselectregion +.Lxnearpio2: + vldr d17, .Lpio2_2 + vsub.f64 d16, d16, d17 + vldr d17, .Lpio2_2t + b .Lfinalizesmallxremainder +.Lsmallxisnegative: + vldr d1, .Lpio2_1 + cmp r3, r2 + vadd.f64 d16, d0, d1 + beq .Lxnearnegpio2 + vldr d17, .Lpio2_1t +.Lfinalizesmallnegxremainder: + vadd.f64 d0, d16, d17 + vsub.f64 d16, d16, d0 + vstr d0, [sp, #8] + vadd.f64 d1, d16, d17 + vstr d1, [sp, #16] +.Lnmod3is0: + mov r0, #1 + bl __kernel_sin + b .Lleave_cos +.Lnmod3is2: + bl __kernel_cos + vneg.f64 d0, d0 + b .Lleave_cos +.Lcomputeremainder: + vsub.f64 d0, d16, d18 + asr r1, r3, #20 + vmov r2, r3, d0 + ubfx r3, r3, #20, #11 + rsb r3, r3, r1 + vstr d0, [sp, #8] + cmp r3, #16 + ble .Lfinishcomputingremainder + vldr d18, .Lpio2_2 + vmul.f64 d20, d17, d18 + vsub.f64 d19, d16, d20 + vsub.f64 d16, d16, d19 + vsub.f64 d18, d16, d20 + vldr d16, .Lpio2_2t + vnmls.f64 d18, d17, d16 + vsub.f64 d0, d19, d18 + vmov r2, r3, d0 + ubfx r3, r3, #20, #11 + rsb r1, r3, r1 + vstr d0, [sp, #8] + cmp r1, #49 + ble .Lfinishseconditeration + vldr d5, .Lpio2_3 + vmul.f64 d20, d17, d5 + vsub.f64 d16, d19, d20 + vsub.f64 d4, d19, d16 + vldr d19, .Lpio2_3t + vsub.f64 d18, d4, d20 + vnmls.f64 d18, d17, d19 + b .Lfinishthirditeration +.Lhandlenegativex: + vneg.f64 d0, d0 + rsb r0, r0, #0 + vneg.f64 d1, d1 + vstr d0, [sp, #8] + vstr d1, [sp, #16] + b .Lselectregion +.Lfinishseconditeration: + vmov d16, d19 + b .Lfinishcomputingremainder +.Lxnearnegpio2: + vldr d0, .Lpio2_2 + vldr d17, .Lpio2_2t + vadd.f64 d16, d16, d0 + b .Lfinalizesmallnegxremainder +.Lhandlenegativxalso: + vldr d6, [sp, #16] + vneg.f64 d0, d0 + rsb r0, r0, #0 + vneg.f64 d1, d6 + vstr d0, [sp, #8] + vstr d1, [sp, #16] + b .Lselectregion + +.align 3 +.Lpio2_1: + .word 0x54400000, 0x3ff921fb +.Lpio2_1t: + .word 0x1a626331, 0x3dd0b461 +.Linvpio2: + .word 0x6dc9c883, 0x3fe45f30 +.Ltwo24: + .word 0x00000000, 0x41700000 +.Lpio2_2: + .word 0x1a600000, 0x3dd0b461 +.Lpio2_2t: + .word 0x2e037073, 0x3ba3198a +.Lpio2_3: + .word 0x2e000000, 0x3ba3198a +.Lpio2_3t: + .word 0x252049c1, 0x397b839a +.Lnpio2_hw_ptr: + .word .Lnpio2_hw-(.LPICnpio2_hw0+8) +.Ltwo_over_pi_ptr: + .word .Ltwo_over_pi-(.LPICtwo_over_pi0+8) +END(cos) + + .section .rodata.npio2_hw,"a",%progbits + .align 2 +.Lnpio2_hw = . + 0 + .type npio2_hw, %object + .size npio2_hw, 128 +npio2_hw: + .word 0x3ff921fb + .word 0x400921fb + .word 0x4012d97c + .word 0x401921fb + .word 0x401f6a7a + .word 0x4022d97c + .word 0x4025fdbb + .word 0x402921fb + .word 0x402c463a + .word 0x402f6a7a + .word 0x4031475c + .word 0x4032d97c + .word 0x40346b9c + .word 0x4035fdbb + .word 0x40378fdb + .word 0x403921fb + .word 0x403ab41b + .word 0x403c463a + .word 0x403dd85a + .word 0x403f6a7a + .word 0x40407e4c + .word 0x4041475c + .word 0x4042106c + .word 0x4042d97c + .word 0x4043a28c + .word 0x40446b9c + .word 0x404534ac + .word 0x4045fdbb + .word 0x4046c6cb + .word 0x40478fdb + .word 0x404858eb + .word 0x404921fb + + .section .rodata.two_over_pi,"a",%progbits + .align 2 +.Ltwo_over_pi = . + 0 + .type two_over_pi, %object + .size two_over_pi, 264 +two_over_pi: + .word 0x00a2f983 + .word 0x006e4e44 + .word 0x001529fc + .word 0x002757d1 + .word 0x00f534dd + .word 0x00c0db62 + .word 0x0095993c + .word 0x00439041 + .word 0x00fe5163 + .word 0x00abdebb + .word 0x00c561b7 + .word 0x00246e3a + .word 0x00424dd2 + .word 0x00e00649 + .word 0x002eea09 + .word 0x00d1921c + .word 0x00fe1deb + .word 0x001cb129 + .word 0x00a73ee8 + .word 0x008235f5 + .word 0x002ebb44 + .word 0x0084e99c + .word 0x007026b4 + .word 0x005f7e41 + .word 0x003991d6 + .word 0x00398353 + .word 0x0039f49c + .word 0x00845f8b + .word 0x00bdf928 + .word 0x003b1ff8 + .word 0x0097ffde + .word 0x0005980f + .word 0x00ef2f11 + .word 0x008b5a0a + .word 0x006d1f6d + .word 0x00367ecf + .word 0x0027cb09 + .word 0x00b74f46 + .word 0x003f669e + .word 0x005fea2d + .word 0x007527ba + .word 0x00c7ebe5 + .word 0x00f17b3d + .word 0x000739f7 + .word 0x008a5292 + .word 0x00ea6bfb + .word 0x005fb11f + .word 0x008d5d08 + .word 0x00560330 + .word 0x0046fc7b + .word 0x006babf0 + .word 0x00cfbc20 + .word 0x009af436 + .word 0x001da9e3 + .word 0x0091615e + .word 0x00e61b08 + .word 0x00659985 + .word 0x005f14a0 + .word 0x0068408d + .word 0x00ffd880 + .word 0x004d7327 + .word 0x00310606 + .word 0x001556ca + .word 0x0073a8c9 + .word 0x0060e27b + .word 0x00c08c6b diff --git a/libm/arm/s_sin.S b/libm/arm/s_sin.S new file mode 100644 index 000000000..9aa682973 --- /dev/null +++ b/libm/arm/s_sin.S @@ -0,0 +1,414 @@ +@ Copyright (c) 2012, The Linux Foundation. All rights reserved. +@ +@ Redistribution and use in source and binary forms, with or without +@ modification, are permitted provided that the following conditions are +@ met: +@ * Redistributions of source code must retain the above copyright +@ notice, this list of conditions and the following disclaimer. +@ * Redistributions in binary form must reproduce the above +@ copyright notice, this list of conditions and the following +@ disclaimer in the documentation and/or other materials provided +@ with the distribution. +@ * Neither the name of The Linux Foundation nor the names of its +@ contributors may be used to endorse or promote products derived +@ from this software without specific prior written permission. +@ +@ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +@ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +@ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +@ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +@ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +@ +@ Additional notices preserved for attributions purposes only. +@ +@ ==================================================== +@ Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. +@ +@ Developed at SunSoft, a Sun Microsystems, Inc. business. +@ Permission to use, copy, modify, and distribute this +@ software is freely granted, provided that this notice +@ is preserved. +@ ==================================================== +@ +@ ==================================================== +@ Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. +@ +@ Developed at SunPro, a Sun Microsystems, Inc. business. +@ Permission to use, copy, modify, and distribute this +@ software is freely granted, provided that this notice +@ is preserved. +@ ==================================================== + +#include +#include + +#define vmov_f64 fconstd + +ENTRY(sin) + push {r4, r6, r7, lr} + vmov d0, r0, r1 + mov r2, r0 + mov r3, r1 + movw r1, #0x21fb + movt r1, #0x3fe9 + mov r4, r3 + bic r3, r3, #0x80000000 + sub sp, sp, #48 + cmp r3, r1 + bgt .Lxgtpio4 + cmp r3, #0x3e400000 + bge .Lxnottiny + vcvt.s32.f64 s15, d0 + vmov r3, s15 + cmp r3, #0 + bne .Lxnottiny +.Lleave_sin: + vmov r0, r1, d0 + add sp, sp, #48 + pop {r4, r6, r7, pc} +.Lxgtpio4: + movw r2, #0xffff + movt r2, #0x7fef + cmp r3, r2 + bgt .LxisNaN + movw r0, #0xd97b + movt r0, #0x4002 + cmp r3, r0 + movw r2, #0x21fb + bgt .Lxge3pio4 + cmp r4, #0 + movt r2, #0x3ff9 + ble .Lsmallxisnegative + vldr d16, .Lpio2_1 + cmp r3, r2 + vsub.f64 d16, d0, d16 + beq .Lxnearpio2 + vldr d17, .Lpio2_1t +.Lfinalizesmallxremainder: + vsub.f64 d0, d16, d17 + vsub.f64 d16, d16, d0 + vstr d0, [sp, #8] + vsub.f64 d1, d16, d17 + vstr d1, [sp, #16] +.Lnmod3is1: + bl __kernel_cos + b .Lleave_sin +.Lxnottiny: + vmov.i64 d1, #0 + mov r0, #0 + bl __kernel_sin + b .Lleave_sin +.LxisNaN: + vsub.f64 d0, d0, d0 + b .Lleave_sin +.Lxge3pio4: + movt r2, #0x4139 + cmp r3, r2 + bgt .Lxgigantic + vmov_f64 d3, #0x60 + vldr d2, .Linvpio2 + vldr d18, .Lpio2_1 + vabs.f64 d16, d0 + vmla.f64 d3, d16, d2 + vcvt.s32.f64 s3, d3 + vcvt.f64.s32 d17, s3 + vmov r0, s3 + cmp r0, #31 + vmls.f64 d16, d17, d18 + vldr d18, .Lpio2_1t + vmul.f64 d18, d17, d18 + bgt .Lcomputeremainder + ldr r2, .Lnpio2_hw_ptr + sub lr, r0, #1 +.LPICnpio2_hw0: + add r12, pc, r2 + ldr r1, [r12, lr, lsl #2] + cmp r3, r1 + beq .Lcomputeremainder +.Lfinishthirditeration: + vsub.f64 d0, d16, d18 + vstr d0, [sp, #8] +.Lfinishcomputingremainder: + vsub.f64 d16, d16, d0 + cmp r4, #0 + vsub.f64 d1, d16, d18 + vstr d1, [sp, #16] + blt .Lhandlenegativex +.Lselectregion: + and r0, r0, #3 + cmp r0, #1 + beq .Lnmod3is1 + cmp r0, #2 + beq .Lnmod3is2 + cmp r0, #0 + bne .Lnmod3is0 + mov r0, #1 + bl __kernel_sin + b .Lleave_sin +.Lxgigantic: + asr r2, r3, #20 + vmov r6, r7, d0 + sub r2, r2, #1040 + mov r0, r6 + sub r2, r2, #6 + vldr d16, .Ltwo24 + sub r1, r3, r2, lsl #20 + vmov d18, r0, r1 + vcvt.s32.f64 s15, d18 + add r1, sp, #48 + mov r3, #3 + vcvt.f64.s32 d17, s15 + vsub.f64 d18, d18, d17 + vstr d17, [sp, #24] + vmul.f64 d18, d18, d16 + vcvt.s32.f64 s15, d18 + vcvt.f64.s32 d17, s15 + vsub.f64 d18, d18, d17 + vstr d17, [sp, #32] + vmul.f64 d16, d18, d16 + fcmpzd d16 + vstmdb r1!, {d16} + vmrs APSR_nzcv, fpscr + bne .Lprocessnonzeroterm +.Lskipzeroterms: + vldmdb r1!, {d16} + sub r3, r3, #1 + fcmpzd d16 + vmrs APSR_nzcv, fpscr + beq .Lskipzeroterms +.Lprocessnonzeroterm: + ldr r12, .Ltwo_over_pi_ptr + add r0, sp, #24 + add r1, sp, #8 +.LPICtwo_over_pi0: + add lr, pc, r12 + mov r12, #2 + str lr, [sp, #4] + str r12, [sp] + bl __kernel_rem_pio2 + cmp r4, #0 + vldr d0, [sp, #8] + blt .Lhandlenegativexalso + vldr d1, [sp, #16] + b .Lselectregion +.Lxnearpio2: + vldr d17, .Lpio2_2 + vsub.f64 d16, d16, d17 + vldr d17, .Lpio2_2t + b .Lfinalizesmallxremainder +.Lsmallxisnegative: + vldr d1, .Lpio2_1 + cmp r3, r2 + vadd.f64 d16, d0, d1 + beq .Lxnearnegpio2 + vldr d17, .Lpio2_1t +.Lfinalizesmallnegxremainder: + vadd.f64 d0, d16, d17 + vsub.f64 d16, d16, d0 + vstr d0, [sp, #8] + vadd.f64 d1, d16, d17 + vstr d1, [sp, #16] +.Lnmod3is0: + bl __kernel_cos + vneg.f64 d0, d0 + b .Lleave_sin +.Lnmod3is2: + mov r0, #1 + bl __kernel_sin + vneg.f64 d0, d0 + b .Lleave_sin +.Lcomputeremainder: + vsub.f64 d0, d16, d18 + asr r1, r3, #20 + vmov r2, r3, d0 + ubfx r3, r3, #20, #11 + rsb r3, r3, r1 + vstr d0, [sp, #8] + cmp r3, #16 + ble .Lfinishcomputingremainder + vldr d18, .Lpio2_2 + vmul.f64 d20, d17, d18 + vsub.f64 d19, d16, d20 + vsub.f64 d16, d16, d19 + vsub.f64 d18, d16, d20 + vldr d16, .Lpio2_2t + vnmls.f64 d18, d17, d16 + vsub.f64 d0, d19, d18 + vmov r2, r3, d0 + ubfx r3, r3, #20, #11 + rsb r1, r3, r1 + vstr d0, [sp, #8] + cmp r1, #49 + ble .Lfinishseconditeration + vldr d5, .Lpio2_3 + vmul.f64 d20, d17, d5 + vsub.f64 d16, d19, d20 + vsub.f64 d4, d19, d16 + vldr d19, .Lpio2_3t + vsub.f64 d18, d4, d20 + vnmls.f64 d18, d17, d19 + b .Lfinishthirditeration +.Lhandlenegativex: + vneg.f64 d0, d0 + rsb r0, r0, #0 + vneg.f64 d1, d1 + vstr d0, [sp, #8] + vstr d1, [sp, #16] + b .Lselectregion +.Lfinishseconditeration: + vmov d16, d19 + b .Lfinishcomputingremainder +.Lxnearnegpio2: + vldr d0, .Lpio2_2 + vldr d17, .Lpio2_2t + vadd.f64 d16, d16, d0 + b .Lfinalizesmallnegxremainder +.Lhandlenegativexalso: + vldr d6, [sp, #16] + vneg.f64 d0, d0 + rsb r0, r0, #0 + vneg.f64 d1, d6 + vstr d0, [sp, #8] + vstr d1, [sp, #16] + b .Lselectregion + +.align 3 +.Lpio2_1: + .word 0x54400000, 0x3ff921fb +.Lpio2_1t: + .word 0x1a626331, 0x3dd0b461 +.Linvpio2: + .word 0x6dc9c883, 0x3fe45f30 +.Ltwo24: + .word 0x00000000, 0x41700000 +.Lpio2_2: + .word 0x1a600000, 0x3dd0b461 +.Lpio2_2t: + .word 0x2e037073, 0x3ba3198a +.Lpio2_3: + .word 0x2e000000, 0x3ba3198a +.Lpio2_3t: + .word 0x252049c1, 0x397b839a +.Lnpio2_hw_ptr: + .word .Lnpio2_hw-(.LPICnpio2_hw0+8) +.Ltwo_over_pi_ptr: + .word .Ltwo_over_pi-(.LPICtwo_over_pi0+8) +END(sin) + + .section .rodata.npio2_hw,"a",%progbits + .align 2 +.Lnpio2_hw = . + 0 + .type npio2_hw, %object + .size npio2_hw, 128 +npio2_hw: + .word 0x3ff921fb + .word 0x400921fb + .word 0x4012d97c + .word 0x401921fb + .word 0x401f6a7a + .word 0x4022d97c + .word 0x4025fdbb + .word 0x402921fb + .word 0x402c463a + .word 0x402f6a7a + .word 0x4031475c + .word 0x4032d97c + .word 0x40346b9c + .word 0x4035fdbb + .word 0x40378fdb + .word 0x403921fb + .word 0x403ab41b + .word 0x403c463a + .word 0x403dd85a + .word 0x403f6a7a + .word 0x40407e4c + .word 0x4041475c + .word 0x4042106c + .word 0x4042d97c + .word 0x4043a28c + .word 0x40446b9c + .word 0x404534ac + .word 0x4045fdbb + .word 0x4046c6cb + .word 0x40478fdb + .word 0x404858eb + .word 0x404921fb + + .section .rodata.two_over_pi,"a",%progbits + .align 2 +.Ltwo_over_pi = . + 0 + .type two_over_pi, %object + .size two_over_pi, 264 +two_over_pi: + .word 0x00a2f983 + .word 0x006e4e44 + .word 0x001529fc + .word 0x002757d1 + .word 0x00f534dd + .word 0x00c0db62 + .word 0x0095993c + .word 0x00439041 + .word 0x00fe5163 + .word 0x00abdebb + .word 0x00c561b7 + .word 0x00246e3a + .word 0x00424dd2 + .word 0x00e00649 + .word 0x002eea09 + .word 0x00d1921c + .word 0x00fe1deb + .word 0x001cb129 + .word 0x00a73ee8 + .word 0x008235f5 + .word 0x002ebb44 + .word 0x0084e99c + .word 0x007026b4 + .word 0x005f7e41 + .word 0x003991d6 + .word 0x00398353 + .word 0x0039f49c + .word 0x00845f8b + .word 0x00bdf928 + .word 0x003b1ff8 + .word 0x0097ffde + .word 0x0005980f + .word 0x00ef2f11 + .word 0x008b5a0a + .word 0x006d1f6d + .word 0x00367ecf + .word 0x0027cb09 + .word 0x00b74f46 + .word 0x003f669e + .word 0x005fea2d + .word 0x007527ba + .word 0x00c7ebe5 + .word 0x00f17b3d + .word 0x000739f7 + .word 0x008a5292 + .word 0x00ea6bfb + .word 0x005fb11f + .word 0x008d5d08 + .word 0x00560330 + .word 0x0046fc7b + .word 0x006babf0 + .word 0x00cfbc20 + .word 0x009af436 + .word 0x001da9e3 + .word 0x0091615e + .word 0x00e61b08 + .word 0x00659985 + .word 0x005f14a0 + .word 0x0068408d + .word 0x00ffd880 + .word 0x004d7327 + .word 0x00310606 + .word 0x001556ca + .word 0x0073a8c9 + .word 0x0060e27b + .word 0x00c08c6b diff --git a/libm/fake_long_double.c b/libm/fake_long_double.c index fab32fe47..0936fb498 100644 --- a/libm/fake_long_double.c +++ b/libm/fake_long_double.c @@ -44,6 +44,7 @@ long double erfcl(long double a1) { return erfc(a1); } long double erfl(long double a1) { return erf(a1); } long double expm1l(long double a1) { return expm1(a1); } long double fabsl(long double a1) { return fabs(a1); } +long double fmal(long double a1, long double a2, long double a3) { return fma(a1, a2, a3); } long double fmaxl(long double a1, long double a2) { return fmax(a1, a2); } long double fmodl(long double a1, long double a2) { return fmod(a1, a2); } long double fminl(long double a1, long double a2) { return fmin(a1, a2); } diff --git a/libm/sincos.c b/libm/sincos.c index 891aa317f..5ecb0a103 100644 --- a/libm/sincos.c +++ b/libm/sincos.c @@ -26,6 +26,18 @@ */ #define _GNU_SOURCE 1 #include +#define INLINE_KERNEL_COSDF +#define INLINE_KERNEL_SINDF +#include "upstream-freebsd/lib/msun/src/math_private.h" +#include "upstream-freebsd/lib/msun/src/k_cosf.c" +#include "upstream-freebsd/lib/msun/src/k_sinf.c" + +/* Small multiples of pi/2 rounded to double precision. */ +static const double + s1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */ + s2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */ + s3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */ + s4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */ // Disable sincos optimization for all functions in this file, // otherwise gcc would generate infinite calls. diff --git a/libm/upstream-freebsd/lib/msun/src/catrig.c b/libm/upstream-freebsd/lib/msun/src/catrig.c new file mode 100644 index 000000000..200977c0a --- /dev/null +++ b/libm/upstream-freebsd/lib/msun/src/catrig.c @@ -0,0 +1,639 @@ +/*- + * Copyright (c) 2012 Stephen Montgomery-Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include "math.h" +#include "math_private.h" + +#undef isinf +#define isinf(x) (fabs(x) == INFINITY) +#undef isnan +#define isnan(x) ((x) != (x)) +#define raise_inexact() do { volatile float junk = 1 + tiny; } while(0) +#undef signbit +#define signbit(x) (__builtin_signbit(x)) + +/* We need that DBL_EPSILON^2/128 is larger than FOUR_SQRT_MIN. */ +static const double +A_crossover = 10, /* Hull et al suggest 1.5, but 10 works better */ +B_crossover = 0.6417, /* suggested by Hull et al */ +FOUR_SQRT_MIN = 0x1p-509, /* >= 4 * sqrt(DBL_MIN) */ +QUARTER_SQRT_MAX = 0x1p509, /* <= sqrt(DBL_MAX) / 4 */ +m_e = 2.7182818284590452e0, /* 0x15bf0a8b145769.0p-51 */ +m_ln2 = 6.9314718055994531e-1, /* 0x162e42fefa39ef.0p-53 */ +pio2_hi = 1.5707963267948966e0, /* 0x1921fb54442d18.0p-52 */ +RECIP_EPSILON = 1 / DBL_EPSILON, +SQRT_3_EPSILON = 2.5809568279517849e-8, /* 0x1bb67ae8584caa.0p-78 */ +SQRT_6_EPSILON = 3.6500241499888571e-8, /* 0x13988e1409212e.0p-77 */ +SQRT_MIN = 0x1p-511; /* >= sqrt(DBL_MIN) */ + +static const volatile double +pio2_lo = 6.1232339957367659e-17; /* 0x11a62633145c07.0p-106 */ +static const volatile float +tiny = 0x1p-100; + +static double complex clog_for_large_values(double complex z); + +/* + * Testing indicates that all these functions are accurate up to 4 ULP. + * The functions casin(h) and cacos(h) are about 2.5 times slower than asinh. + * The functions catan(h) are a little under 2 times slower than atanh. + * + * The code for casinh, casin, cacos, and cacosh comes first. The code is + * rather complicated, and the four functions are highly interdependent. + * + * The code for catanh and catan comes at the end. It is much simpler than + * the other functions, and the code for these can be disconnected from the + * rest of the code. + */ + +/* + * ================================ + * | casinh, casin, cacos, cacosh | + * ================================ + */ + +/* + * The algorithm is very close to that in "Implementing the complex arcsine + * and arccosine functions using exception handling" by T. E. Hull, Thomas F. + * Fairgrieve, and Ping Tak Peter Tang, published in ACM Transactions on + * Mathematical Software, Volume 23 Issue 3, 1997, Pages 299-335, + * http://dl.acm.org/citation.cfm?id=275324. + * + * Throughout we use the convention z = x + I*y. + * + * casinh(z) = sign(x)*log(A+sqrt(A*A-1)) + I*asin(B) + * where + * A = (|z+I| + |z-I|) / 2 + * B = (|z+I| - |z-I|) / 2 = y/A + * + * These formulas become numerically unstable: + * (a) for Re(casinh(z)) when z is close to the line segment [-I, I] (that + * is, Re(casinh(z)) is close to 0); + * (b) for Im(casinh(z)) when z is close to either of the intervals + * [I, I*infinity) or (-I*infinity, -I] (that is, |Im(casinh(z))| is + * close to PI/2). + * + * These numerical problems are overcome by defining + * f(a, b) = (hypot(a, b) - b) / 2 = a*a / (hypot(a, b) + b) / 2 + * Then if A < A_crossover, we use + * log(A + sqrt(A*A-1)) = log1p((A-1) + sqrt((A-1)*(A+1))) + * A-1 = f(x, 1+y) + f(x, 1-y) + * and if B > B_crossover, we use + * asin(B) = atan2(y, sqrt(A*A - y*y)) = atan2(y, sqrt((A+y)*(A-y))) + * A-y = f(x, y+1) + f(x, y-1) + * where without loss of generality we have assumed that x and y are + * non-negative. + * + * Much of the difficulty comes because the intermediate computations may + * produce overflows or underflows. This is dealt with in the paper by Hull + * et al by using exception handling. We do this by detecting when + * computations risk underflow or overflow. The hardest part is handling the + * underflows when computing f(a, b). + * + * Note that the function f(a, b) does not appear explicitly in the paper by + * Hull et al, but the idea may be found on pages 308 and 309. Introducing the + * function f(a, b) allows us to concentrate many of the clever tricks in this + * paper into one function. + */ + +/* + * Function f(a, b, hypot_a_b) = (hypot(a, b) - b) / 2. + * Pass hypot(a, b) as the third argument. + */ +static inline double +f(double a, double b, double hypot_a_b) +{ + if (b < 0) + return ((hypot_a_b - b) / 2); + if (b == 0) + return (a / 2); + return (a * a / (hypot_a_b + b) / 2); +} + +/* + * All the hard work is contained in this function. + * x and y are assumed positive or zero, and less than RECIP_EPSILON. + * Upon return: + * rx = Re(casinh(z)) = -Im(cacos(y + I*x)). + * B_is_usable is set to 1 if the value of B is usable. + * If B_is_usable is set to 0, sqrt_A2my2 = sqrt(A*A - y*y), and new_y = y. + * If returning sqrt_A2my2 has potential to result in an underflow, it is + * rescaled, and new_y is similarly rescaled. + */ +static inline void +do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B, + double *sqrt_A2my2, double *new_y) +{ + double R, S, A; /* A, B, R, and S are as in Hull et al. */ + double Am1, Amy; /* A-1, A-y. */ + + R = hypot(x, y + 1); /* |z+I| */ + S = hypot(x, y - 1); /* |z-I| */ + + /* A = (|z+I| + |z-I|) / 2 */ + A = (R + S) / 2; + /* + * Mathematically A >= 1. There is a small chance that this will not + * be so because of rounding errors. So we will make certain it is + * so. + */ + if (A < 1) + A = 1; + + if (A < A_crossover) { + /* + * Am1 = fp + fm, where fp = f(x, 1+y), and fm = f(x, 1-y). + * rx = log1p(Am1 + sqrt(Am1*(A+1))) + */ + if (y == 1 && x < DBL_EPSILON * DBL_EPSILON / 128) { + /* + * fp is of order x^2, and fm = x/2. + * A = 1 (inexactly). + */ + *rx = sqrt(x); + } else if (x >= DBL_EPSILON * fabs(y - 1)) { + /* + * Underflow will not occur because + * x >= DBL_EPSILON^2/128 >= FOUR_SQRT_MIN + */ + Am1 = f(x, 1 + y, R) + f(x, 1 - y, S); + *rx = log1p(Am1 + sqrt(Am1 * (A + 1))); + } else if (y < 1) { + /* + * fp = x*x/(1+y)/4, fm = x*x/(1-y)/4, and + * A = 1 (inexactly). + */ + *rx = x / sqrt((1 - y) * (1 + y)); + } else { /* if (y > 1) */ + /* + * A-1 = y-1 (inexactly). + */ + *rx = log1p((y - 1) + sqrt((y - 1) * (y + 1))); + } + } else { + *rx = log(A + sqrt(A * A - 1)); + } + + *new_y = y; + + if (y < FOUR_SQRT_MIN) { + /* + * Avoid a possible underflow caused by y/A. For casinh this + * would be legitimate, but will be picked up by invoking atan2 + * later on. For cacos this would not be legitimate. + */ + *B_is_usable = 0; + *sqrt_A2my2 = A * (2 / DBL_EPSILON); + *new_y = y * (2 / DBL_EPSILON); + return; + } + + /* B = (|z+I| - |z-I|) / 2 = y/A */ + *B = y / A; + *B_is_usable = 1; + + if (*B > B_crossover) { + *B_is_usable = 0; + /* + * Amy = fp + fm, where fp = f(x, y+1), and fm = f(x, y-1). + * sqrt_A2my2 = sqrt(Amy*(A+y)) + */ + if (y == 1 && x < DBL_EPSILON / 128) { + /* + * fp is of order x^2, and fm = x/2. + * A = 1 (inexactly). + */ + *sqrt_A2my2 = sqrt(x) * sqrt((A + y) / 2); + } else if (x >= DBL_EPSILON * fabs(y - 1)) { + /* + * Underflow will not occur because + * x >= DBL_EPSILON/128 >= FOUR_SQRT_MIN + * and + * x >= DBL_EPSILON^2 >= FOUR_SQRT_MIN + */ + Amy = f(x, y + 1, R) + f(x, y - 1, S); + *sqrt_A2my2 = sqrt(Amy * (A + y)); + } else if (y > 1) { + /* + * fp = x*x/(y+1)/4, fm = x*x/(y-1)/4, and + * A = y (inexactly). + * + * y < RECIP_EPSILON. So the following + * scaling should avoid any underflow problems. + */ + *sqrt_A2my2 = x * (4 / DBL_EPSILON / DBL_EPSILON) * y / + sqrt((y + 1) * (y - 1)); + *new_y = y * (4 / DBL_EPSILON / DBL_EPSILON); + } else { /* if (y < 1) */ + /* + * fm = 1-y >= DBL_EPSILON, fp is of order x^2, and + * A = 1 (inexactly). + */ + *sqrt_A2my2 = sqrt((1 - y) * (1 + y)); + } + } +} + +/* + * casinh(z) = z + O(z^3) as z -> 0 + * + * casinh(z) = sign(x)*clog(sign(x)*z) + O(1/z^2) as z -> infinity + * The above formula works for the imaginary part as well, because + * Im(casinh(z)) = sign(x)*atan2(sign(x)*y, fabs(x)) + O(y/z^3) + * as z -> infinity, uniformly in y + */ +double complex +casinh(double complex z) +{ + double x, y, ax, ay, rx, ry, B, sqrt_A2my2, new_y; + int B_is_usable; + double complex w; + + x = creal(z); + y = cimag(z); + ax = fabs(x); + ay = fabs(y); + + if (isnan(x) || isnan(y)) { + /* casinh(+-Inf + I*NaN) = +-Inf + I*NaN */ + if (isinf(x)) + return (cpack(x, y + y)); + /* casinh(NaN + I*+-Inf) = opt(+-)Inf + I*NaN */ + if (isinf(y)) + return (cpack(y, x + x)); + /* casinh(NaN + I*0) = NaN + I*0 */ + if (y == 0) + return (cpack(x + x, y)); + /* + * All other cases involving NaN return NaN + I*NaN. + * C99 leaves it optional whether to raise invalid if one of + * the arguments is not NaN, so we opt not to raise it. + */ + return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); + } + + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) { + /* clog...() will raise inexact unless x or y is infinite. */ + if (signbit(x) == 0) + w = clog_for_large_values(z) + m_ln2; + else + w = clog_for_large_values(-z) + m_ln2; + return (cpack(copysign(creal(w), x), copysign(cimag(w), y))); + } + + /* Avoid spuriously raising inexact for z = 0. */ + if (x == 0 && y == 0) + return (z); + + /* All remaining cases are inexact. */ + raise_inexact(); + + if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4) + return (z); + + do_hard_work(ax, ay, &rx, &B_is_usable, &B, &sqrt_A2my2, &new_y); + if (B_is_usable) + ry = asin(B); + else + ry = atan2(new_y, sqrt_A2my2); + return (cpack(copysign(rx, x), copysign(ry, y))); +} + +/* + * casin(z) = reverse(casinh(reverse(z))) + * where reverse(x + I*y) = y + I*x = I*conj(z). + */ +double complex +casin(double complex z) +{ + double complex w = casinh(cpack(cimag(z), creal(z))); + + return (cpack(cimag(w), creal(w))); +} + +/* + * cacos(z) = PI/2 - casin(z) + * but do the computation carefully so cacos(z) is accurate when z is + * close to 1. + * + * cacos(z) = PI/2 - z + O(z^3) as z -> 0 + * + * cacos(z) = -sign(y)*I*clog(z) + O(1/z^2) as z -> infinity + * The above formula works for the real part as well, because + * Re(cacos(z)) = atan2(fabs(y), x) + O(y/z^3) + * as z -> infinity, uniformly in y + */ +double complex +cacos(double complex z) +{ + double x, y, ax, ay, rx, ry, B, sqrt_A2mx2, new_x; + int sx, sy; + int B_is_usable; + double complex w; + + x = creal(z); + y = cimag(z); + sx = signbit(x); + sy = signbit(y); + ax = fabs(x); + ay = fabs(y); + + if (isnan(x) || isnan(y)) { + /* cacos(+-Inf + I*NaN) = NaN + I*opt(-)Inf */ + if (isinf(x)) + return (cpack(y + y, -INFINITY)); + /* cacos(NaN + I*+-Inf) = NaN + I*-+Inf */ + if (isinf(y)) + return (cpack(x + x, -y)); + /* cacos(0 + I*NaN) = PI/2 + I*NaN with inexact */ + if (x == 0) + return (cpack(pio2_hi + pio2_lo, y + y)); + /* + * All other cases involving NaN return NaN + I*NaN. + * C99 leaves it optional whether to raise invalid if one of + * the arguments is not NaN, so we opt not to raise it. + */ + return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); + } + + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) { + /* clog...() will raise inexact unless x or y is infinite. */ + w = clog_for_large_values(z); + rx = fabs(cimag(w)); + ry = creal(w) + m_ln2; + if (sy == 0) + ry = -ry; + return (cpack(rx, ry)); + } + + /* Avoid spuriously raising inexact for z = 1. */ + if (x == 1 && y == 0) + return (cpack(0, -y)); + + /* All remaining cases are inexact. */ + raise_inexact(); + + if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4) + return (cpack(pio2_hi - (x - pio2_lo), -y)); + + do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x); + if (B_is_usable) { + if (sx == 0) + rx = acos(B); + else + rx = acos(-B); + } else { + if (sx == 0) + rx = atan2(sqrt_A2mx2, new_x); + else + rx = atan2(sqrt_A2mx2, -new_x); + } + if (sy == 0) + ry = -ry; + return (cpack(rx, ry)); +} + +/* + * cacosh(z) = I*cacos(z) or -I*cacos(z) + * where the sign is chosen so Re(cacosh(z)) >= 0. + */ +double complex +cacosh(double complex z) +{ + double complex w; + double rx, ry; + + w = cacos(z); + rx = creal(w); + ry = cimag(w); + /* cacosh(NaN + I*NaN) = NaN + I*NaN */ + if (isnan(rx) && isnan(ry)) + return (cpack(ry, rx)); + /* cacosh(NaN + I*+-Inf) = +Inf + I*NaN */ + /* cacosh(+-Inf + I*NaN) = +Inf + I*NaN */ + if (isnan(rx)) + return (cpack(fabs(ry), rx)); + /* cacosh(0 + I*NaN) = NaN + I*NaN */ + if (isnan(ry)) + return (cpack(ry, ry)); + return (cpack(fabs(ry), copysign(rx, cimag(z)))); +} + +/* + * Optimized version of clog() for |z| finite and larger than ~RECIP_EPSILON. + */ +static double complex +clog_for_large_values(double complex z) +{ + double x, y; + double ax, ay, t; + + x = creal(z); + y = cimag(z); + ax = fabs(x); + ay = fabs(y); + if (ax < ay) { + t = ax; + ax = ay; + ay = t; + } + + /* + * Avoid overflow in hypot() when x and y are both very large. + * Divide x and y by E, and then add 1 to the logarithm. This depends + * on E being larger than sqrt(2). + * Dividing by E causes an insignificant loss of accuracy; however + * this method is still poor since it is uneccessarily slow. + */ + if (ax > DBL_MAX / 2) + return (cpack(log(hypot(x / m_e, y / m_e)) + 1, atan2(y, x))); + + /* + * Avoid overflow when x or y is large. Avoid underflow when x or + * y is small. + */ + if (ax > QUARTER_SQRT_MAX || ay < SQRT_MIN) + return (cpack(log(hypot(x, y)), atan2(y, x))); + + return (cpack(log(ax * ax + ay * ay) / 2, atan2(y, x))); +} + +/* + * ================= + * | catanh, catan | + * ================= + */ + +/* + * sum_squares(x,y) = x*x + y*y (or just x*x if y*y would underflow). + * Assumes x*x and y*y will not overflow. + * Assumes x and y are finite. + * Assumes y is non-negative. + * Assumes fabs(x) >= DBL_EPSILON. + */ +static inline double +sum_squares(double x, double y) +{ + + /* Avoid underflow when y is small. */ + if (y < SQRT_MIN) + return (x * x); + + return (x * x + y * y); +} + +/* + * real_part_reciprocal(x, y) = Re(1/(x+I*y)) = x/(x*x + y*y). + * Assumes x and y are not NaN, and one of x and y is larger than + * RECIP_EPSILON. We avoid unwarranted underflow. It is important to not use + * the code creal(1/z), because the imaginary part may produce an unwanted + * underflow. + * This is only called in a context where inexact is always raised before + * the call, so no effort is made to avoid or force inexact. + */ +static inline double +real_part_reciprocal(double x, double y) +{ + double scale; + uint32_t hx, hy; + int32_t ix, iy; + + /* + * This code is inspired by the C99 document n1124.pdf, Section G.5.1, + * example 2. + */ + GET_HIGH_WORD(hx, x); + ix = hx & 0x7ff00000; + GET_HIGH_WORD(hy, y); + iy = hy & 0x7ff00000; +#define BIAS (DBL_MAX_EXP - 1) +/* XXX more guard digits are useful iff there is extra precision. */ +#define CUTOFF (DBL_MANT_DIG / 2 + 1) /* just half or 1 guard digit */ + if (ix - iy >= CUTOFF << 20 || isinf(x)) + return (1 / x); /* +-Inf -> +-0 is special */ + if (iy - ix >= CUTOFF << 20) + return (x / y / y); /* should avoid double div, but hard */ + if (ix <= (BIAS + DBL_MAX_EXP / 2 - CUTOFF) << 20) + return (x / (x * x + y * y)); + scale = 1; + SET_HIGH_WORD(scale, 0x7ff00000 - ix); /* 2**(1-ilogb(x)) */ + x *= scale; + y *= scale; + return (x / (x * x + y * y) * scale); +} + +/* + * catanh(z) = log((1+z)/(1-z)) / 2 + * = log1p(4*x / |z-1|^2) / 4 + * + I * atan2(2*y, (1-x)*(1+x)-y*y) / 2 + * + * catanh(z) = z + O(z^3) as z -> 0 + * + * catanh(z) = 1/z + sign(y)*I*PI/2 + O(1/z^3) as z -> infinity + * The above formula works for the real part as well, because + * Re(catanh(z)) = x/|z|^2 + O(x/z^4) + * as z -> infinity, uniformly in x + */ +double complex +catanh(double complex z) +{ + double x, y, ax, ay, rx, ry; + + x = creal(z); + y = cimag(z); + ax = fabs(x); + ay = fabs(y); + + /* This helps handle many cases. */ + if (y == 0 && ax <= 1) + return (cpack(atanh(x), y)); + + /* To ensure the same accuracy as atan(), and to filter out z = 0. */ + if (x == 0) + return (cpack(x, atan(y))); + + if (isnan(x) || isnan(y)) { + /* catanh(+-Inf + I*NaN) = +-0 + I*NaN */ + if (isinf(x)) + return (cpack(copysign(0, x), y + y)); + /* catanh(NaN + I*+-Inf) = sign(NaN)0 + I*+-PI/2 */ + if (isinf(y)) + return (cpack(copysign(0, x), + copysign(pio2_hi + pio2_lo, y))); + /* + * All other cases involving NaN return NaN + I*NaN. + * C99 leaves it optional whether to raise invalid if one of + * the arguments is not NaN, so we opt not to raise it. + */ + return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); + } + + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) + return (cpack(real_part_reciprocal(x, y), + copysign(pio2_hi + pio2_lo, y))); + + if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) { + /* + * z = 0 was filtered out above. All other cases must raise + * inexact, but this is the only only that needs to do it + * explicitly. + */ + raise_inexact(); + return (z); + } + + if (ax == 1 && ay < DBL_EPSILON) + rx = (m_ln2 - log(ay)) / 2; + else + rx = log1p(4 * ax / sum_squares(ax - 1, ay)) / 4; + + if (ax == 1) + ry = atan2(2, -ay) / 2; + else if (ay < DBL_EPSILON) + ry = atan2(2 * ay, (1 - ax) * (1 + ax)) / 2; + else + ry = atan2(2 * ay, (1 - ax) * (1 + ax) - ay * ay) / 2; + + return (cpack(copysign(rx, x), copysign(ry, y))); +} + +/* + * catan(z) = reverse(catanh(reverse(z))) + * where reverse(x + I*y) = y + I*x = I*conj(z). + */ +double complex +catan(double complex z) +{ + double complex w = catanh(cpack(cimag(z), creal(z))); + + return (cpack(cimag(w), creal(w))); +} diff --git a/libm/upstream-freebsd/lib/msun/src/catrigf.c b/libm/upstream-freebsd/lib/msun/src/catrigf.c new file mode 100644 index 000000000..08ebef783 --- /dev/null +++ b/libm/upstream-freebsd/lib/msun/src/catrigf.c @@ -0,0 +1,393 @@ +/*- + * Copyright (c) 2012 Stephen Montgomery-Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * The algorithm is very close to that in "Implementing the complex arcsine + * and arccosine functions using exception handling" by T. E. Hull, Thomas F. + * Fairgrieve, and Ping Tak Peter Tang, published in ACM Transactions on + * Mathematical Software, Volume 23 Issue 3, 1997, Pages 299-335, + * http://dl.acm.org/citation.cfm?id=275324. + * + * See catrig.c for complete comments. + * + * XXX comments were removed automatically, and even short ones on the right + * of statements were removed (all of them), contrary to normal style. Only + * a few comments on the right of declarations remain. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include "math.h" +#include "math_private.h" + +#undef isinf +#define isinf(x) (fabsf(x) == INFINITY) +#undef isnan +#define isnan(x) ((x) != (x)) +#define raise_inexact() do { volatile float junk = 1 + tiny; } while(0) +#undef signbit +#define signbit(x) (__builtin_signbitf(x)) + +static const float +A_crossover = 10, +B_crossover = 0.6417, +FOUR_SQRT_MIN = 0x1p-61, +QUARTER_SQRT_MAX = 0x1p61, +m_e = 2.7182818285e0, /* 0xadf854.0p-22 */ +m_ln2 = 6.9314718056e-1, /* 0xb17218.0p-24 */ +pio2_hi = 1.5707962513e0, /* 0xc90fda.0p-23 */ +RECIP_EPSILON = 1 / FLT_EPSILON, +SQRT_3_EPSILON = 5.9801995673e-4, /* 0x9cc471.0p-34 */ +SQRT_6_EPSILON = 8.4572793338e-4, /* 0xddb3d7.0p-34 */ +SQRT_MIN = 0x1p-63; + +static const volatile float +pio2_lo = 7.5497899549e-8, /* 0xa22169.0p-47 */ +tiny = 0x1p-100; + +static float complex clog_for_large_values(float complex z); + +static inline float +f(float a, float b, float hypot_a_b) +{ + if (b < 0) + return ((hypot_a_b - b) / 2); + if (b == 0) + return (a / 2); + return (a * a / (hypot_a_b + b) / 2); +} + +static inline void +do_hard_work(float x, float y, float *rx, int *B_is_usable, float *B, + float *sqrt_A2my2, float *new_y) +{ + float R, S, A; + float Am1, Amy; + + R = hypotf(x, y + 1); + S = hypotf(x, y - 1); + + A = (R + S) / 2; + if (A < 1) + A = 1; + + if (A < A_crossover) { + if (y == 1 && x < FLT_EPSILON * FLT_EPSILON / 128) { + *rx = sqrtf(x); + } else if (x >= FLT_EPSILON * fabsf(y - 1)) { + Am1 = f(x, 1 + y, R) + f(x, 1 - y, S); + *rx = log1pf(Am1 + sqrtf(Am1 * (A + 1))); + } else if (y < 1) { + *rx = x / sqrtf((1 - y) * (1 + y)); + } else { + *rx = log1pf((y - 1) + sqrtf((y - 1) * (y + 1))); + } + } else { + *rx = logf(A + sqrtf(A * A - 1)); + } + + *new_y = y; + + if (y < FOUR_SQRT_MIN) { + *B_is_usable = 0; + *sqrt_A2my2 = A * (2 / FLT_EPSILON); + *new_y = y * (2 / FLT_EPSILON); + return; + } + + *B = y / A; + *B_is_usable = 1; + + if (*B > B_crossover) { + *B_is_usable = 0; + if (y == 1 && x < FLT_EPSILON / 128) { + *sqrt_A2my2 = sqrtf(x) * sqrtf((A + y) / 2); + } else if (x >= FLT_EPSILON * fabsf(y - 1)) { + Amy = f(x, y + 1, R) + f(x, y - 1, S); + *sqrt_A2my2 = sqrtf(Amy * (A + y)); + } else if (y > 1) { + *sqrt_A2my2 = x * (4 / FLT_EPSILON / FLT_EPSILON) * y / + sqrtf((y + 1) * (y - 1)); + *new_y = y * (4 / FLT_EPSILON / FLT_EPSILON); + } else { + *sqrt_A2my2 = sqrtf((1 - y) * (1 + y)); + } + } +} + +float complex +casinhf(float complex z) +{ + float x, y, ax, ay, rx, ry, B, sqrt_A2my2, new_y; + int B_is_usable; + float complex w; + + x = crealf(z); + y = cimagf(z); + ax = fabsf(x); + ay = fabsf(y); + + if (isnan(x) || isnan(y)) { + if (isinf(x)) + return (cpackf(x, y + y)); + if (isinf(y)) + return (cpackf(y, x + x)); + if (y == 0) + return (cpackf(x + x, y)); + return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); + } + + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) { + if (signbit(x) == 0) + w = clog_for_large_values(z) + m_ln2; + else + w = clog_for_large_values(-z) + m_ln2; + return (cpackf(copysignf(crealf(w), x), + copysignf(cimagf(w), y))); + } + + if (x == 0 && y == 0) + return (z); + + raise_inexact(); + + if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4) + return (z); + + do_hard_work(ax, ay, &rx, &B_is_usable, &B, &sqrt_A2my2, &new_y); + if (B_is_usable) + ry = asinf(B); + else + ry = atan2f(new_y, sqrt_A2my2); + return (cpackf(copysignf(rx, x), copysignf(ry, y))); +} + +float complex +casinf(float complex z) +{ + float complex w = casinhf(cpackf(cimagf(z), crealf(z))); + + return (cpackf(cimagf(w), crealf(w))); +} + +float complex +cacosf(float complex z) +{ + float x, y, ax, ay, rx, ry, B, sqrt_A2mx2, new_x; + int sx, sy; + int B_is_usable; + float complex w; + + x = crealf(z); + y = cimagf(z); + sx = signbit(x); + sy = signbit(y); + ax = fabsf(x); + ay = fabsf(y); + + if (isnan(x) || isnan(y)) { + if (isinf(x)) + return (cpackf(y + y, -INFINITY)); + if (isinf(y)) + return (cpackf(x + x, -y)); + if (x == 0) + return (cpackf(pio2_hi + pio2_lo, y + y)); + return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); + } + + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) { + w = clog_for_large_values(z); + rx = fabsf(cimagf(w)); + ry = crealf(w) + m_ln2; + if (sy == 0) + ry = -ry; + return (cpackf(rx, ry)); + } + + if (x == 1 && y == 0) + return (cpackf(0, -y)); + + raise_inexact(); + + if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4) + return (cpackf(pio2_hi - (x - pio2_lo), -y)); + + do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x); + if (B_is_usable) { + if (sx == 0) + rx = acosf(B); + else + rx = acosf(-B); + } else { + if (sx == 0) + rx = atan2f(sqrt_A2mx2, new_x); + else + rx = atan2f(sqrt_A2mx2, -new_x); + } + if (sy == 0) + ry = -ry; + return (cpackf(rx, ry)); +} + +float complex +cacoshf(float complex z) +{ + float complex w; + float rx, ry; + + w = cacosf(z); + rx = crealf(w); + ry = cimagf(w); + if (isnan(rx) && isnan(ry)) + return (cpackf(ry, rx)); + if (isnan(rx)) + return (cpackf(fabsf(ry), rx)); + if (isnan(ry)) + return (cpackf(ry, ry)); + return (cpackf(fabsf(ry), copysignf(rx, cimagf(z)))); +} + +static float complex +clog_for_large_values(float complex z) +{ + float x, y; + float ax, ay, t; + + x = crealf(z); + y = cimagf(z); + ax = fabsf(x); + ay = fabsf(y); + if (ax < ay) { + t = ax; + ax = ay; + ay = t; + } + + if (ax > FLT_MAX / 2) + return (cpackf(logf(hypotf(x / m_e, y / m_e)) + 1, + atan2f(y, x))); + + if (ax > QUARTER_SQRT_MAX || ay < SQRT_MIN) + return (cpackf(logf(hypotf(x, y)), atan2f(y, x))); + + return (cpackf(logf(ax * ax + ay * ay) / 2, atan2f(y, x))); +} + +static inline float +sum_squares(float x, float y) +{ + + if (y < SQRT_MIN) + return (x * x); + + return (x * x + y * y); +} + +static inline float +real_part_reciprocal(float x, float y) +{ + float scale; + uint32_t hx, hy; + int32_t ix, iy; + + GET_FLOAT_WORD(hx, x); + ix = hx & 0x7f800000; + GET_FLOAT_WORD(hy, y); + iy = hy & 0x7f800000; +#define BIAS (FLT_MAX_EXP - 1) +#define CUTOFF (FLT_MANT_DIG / 2 + 1) + if (ix - iy >= CUTOFF << 23 || isinf(x)) + return (1 / x); + if (iy - ix >= CUTOFF << 23) + return (x / y / y); + if (ix <= (BIAS + FLT_MAX_EXP / 2 - CUTOFF) << 23) + return (x / (x * x + y * y)); + SET_FLOAT_WORD(scale, 0x7f800000 - ix); + x *= scale; + y *= scale; + return (x / (x * x + y * y) * scale); +} + +float complex +catanhf(float complex z) +{ + float x, y, ax, ay, rx, ry; + + x = crealf(z); + y = cimagf(z); + ax = fabsf(x); + ay = fabsf(y); + + if (y == 0 && ax <= 1) + return (cpackf(atanhf(x), y)); + + if (x == 0) + return (cpackf(x, atanf(y))); + + if (isnan(x) || isnan(y)) { + if (isinf(x)) + return (cpackf(copysignf(0, x), y + y)); + if (isinf(y)) + return (cpackf(copysignf(0, x), + copysignf(pio2_hi + pio2_lo, y))); + return (cpackf(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); + } + + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) + return (cpackf(real_part_reciprocal(x, y), + copysignf(pio2_hi + pio2_lo, y))); + + if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) { + raise_inexact(); + return (z); + } + + if (ax == 1 && ay < FLT_EPSILON) + rx = (m_ln2 - logf(ay)) / 2; + else + rx = log1pf(4 * ax / sum_squares(ax - 1, ay)) / 4; + + if (ax == 1) + ry = atan2f(2, -ay) / 2; + else if (ay < FLT_EPSILON) + ry = atan2f(2 * ay, (1 - ax) * (1 + ax)) / 2; + else + ry = atan2f(2 * ay, (1 - ax) * (1 + ax) - ay * ay) / 2; + + return (cpackf(copysignf(rx, x), copysignf(ry, y))); +} + +float complex +catanf(float complex z) +{ + float complex w = catanhf(cpackf(cimagf(z), crealf(z))); + + return (cpackf(cimagf(w), crealf(w))); +} diff --git a/libm/upstream-freebsd/lib/msun/src/e_acoshl.c b/libm/upstream-freebsd/lib/msun/src/e_acoshl.c new file mode 100644 index 000000000..b9f3aed67 --- /dev/null +++ b/libm/upstream-freebsd/lib/msun/src/e_acoshl.c @@ -0,0 +1,89 @@ +/* from: FreeBSD: head/lib/msun/src/e_acosh.c 176451 2008-02-22 02:30:36Z das */ + +/* @(#)e_acosh.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * See e_acosh.c for complete comments. + * + * Converted to long double by David Schultz and + * Bruce D. Evans. + */ + +#include +#ifdef __i386__ +#include +#endif + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" + +/* EXP_LARGE is the threshold above which we use acosh(x) ~= log(2x). */ +#if LDBL_MANT_DIG == 64 +#define EXP_LARGE 34 +#elif LDBL_MANT_DIG == 113 +#define EXP_LARGE 58 +#else +#error "Unsupported long double format" +#endif + +#if LDBL_MAX_EXP != 0x4000 +/* We also require the usual expsign encoding. */ +#error "Unsupported long double format" +#endif + +#define BIAS (LDBL_MAX_EXP - 1) + +static const double +one = 1.0; + +#if LDBL_MANT_DIG == 64 +static const union IEEEl2bits +u_ln2 = LD80C(0xb17217f7d1cf79ac, -1, 6.93147180559945309417e-1L); +#define ln2 u_ln2.e +#elif LDBL_MANT_DIG == 113 +static const long double +ln2 = 6.93147180559945309417232121458176568e-1L; /* 0x162e42fefa39ef35793c7673007e6.0p-113 */ +#else +#error "Unsupported long double format" +#endif + +long double +acoshl(long double x) +{ + long double t; + int16_t hx; + + ENTERI(); + GET_LDBL_EXPSIGN(hx, x); + if (hx < 0x3fff) { /* x < 1, or misnormal */ + RETURNI((x-x)/(x-x)); + } else if (hx >= BIAS + EXP_LARGE) { /* x >= LARGE */ + if (hx >= 0x7fff) { /* x is inf, NaN or misnormal */ + RETURNI(x+x); + } else + RETURNI(logl(x)+ln2); /* acosh(huge)=log(2x), or misnormal */ + } else if (hx == 0x3fff && x == 1) { + RETURNI(0.0); /* acosh(1) = 0 */ + } else if (hx >= 0x4000) { /* LARGE > x >= 2, or misnormal */ + t=x*x; + RETURNI(logl(2.0*x-one/(x+sqrtl(t-one)))); + } else { /* 1 +__FBSDID("$FreeBSD$"); + +/* + * See e_atanh.c for complete comments. + * + * Converted to long double by David Schultz and + * Bruce D. Evans. + */ + +#include +#ifdef __i386__ +#include +#endif + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" + +/* EXP_TINY is the threshold below which we use atanh(x) ~= x. */ +#if LDBL_MANT_DIG == 64 +#define EXP_TINY -34 +#elif LDBL_MANT_DIG == 113 +#define EXP_TINY -58 +#else +#error "Unsupported long double format" +#endif + +#if LDBL_MAX_EXP != 0x4000 +/* We also require the usual expsign encoding. */ +#error "Unsupported long double format" +#endif + +#define BIAS (LDBL_MAX_EXP - 1) + +static const double one = 1.0, huge = 1e300; +static const double zero = 0.0; + +long double +atanhl(long double x) +{ + long double t; + uint16_t hx, ix; + + ENTERI(); + GET_LDBL_EXPSIGN(hx, x); + ix = hx & 0x7fff; + if (ix >= 0x3fff) /* |x| >= 1, or NaN or misnormal */ + RETURNI(fabsl(x) == 1 ? x / zero : (x - x) / (x - x)); + if (ix < BIAS + EXP_TINY && (huge + x) > zero) + RETURNI(x); /* x is tiny */ + SET_LDBL_EXPSIGN(x, ix); + if (ix < 0x3ffe) { /* |x| < 0.5, or misnormal */ + t = x+x; + t = 0.5*log1pl(t+t*x/(one-x)); + } else + t = 0.5*log1pl((x+x)/(one-x)); + RETURNI((hx & 0x8000) == 0 ? t : -t); +} diff --git a/libm/upstream-freebsd/lib/msun/src/e_pow.c b/libm/upstream-freebsd/lib/msun/src/e_pow.c index 7607a4a72..917e80baf 100644 --- a/libm/upstream-freebsd/lib/msun/src/e_pow.c +++ b/libm/upstream-freebsd/lib/msun/src/e_pow.c @@ -94,7 +94,11 @@ ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ double +#if defined(KRAIT_NEON_OPTIMIZATION) || defined(SPARROW_NEON_OPTIMIZATION) +__full_ieee754_pow(double x, double y) +#else __ieee754_pow(double x, double y) +#endif { double z,ax,z_h,z_l,p_h,p_l; double y1,t1,t2,r,s,t,u,v,w; @@ -107,15 +111,32 @@ __ieee754_pow(double x, double y) ix = hx&0x7fffffff; iy = hy&0x7fffffff; /* y==zero: x**0 = 1 */ - if((iy|ly)==0) return one; - /* x==1: 1**y = 1, even if y is NaN */ - if (hx==0x3ff00000 && lx == 0) return one; + if (ly == 0) { + if (hy == ly) { + /* y==0.0, x**0 = 1 */ + return one; + } + else if (iy > 0x7ff00000) { + /* y is NaN, return x+y (NaN) */ + return x+y; + } + } + else if (iy >= 0x7ff00000) { + /* y is NaN, return x+y (NaN) */ + return x+y; + } - /* y!=zero: result is NaN if either arg is NaN */ - if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || - iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) - return (x+0.0)+(y+0.0); + if (lx == 0) { + if (ix > 0x7ff00000) { + /* x is NaN, return x+y (NaN) */ + return x+y; + } + } + else if (ix >= 0x7ff00000) { + /* x is NaN, return x+y (NaN) */ + return x+y; + } /* determine if y is an odd int when x < 0 * yisint = 0 ... y is not an integer diff --git a/libm/upstream-freebsd/lib/msun/src/imprecise.c b/libm/upstream-freebsd/lib/msun/src/imprecise.c new file mode 100644 index 000000000..a7503bf1c --- /dev/null +++ b/libm/upstream-freebsd/lib/msun/src/imprecise.c @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2013 David Chisnall + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +/* + * If long double is not the same size as double, then these will lose + * precision and we should emit a warning whenever something links against + * them. + */ +#if (LDBL_MANT_DIG > 53) +#define WARN_IMPRECISE(x) \ + __warn_references(x, # x " has lower than advertised precision"); +#else +#define WARN_IMPRECISE(x) +#endif +/* + * Declare the functions as weak variants so that other libraries providing + * real versions can override them. + */ +#define DECLARE_WEAK(x)\ + __weak_reference(imprecise_## x, x);\ + WARN_IMPRECISE(x) + +long double +imprecise_powl(long double x, long double y) +{ + + return pow(x, y); +} +DECLARE_WEAK(powl); + +#define DECLARE_IMPRECISE(f) \ + long double imprecise_ ## f ## l(long double v) { return f(v); }\ + DECLARE_WEAK(f ## l) + +DECLARE_IMPRECISE(cosh); +DECLARE_IMPRECISE(erfc); +DECLARE_IMPRECISE(erf); +DECLARE_IMPRECISE(lgamma); +DECLARE_IMPRECISE(sinh); +DECLARE_IMPRECISE(tanh); +DECLARE_IMPRECISE(tgamma); diff --git a/libm/upstream-freebsd/lib/msun/src/k_cos.c b/libm/upstream-freebsd/lib/msun/src/k_cos.c index c4702e65b..a7eab7b13 100644 --- a/libm/upstream-freebsd/lib/msun/src/k_cos.c +++ b/libm/upstream-freebsd/lib/msun/src/k_cos.c @@ -68,6 +68,17 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ double __kernel_cos(double x, double y) { +#if defined(KRAIT_NEON_OPTIMIZATION) + double hz,z,zz,r,w,k; + + z = x*x; + zz = z*z; + k = x*y; + hz = (float)0.5*z; + r = z*(z*(C1+z*(C2+z*((C3+z*C4)+zz*(C5+z*C6))))); + w = one-hz; + return w + (((one-w)-hz) + (r-k)); +#else double hz,z,r,w; z = x*x; @@ -76,4 +87,5 @@ __kernel_cos(double x, double y) hz = 0.5*z; w = one-hz; return w + (((one-w)-hz) + (z*r-x*y)); +#endif } diff --git a/libm/upstream-freebsd/lib/msun/src/k_sin.c b/libm/upstream-freebsd/lib/msun/src/k_sin.c index 12ee8c143..85063914a 100644 --- a/libm/upstream-freebsd/lib/msun/src/k_sin.c +++ b/libm/upstream-freebsd/lib/msun/src/k_sin.c @@ -59,6 +59,16 @@ S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ double __kernel_sin(double x, double y, int iy) { +#if defined(KRAIT_NEON_OPTIMIZATION) + double z,zz,r,v; + + z = x*x; + zz = z*z; + v = z*x; + r = S2+z*((S3+z*S4)+zz*(S5+z*S6)); + if(iy==0) return x+v*(S1+z*r); + else return x-((z*(half*y-v*r)-y)-v*S1); +#else double z,r,v,w; z = x*x; @@ -67,4 +77,5 @@ __kernel_sin(double x, double y, int iy) v = z*x; if(iy==0) return x+v*(S1+z*r); else return x-((z*(half*y-v*r)-y)-v*S1); +#endif } diff --git a/libm/upstream-freebsd/lib/msun/src/math_private.h b/libm/upstream-freebsd/lib/msun/src/math_private.h index 8ebc7fbf3..f796ace14 100644 --- a/libm/upstream-freebsd/lib/msun/src/math_private.h +++ b/libm/upstream-freebsd/lib/msun/src/math_private.h @@ -39,7 +39,7 @@ */ #ifdef __arm__ -#if defined(__VFP_FP__) +#if defined(__VFP_FP__) || defined(__ARM_EABI__) #define IEEE_WORD_ORDER BYTE_ORDER #else #define IEEE_WORD_ORDER BIG_ENDIAN @@ -723,6 +723,16 @@ irintl(long double x) #define __ieee754_remainderf remainderf #define __ieee754_scalbf scalbf +#if defined(KRAIT_NEON_OPTIMIZATION) +int __kernel_rem_pio2(double*,double*,int,int,int) __attribute__((pcs("aapcs-vfp"))); +double __full_ieee754_pow(double,double); +#ifndef INLINE_REM_PIO2 +int __ieee754_rem_pio2(double,double*) __attribute__((pcs("aapcs-vfp"))); +#endif +double __kernel_sin(double,double,int) __attribute__((pcs("aapcs-vfp"))); +double __kernel_cos(double,double) __attribute__((pcs("aapcs-vfp"))); +double __kernel_tan(double,double,int) __attribute__((pcs("aapcs-vfp"))); +#else /* fdlibm kernel function */ int __kernel_rem_pio2(double*,double*,int,int,int); @@ -733,6 +743,8 @@ int __ieee754_rem_pio2(double,double*); double __kernel_sin(double,double,int); double __kernel_cos(double,double); double __kernel_tan(double,double,int); +#endif + double __ldexp_exp(double,int); #ifdef _COMPLEX_H double complex __ldexp_cexp(double complex,int); diff --git a/libm/upstream-freebsd/lib/msun/src/s_asinhl.c b/libm/upstream-freebsd/lib/msun/src/s_asinhl.c new file mode 100644 index 000000000..ba28f599c --- /dev/null +++ b/libm/upstream-freebsd/lib/msun/src/s_asinhl.c @@ -0,0 +1,91 @@ +/* from: FreeBSD: head/lib/msun/src/e_acosh.c 176451 2008-02-22 02:30:36Z das */ + +/* @(#)s_asinh.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * See s_asinh.c for complete comments. + * + * Converted to long double by David Schultz and + * Bruce D. Evans. + */ + +#include +#ifdef __i386__ +#include +#endif + +#include "fpmath.h" +#include "math.h" +#include "math_private.h" + +/* EXP_LARGE is the threshold above which we use asinh(x) ~= log(2x). */ +/* EXP_TINY is the threshold below which we use asinh(x) ~= x. */ +#if LDBL_MANT_DIG == 64 +#define EXP_LARGE 34 +#define EXP_TINY -34 +#elif LDBL_MANT_DIG == 113 +#define EXP_LARGE 58 +#define EXP_TINY -58 +#else +#error "Unsupported long double format" +#endif + +#if LDBL_MAX_EXP != 0x4000 +/* We also require the usual expsign encoding. */ +#error "Unsupported long double format" +#endif + +#define BIAS (LDBL_MAX_EXP - 1) + +static const double +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +huge= 1.00000000000000000000e+300; + +#if LDBL_MANT_DIG == 64 +static const union IEEEl2bits +u_ln2 = LD80C(0xb17217f7d1cf79ac, -1, 6.93147180559945309417e-1L); +#define ln2 u_ln2.e +#elif LDBL_MANT_DIG == 113 +static const long double +ln2 = 6.93147180559945309417232121458176568e-1L; /* 0x162e42fefa39ef35793c7673007e6.0p-113 */ +#else +#error "Unsupported long double format" +#endif + +long double +asinhl(long double x) +{ + long double t, w; + uint16_t hx, ix; + + ENTERI(); + GET_LDBL_EXPSIGN(hx, x); + ix = hx & 0x7fff; + if (ix >= 0x7fff) RETURNI(x+x); /* x is inf, NaN or misnormal */ + if (ix < BIAS + EXP_TINY) { /* |x| < TINY, or misnormal */ + if (huge + x > one) RETURNI(x); /* return x inexact except 0 */ + } + if (ix >= BIAS + EXP_LARGE) { /* |x| >= LARGE, or misnormal */ + w = logl(fabsl(x))+ln2; + } else if (ix >= 0x4000) { /* LARGE > |x| >= 2.0, or misnormal */ + t = fabsl(x); + w = logl(2.0*t+one/(sqrtl(x*x+one)+t)); + } else { /* 2.0 > |x| >= TINY, or misnormal */ + t = x*x; + w =log1pl(fabsl(x)+t/(one+sqrtl(one+t))); + } + RETURNI((hx & 0x8000) == 0 ? w : -w); +} diff --git a/libm/upstream-freebsd/lib/msun/src/s_erf.c b/libm/upstream-freebsd/lib/msun/src/s_erf.c index 0886e5e7d..854767bc9 100644 --- a/libm/upstream-freebsd/lib/msun/src/s_erf.c +++ b/libm/upstream-freebsd/lib/msun/src/s_erf.c @@ -201,7 +201,7 @@ erf(double x) if(ix < 0x3feb0000) { /* |x|<0.84375 */ if(ix < 0x3e300000) { /* |x|<2**-28 */ if (ix < 0x00800000) - return 0.125*(8.0*x+efx8*x); /*avoid underflow */ + return (8*x+efx8*x)/8; /* avoid spurious underflow */ return x + efx*x; } z = x*x; diff --git a/libm/upstream-freebsd/lib/msun/src/s_erff.c b/libm/upstream-freebsd/lib/msun/src/s_erff.c index a44e13565..b97ca1d12 100644 --- a/libm/upstream-freebsd/lib/msun/src/s_erff.c +++ b/libm/upstream-freebsd/lib/msun/src/s_erff.c @@ -24,75 +24,59 @@ tiny = 1e-30, half= 5.0000000000e-01, /* 0x3F000000 */ one = 1.0000000000e+00, /* 0x3F800000 */ two = 2.0000000000e+00, /* 0x40000000 */ - /* c = (subfloat)0.84506291151 */ -erx = 8.4506291151e-01, /* 0x3f58560b */ /* - * Coefficients for approximation to erf on [0,0.84375] + * Coefficients for approximation to erf on [0,0.84375] */ efx = 1.2837916613e-01, /* 0x3e0375d4 */ efx8= 1.0270333290e+00, /* 0x3f8375d4 */ -pp0 = 1.2837916613e-01, /* 0x3e0375d4 */ -pp1 = -3.2504209876e-01, /* 0xbea66beb */ -pp2 = -2.8481749818e-02, /* 0xbce9528f */ -pp3 = -5.7702702470e-03, /* 0xbbbd1489 */ -pp4 = -2.3763017452e-05, /* 0xb7c756b1 */ -qq1 = 3.9791721106e-01, /* 0x3ecbbbce */ -qq2 = 6.5022252500e-02, /* 0x3d852a63 */ -qq3 = 5.0813062117e-03, /* 0x3ba68116 */ -qq4 = 1.3249473704e-04, /* 0x390aee49 */ -qq5 = -3.9602282413e-06, /* 0xb684e21a */ /* - * Coefficients for approximation to erf in [0.84375,1.25] + * Domain [0, 0.84375], range ~[-5.4446e-10,5.5197e-10]: + * |(erf(x) - x)/x - p(x)/q(x)| < 2**-31. */ -pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ -pa1 = 4.1485610604e-01, /* 0x3ed46805 */ -pa2 = -3.7220788002e-01, /* 0xbebe9208 */ -pa3 = 3.1834661961e-01, /* 0x3ea2fe54 */ -pa4 = -1.1089469492e-01, /* 0xbde31cc2 */ -pa5 = 3.5478305072e-02, /* 0x3d1151b3 */ -pa6 = -2.1663755178e-03, /* 0xbb0df9c0 */ -qa1 = 1.0642088205e-01, /* 0x3dd9f331 */ -qa2 = 5.4039794207e-01, /* 0x3f0a5785 */ -qa3 = 7.1828655899e-02, /* 0x3d931ae7 */ -qa4 = 1.2617121637e-01, /* 0x3e013307 */ -qa5 = 1.3637083583e-02, /* 0x3c5f6e13 */ -qa6 = 1.1984500103e-02, /* 0x3c445aa3 */ +pp0 = 1.28379166e-01F, /* 0x1.06eba8p-3 */ +pp1 = -3.36030394e-01F, /* -0x1.58185ap-2 */ +pp2 = -1.86260219e-03F, /* -0x1.e8451ep-10 */ +qq1 = 3.12324286e-01F, /* 0x1.3fd1f0p-2 */ +qq2 = 2.16070302e-02F, /* 0x1.620274p-6 */ +qq3 = -1.98859419e-03F, /* -0x1.04a626p-9 */ /* - * Coefficients for approximation to erfc in [1.25,1/0.35] + * Domain [0.84375, 1.25], range ~[-1.953e-11,1.940e-11]: + * |(erf(x) - erx) - p(x)/q(x)| < 2**-36. */ -ra0 = -9.8649440333e-03, /* 0xbc21a093 */ -ra1 = -6.9385856390e-01, /* 0xbf31a0b7 */ -ra2 = -1.0558626175e+01, /* 0xc128f022 */ -ra3 = -6.2375331879e+01, /* 0xc2798057 */ -ra4 = -1.6239666748e+02, /* 0xc322658c */ -ra5 = -1.8460508728e+02, /* 0xc3389ae7 */ -ra6 = -8.1287437439e+01, /* 0xc2a2932b */ -ra7 = -9.8143291473e+00, /* 0xc11d077e */ -sa1 = 1.9651271820e+01, /* 0x419d35ce */ -sa2 = 1.3765776062e+02, /* 0x4309a863 */ -sa3 = 4.3456588745e+02, /* 0x43d9486f */ -sa4 = 6.4538726807e+02, /* 0x442158c9 */ -sa5 = 4.2900814819e+02, /* 0x43d6810b */ -sa6 = 1.0863500214e+02, /* 0x42d9451f */ -sa7 = 6.5702495575e+00, /* 0x40d23f7c */ -sa8 = -6.0424413532e-02, /* 0xbd777f97 */ +erx = 8.42697144e-01F, /* 0x1.af7600p-1. erf(1) rounded to 16 bits. */ +pa0 = 3.64939137e-06F, /* 0x1.e9d022p-19 */ +pa1 = 4.15109694e-01F, /* 0x1.a91284p-2 */ +pa2 = -1.65179938e-01F, /* -0x1.5249dcp-3 */ +pa3 = 1.10914491e-01F, /* 0x1.c64e46p-4 */ +qa1 = 6.02074385e-01F, /* 0x1.344318p-1 */ +qa2 = 5.35934687e-01F, /* 0x1.126608p-1 */ +qa3 = 1.68576106e-01F, /* 0x1.593e6ep-3 */ +qa4 = 5.62181212e-02F, /* 0x1.cc89f2p-5 */ /* - * Coefficients for approximation to erfc in [1/.35,28] + * Domain [1.25,1/0.35], range ~[-7.043e-10,7.457e-10]: + * |log(x*erfc(x)) + x**2 + 0.5625 - r(x)/s(x)| < 2**-30 */ -rb0 = -9.8649431020e-03, /* 0xbc21a092 */ -rb1 = -7.9928326607e-01, /* 0xbf4c9dd4 */ -rb2 = -1.7757955551e+01, /* 0xc18e104b */ -rb3 = -1.6063638306e+02, /* 0xc320a2ea */ -rb4 = -6.3756646729e+02, /* 0xc41f6441 */ -rb5 = -1.0250950928e+03, /* 0xc480230b */ -rb6 = -4.8351919556e+02, /* 0xc3f1c275 */ -sb1 = 3.0338060379e+01, /* 0x41f2b459 */ -sb2 = 3.2579251099e+02, /* 0x43a2e571 */ -sb3 = 1.5367296143e+03, /* 0x44c01759 */ -sb4 = 3.1998581543e+03, /* 0x4547fdbb */ -sb5 = 2.5530502930e+03, /* 0x451f90ce */ -sb6 = 4.7452853394e+02, /* 0x43ed43a7 */ -sb7 = -2.2440952301e+01; /* 0xc1b38712 */ +ra0 = -9.87132732e-03F, /* -0x1.4376b2p-7 */ +ra1 = -5.53605914e-01F, /* -0x1.1b723cp-1 */ +ra2 = -2.17589188e+00F, /* -0x1.1683a0p+1 */ +ra3 = -1.43268085e+00F, /* -0x1.6ec42cp+0 */ +sa1 = 5.45995426e+00F, /* 0x1.5d6fe4p+2 */ +sa2 = 6.69798088e+00F, /* 0x1.acabb8p+2 */ +sa3 = 1.43113089e+00F, /* 0x1.6e5e98p+0 */ +sa4 = -5.77397496e-02F, /* -0x1.d90108p-5 */ +/* + * Domain [1/0.35, 11], range ~[-2.264e-13,2.336e-13]: + * |log(x*erfc(x)) + x**2 + 0.5625 - r(x)/s(x)| < 2**-42 + */ +rb0 = -9.86494310e-03F, /* -0x1.434124p-7 */ +rb1 = -6.25171244e-01F, /* -0x1.401672p-1 */ +rb2 = -6.16498327e+00F, /* -0x1.8a8f16p+2 */ +rb3 = -1.66696873e+01F, /* -0x1.0ab70ap+4 */ +rb4 = -9.53764343e+00F, /* -0x1.313460p+3 */ +sb1 = 1.26884899e+01F, /* 0x1.96081cp+3 */ +sb2 = 4.51839523e+01F, /* 0x1.6978bcp+5 */ +sb3 = 4.72810211e+01F, /* 0x1.7a3f88p+5 */ +sb4 = 8.93033314e+00F; /* 0x1.1dc54ap+3 */ float erff(float x) @@ -107,43 +91,37 @@ erff(float x) } if(ix < 0x3f580000) { /* |x|<0.84375 */ - if(ix < 0x31800000) { /* |x|<2**-28 */ - if (ix < 0x04000000) - /*avoid underflow */ - return (float)0.125*((float)8.0*x+efx8*x); + if(ix < 0x38800000) { /* |x|<2**-14 */ + if (ix < 0x04000000) /* |x|<0x1p-119 */ + return (8*x+efx8*x)/8; /* avoid spurious underflow */ return x + efx*x; } z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); + r = pp0+z*(pp1+z*pp2); + s = one+z*(qq1+z*(qq2+z*qq3)); y = r/s; return x + x*y; } if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ s = fabsf(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); + P = pa0+s*(pa1+s*(pa2+s*pa3)); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*qa4))); if(hx>=0) return erx + P/Q; else return -erx - P/Q; } - if (ix >= 0x40c00000) { /* inf>|x|>=6 */ + if (ix >= 0x40800000) { /* inf>|x|>=4 */ if(hx>=0) return one-tiny; else return tiny-one; } x = fabsf(x); s = one/(x*x); if(ix< 0x4036DB6E) { /* |x| < 1/0.35 */ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); + R=ra0+s*(ra1+s*(ra2+s*ra3)); + S=one+s*(sa1+s*(sa2+s*(sa3+s*sa4))); } else { /* |x| >= 1/0.35 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*rb4))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*sb4))); } - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(z,ix&0xfffff000); - r = __ieee754_expf(-z*z-(float)0.5625)*__ieee754_expf((z-x)*(z+x)+R/S); + SET_FLOAT_WORD(z,hx&0xffffe000); + r = expf(-z*z-0.5625F)*expf((z-x)*(z+x)+R/S); if(hx>=0) return one-r/x; else return r/x-one; } @@ -160,11 +138,11 @@ erfcf(float x) } if(ix < 0x3f580000) { /* |x|<0.84375 */ - if(ix < 0x23800000) /* |x|<2**-56 */ + if(ix < 0x33800000) /* |x|<2**-24 */ return one-x; z = x*x; - r = pp0+z*(pp1+z*(pp2+z*(pp3+z*pp4))); - s = one+z*(qq1+z*(qq2+z*(qq3+z*(qq4+z*qq5)))); + r = pp0+z*(pp1+z*pp2); + s = one+z*(qq1+z*(qq2+z*qq3)); y = r/s; if(hx < 0x3e800000) { /* x<1/4 */ return one-(x+x*y); @@ -176,33 +154,27 @@ erfcf(float x) } if(ix < 0x3fa00000) { /* 0.84375 <= |x| < 1.25 */ s = fabsf(x)-one; - P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); - Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); + P = pa0+s*(pa1+s*(pa2+s*pa3)); + Q = one+s*(qa1+s*(qa2+s*(qa3+s*qa4))); if(hx>=0) { z = one-erx; return z - P/Q; } else { z = erx+P/Q; return one+z; } } - if (ix < 0x41e00000) { /* |x|<28 */ + if (ix < 0x41300000) { /* |x|<11 */ x = fabsf(x); s = one/(x*x); if(ix< 0x4036DB6D) { /* |x| < 1/.35 ~ 2.857143*/ - R=ra0+s*(ra1+s*(ra2+s*(ra3+s*(ra4+s*( - ra5+s*(ra6+s*ra7)))))); - S=one+s*(sa1+s*(sa2+s*(sa3+s*(sa4+s*( - sa5+s*(sa6+s*(sa7+s*sa8))))))); + R=ra0+s*(ra1+s*(ra2+s*ra3)); + S=one+s*(sa1+s*(sa2+s*(sa3+s*sa4))); } else { /* |x| >= 1/.35 ~ 2.857143 */ - if(hx<0&&ix>=0x40c00000) return two-tiny;/* x < -6 */ - R=rb0+s*(rb1+s*(rb2+s*(rb3+s*(rb4+s*( - rb5+s*rb6))))); - S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( - sb5+s*(sb6+s*sb7)))))); + if(hx<0&&ix>=0x40a00000) return two-tiny;/* x < -5 */ + R=rb0+s*(rb1+s*(rb2+s*(rb3+s*rb4))); + S=one+s*(sb1+s*(sb2+s*(sb3+s*sb4))); } - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(z,ix&0xfffff000); - r = __ieee754_expf(-z*z-(float)0.5625)* - __ieee754_expf((z-x)*(z+x)+R/S); + SET_FLOAT_WORD(z,hx&0xffffe000); + r = expf(-z*z-0.5625F)*expf((z-x)*(z+x)+R/S); if(hx>0) return r/x; else return two-r/x; } else { if(hx>0) return tiny*tiny; else return two-tiny; diff --git a/libm/upstream-freebsd/lib/msun/src/s_fma.c b/libm/upstream-freebsd/lib/msun/src/s_fma.c index 452bece37..b1066c20a 100644 --- a/libm/upstream-freebsd/lib/msun/src/s_fma.c +++ b/libm/upstream-freebsd/lib/msun/src/s_fma.c @@ -117,7 +117,7 @@ add_and_denormalize(double a, double b, int scale) if (sum.lo != 0) { EXTRACT_WORD64(hibits, sum.hi); bits_lost = -((int)(hibits >> 52) & 0x7ff) - scale + 1; - if (bits_lost != 1 ^ (int)(hibits & 1)) { + if ((bits_lost != 1) ^ (int)(hibits & 1)) { /* hibits += (int)copysign(1.0, sum.hi * sum.lo) */ EXTRACT_WORD64(lobits, sum.lo); hibits += 1 - (((hibits ^ lobits) >> 62) & 2); diff --git a/libm/upstream-freebsd/lib/msun/src/s_fmal.c b/libm/upstream-freebsd/lib/msun/src/s_fmal.c index 92719010e..d435f4f45 100644 --- a/libm/upstream-freebsd/lib/msun/src/s_fmal.c +++ b/libm/upstream-freebsd/lib/msun/src/s_fmal.c @@ -113,7 +113,7 @@ add_and_denormalize(long double a, long double b, int scale) if (sum.lo != 0) { u.e = sum.hi; bits_lost = -u.bits.exp - scale + 1; - if (bits_lost != 1 ^ (int)(u.bits.manl & 1)) + if ((bits_lost != 1) ^ (int)(u.bits.manl & 1)) sum.hi = nextafterl(sum.hi, INFINITY * sum.lo); } return (ldexp(sum.hi, scale)); diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp index 638164d68..946f79eb7 100644 --- a/linker/dlfcn.cpp +++ b/linker/dlfcn.cpp @@ -146,11 +146,10 @@ int dlclose(void* handle) { } #if defined(ANDROID_ARM_LINKER) -// 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667 -// 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890 +// 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667777777777888 8888888 +// 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890123456789012 3456789 #define ANDROID_LIBDL_STRTAB \ - "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0android_update_LD_LIBRARY_PATH\0dl_unwind_find_exidx\0" - + "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0android_update_LD_LIBRARY_PATH\0dl_iterate_phdr\0dl_unwind_find_exidx\0" #elif defined(ANDROID_X86_LINKER) || defined(ANDROID_MIPS_LINKER) // 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667 // 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890 @@ -181,10 +180,9 @@ static Elf32_Sym gLibDlSymtab[] = { ELF32_SYM_INITIALIZER(21, &dlerror, 1), ELF32_SYM_INITIALIZER(29, &dladdr, 1), ELF32_SYM_INITIALIZER(36, &android_update_LD_LIBRARY_PATH, 1), -#if defined(ANDROID_ARM_LINKER) - ELF32_SYM_INITIALIZER(67, &dl_unwind_find_exidx, 1), -#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_MIPS_LINKER) ELF32_SYM_INITIALIZER(67, &dl_iterate_phdr, 1), +#if defined(ANDROID_ARM_LINKER) + ELF32_SYM_INITIALIZER(83, &dl_unwind_find_exidx, 1), #endif }; @@ -207,7 +205,11 @@ static Elf32_Sym gLibDlSymtab[] = { // Note that adding any new symbols here requires // stubbing them out in libdl. static unsigned gLibDlBuckets[1] = { 1 }; +#if defined(ANDROID_ARM_LINKER) +static unsigned gLibDlChains[9] = { 0, 2, 3, 4, 5, 6, 7, 8, 0 }; +#else static unsigned gLibDlChains[8] = { 0, 2, 3, 4, 5, 6, 7, 0 }; +#endif // This is used by the dynamic linker. Every process gets these symbols for free. soinfo libdl_info = { @@ -223,8 +225,8 @@ soinfo libdl_info = { strtab: ANDROID_LIBDL_STRTAB, symtab: gLibDlSymtab, - nbucket: 1, - nchain: 8, + nbucket: sizeof(gLibDlBuckets)/sizeof(unsigned), + nchain: sizeof(gLibDlChains)/sizeof(unsigned), bucket: gLibDlBuckets, chain: gLibDlChains, diff --git a/linker/linker.cpp b/linker/linker.cpp index 623be29f3..77ce50786 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -414,7 +414,7 @@ _Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount) return NULL; } -#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_MIPS_LINKER) +#endif /* Here, we only have to provide a callback to iterate across all the * loaded libraries. gcc_eh does the rest. */ @@ -437,8 +437,6 @@ dl_iterate_phdr(int (*cb)(dl_phdr_info *info, size_t size, void *data), return rv; } -#endif - static Elf32_Sym* soinfo_elf_lookup(soinfo* si, unsigned hash, const char* name) { Elf32_Sym* symtab = si->symtab; const char* strtab = si->strtab; @@ -1531,7 +1529,7 @@ static bool soinfo_link_image(soinfo* si) { * phdr_table_protect_segments() after all of them are applied * and all constructors are run. */ - DL_WARN("%s has text relocations. This is wasting memory and is " + DEBUG("%s has text relocations. This is wasting memory and is " "a security risk. Please fix.", si->name); if (phdr_table_unprotect_segments(si->phdr, si->phnum, si->load_bias) < 0) { DL_ERR("can't unprotect loadable segments for \"%s\": %s", diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp index 83f163c5e..74f5a1c87 100644 --- a/linker/linker_phdr.cpp +++ b/linker/linker_phdr.cpp @@ -118,7 +118,7 @@ ElfReader::ElfReader(const char* name, int fd) : name_(name), fd_(fd), phdr_num_(0), phdr_mmap_(NULL), phdr_table_(NULL), phdr_size_(0), - load_start_(NULL), load_size_(0), load_bias_(0), + load_start_(NULL), load_size_(0), load_bias_(0), required_base_(0), loaded_phdr_(NULL) { } @@ -147,7 +147,8 @@ bool ElfReader::ReadElfHeader() { return false; } if (rc != sizeof(header_)) { - DL_ERR("\"%s\" is too small to be an ELF executable", name_); + DL_ERR("\"%s\" is too small to be an ELF executable. Expected at least %d bytes, only found %d bytes.", + name_, sizeof(header_), rc); return false; } return true; @@ -277,6 +278,36 @@ size_t phdr_table_get_load_size(const Elf32_Phdr* phdr_table, return max_vaddr - min_vaddr; } +typedef struct { + long mmap_addr; + char tag[4]; /* 'P', 'R', 'E', ' ' */ +} prelink_info_t; + +/* Returns the requested base address if the library is prelinked, + * and 0 otherwise. */ +static Elf32_Addr is_prelinked(int fd, const char *name) +{ + off_t sz = lseek(fd, -sizeof(prelink_info_t), SEEK_END); + if (sz < 0) { + DL_ERR("lseek() failed!"); + return 0; + } + + prelink_info_t info; + int rc = TEMP_FAILURE_RETRY(read(fd, &info, sizeof(info))); + if (rc != sizeof(info)) { + DL_ERR("Could not read prelink_info_t structure for `%s`\n", name); + return 0; + } + + if (memcmp(info.tag, "PRE ", 4)) { + DL_ERR("`%s` is not a prelinked library\n", name); + return 0; + } + + return (unsigned long)info.mmap_addr; +} + // Reserve a virtual address range big enough to hold all loadable // segments of a program header table. This is done by creating a // private anonymous mmap() with PROT_NONE. @@ -288,8 +319,14 @@ bool ElfReader::ReserveAddressSpace() { return false; } + required_base_ = is_prelinked(fd_, name_); + uint8_t* addr = reinterpret_cast(min_vaddr); int mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS; + if (required_base_ != 0) { + mmap_flags |= MAP_FIXED; + addr = (uint8_t*) required_base_; + } void* start = mmap(addr, load_size_, PROT_NONE, mmap_flags, -1, 0); if (start == MAP_FAILED) { DL_ERR("couldn't reserve %d bytes of address space for \"%s\"", load_size_, name_); @@ -297,7 +334,7 @@ bool ElfReader::ReserveAddressSpace() { } load_start_ = start; - load_bias_ = reinterpret_cast(start) - addr; + load_bias_ = reinterpret_cast(start) - reinterpret_cast(min_vaddr); return true; } diff --git a/linker/linker_phdr.h b/linker/linker_phdr.h index 992d95e56..efd123b7b 100644 --- a/linker/linker_phdr.h +++ b/linker/linker_phdr.h @@ -48,6 +48,7 @@ class ElfReader { Elf32_Addr load_start() { return reinterpret_cast(load_start_); } Elf32_Addr load_size() { return load_size_; } Elf32_Addr load_bias() { return load_bias_; } + Elf32_Addr required_base() { return required_base_; } const Elf32_Phdr* loaded_phdr() { return loaded_phdr_; } private: @@ -75,6 +76,9 @@ class ElfReader { Elf32_Addr load_size_; // Load bias. Elf32_Addr load_bias_; + // For prelinked libraries, mandatory load address of the first + // loadable segment. 0 otherwise. + Elf32_Addr required_base_; // Loaded phdr. const Elf32_Phdr* loaded_phdr_; diff --git a/tests/Android.mk b/tests/Android.mk index 534aa3017..8aa604918 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -81,6 +81,8 @@ test_src_files = \ strings_test.cpp \ stubs_test.cpp \ sys_stat_test.cpp \ + sys_syscall_test.cpp \ + sys_time_test.cpp \ system_properties_test.cpp \ time_test.cpp \ unistd_test.cpp \ @@ -187,6 +189,25 @@ LOCAL_STATIC_LIBRARIES += bionic-unit-tests-unwind-test-impl-host include $(BUILD_HOST_NATIVE_TEST) endif +# ----------------------------------------------------------------------------- +# Unit tests run on host with bionic .so +# ----------------------------------------------------------------------------- + +# We can use the same binaries as for device, but need to do some extra setup: +# 1. We need linker as well as all library deps. +# 2. Need /system/bin writable location on host since all Android executables +# are looking for linker over there. +# 3. Need EXTERNAL_STORAGE as temporary location +# Note: tests which are testing Android specifics (e.g. properties) will fail. +ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) +linker_name=linker + +bionic-unit-tests-run-on-host: bionic-unit-tests $(linker_name) + cp $(TARGET_OUT_EXECUTABLES)/$(linker_name) /system/bin + LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) EXTERNAL_STORAGE=/tmp \ + $(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests +endif + # ----------------------------------------------------------------------------- # FORTIFY_SOURCE tests # ----------------------------------------------------------------------------- diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp index 938b8a543..fc90dd915 100644 --- a/tests/dlfcn_test.cpp +++ b/tests/dlfcn_test.cpp @@ -222,3 +222,23 @@ TEST(dlfcn, dlopen_bad_flags) { ASSERT_TRUE(handle != NULL); ASSERT_SUBSTR(NULL, dlerror()); } + +TEST(dlfcn, rtld_default_unknown_symbol) { + void* addr = dlsym(RTLD_DEFAULT, "ANY_UNKNOWN_SYMBOL_NAME"); + ASSERT_TRUE(addr == NULL); +} + +TEST(dlfcn, rtld_default_known_symbol) { + void* addr = dlsym(RTLD_DEFAULT, "fopen"); + ASSERT_TRUE(addr != NULL); +} + +TEST(dlfcn, rtld_next_unknown_symbol) { + void* addr = dlsym(RTLD_NEXT, "ANY_UNKNOWN_SYMBOL_NAME"); + ASSERT_TRUE(addr == NULL); +} + +TEST(dlfcn, rtld_next_known_symbol) { + void* addr = dlsym(RTLD_NEXT, "fopen"); + ASSERT_TRUE(addr != NULL); +} diff --git a/tests/math_benchmark.cpp b/tests/math_benchmark.cpp index a8c1cfae7..3ef2a1c5a 100644 --- a/tests/math_benchmark.cpp +++ b/tests/math_benchmark.cpp @@ -21,6 +21,8 @@ // Avoid optimization. double d; double v; +float f; +float fv; static void BM_math_sqrt(int iters) { StartBenchmarkTiming(); @@ -35,6 +37,19 @@ static void BM_math_sqrt(int iters) { } BENCHMARK(BM_math_sqrt); +static void BM_math_sqrtf(int iters) { + StartBenchmarkTiming(); + + f = 0.0; + fv = 2.0; + for (int i = 0; i < iters; ++i) { + f += sqrtf(fv); + } + + StopBenchmarkTiming(); +} +BENCHMARK(BM_math_sqrtf); + static void BM_math_log10(int iters) { StartBenchmarkTiming(); @@ -60,3 +75,56 @@ static void BM_math_logb(int iters) { StopBenchmarkTiming(); } BENCHMARK(BM_math_logb); + +static void BM_math_pow(int iters) { + StartBenchmarkTiming(); + + d = 0.0; + v = 4.0; + for (int i = 0; i < iters; ++i) { + d += pow(v,v); + } + + StopBenchmarkTiming(); +} +BENCHMARK(BM_math_pow); + +static void BM_math_sin(int iters) { + StartBenchmarkTiming(); + + d = 0.0; + v = 1234.0; + for (int i = 0; i < iters; ++i) { + d += sin(v); + } + + StopBenchmarkTiming(); +} +BENCHMARK(BM_math_sin); + +static void BM_math_cos(int iters) { + StartBenchmarkTiming(); + + d = 0.0; + v = 1234.0; + for (int i = 0; i < iters; ++i) { + d += cos(v); + } + + StopBenchmarkTiming(); +} +BENCHMARK(BM_math_cos); + +static void BM_math_modf(int iters) { + StartBenchmarkTiming(); + + d = 3.1415926535897932384626433; + v = 0.0; + for (int i = 0; i < iters; ++i) { + modf(d, &v); + } + + StopBenchmarkTiming(); +} +BENCHMARK(BM_math_modf); + diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp index d4d38f521..5551c4833 100644 --- a/tests/pthread_test.cpp +++ b/tests/pthread_test.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -278,6 +279,35 @@ TEST(pthread, pthread_detach__no_such_thread) { ASSERT_EQ(ESRCH, pthread_detach(dead_thread)); } +TEST(pthread, pthread_detach__leak) { + size_t initial_bytes = mallinfo().uordblks; + + pthread_attr_t attr; + ASSERT_EQ(0, pthread_attr_init(&attr)); + ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE)); + + std::vector threads; + for (size_t i = 0; i < 32; ++i) { + pthread_t t; + ASSERT_EQ(0, pthread_create(&t, &attr, IdFn, NULL)); + threads.push_back(t); + } + + sleep(1); + + for (size_t i = 0; i < 32; ++i) { + ASSERT_EQ(0, pthread_detach(threads[i])) << i; + } + + size_t final_bytes = mallinfo().uordblks; + + int leaked_bytes = (final_bytes - initial_bytes); + + // User code (like this test) doesn't know how large pthread_internal_t is. + // We can be pretty sure it's more than 128 bytes. + ASSERT_LT(leaked_bytes, 32 /*threads*/ * 128 /*bytes*/); +} + TEST(pthread, pthread_getcpuclockid__clock_gettime) { pthread_t t; ASSERT_EQ(0, pthread_create(&t, NULL, SleepFn, reinterpret_cast(5))); diff --git a/tests/sys_syscall_test.cpp b/tests/sys_syscall_test.cpp new file mode 100644 index 000000000..9c5e350d0 --- /dev/null +++ b/tests/sys_syscall_test.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include + +TEST(unistd, syscall) { + ASSERT_EQ(getpid(), syscall(SYS_getpid)); +} diff --git a/tests/system_properties_test.cpp b/tests/system_properties_test.cpp index 0a8cfa519..ba73c68c5 100644 --- a/tests/system_properties_test.cpp +++ b/tests/system_properties_test.cpp @@ -198,84 +198,6 @@ TEST(properties, find_nth) { ASSERT_EQ((const prop_info *)NULL, __system_property_find_nth(247)); } -static void hierarchical_test_callback(const prop_info *pi, void *cookie) { - bool (*ok)[8][8] = static_cast(cookie); - - char name[PROP_NAME_MAX]; - char value[PROP_VALUE_MAX]; - - __system_property_read(pi, name, value); - - int name_i, name_j, name_k; - int value_i, value_j, value_k; - ASSERT_EQ(3, sscanf(name, "property_%d.%d.%d", &name_i, &name_j, &name_k)); - ASSERT_EQ(3, sscanf(value, "value_%d.%d.%d", &value_i, &value_j, &value_k)); - ASSERT_EQ(name_i, value_i); - ASSERT_GE(name_i, 0); - ASSERT_LT(name_i, 8); - ASSERT_EQ(name_j, value_j); - ASSERT_GE(name_j, 0); - ASSERT_LT(name_j, 8); - ASSERT_EQ(name_k, value_k); - ASSERT_GE(name_k, 0); - ASSERT_LT(name_k, 8); - - ok[name_i][name_j][name_k] = true; -} - -TEST(properties, fill_hierarchical) { - LocalPropertyTestState pa; - ASSERT_TRUE(pa.valid); - char prop_name[PROP_NAME_MAX]; - char prop_value[PROP_VALUE_MAX]; - char prop_value_ret[PROP_VALUE_MAX]; - int ret; - - for (int i = 0; i < 8; i++) { - for (int j = 0; j < 8; j++) { - for (int k = 0; k < 8; k++) { - ret = snprintf(prop_name, PROP_NAME_MAX - 1, "property_%d.%d.%d", i, j, k); - memset(prop_name + ret, 'a', PROP_NAME_MAX - 1 - ret); - ret = snprintf(prop_value, PROP_VALUE_MAX - 1, "value_%d.%d.%d", i, j, k); - memset(prop_value + ret, 'b', PROP_VALUE_MAX - 1 - ret); - prop_name[PROP_NAME_MAX - 1] = 0; - prop_value[PROP_VALUE_MAX - 1] = 0; - - ASSERT_EQ(0, __system_property_add(prop_name, PROP_NAME_MAX - 1, prop_value, PROP_VALUE_MAX - 1)); - } - } - } - - for (int i = 0; i < 8; i++) { - for (int j = 0; j < 8; j++) { - for (int k = 0; k < 8; k++) { - ret = snprintf(prop_name, PROP_NAME_MAX - 1, "property_%d.%d.%d", i, j, k); - memset(prop_name + ret, 'a', PROP_NAME_MAX - 1 - ret); - ret = snprintf(prop_value, PROP_VALUE_MAX - 1, "value_%d.%d.%d", i, j, k); - memset(prop_value + ret, 'b', PROP_VALUE_MAX - 1 - ret); - prop_name[PROP_NAME_MAX - 1] = 0; - prop_value[PROP_VALUE_MAX - 1] = 0; - memset(prop_value_ret, '\0', PROP_VALUE_MAX); - - ASSERT_EQ(PROP_VALUE_MAX - 1, __system_property_get(prop_name, prop_value_ret)); - ASSERT_EQ(0, memcmp(prop_value, prop_value_ret, PROP_VALUE_MAX)); - } - } - } - - bool ok[8][8][8]; - memset(ok, 0, sizeof(ok)); - __system_property_foreach(hierarchical_test_callback, ok); - - for (int i = 0; i < 8; i++) { - for (int j = 0; j < 8; j++) { - for (int k = 0; k < 8; k++) { - ASSERT_TRUE(ok[i][j][k]); - } - } - } -} - TEST(properties, errors) { LocalPropertyTestState pa; ASSERT_TRUE(pa.valid);