From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2b.google.com (mail-oo1-xc2b.google.com [IPv6:2607:f8b0:4864:20::c2b]) by sourceware.org (Postfix) with ESMTPS id 306BA385B516 for ; Wed, 13 Dec 2023 21:11:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 306BA385B516 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 306BA385B516 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c2b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702501925; cv=none; b=E4yevUananvf/qDrA4xoKaZPhrnJrfZqX9VQ76I8ECsm7kp/oMC4hl8iO3vMBDaMJ6vDJx2xICZD+qpkDcczD/YjrAsiWjL8cRFrXNAEL09kmYOVkplXEhJKVgUV8leKL/4dcd/xQQfKJ5Htwb0HuvG8rto7IkK2xn+qmajPSgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702501925; c=relaxed/simple; bh=RrgBRwsIXn0t+zBqq842fnWckQNWet6kKCk5X+hbfzs=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=DBsBWA7SXCR4yOyazroEvMRG7bfiRxswy0WxytN16NvouZMxG/rePPkmVrztyrU9DJblsZ8Sy+3Hyth1zHgY8LVbGedNjs9gbbZgLaLiuPU/HijwcO9S5YL76RqN0ald69Rd0UYF6qyd3N/yQVHGI66MSOK19gTFTanH4ipG+/U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-59067ccb090so4749823eaf.1 for ; Wed, 13 Dec 2023 13:11:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1702501917; x=1703106717; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+2qQ1SUsKwL6OUNgVYMmwF/9joyr4Le9FFVTYHSWq6w=; b=qrF/Y5E5Tihx9XNtvxLVaQkk7V7/TgCVz0/FeNFfSMexJD7yT3muVojwfPE+wjYxq3 OBpZERt5u28TyuzWVN+DcQxSN2AVnOp7S3jXBlaQ44gmHRsaGik4od268l0mSbxyf+2m KTsKrAZ1QwIfPnIKXbPGK5sLNvThPGvjuzqalsZONcB6/nVhaNNphACC+qhcZU2mzSBD yZauwupuIND05ZGgH9cyS45EwmzFPEdFLDGpG5qgP6l7WsK7tIznMlMQqTxALiAvAUjH c0LHBgu8fbZVSCy/lmdSNnABQ+WWbhel0SjUxN5KW6AXrHTwVQ1h1a/77g1RCvdpfKFK 1qTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702501917; x=1703106717; 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=+2qQ1SUsKwL6OUNgVYMmwF/9joyr4Le9FFVTYHSWq6w=; b=FlnE7/n+be8BXKlX4PRlUDtxuW3OnB4nesAtmDv1d1DOoG8uqXpp+fttxyO5n8bg5o uKeSzVf+a65F8Ug+Id+14MZFVA7fZGFePadQm8Zeo3EZWttJGygy5JPlDu8zBvKE6gyr 3yz0aOGs6uw09OsMgdPoDhnS2iKSLU0W1ZZkafsYeWbbc+5qEvMKb2DTordUOVgcs4ym XNfqOBdp3TFo7P/HB1Dxq39qJsMSU2GgCZMWFNycqY9RzAZKks1RH04al/j4D6iiZSqb ywbTsyLGB6dGsi6Wkc1gUVjta1U1Ja4yzEm+qmk6xzxE4RkEXOcJLnxSZUQvBDvSV5Gz gK6g== X-Gm-Message-State: AOJu0Yxd99s+8Qds1C6n5jt99yopoxUhVkN2d2duYqpuLag90eulXV9I SgixUkuBdZCdCxt0BE9FbnrgIHtrjyC87woOd5o= X-Google-Smtp-Source: AGHT+IGgm6AkoJnfdRxoFTlPZ1lf9h+egZfHR23L/F096ertwvUIUeB3HJM202TQDBpxUgOxKKfOpA== X-Received: by 2002:a4a:98e1:0:b0:590:d3ab:c9e2 with SMTP id b30-20020a4a98e1000000b00590d3abc9e2mr2733332ooj.19.1702501917642; Wed, 13 Dec 2023 13:11:57 -0800 (PST) Received: from evan.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id c15-20020a4a380f000000b0058d1de21893sm3223109ooa.24.2023.12.13.13.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 13:11:57 -0800 (PST) From: Evan Green To: libc-alpha@sourceware.org Cc: vineetg@rivosinc.com, slewis@rivosinc.com, palmer@rivosinc.com, Florian Weimer , Evan Green Subject: [PATCH v10 2/7] linux: Introduce INTERNAL_VSYSCALL Date: Wed, 13 Dec 2023 13:11:37 -0800 Message-Id: <20231213211142.1543025-3-evan@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231213211142.1543025-1-evan@rivosinc.com> References: <20231213211142.1543025-1-evan@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: Add an INTERNAL_VSYSCALL() macro that makes a vDSO call, falling back to a regular syscall, but without setting errno. Instead, the return value is plumbed straight out of the macro. Signed-off-by: Evan Green --- Changes in v10: - Introduced INTERNAL_VSYSCALL patch sysdeps/unix/sysv/linux/sysdep-vdso.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h index a51b5deb37..2a1fc17e23 100644 --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h @@ -53,4 +53,23 @@ sc_ret; \ }) +#define INTERNAL_VSYSCALL(name, nr, args...) \ + ({ \ + __label__ out; \ + long int sc_ret; \ + \ + __typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name); \ + if (vdsop != NULL) \ + { \ + sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args); \ + if ((!INTERNAL_SYSCALL_ERROR_P (sc_ret)) || \ + (INTERNAL_SYSCALL_ERRNO (sc_ret) != ENOSYS)) \ + goto out; \ + } \ + \ + sc_ret = INTERNAL_SYSCALL_CALL (name, ##args); \ + out: \ + sc_ret; \ + }) + #endif /* SYSDEP_VDSO_LINUX_H */ -- 2.34.1