From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id DE4271F45E for ; Tue, 11 Feb 2020 12:32:03 +0000 (UTC) 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:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=ghAePEiR0Js9fEUGubWQ6s0YCYx44enKw1wt4n8kWVR Og65I9HMVcSXk5kVV63HgXIDY5MfGx2BHBxfCziLdy4+CNY3eW5NNemrJPi8DhvK wPmg5n/ZiOcp1ArqVcKeVnvQ5fN5zCJfMhjyGSwljGCKxeePX8M+JgxW7M/soBEw = 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:references:date:in-reply-to :message-id:mime-version:content-type:content-transfer-encoding; s=default; bh=DKbiztagRk5iUSlMIcScOLZxtoQ=; b=m1TMPUyv4RXcsz8t3 vJmSxUq264MVugygZ7I5fsVf7svYEyCCZR6K0pIkKT9wZnZ67+Y5/rFh1+gH+Yti ht1dfU9QSqqj7jhqQcAzWUGn3gR4FbQ+7CtuR3XaJkagtLBEJMk3kJ3pm/VBNrb5 /Z8OXrg0q8ysPDSYlVMEKNnFkg= Received: (qmail 69073 invoked by alias); 11 Feb 2020 12:32:00 -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 Received: (qmail 69062 invoked by uid 89); 11 Feb 2020 12:32:00 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581424317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RNmouIlKKkxu8skB8o+H/HqKIwJ7cahlJsoHiHNlLB4=; b=i9IqqOoZFTigMiihXxdAMLu0gl7XTNEtAeiRdh+q6qxEyZJLw2APsZ9pIxjzYMGYC18McH 6lgBA24mVCzL0uvb55t56haiQkJ+Im3Bd0mo4LQSLn4VA7l/MxiXlhkwyCgVX3H5hEdPfw dBp1qvWrGPpm0A/pZ0DWe9/mYT6HJbo= From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 02/15] powerpc: Use Linux kABI for syscall return References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> <20200210192038.23588-2-adhemerval.zanella@linaro.org> <874kvxpe2x.fsf@oldenburg2.str.redhat.com> Date: Tue, 11 Feb 2020 13:31:52 +0100 In-Reply-To: (Adhemerval Zanella's message of "Tue, 11 Feb 2020 09:14:05 -0300") Message-ID: <871rr1nw3r.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable * Adhemerval Zanella: > On 11/02/2020 08:18, Florian Weimer wrote: >> * Adhemerval Zanella: >>=20 >>> diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sy= sv/linux/powerpc/sysdep.h >>> index 01c26be24b..abdcfd4a63 100644 >>> --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h >>> +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h >>> @@ -60,9 +60,8 @@ >>> : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), = \ >>> "+r" (r7), "+r" (r8)=09=09=09=09=09=09\ >>> : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory");= =09\ >>> - err =3D (long int) r0;=09=09=09=09=09=09\ >>> __asm__ __volatile__ ("" : "=3Dr" (rval) : "r" (r3));=09=09 = \ >>> - rval;=09=09=09=09=09=09=09=09\ >>> + (long int) r0 & (1 << 28) ? -rval : rval;=09=09=09=09\ >>> }) >>> =20 >>> #define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...)=09=09\ >>> @@ -110,21 +109,20 @@ >>> : ASM_INPUT_##nr=09=09=09=09=09=09=09\ >>> : "r9", "r10", "r11", "r12",=09=09=09=09=09\ >>> "cr0", "ctr", "memory");=09=09=09=09=09\ >>> -=09 err =3D r0; \ >>> - r3; \ >>> + r0 & (1 << 28) ? -r3 : r3;=09=09=09=09=09=09\ >>> }) >>> #define INTERNAL_SYSCALL(name, err, nr, args...)=09=09=09\ >>> INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) >>> =20 >>> #undef INTERNAL_SYSCALL_DECL >>> -#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused= )) >>> +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) >>> =20 >>> #undef INTERNAL_SYSCALL_ERROR_P >>> #define INTERNAL_SYSCALL_ERROR_P(val, err) \ >>> - ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) >>> + ((unsigned long) (val) >=3D (unsigned long) -4095) >>> =20 >>> #undef INTERNAL_SYSCALL_ERRNO >>> -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) >>> +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) >>> =20 >>> #if defined(__PPC64__) || defined(__powerpc64__) >>> # define SYSCALL_ARG_SIZE 8 >>=20 >> What's the baseline for this patch? > > To simplify the Linux syscall handling on all architectures by using the > already set kABI interface (where returns values from > 0xfffffffffffff000 to 0xffffffffffffffff indicates an error). The idea > is initially to consolidate the INLINE_SYSCALL macro and remove the > INTERNAL_SYSCALL_DECL macro. > > This refactoring is an initial one, my long-term goal is twofold: > > 1. Remove the assembly macros to define syscall and only use the > C interface. It simplifies ports, requires less hackery to handle > all its subtitles in C generations (static/pic/etc), and most likely > would play nice on a possible LTO build. > > 2. Rework the syscall interfaces to use static inline instead of > macros. It will avoid the argument handling that led to the > subtle BZ#25523 bug and it defines a proper kABI interface. I meant that the patch doesn't seem to be against master. I don't have the object 01c26be24b locally. Thanks, Florian