From patchwork Sat May 24 00:11:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1123 Received: (qmail 24091 invoked by alias); 24 May 2014 00:12:12 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23981 invoked by uid 89); 24 May 2014 00:12:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_20, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-qc0-f170.google.com X-Received: by 10.140.30.161 with SMTP id d30mr11061268qgd.62.1400890327360; Fri, 23 May 2014 17:12:07 -0700 (PDT) From: Richard Henderson To: libc-alpha@sourceware.org Cc: marcus.shawcroft@gmail.com, Richard Henderson Subject: [PATCH v2 2/9] aarch64: Tidy syscall error check Date: Fri, 23 May 2014 17:11:42 -0700 Message-Id: <1400890309-16710-3-git-send-email-rth@twiddle.net> In-Reply-To: <1400890309-16710-1-git-send-email-rth@twiddle.net> References: <1400890309-16710-1-git-send-email-rth@twiddle.net> From: Richard Henderson Move the error branch from the PSEUDO_RET macro to the PSEUDO macro. This is in line with other architectures, and will enable further improvments. --- sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h | 5 ++++- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h index 957bb99..2d0ae5b 100644 --- a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h +++ b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h @@ -33,6 +33,7 @@ cfi_startproc; \ DO_CALL (syscall_name, args); \ cmn x0, 4095; \ + b.cs .Lsyscall_error; \ PSEUDO_RET; \ cfi_endproc; \ .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \ @@ -41,6 +42,7 @@ bne .Lpseudo_cancel; \ DO_CALL (syscall_name, 0); \ cmn x0, 4095; \ + b.cs .Lsyscall_error; \ PSEUDO_RET; \ .Lpseudo_cancel: \ DOCARGS_##args; /* save syscall args etc. around CENABLE. */ \ @@ -58,7 +60,8 @@ ldr x30, [sp], 16; \ cfi_adjust_cfa_offset (-16); \ cfi_restore (x30); \ - cmn x0, 4095; + cmn x0, 4095; \ + b.cs .Lsyscall_error; # define DOCARGS_0 \ str x30, [sp, -16]!; \ diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index cffd008..0e91f83 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -58,17 +58,15 @@ .text; \ ENTRY (name); \ DO_CALL (syscall_name, args); \ - cmn x0, #4095; + cmn x0, #4095; \ + b.cs .Lsyscall_error; /* Notice the use of 'RET' instead of 'ret' the assembler is case insensitive and eglibc already uses the preprocessor symbol 'ret' so we use the upper case 'RET' to force through a ret instruction to the assembler */ # define PSEUDO_RET \ - b.cs 1f; \ - RET; \ - 1: \ - b SYSCALL_ERROR + RET; # undef ret # define ret PSEUDO_RET @@ -112,10 +110,10 @@ # define ret_ERRVAL PSEUDO_RET_NOERRNO # if NOT_IN_libc -# define SYSCALL_ERROR __local_syscall_error +# define SYSCALL_ERROR .Lsyscall_error # if RTLD_PRIVATE_ERRNO # define SYSCALL_ERROR_HANDLER \ -__local_syscall_error: \ +.Lsyscall_error: \ adrp x1, C_SYMBOL_NAME(rtld_errno); \ neg w0, w0; \ str w0, [x1, :lo12:C_SYMBOL_NAME(rtld_errno)]; \ @@ -124,7 +122,7 @@ __local_syscall_error: \ # else # define SYSCALL_ERROR_HANDLER \ -__local_syscall_error: \ +.Lsyscall_error: \ stp x29, x30, [sp, -32]!; \ cfi_adjust_cfa_offset (32); \ cfi_rel_offset (x29, 0); \ @@ -143,8 +141,10 @@ __local_syscall_error: \ RET; # endif # else -# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ # define SYSCALL_ERROR __syscall_error +# define SYSCALL_ERROR_HANDLER \ +.Lsyscall_error: \ + b __syscall_error; # endif /* Linux takes system call args in registers: