From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 6C1983858C83 for ; Wed, 12 Apr 2023 21:11:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C1983858C83 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681333887; 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=NqD66wLeGYTsXhVPcGYcidMYQx4n8yzfpDmRUGFm+r0=; b=bw5kx5l9jpMJRyKjfWh37gYTm3nIB6iUCw+wF5LM5vj+ZD6K24zx5vFyhrH9y+xXDBIKnL rP0XfeBWv1mMR8fMutbbfwEeWQAbolqZHmARKhSglxz5HTxR+gJFnZP3MMjLyqaiB+pvLf Uai/l6gF9q/1G87hHAsYSLRhrKgnrRo= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-74-Qi-h35DxMDO7NQQvzR3w9A-1; Wed, 12 Apr 2023 17:11:26 -0400 X-MC-Unique: Qi-h35DxMDO7NQQvzR3w9A-1 Received: by mail-qt1-f198.google.com with SMTP id bp42-20020a05622a1baa00b003e6748b05edso16390004qtb.2 for ; Wed, 12 Apr 2023 14:11:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681333885; x=1683925885; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NqD66wLeGYTsXhVPcGYcidMYQx4n8yzfpDmRUGFm+r0=; b=WojSV74N29CfQnK9yIsus4/H0WAc3qcBDgCCv8WnjYaVdmlXmQWFrp/EZ6KmWcq+Ks R+5udH+ycqyejcx9t56iF3JkA/LvSkYH4zW44zUvEXBy56SWNNicLy7gL4Dp3gNOiPv3 lbeZac4/YZksfJ2ayV/Nw5ejvU+Xf33kcHKWpgIm2U4MNTBD5sKEhe7LhpbO8SYYdTvt MFiAwj7vCucPPf52XBni/M55xn5y6MIRiSW3S5wFtM1fbyPWYt8j8LqZC7zJr9Ywo9/O Zd3k3qnlLs4e8mY+h9rpxxwpCl38ZwPVyUTVZE2C5MeKGLh0Fa0jIYxZb5mHXwXRy1nY MnXg== X-Gm-Message-State: AAQBX9dt9bX5L7Ybn4yQ1JWpGFPpbpv9xNYctlRZXNTO0Dpff20PGOTH Ru06SRX7Fs2dY4GQl5g3Ffp3WwRLdYMxkzTaSytVT0VQvjdTc1tCy0h3Th2RZNXlI+dJXZLT2Mh DA5JB86hOXAy/PHprGdYQWrqxdrPn6xqGVApThkUznB8gzQG0pgxp8jRkijmUjAxL6193jqe6/3 n0sIau X-Received: by 2002:a05:622a:1048:b0:3e8:b3fd:4cee with SMTP id f8-20020a05622a104800b003e8b3fd4ceemr4039936qte.46.1681333885520; Wed, 12 Apr 2023 14:11:25 -0700 (PDT) X-Google-Smtp-Source: AKy350aPwgBspT1b8RdKzBJAKFRHh/y4+2CXol+RHbpGpSGPFhInyIhsliB0A8vs4KWguUcCPfFLCg== X-Received: by 2002:a05:622a:1048:b0:3e8:b3fd:4cee with SMTP id f8-20020a05622a104800b003e8b3fd4ceemr4039906qte.46.1681333885134; Wed, 12 Apr 2023 14:11:25 -0700 (PDT) Received: from oak.redhat.com (c-71-206-142-238.hsd1.va.comcast.net. [71.206.142.238]) by smtp.gmail.com with ESMTPSA id r82-20020a37a855000000b0074a0051fcd4sm4939068qke.88.2023.04.12.14.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 14:11:24 -0700 (PDT) From: Joe Simmons-Talbott To: libc-alpha@sourceware.org Cc: Joe Simmons-Talbott Subject: [PATCH v2 2/2] aarch64: Set the syscall register right before doing the syscall. Date: Wed, 12 Apr 2023 17:11:04 -0400 Message-Id: <20230412211104.2609738-3-josimmon@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230412211104.2609738-1-josimmon@redhat.com> References: <20230411133004.2268170-1-josimmon@redhat.com> <20230412211104.2609738-1-josimmon@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: To make identifying syscalls easier during call tree analysis load the syscall number just before performing the syscall. --- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index e94d1703ad..b91656fdff 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -167,14 +167,28 @@ # define HAVE_CLONE3_WRAPPER 1 +# define MSTR_HELPER(x) # x +# define MSTR(x) MSTR_HELPER(x) + # undef INTERNAL_SYSCALL_RAW # define INTERNAL_SYSCALL_RAW(name, nr, args...) \ ({ long _sys_result; \ { \ LOAD_ARGS_##nr (args) \ - register long _x8 asm ("x8") = (name); \ - asm volatile ("svc 0 // syscall " # name \ - : "=r" (_x0) : "r"(_x8) ASM_ARGS_##nr : "memory"); \ + if (__builtin_constant_p(name)) \ + asm volatile ("mov x8, %1\n" \ + "svc 0 // syscall " # name \ + : "=r" (_x0) \ + : "i" (name) ASM_ARGS_##nr \ + : "x8", "memory"); \ + else \ + { \ + register long _x8 asm ("x8") = (name); \ + asm volatile ("svc 0 // syscall " # name \ + : "=r" (_x0) \ + : "r"(_x8) ASM_ARGS_##nr \ + : "memory"); \ + } \ _sys_result = _x0; \ } \ _sys_result; }) -- 2.39.2