From patchwork Tue May 20 20:56:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1037 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id 021F5360098 for ; Tue, 20 May 2014 13:57:27 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14307373) id DC0A019508AC; Tue, 20 May 2014 13:57:26 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 87F971958A9B for ; Tue, 20 May 2014 13:57:26 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Q8klQWsUd5OCUOUmcwEA+IFljJzxzuO V96JbYJuXCSEgJOby5guoCqRfoG+7DIZSPmkbcvfvFJ79N2ZgjWx3vWZUdjXwOfi D/j0/2VQZGOkb9i8aADiRkEBttoSEoUlDEP03JnwOsI9OtWj506U5Me9UKqpr1P3 eKUSVdww6yiA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=BxHUEkNyVDDBI8Z8ZFOkuvlg7Zg=; b=d1zzD rgsXimVw4sOgIB3vJDwJ6tNfjQX7b84BlZ2KSM6KGtvy/jQo0qkcBewhIFl9wvN9 QX4BgPLJ30LV1hSQvrLtCoNshNiJmfw8wgfbPjoze+eTMWS665Wr1vOGvZZpuVKw ctAEG2TWUJS2Enr3AZcKOB2HnYjljbBXayi5eg= Received: (qmail 18337 invoked by alias); 20 May 2014 20:57:01 -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 18268 invoked by uid 89); 20 May 2014 20:57:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-qc0-f179.google.com X-Received: by 10.140.106.202 with SMTP id e68mr49903408qgf.83.1400619416622; Tue, 20 May 2014 13:56:56 -0700 (PDT) From: Richard Henderson To: libc-alpha@sourceware.org Cc: marcus.shawcroft@gmail.com, Richard Henderson Subject: [PATCH 3/6] aarch64: Tidy syscall error check Date: Tue, 20 May 2014 13:56:15 -0700 Message-Id: <1400619378-7262-4-git-send-email-rth@twiddle.net> In-Reply-To: <1400619378-7262-1-git-send-email-rth@twiddle.net> References: <1400619378-7262-1-git-send-email-rth@twiddle.net> X-DH-Original-To: glibc@patchwork.siddhesh.in 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 (PSEUDO): Branch to .Lsyscall_error on error. Do not call DOARGS/UNDOARGS. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (PSEUDO): Branch to .Lsyscall_error on error. (PSEUDO_RET): Do not check for error. (SYSCALL_ERROR) [NOT_IN_libc]: Use .Lsyscall_error. (SYSCALL_ERROR_HANDLER) [!NOT_IN_libc]: Branch to __syscall_error. --- sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h | 7 ++++--- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h index acaed5d..e3b4b56 100644 --- a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h +++ b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h @@ -33,16 +33,16 @@ 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; \ ENTRY (name); \ SINGLE_THREAD_P; \ - DOARGS_##args; \ bne .Lpseudo_cancel; \ DO_CALL (syscall_name, 0); \ - UNDOARGS_##args; \ cmn x0, 4095; \ + b.cs .Lsyscall_error; \ PSEUDO_RET; \ .Lpseudo_cancel: \ DOCARGS_##args; /* save syscall args etc. around CENABLE. */ \ @@ -61,7 +61,8 @@ cfi_adjust_cfa_offset (-16); \ cfi_restore (x30); \ UNDOARGS_##args; \ - 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 8397ad3..b32a565 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: