merge in jb-release history after reset to master
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 14b990d..a9bd4fd 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -160,6 +160,7 @@
int rename(const char *, const char *) 38
int __getcwd:getcwd(char * buf, size_t size) 183
int access(const char *, int) 33
+int faccessat(int, const char *, int, int) 334,307
int symlink(const char *, const char *) 83
int fchdir(int) 133
int truncate(const char*, off_t) 92
diff --git a/libc/arch-arm/bionic/crtbegin_dynamic.S b/libc/arch-arm/bionic/crtbegin_dynamic.S
index 6ca0845..ec6d482 100644
--- a/libc/arch-arm/bionic/crtbegin_dynamic.S
+++ b/libc/arch-arm/bionic/crtbegin_dynamic.S
@@ -53,7 +53,9 @@
ldr r2, =main
adr r3, 1f
ldr r4, =__libc_init
- bx r4
+ blx r4
+ mov r0, #0
+ bx r0
1: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__
diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk
index 61a37d5..e635e68 100644
--- a/libc/arch-arm/syscalls.mk
+++ b/libc/arch-arm/syscalls.mk
@@ -108,6 +108,7 @@
syscall_src += arch-arm/syscalls/rename.S
syscall_src += arch-arm/syscalls/__getcwd.S
syscall_src += arch-arm/syscalls/access.S
+syscall_src += arch-arm/syscalls/faccessat.S
syscall_src += arch-arm/syscalls/symlink.S
syscall_src += arch-arm/syscalls/fchdir.S
syscall_src += arch-arm/syscalls/truncate.S
diff --git a/libc/arch-arm/syscalls/faccessat.S b/libc/arch-arm/syscalls/faccessat.S
new file mode 100644
index 0000000..a2f176f
--- /dev/null
+++ b/libc/arch-arm/syscalls/faccessat.S
@@ -0,0 +1,14 @@
+/* autogenerated by gensyscalls.py */
+#include <machine/asm.h>
+#include <sys/linux-syscalls.h>
+
+ENTRY(faccessat)
+ .save {r4, r7}
+ stmfd sp!, {r4, r7}
+ ldr r7, =__NR_faccessat
+ swi #0
+ ldmfd sp!, {r4, r7}
+ movs r0, r0
+ bxpl lr
+ b __set_syscall_errno
+END(faccessat)
diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk
index d7362f2..f1b7e76 100644
--- a/libc/arch-x86/syscalls.mk
+++ b/libc/arch-x86/syscalls.mk
@@ -112,6 +112,7 @@
syscall_src += arch-x86/syscalls/rename.S
syscall_src += arch-x86/syscalls/__getcwd.S
syscall_src += arch-x86/syscalls/access.S
+syscall_src += arch-x86/syscalls/faccessat.S
syscall_src += arch-x86/syscalls/symlink.S
syscall_src += arch-x86/syscalls/fchdir.S
syscall_src += arch-x86/syscalls/truncate.S
diff --git a/libc/arch-x86/syscalls/faccessat.S b/libc/arch-x86/syscalls/faccessat.S
new file mode 100644
index 0000000..2010e57
--- /dev/null
+++ b/libc/arch-x86/syscalls/faccessat.S
@@ -0,0 +1,32 @@
+/* autogenerated by gensyscalls.py */
+#include <sys/linux-syscalls.h>
+
+ .text
+ .type faccessat, @function
+ .globl faccessat
+ .align 4
+
+faccessat:
+ pushl %ebx
+ pushl %ecx
+ pushl %edx
+ pushl %esi
+ mov 20(%esp), %ebx
+ mov 24(%esp), %ecx
+ mov 28(%esp), %edx
+ mov 32(%esp), %esi
+ movl $__NR_faccessat, %eax
+ int $0x80
+ cmpl $-129, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %esi
+ popl %edx
+ popl %ecx
+ popl %ebx
+ ret
diff --git a/libc/bionic/libc_init_common.c b/libc/bionic/libc_init_common.c
index b6a6379..7fb1246 100644
--- a/libc/bionic/libc_init_common.c
+++ b/libc/bionic/libc_init_common.c
@@ -52,12 +52,19 @@
int __system_properties_init(void);
-void __libc_init_common(uintptr_t *elfdata)
+/* Init TLS for the initial thread. Called by the linker _before_ libc is mapped
+ * in memory. Beware: all writes to libc globals from this function will
+ * apply to linker-private copies and will not be visible from libc later on.
+ *
+ * Note: this function creates a pthread_internal_t for the initial thread and
+ * stores the pointer in TLS, but does not add it to pthread's gThreadList. This
+ * has to be done later from libc itself (see __libc_init_common).
+ *
+ * This function also stores elfdata argument in a specific TLS slot to be later
+ * picked up by the libc constructor.
+ */
+void __libc_init_tls(unsigned** elfdata)
{
- int argc = *elfdata;
- char** argv = (char**)(elfdata + 1);
- char** envp = argv + argc + 1;
-
pthread_attr_t thread_attr;
static pthread_internal_t thread;
static void* tls_area[BIONIC_TLS_SLOTS];
@@ -72,7 +79,19 @@
_init_thread(&thread, gettid(), &thread_attr, (void*)stackbottom);
__init_tls(tls_area, &thread);
- /* clear errno - requires TLS area */
+ tls_area[TLS_SLOT_BIONIC_PREINIT] = elfdata;
+}
+
+void __libc_init_common(uintptr_t *elfdata)
+{
+ int argc = *elfdata;
+ char** argv = (char**)(elfdata + 1);
+ char** envp = argv + argc + 1;
+
+ /* get the initial thread from TLS and add it to gThreadList */
+ _pthread_internal_add(__get_thread());
+
+ /* clear errno */
errno = 0;
/* set program name */
diff --git a/libc/bionic/libc_init_static.c b/libc/bionic/libc_init_static.c
index a2c11a9..f97961d 100644
--- a/libc/bionic/libc_init_static.c
+++ b/libc/bionic/libc_init_static.c
@@ -65,6 +65,11 @@
int argc;
char **argv, **envp;
+ __libc_init_tls(NULL);
+
+ /* get the initial thread from TLS and add it to gThreadList */
+ _pthread_internal_add(__get_thread());
+
/* Initialize the C runtime environment */
__libc_init_common(elfdata);
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index fdfe508..5cad167 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -145,7 +145,7 @@
pthread_mutex_unlock(&gThreadListLock);
}
-static void
+__LIBC_ABI_PRIVATE__ void
_pthread_internal_add( pthread_internal_t* thread )
{
pthread_mutex_lock(&gThreadListLock);
@@ -157,7 +157,7 @@
pthread_mutex_unlock(&gThreadListLock);
}
-pthread_internal_t*
+__LIBC_ABI_PRIVATE__ pthread_internal_t*
__get_thread(void)
{
void** tls = (void**)__get_tls();
@@ -217,6 +217,7 @@
pthread_exit( (void*)func(arg) );
}
+__LIBC_ABI_PRIVATE__
void _init_thread(pthread_internal_t * thread, pid_t kernel_id, pthread_attr_t * attr, void * stack_base)
{
if (attr == NULL) {
@@ -238,8 +239,6 @@
thread->join_count = 0;
thread->cleanup_stack = NULL;
-
- _pthread_internal_add(thread);
}
@@ -371,6 +370,8 @@
_init_thread(thread, tid, (pthread_attr_t*)attr, stack);
+ _pthread_internal_add(thread);
+
if (!madestack)
thread->attr.flags |= PTHREAD_ATTR_FLAG_USER_STACK;
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 655b8f3..268cacf 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -47,6 +47,8 @@
} pthread_internal_t;
extern void _init_thread(pthread_internal_t * thread, pid_t kernel_id, pthread_attr_t * attr, void * stack_base);
+void _pthread_internal_add( pthread_internal_t* thread );
+pthread_internal_t* __get_thread(void);
/* needed by posix-timers.c */
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index c2c609d..d09e955 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -166,6 +166,7 @@
#define __NR_fchmodat (__NR_SYSCALL_BASE + 333)
#define __NR_renameat (__NR_SYSCALL_BASE + 329)
#define __NR_unlinkat (__NR_SYSCALL_BASE + 328)
+#define __NR_faccessat (__NR_SYSCALL_BASE + 334)
#define __NR_statfs64 (__NR_SYSCALL_BASE + 266)
#define __NR_clock_gettime (__NR_SYSCALL_BASE + 263)
#define __NR_clock_settime (__NR_SYSCALL_BASE + 262)
@@ -227,6 +228,7 @@
#define __NR_fchmodat (__NR_SYSCALL_BASE + 306)
#define __NR_renameat (__NR_SYSCALL_BASE + 302)
#define __NR_unlinkat (__NR_SYSCALL_BASE + 301)
+#define __NR_faccessat (__NR_SYSCALL_BASE + 307)
#define __NR_statfs64 (__NR_SYSCALL_BASE + 268)
#define __NR_clock_gettime (__NR_SYSCALL_BASE + 265)
#define __NR_clock_settime (__NR_SYSCALL_BASE + 264)
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index d92549f..d8263fe 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -107,6 +107,7 @@
#define F_OK 0 /* Existence */
extern int access(const char *, int);
+extern int faccessat(int, const char *, int, int);
extern int link(const char *, const char *);
extern int unlink(const char *);
extern int chdir(const char *);
diff --git a/libc/kernel/arch-arm/asm/unistd.h b/libc/kernel/arch-arm/asm/unistd.h
index 9423754..454ed89 100644
--- a/libc/kernel/arch-arm/asm/unistd.h
+++ b/libc/kernel/arch-arm/asm/unistd.h
@@ -387,7 +387,77 @@
#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 __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000)
#define __ARM_NR_breakpoint (__ARM_NR_BASE+1)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@@ -396,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 */
-#if defined(__ARM_EABI__) && !defined(__KERNEL__)
+#ifdef __ARM_EABI__
#undef __NR_time
#undef __NR_umount
#undef __NR_stime
diff --git a/libc/kernel/common/linux/fb.h b/libc/kernel/common/linux/fb.h
index 18e43f0..451301c 100644
--- a/libc/kernel/common/linux/fb.h
+++ b/libc/kernel/common/linux/fb.h
@@ -241,156 +241,159 @@
#define FB_FLAG_RATIO_16_9 128
#define FB_FLAG_PIXEL_REPEAT 256
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define FB_FLAG_PREFERRED 512
+#define FB_FLAG_HW_CAPABLE 1024
#define FB_ROTATE_UR 0
#define FB_ROTATE_CW 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FB_ROTATE_UD 2
#define FB_ROTATE_CCW 3
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PICOS2KHZ(a) (1000000000UL/(a))
#define KHZ2PICOS(a) (1000000000UL/(a))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct fb_var_screeninfo {
__u32 xres;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 yres;
__u32 xres_virtual;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 yres_virtual;
__u32 xoffset;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 yoffset;
__u32 bits_per_pixel;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 grayscale;
struct fb_bitfield red;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct fb_bitfield green;
struct fb_bitfield blue;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct fb_bitfield transp;
__u32 nonstd;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 activate;
__u32 height;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 width;
__u32 accel_flags;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 pixclock;
__u32 left_margin;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 right_margin;
__u32 upper_margin;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 lower_margin;
__u32 hsync_len;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 vsync_len;
__u32 sync;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 vmode;
__u32 rotate;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 reserved[5];
};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct fb_cmap {
__u32 start;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 len;
__u16 *red;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u16 *green;
__u16 *blue;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u16 *transp;
};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct fb_con2fbmap {
__u32 console;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 framebuffer;
};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define VESA_NO_BLANKING 0
#define VESA_VSYNC_SUSPEND 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define VESA_HSYNC_SUSPEND 2
#define VESA_POWERDOWN 3
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
enum {
FB_BLANK_UNBLANK = VESA_NO_BLANKING,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
FB_BLANK_NORMAL = VESA_NO_BLANKING + 1,
FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1,
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1,
FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
#define FB_VBLANK_VBLANKING 0x001
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FB_VBLANK_HBLANKING 0x002
#define FB_VBLANK_HAVE_VBLANK 0x004
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FB_VBLANK_HAVE_HBLANK 0x008
#define FB_VBLANK_HAVE_COUNT 0x010
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FB_VBLANK_HAVE_VCOUNT 0x020
#define FB_VBLANK_HAVE_HCOUNT 0x040
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FB_VBLANK_VSYNCING 0x080
#define FB_VBLANK_HAVE_VSYNC 0x100
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct fb_vblank {
__u32 flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 count;
__u32 vcount;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 hcount;
__u32 reserved[4];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
#define ROP_COPY 0
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ROP_XOR 1
struct fb_copyarea {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 dx;
__u32 dy;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 width;
__u32 height;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 sx;
__u32 sy;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct fb_fillrect {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 dx;
__u32 dy;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 width;
__u32 height;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 color;
__u32 rop;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct fb_image {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 dx;
__u32 dy;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 width;
__u32 height;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 fg_color;
__u32 bg_color;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u8 depth;
const char *data;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct fb_cmap cmap;
};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FB_CUR_SETIMAGE 0x01
#define FB_CUR_SETPOS 0x02
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FB_CUR_SETHOT 0x04
#define FB_CUR_SETCMAP 0x08
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FB_CUR_SETSHAPE 0x10
#define FB_CUR_SETSIZE 0x20
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FB_CUR_SETALL 0xFF
struct fbcurpos {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u16 x, y;
};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct fb_cursor {
__u16 set;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u16 enable;
__u16 rop;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
const char *mask;
struct fbcurpos hot;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct fb_image image;
};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index 008fd2f..af19554 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -134,6 +134,9 @@
/* return the stack base and size, used by our malloc debugger */
extern void* __get_stack_base(int *p_stack_size);
+/* Initialize the TLS. */
+extern void __libc_init_tls(unsigned** elfdata);
+
__END_DECLS
#endif /* _SYS_TLS_H */
diff --git a/libm/src/s_remquo.c b/libm/src/s_remquo.c
index eee65df..9ad1e4c 100644
--- a/libm/src/s_remquo.c
+++ b/libm/src/s_remquo.c
@@ -49,7 +49,7 @@
goto fixup; /* |x|<|y| return x or x-y */
}
if(lx==ly) {
- *quo = 1;
+ *quo = (sxy ? -1 : 1);
return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
}
}
@@ -112,7 +112,8 @@
/* convert back to floating value and restore the sign */
if((hx|lx)==0) { /* return sign(x)*0 */
- *quo = (sxy ? -q : q);
+ q &= 0x7fffffff;
+ *quo = (sxy ? -q : q);
return Zero[(u_int32_t)sx>>31];
}
while(hx<0x00100000) { /* normalize x */
@@ -127,9 +128,9 @@
lx = (lx>>n)|((u_int32_t)hx<<(32-n));
hx >>= n;
} else if (n<=31) {
- lx = (hx<<(32-n))|(lx>>n); hx = sx;
+ lx = (hx<<(32-n))|(lx>>n); hx = 0;
} else {
- lx = hx>>(n-32); hx = sx;
+ lx = hx>>(n-32); hx = 0;
}
}
fixup:
diff --git a/libm/src/s_remquof.c b/libm/src/s_remquof.c
index 5d722ce..43e05cb 100644
--- a/libm/src/s_remquof.c
+++ b/libm/src/s_remquof.c
@@ -46,7 +46,7 @@
q = 0;
goto fixup; /* |x|<|y| return x or x-y */
} else if(hx==hy) {
- *quo = 1;
+ *quo = (sxy ? -1 : 1);
return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
}
@@ -88,7 +88,8 @@
/* convert back to floating value and restore the sign */
if(hx==0) { /* return sign(x)*0 */
- *quo = (sxy ? -q : q);
+ q &= 0x7fffffff;
+ *quo = (sxy ? -q : q);
return Zero[(u_int32_t)sx>>31];
}
while(hx<0x00800000) { /* normalize x */
diff --git a/linker/linker.c b/linker/linker.c
index 9805b35..6b6282d 100644
--- a/linker/linker.c
+++ b/linker/linker.c
@@ -2054,10 +2054,6 @@
}
}
-#define ANDROID_TLS_SLOTS BIONIC_TLS_SLOTS
-
-static void * __tls_area[ANDROID_TLS_SLOTS];
-
/*
* This code is called after the linker has linked itself and
* fixed it's own GOT. It is safe to make references to externs
@@ -2076,18 +2072,6 @@
const char *ldpath_env = NULL;
const char *ldpreload_env = NULL;
- /* Setup a temporary TLS area that is used to get a working
- * errno for system calls.
- */
- __set_tls(__tls_area);
-
- pid = getpid();
-
-#if TIMING
- struct timeval t0, t1;
- gettimeofday(&t0, 0);
-#endif
-
/* NOTE: we store the elfdata pointer on a special location
* of the temporary TLS area in order to pass it to
* the C Library's runtime initializer.
@@ -2096,7 +2080,14 @@
* to point to a different location to ensure that no other
* shared library constructor can access it.
*/
- __tls_area[TLS_SLOT_BIONIC_PREINIT] = elfdata;
+ __libc_init_tls(elfdata);
+
+ pid = getpid();
+
+#if TIMING
+ struct timeval t0, t1;
+ gettimeofday(&t0, 0);
+#endif
/* Initialize environment functions, and get to the ELF aux vectors table */
vecs = linker_env_init(vecs);