From d9124876f07bb5f1f9d1de465aa4b93f41718efb Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Fri, 6 Sep 2013 16:25:41 +0800 Subject: [PATCH] arch-specific diff of header Change-Id: I78e2186dc7e491095201efc2c709f26e8822a076 --- .../android-3/header-patches/headers.patch | 138 ++++++++++++++++ .../include/asm-generic/fcntl.h | 138 ++++++++++++++++ .../header-patches/include/asm/div64.h | 6 + .../header-patches/include/asm/elf.h | 31 ++++ .../header-patches/include/asm/locks.h | 7 + .../header-patches/include/asm/ptrace.h | 105 ++++++++++++ .../header-patches/include/asm/sigcontext.h | 4 + .../header-patches/include/asm/uaccess.h | 37 +++++ .../android-3/header-patches/include/fenv.h | 101 ++++++++++++ .../header-patches/include/machine/endian.h | 55 +++++++ .../header-patches/include/machine/ieee.h | 151 ++++++++++++++++++ .../header-patches/include/machine/setjmp.h | 39 +++++ .../header-patches/include/sys/epoll.h | 72 +++++++++ .../header-patches/include/sys/stat.h | 110 +++++++++++++ 14 files changed, 994 insertions(+) create mode 100644 ndk/platforms/android-3/header-patches/headers.patch create mode 100644 ndk/platforms/android-3/header-patches/include/asm-generic/fcntl.h create mode 100644 ndk/platforms/android-3/header-patches/include/asm/div64.h create mode 100644 ndk/platforms/android-3/header-patches/include/asm/elf.h create mode 100644 ndk/platforms/android-3/header-patches/include/asm/locks.h create mode 100644 ndk/platforms/android-3/header-patches/include/asm/ptrace.h create mode 100644 ndk/platforms/android-3/header-patches/include/asm/sigcontext.h create mode 100644 ndk/platforms/android-3/header-patches/include/asm/uaccess.h create mode 100644 ndk/platforms/android-3/header-patches/include/fenv.h create mode 100644 ndk/platforms/android-3/header-patches/include/machine/endian.h create mode 100644 ndk/platforms/android-3/header-patches/include/machine/ieee.h create mode 100644 ndk/platforms/android-3/header-patches/include/machine/setjmp.h create mode 100644 ndk/platforms/android-3/header-patches/include/sys/epoll.h create mode 100644 ndk/platforms/android-3/header-patches/include/sys/stat.h diff --git a/ndk/platforms/android-3/header-patches/headers.patch b/ndk/platforms/android-3/header-patches/headers.patch new file mode 100644 index 000000000..56b44a410 --- /dev/null +++ b/ndk/platforms/android-3/header-patches/headers.patch @@ -0,0 +1,138 @@ +diff -Naur a/include/asm/a.out.h b/include/asm/a.out.h +--- a/include/asm/a.out.h 2013-06-10 08:16:13.496310000 +0800 ++++ b/include/asm/a.out.h 2013-09-06 14:13:28.366275000 +0800 +@@ -33,7 +33,7 @@ + #define N_DRSIZE(a) ((a).a_drsize) + #define N_SYMSIZE(a) ((a).a_syms) + +-#define M_MACHINE 103 ++#define M_ARM 103 + + #ifndef LIBRARY_START_TEXT + #define LIBRARY_START_TEXT (0x00c00000) +diff -Naur a/include/asm/byteorder.h b/include/asm/byteorder.h +--- a/include/asm/byteorder.h 2013-09-03 12:33:37.353419000 +0800 ++++ b/include/asm/byteorder.h 2013-08-30 17:41:09.234265000 +0800 +@@ -19,12 +19,6 @@ + { + __u32 t; + +-#ifndef __thumb__ +- if (!__builtin_constant_p(x)) { +- +- __asm__ ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x)); +- } else +-#endif + t = x ^ ((x << 16) | (x >> 16)); + + x = (x << 24) | (x >> 8); +diff -Naur a/include/asm/stat.h b/include/asm/stat.h +--- a/include/asm/stat.h 2013-09-03 12:33:37.367418000 +0800 ++++ b/include/asm/stat.h 2013-08-30 17:41:09.431302000 +0800 +@@ -29,23 +29,13 @@ + #define STAT_HAVE_NSEC + + struct stat { +-#ifdef __ARMEB__ +- unsigned short st_dev; +- unsigned short __pad1; +-#else + unsigned long st_dev; +-#endif + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; +-#ifdef __ARMEB__ +- unsigned short st_rdev; +- unsigned short __pad2; +-#else + unsigned long st_rdev; +-#endif + unsigned long st_size; + unsigned long st_blksize; + unsigned long st_blocks; +diff -Naur a/include/asm/types.h b/include/asm/types.h +--- a/include/asm/types.h 2013-09-03 12:33:37.313428000 +0800 ++++ b/include/asm/types.h 2013-08-30 17:41:09.467274000 +0800 +@@ -25,7 +25,7 @@ + typedef __signed__ int __s32; + typedef unsigned int __u32; + +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__STRICT_ANSI__) + typedef __signed__ long long __s64; + typedef unsigned long long __u64; + #endif +diff -Naur a/include/asm/unaligned.h b/include/asm/unaligned.h +--- a/include/asm/unaligned.h 2013-09-03 12:33:37.376422000 +0800 ++++ b/include/asm/unaligned.h 2013-08-30 17:41:09.500316000 +0800 +@@ -28,11 +28,6 @@ + + #define __put_unaligned_le(val,ptr) ({ switch (sizeof(*(ptr))) { case 1: *(ptr) = (val); break; case 2: __put_unaligned_2_le((val),(__u8 *)(ptr)); break; case 4: __put_unaligned_4_le((val),(__u8 *)(ptr)); break; case 8: __put_unaligned_8_le((val),(__u8 *)(ptr)); break; default: __bug_unaligned_x(ptr); break; } (void) 0; }) + #define __put_unaligned_be(val,ptr) ({ switch (sizeof(*(ptr))) { case 1: *(ptr) = (val); break; case 2: __put_unaligned_2_be((val),(__u8 *)(ptr)); break; case 4: __put_unaligned_4_be((val),(__u8 *)(ptr)); break; case 8: __put_unaligned_8_be((val),(__u8 *)(ptr)); break; default: __bug_unaligned_x(ptr); break; } (void) 0; }) +-#ifndef __ARMEB__ + #define get_unaligned __get_unaligned_le + #define put_unaligned __put_unaligned_le +-#else +-#define get_unaligned __get_unaligned_be +-#define put_unaligned __put_unaligned_be +-#endif + #endif +diff -Naur a/include/asm/unistd.h b/include/asm/unistd.h +--- a/include/asm/unistd.h 2013-09-03 12:33:37.322427000 +0800 ++++ b/include/asm/unistd.h 2013-08-30 17:41:09.506276000 +0800 +@@ -19,12 +19,7 @@ + #ifndef __ASM_MACHINE_UNISTD_H + #define __ASM_MACHINE_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) +diff -Naur a/include/asm/user.h b/include/asm/user.h +--- a/include/asm/user.h 2013-09-03 12:33:37.118421000 +0800 ++++ b/include/asm/user.h 2013-08-30 17:41:09.519301000 +0800 +@@ -58,15 +58,4 @@ + #define HOST_TEXT_START_ADDR (u.start_code) + #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + +-struct user_vfp { +- unsigned long long fpregs[32]; +- unsigned long fpscr; +-}; +- +-struct user_vfp_exc { +- unsigned long fpexc; +- unsigned long fpinst; +- unsigned long fpinst2; +-}; +- + #endif +diff -Naur a/include/machine/asm.h b/include/machine/asm.h +--- a/include/machine/asm.h 2013-09-03 12:33:37.135419000 +0800 ++++ b/include/machine/asm.h 2013-08-30 17:41:09.533294000 +0800 +@@ -78,17 +78,7 @@ + .fnend; \ + _ASM_SIZE(x) + +-#ifdef GPROF +-# ifdef __ELF__ +-# define _PROF_PROLOGUE \ +- mov ip, lr; bl __mcount +-# else +-# define _PROF_PROLOGUE \ +- mov ip,lr; bl mcount +-# endif +-#else + # define _PROF_PROLOGUE +-#endif + + #define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE + #define ENTRY_NP(y) _ENTRY(_C_LABEL(y)) diff --git a/ndk/platforms/android-3/header-patches/include/asm-generic/fcntl.h b/ndk/platforms/android-3/header-patches/include/asm-generic/fcntl.h new file mode 100644 index 000000000..83c58e615 --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/asm-generic/fcntl.h @@ -0,0 +1,138 @@ +#ifndef _ASM_GENERIC_FCNTL_H +#define _ASM_GENERIC_FCNTL_H + +#include + +#define O_ACCMODE 00000003 +#define O_RDONLY 00000000 +#define O_WRONLY 00000001 +#define O_RDWR 00000002 +#ifndef O_CREAT +#define O_CREAT 00000100 +#endif +#ifndef O_EXCL +#define O_EXCL 00000200 +#endif +#ifndef O_NOCTTY +#define O_NOCTTY 00000400 +#endif +#ifndef O_TRUNC +#define O_TRUNC 00001000 +#endif +#ifndef O_APPEND +#define O_APPEND 00002000 +#endif +#ifndef O_NONBLOCK +#define O_NONBLOCK 00004000 +#endif +#ifndef O_SYNC +#define O_SYNC 00010000 +#endif +#ifndef FASYNC +#define FASYNC 00020000 +#endif +#ifndef O_DIRECT +#define O_DIRECT 00040000 +#endif +#ifndef O_LARGEFILE +#define O_LARGEFILE 00100000 +#endif +#ifndef O_DIRECTORY +#define O_DIRECTORY 00200000 +#endif +#ifndef O_NOFOLLOW +#define O_NOFOLLOW 00400000 +#endif +#ifndef O_NOATIME +#define O_NOATIME 01000000 +#endif +#ifndef O_NDELAY +#define O_NDELAY O_NONBLOCK +#endif + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 +#ifndef F_GETLK +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 +#endif +#ifndef F_SETOWN +#define F_SETOWN 8 +#define F_GETOWN 9 +#endif +#ifndef F_SETSIG +#define F_SETSIG 10 +#define F_GETSIG 11 +#endif + +#define FD_CLOEXEC 1 + +#ifndef F_RDLCK +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 +#endif + +#ifndef F_EXLCK +#define F_EXLCK 4 +#define F_SHLCK 8 +#endif + +#ifndef F_INPROGRESS +#define F_INPROGRESS 16 +#endif + +#define LOCK_SH 1 +#define LOCK_EX 2 +#define LOCK_NB 4 +#define LOCK_UN 8 + +#define LOCK_MAND 32 +#define LOCK_READ 64 +#define LOCK_WRITE 128 +#define LOCK_RW 192 + +#define F_LINUX_SPECIFIC_BASE 1024 + +#ifndef HAVE_ARCH_STRUCT_FLOCK +#ifndef __ARCH_FLOCK_PAD +#define __ARCH_FLOCK_PAD +#endif + +struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + pid_t l_pid; + __ARCH_FLOCK_PAD +}; +#endif + +#ifndef F_GETLK64 +#define F_GETLK64 12 +#define F_SETLK64 13 +#define F_SETLKW64 14 +#endif + +#ifndef HAVE_ARCH_STRUCT_FLOCK64 +#ifndef __ARCH_FLOCK64_PAD +#define __ARCH_FLOCK64_PAD +#endif + +struct flock64 { + short l_type; + short l_whence; + unsigned char __padding[4]; + loff_t l_start; + loff_t l_len; + pid_t l_pid; + __ARCH_FLOCK64_PAD +}; + +#endif +#endif diff --git a/ndk/platforms/android-3/header-patches/include/asm/div64.h b/ndk/platforms/android-3/header-patches/include/asm/div64.h new file mode 100644 index 000000000..cde72748b --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/asm/div64.h @@ -0,0 +1,6 @@ +#ifndef __ASM_DIV64_H +#define __ASM_DIV64_H + +#include + +#endif diff --git a/ndk/platforms/android-3/header-patches/include/asm/elf.h b/ndk/platforms/android-3/header-patches/include/asm/elf.h new file mode 100644 index 000000000..cec933801 --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/asm/elf.h @@ -0,0 +1,31 @@ +#ifndef __ASM_ELF_H +#define __ASM_ELF_H + +#include +#include + +typedef unsigned long elf_greg_t; +typedef unsigned long elf_freg_t[3]; + + +#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef struct user_fp elf_fpregset_t; + +#define ELF_CLASS ELFCLASS32 +#define ELF_DATA ELFDATA2LSB + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) + + +#define ELF_HWCAP (elf_hwcap) + +#define ELF_PLATFORM_SIZE 8 + +#define ELF_PLATFORM (elf_platform) + +#endif diff --git a/ndk/platforms/android-3/header-patches/include/asm/locks.h b/ndk/platforms/android-3/header-patches/include/asm/locks.h new file mode 100644 index 000000000..446360330 --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/asm/locks.h @@ -0,0 +1,7 @@ +#ifndef __ASM_PROC_LOCKS_H +#define __ASM_PROC_LOCKS_H + +#define RW_LOCK_BIAS 0x01000000 +#define RW_LOCK_BIAS_STR "0x01000000" + +#endif diff --git a/ndk/platforms/android-3/header-patches/include/asm/ptrace.h b/ndk/platforms/android-3/header-patches/include/asm/ptrace.h new file mode 100644 index 000000000..a0877cfc6 --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/asm/ptrace.h @@ -0,0 +1,105 @@ +#ifndef __ASM_PTRACE_H +#define __ASM_PTRACE_H + +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 + +#define PTRACE_GETWMMXREGS 18 +#define PTRACE_SETWMMXREGS 19 + +#define PTRACE_OLDSETOPTIONS 21 + +#define PTRACE_GET_THREAD_AREA 22 + +#define PTRACE_SET_SYSCALL 23 + +#define PTRACE_GETCRUNCHREGS 25 +#define PTRACE_SETCRUNCHREGS 26 + +#define USR26_MODE 0x00000000 +#define FIQ26_MODE 0x00000001 +#define IRQ26_MODE 0x00000002 +#define SVC26_MODE 0x00000003 +#define USR_MODE 0x00000010 +#define FIQ_MODE 0x00000011 +#define IRQ_MODE 0x00000012 +#define SVC_MODE 0x00000013 +#define ABT_MODE 0x00000017 +#define UND_MODE 0x0000001b +#define SYSTEM_MODE 0x0000001f +#define MODE32_BIT 0x00000010 +#define MODE_MASK 0x0000001f +#define PSR_T_BIT 0x00000020 +#define PSR_F_BIT 0x00000040 +#define PSR_I_BIT 0x00000080 +#define PSR_J_BIT 0x01000000 +#define PSR_Q_BIT 0x08000000 +#define PSR_V_BIT 0x10000000 +#define PSR_C_BIT 0x20000000 +#define PSR_Z_BIT 0x40000000 +#define PSR_N_BIT 0x80000000 +#define PCMASK 0 + +#define PSR_f 0xff000000 +#define PSR_s 0x00ff0000 +#define PSR_x 0x0000ff00 +#define PSR_c 0x000000ff + +#ifndef __ASSEMBLY__ + +struct pt_regs { + long uregs[44]; // Increase array size for ARM/x86/MIPS compatibility +}; + +#define ARM_cpsr uregs[16] +#define ARM_pc uregs[15] +#define ARM_lr uregs[14] +#define ARM_sp uregs[13] +#define ARM_ip uregs[12] +#define ARM_fp uregs[11] +#define ARM_r10 uregs[10] +#define ARM_r9 uregs[9] +#define ARM_r8 uregs[8] +#define ARM_r7 uregs[7] +#define ARM_r6 uregs[6] +#define ARM_r5 uregs[5] +#define ARM_r4 uregs[4] +#define ARM_r3 uregs[3] +#define ARM_r2 uregs[2] +#define ARM_r1 uregs[1] +#define ARM_r0 uregs[0] +#define ARM_ORIG_r0 uregs[17] + +#define x86_r15 uregs[0] +#define x86_r14 uregs[1] +#define x86_r13 uregs[2] +#define x86_r12 uregs[3] +#define x86_rbp uregs[4] +#define x86_rbx uregs[5] +#define x86_r11 uregs[6] +#define x86_r10 uregs[7] +#define x86_r9 uregs[8] +#define x86_r8 uregs[9] +#define x86_rax uregs[10] +#define x86_rcx uregs[11] +#define x86_rdx uregs[12] +#define x86_rsi uregs[13] +#define x86_rdi uregs[14] +#define x86_orig_rax uregs[15] +#define x86_rip uregs[16] +#define x86_cs uregs[17] +#define x86_eflags uregs[18] +#define x86_rsp uregs[19] +#define x86_ss uregs[20] + +#define pc_pointer(v) ((v) & ~PCMASK) + +#define instruction_pointer(regs) (pc_pointer((regs)->ARM_pc)) + +#define profile_pc(regs) instruction_pointer(regs) + +#endif + +#endif diff --git a/ndk/platforms/android-3/header-patches/include/asm/sigcontext.h b/ndk/platforms/android-3/header-patches/include/asm/sigcontext.h new file mode 100644 index 000000000..ebbcafab9 --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/asm/sigcontext.h @@ -0,0 +1,4 @@ +#ifndef _ASM_SIGCONTEXT_H +#define _ASM_SIGCONTEXT_H + +#endif diff --git a/ndk/platforms/android-3/header-patches/include/asm/uaccess.h b/ndk/platforms/android-3/header-patches/include/asm/uaccess.h new file mode 100644 index 000000000..ace935e9e --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/asm/uaccess.h @@ -0,0 +1,37 @@ +#ifndef _ASM_UACCESS_H +#define _ASM_UACCESS_H + +#include +#include +#include +#include + +#define VERIFY_READ 0 +#define VERIFY_WRITE 1 + +struct exception_table_entry +{ + unsigned long insn, fixup; +}; + +#define KERNEL_DS 0x00000000 +#define get_ds() (KERNEL_DS) + +#define USER_DS KERNEL_DS + +#define segment_eq(a,b) (1) +#define __addr_ok(addr) (1) +#define __range_ok(addr,size) (0) +#define get_fs() (KERNEL_DS) + +#define get_user(x,p) +#define put_user(x,p) +#define access_ok(type,addr,size) (__range_ok(addr,size) == 0) +#define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0) +#define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0) +#define __clear_user(addr,n) (memset((void __force *)addr, 0, n), 0) + +#define __copy_to_user_inatomic __copy_to_user +#define __copy_from_user_inatomic __copy_from_user +#define strlen_user(s) strnlen_user(s, ~0UL >> 1) +#endif diff --git a/ndk/platforms/android-3/header-patches/include/fenv.h b/ndk/platforms/android-3/header-patches/include/fenv.h new file mode 100644 index 000000000..2ee530d09 --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/fenv.h @@ -0,0 +1,101 @@ +/*- + * Copyright (c) 2004-2005 David Schultz + * 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: src/lib/msun/arm/fenv.h,v 1.5 2005/03/16 19:03:45 das Exp $ + */ + +/* + * Rewritten for Android. + * + * The ARM FPSCR is described here: + * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0344b/Chdfafia.html + */ + +#ifndef _FENV_H_ +#define _FENV_H_ + +#include + +__BEGIN_DECLS + +/* + * arm/mips definition + */ +typedef __uint32_t fenv_t; +typedef __uint32_t fexcept_t; + +/* + * x86 definition + */ +/* +typedef struct { + __uint16_t __control; + __uint16_t __mxcsr_hi; + __uint16_t __status; + __uint16_t __mxcsr_lo; + __uint32_t __tag; + char __other[16]; +} fenv_t; +*/ + + +/* Exception flags. */ +#define FE_INVALID 0x01 +#define FE_DIVBYZERO 0x02 +#define FE_OVERFLOW 0x04 +#define FE_UNDERFLOW 0x08 +#define FE_INEXACT 0x10 +#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW) + +/* Rounding modes. */ +#define FE_TONEAREST 0x0 +#define FE_UPWARD 0x1 +#define FE_DOWNWARD 0x2 +#define FE_TOWARDZERO 0x3 + +/* Default floating-point environment. */ +extern const fenv_t __fe_dfl_env; +#define FE_DFL_ENV (&__fe_dfl_env) + +/* + * Need implementations in libportable to enable following functions + * + * int fegetenv(fenv_t* __envp); + * int fesetenv(const fenv_t* __envp); + * int feholdexcept(fenv_t* __envp); + * int feupdateenv(const fenv_t* __envp); + */ + +int feclearexcept(int __excepts); +int fegetexceptflag(fexcept_t* __flagp, int __excepts); +int fesetexceptflag(const fexcept_t* __flagp, int __excepts); +int feraiseexcept(int __excepts); +int fetestexcept(int __excepts); +int fegetround(void); +int fesetround(int __round); + +__END_DECLS + +#endif /* !_FENV_H_ */ diff --git a/ndk/platforms/android-3/header-patches/include/machine/endian.h b/ndk/platforms/android-3/header-patches/include/machine/endian.h new file mode 100644 index 000000000..5f693579a --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/machine/endian.h @@ -0,0 +1,55 @@ +/* $OpenBSD: endian.h,v 1.3 2005/12/13 00:35:23 millert Exp $ */ + +/* + * 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. + */ + +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +#ifdef __GNUC__ + +/* + * Implement below swap{16,32,64}md functions in libportable + * that are optimized for your architecture. + * + * uint16_t __swap16md(uint16_t x); + * uint32_t __swap32md(uint32_t x); + * uint64_t __swap64md(uint64_t x); + */ + +/* Tell sys/endian.h we have MD variants of the swap macros. + * #define MD_SWAP + */ +#endif /* __GNUC__ */ + +#define _BYTE_ORDER _LITTLE_ENDIAN +#define __STRICT_ALIGNMENT +#include +#include + +#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/ndk/platforms/android-3/header-patches/include/machine/ieee.h b/ndk/platforms/android-3/header-patches/include/machine/ieee.h new file mode 100644 index 000000000..823f5efa9 --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/machine/ieee.h @@ -0,0 +1,151 @@ +/* $OpenBSD: ieee.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */ +/* $NetBSD: ieee.h,v 1.2 2001/02/21 17:43:50 bjh21 Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. 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. + * + * @(#)ieee.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * ieee.h defines the machine-dependent layout of the machine's IEEE + * floating point. + */ + +/* + * Define the number of bits in each fraction and exponent. + * + * k k+1 + * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented + * + * (-exp_bias+1) + * as fractions that look like 0.fffff x 2 . This means that + * + * -126 + * the number 0.10000 x 2 , for instance, is the same as the normalized + * + * -127 -128 + * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero + * + * -129 + * in the fraction; to represent 2 , we need two, and so on. This + * + * (-exp_bias-fracbits+1) + * implies that the smallest denormalized number is 2 + * + * for whichever format we are talking about: for single precision, for + * + * -126 -149 + * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and + * + * -149 == -127 - 23 + 1. + */ + +/* + * The ARM has two sets of FP data formats. The FPA supports 32-bit, 64-bit + * and 96-bit IEEE formats, with the words in big-endian order. VFP supports + * 32-bin and 64-bit IEEE formats with the words in the CPU's native byte + * order. + * + * The FPA also has two packed decimal formats, but we ignore them here. + */ + +#define SNG_EXPBITS 8 +#define SNG_FRACBITS 23 + +#define DBL_EXPBITS 11 +#define DBL_FRACBITS 52 + +#define EXT_EXPBITS 15 +#define EXT_FRACBITS 112 + +struct ieee_single { + u_int sng_frac:23; + u_int sng_exp:8; + u_int sng_sign:1; +}; + +struct ieee_double { + u_int dbl_fracl; + u_int dbl_frach:20; + u_int dbl_exp:11; + u_int dbl_sign:1; +}; + +union ieee_double_u { + double dblu_d; + struct ieee_double dblu_dbl; +}; + +struct ieee_ext { + u_int ext_frach:16; + u_int ext_exp:15; + u_int ext_sign:1; + u_int ext_frachm; + u_int ext_fraclm; + u_int ext_fracl; +}; + +/* + * Floats whose exponent is in [1..INFNAN) (of whatever type) are + * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. + * Floats whose exponent is zero are either zero (iff all fraction + * bits are zero) or subnormal values. + * + * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its + * high fraction; if the bit is set, it is a `quiet NaN'. + */ +#define SNG_EXP_INFNAN 255 +#define DBL_EXP_INFNAN 2047 +#define EXT_EXP_INFNAN 32767 + +#if 0 +#define SNG_QUIETNAN (1 << 22) +#define DBL_QUIETNAN (1 << 19) +#define EXT_QUIETNAN (1 << 15) +#endif + +/* + * Exponent biases. + */ +#define SNG_EXP_BIAS 127 +#define DBL_EXP_BIAS 1023 +#define EXT_EXP_BIAS 16383 diff --git a/ndk/platforms/android-3/header-patches/include/machine/setjmp.h b/ndk/platforms/android-3/header-patches/include/machine/setjmp.h new file mode 100644 index 000000000..d7b792e23 --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/machine/setjmp.h @@ -0,0 +1,39 @@ +/* + * 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. + */ + +/* + * machine/setjmp.h: machine dependent setjmp-related information. + */ + +/* _JBLEN is the size of a jmp_buf in longs. + * Do not modify this value or you will break the ABI ! + * + * This value comes from the mips machine/setjmp.h header + * because it has the biggest jump buffer length. + */ +#define _JBLEN 157 diff --git a/ndk/platforms/android-3/header-patches/include/sys/epoll.h b/ndk/platforms/android-3/header-patches/include/sys/epoll.h new file mode 100644 index 000000000..c6b08821b --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/sys/epoll.h @@ -0,0 +1,72 @@ +/* + * 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. + */ +#ifndef _SYS_EPOLL_H_ +#define _SYS_EPOLL_H_ + +#include + +__BEGIN_DECLS + +#define EPOLLIN 0x00000001 +#define EPOLLPRI 0x00000002 +#define EPOLLOUT 0x00000004 +#define EPOLLERR 0x00000008 +#define EPOLLHUP 0x00000010 +#define EPOLLRDNORM 0x00000040 +#define EPOLLRDBAND 0x00000080 +#define EPOLLWRNORM 0x00000100 +#define EPOLLWRBAND 0x00000200 +#define EPOLLMSG 0x00000400 +#define EPOLLET 0x80000000 + +#define EPOLL_CTL_ADD 1 +#define EPOLL_CTL_DEL 2 +#define EPOLL_CTL_MOD 3 + +typedef union epoll_data +{ + void *ptr; + int fd; + unsigned int u32; + unsigned long long u64; +} epoll_data_t; + +struct epoll_event +{ + unsigned int events; + unsigned char __padding[4]; + epoll_data_t data; +}; + +int epoll_create(int size); +int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event); +int epoll_wait(int epfd, struct epoll_event *events, int max, int timeout); + +__END_DECLS + +#endif /* _SYS_EPOLL_H_ */ diff --git a/ndk/platforms/android-3/header-patches/include/sys/stat.h b/ndk/platforms/android-3/header-patches/include/sys/stat.h new file mode 100644 index 000000000..0a9af5bbd --- /dev/null +++ b/ndk/platforms/android-3/header-patches/include/sys/stat.h @@ -0,0 +1,110 @@ +/* + * 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. + */ +#ifndef _SYS_STAT_H_ +#define _SYS_STAT_H_ + +#include +#include +#include +#include + +#include + +__BEGIN_DECLS + +/* really matches stat64 in the kernel, hence the padding + * Note: The kernel zero's the padded region because glibc might read them + * in the hope that the kernel has stretched to using larger sizes. + */ +struct stat { + unsigned long long st_dev; + unsigned char __pad0[4]; + + unsigned long __st_ino; + unsigned int st_mode; + unsigned int st_nlink; + + unsigned long st_uid; + unsigned long st_gid; + + unsigned long long st_rdev; + unsigned char __pad3[4]; + + unsigned char __pad4[4]; + long long st_size; + unsigned long st_blksize; + unsigned char __pad5[4]; + unsigned long long st_blocks; + + unsigned long st_atime; + unsigned long st_atime_nsec; + + unsigned long st_mtime; + unsigned long st_mtime_nsec; + + unsigned long st_ctime; + unsigned long st_ctime_nsec; + + unsigned long long st_ino; +}; + +/* For compatibility with GLibc, we provide macro aliases + * for the non-Posix nano-seconds accessors. + */ +#define st_atimensec st_atime_nsec +#define st_mtimensec st_mtime_nsec +#define st_ctimensec st_ctime_nsec + +extern int chmod(const char *, mode_t); +extern int fchmod(int, mode_t); +extern int mkdir(const char *, mode_t); + +extern int stat(const char *, struct stat *); +extern int fstat(int, struct stat *); +extern int lstat(const char *, struct stat *); +extern int mknod(const char *, mode_t, dev_t); +extern mode_t umask(mode_t); + +#define stat64 stat +#define fstat64 fstat +#define lstat64 lstat + +static __inline__ int mkfifo(const char *__p, mode_t __m) +{ + return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0); +} + +extern int fstatat(int dirfd, const char *path, struct stat *buf, int flags); +extern int mkdirat(int dirfd, const char *pathname, mode_t mode); +extern int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags); +extern int fchmodat(int dirfd, const char *path, mode_t mode, int flags); +extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath); + +__END_DECLS + +#endif /* _SYS_STAT_H_ */