From 8ccf7c3e8c725e9fc29ad0f5accebb127c9ea246 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sat, 26 Nov 2016 10:12:58 +0100 Subject: microblaze: sync sysdep-cancel.h/sydep.h with GNU libc --- libc/sysdeps/linux/microblaze/sysdep.h | 29 +++++++++++++ .../unix/sysv/linux/microblaze/sysdep-cancel.h | 48 ++++++++++++++-------- 2 files changed, 59 insertions(+), 18 deletions(-) diff --git a/libc/sysdeps/linux/microblaze/sysdep.h b/libc/sysdeps/linux/microblaze/sysdep.h index a463d339e..d4b4e90f2 100644 --- a/libc/sysdeps/linux/microblaze/sysdep.h +++ b/libc/sysdeps/linux/microblaze/sysdep.h @@ -65,6 +65,35 @@ SYSCALL_ERROR_HANDLER; \ END (name) +# undef PSEUDO_NOERRNO +# define PSEUDO_NOERRNO(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args); + +# undef PSEUDO_END_NOERRNO +# define PSEUDO_END_NOERRNO(name) \ + END (name) + +/* The function has to return the error code. */ +# undef PSEUDO_ERRVAL +# define PSEUDO_ERRVAL(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args); \ + +# undef PSEUDO_END_ERRVAL +# define PSEUDO_END_ERRVAL(name) \ + END (name) + +# undef ret_NOERRNO +# define ret_NOERRNO \ + rtsd r15,8; addk r0,r0,r0; + +# undef ret_ERRVAL +# define ret_ERRVAL \ + rtsd r15,8; rsubk r3,r3,r0; + #ifdef __PIC__ # define SYSCALL_ERROR_LABEL_DCL 0 # if defined _LIBC_REENTRANT diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h index 2af79cab5..a03e42a40 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h @@ -23,12 +23,7 @@ #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt -#ifdef __ASSEMBLER__ - -#undef ret -#define ret - -# if !IS_IN_librt || !defined(PIC) +# if !defined IS_IN_librt || !defined(PIC) # define AC_STACK_SIZE 16 /* space for r15, async_cancel arg and 2 temp words */ # define AC_SET_GOT /* empty */ # define AC_RESTORE_GOT /* empty */ @@ -54,9 +49,7 @@ __##syscall_name##_nocancel: \ DO_CALL (syscall_name, args); \ addik r4, r0, -4095; \ cmpu r4, r4, r3; \ - rsubk r3,r3,r0; \ - rtsd r15,8; \ - addik r3,r0,-1; \ + bgei r4, SYSCALL_ERROR_LABEL; \ rtsd r15, 8; \ nop; \ .size __##syscall_name##_nocancel, .-__##syscall_name##_nocancel; \ @@ -78,9 +71,7 @@ L(pseudo_cancel): \ addik r1, r1, AC_STACK_SIZE; \ addik r4, r0, -4095; \ cmpu r4, r4, r3; \ - rsubk r3,r3,r0; \ - rtsd r15,8; \ - addik r3,r0,-1; \ + bgei r4, SYSCALL_ERROR_LABEL; \ rtsd r15, 8; \ nop; @@ -126,14 +117,35 @@ L(pseudo_cancel): \ # error Unsupported library # endif -#define SINGLE_THREAD_P(reg) \ - lwi reg, r0, MULTIPLE_THREADS_OFFSET(reg) - -#else /* !__ASSEMBLER__ */ -# define SINGLE_THREAD_P \ +#if !defined NOT_IN_libc || defined IS_IN_libpthread +# ifndef __ASSEMBLER__ +extern int __local_multiple_threads attribute_hidden; +# define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1) +# else +# if !defined PIC +# define SINGLE_THREAD_P(reg) lwi reg, r0, __local_multiple_threads; +# else +# define SINGLE_THREAD_P(reg) \ + mfs reg, rpc; \ + addik reg, reg, _GLOBAL_OFFSET_TABLE_+8; \ + lwi reg, reg, __local_multiple_threads@GOT; \ + lwi reg, reg, 0; +# endif +# endif +# else +# ifndef __ASSEMBLER__ +# define SINGLE_THREAD_P \ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ header.multiple_threads) == 0, 1) +# else +# define SINGLE_THREAD_P(reg) \ + lwi reg, r0, MULTIPLE_THREADS_OFFSET(reg) +# endif +# endif + +#elif !defined __ASSEMBLER__ -#endif /* __ASSEMBLER__ */ +# define SINGLE_THREAD_P (1) +# define NO_CANCELLATION (1) #endif -- cgit v1.2.3