From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 6FC50385E007 for ; Wed, 14 Feb 2024 14:32:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6FC50385E007 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 6FC50385E007 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707921168; cv=none; b=uN8GqASdXb87vmYBWMD4PJsoZPftPvZmjPOT/radQxnJMWIo41RgsN1Fzbr88VTEZ06e+SSpROUGAA59w8iYIBJspyp499vcNs5vXL/ZM5JcdBON0OZ6uOrStmmEX3pEZfEc9ygMdynT+vwSPDYj864if2DPj6GoOmS3P2mgAmM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707921168; c=relaxed/simple; bh=1wuQLv8CmSDMOXjtH1MNMaPK7zKggX9VA0d9GfH+IqM=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=KOCaVFYGI+pn9mbFUw8aCCwbx8XFmxYd+D6N4J6fHO0KPaovxcZDPjAzLbPZjrxEqw1Lr//GNLfYzi1rt2+Sj5kpRyHDQksAQDAm7FnBU0PmcNwfIedHzXCe+FiFc3l/sTnzbGROCT+o9W1pPtdv6NFFm0blV5nlCcCbjnkTmlQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6e0f4e3bc59so1601971b3a.0 for ; Wed, 14 Feb 2024 06:32:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1707921164; x=1708525964; 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=p5uSuckPc0H6i5FwW8PtNnyo41Zsuwt/Ty+Wr6YA8Jc=; b=RF206U1HydYXiglZriEUWnIx+REw1/sGUkn4PyYSNSzYq5x9x4w/j7QhIx/K+CPzCb OqnOkoETI64ayn4p3DPP6UQRwXKrrXDq/pFOzFSAuOIvT+24/1JDajVstvRCSOAiNtke o0snl9Sakc7YEjU/ne7MaMrHucNyS4UBoWtyt+D4/0peH2h2D+D90irVNPe/0IFkpMjW gBKr1qhdgkU1EuDqZyvjZ5UbmWWvITy84JMuX4IoSWWIKguDvO++2do/z1CS517qKQlR aYZg1JMRGnQciWS93pntbq1O6WBGQaVIXaKNHYwNLpwUDQwYdbwjtIogjypB7E3Zl2wK DB+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707921164; x=1708525964; 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=p5uSuckPc0H6i5FwW8PtNnyo41Zsuwt/Ty+Wr6YA8Jc=; b=gGKTvfzvbvXnc2BCpgZy5Qx01SsXQpz7z5u4Z5qfol71pQsAqowpVkFliH77amYswl ZPZeJgbMNmqANEMlyow3/+4IyzpZ5+y2wDFJgm+mPf4FtQGi+Ee96+2W1Je1v3nwH7Gt UhsjAorXOVrvgXrfzmQTY8QXISCZY67rKRt2iDs0f2miMH7Y7QQzGYyhygtIF7HsIRo5 5cw27hzRc+ZzRwLr19QowPCE1R3kceSO+UIsQ6D+g90gIM68MGxSOfSKQD2Dh8Y1/LEl gl/258kIG+W1yLekDO0ytL2wsBBwQKC60YpCDMME5UCcj+3FLPiDA7MzTOhTeeVbwibq UP0Q== X-Gm-Message-State: AOJu0YwbqfEmK5Ggh25g5PEhYZJK50thdWq8kkKMyzBoqR2Ypegr//Ir hgWQk8+T3N5CvKa4PEHcY+Cc4T5RvdNZ0Z3COCfwhGbI2G5oULdCQfoap9MAb/9jct7pNONaoxr / X-Google-Smtp-Source: AGHT+IHj1PMUC6w+mmhWc8OmJGMa4ZmmWVFt6DHOrRvE5FbtndoCzAcvradD5eM1Ea26FJw0+2+ZoQ== X-Received: by 2002:a05:6a21:1645:b0:19f:2df0:13fd with SMTP id no5-20020a056a21164500b0019f2df013fdmr3469627pzb.29.1707921164587; Wed, 14 Feb 2024 06:32:44 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXkLOmZj0FJSodzm/AUoihDwkpPJhS8TYyXsUzVurlC1nUC/SRIllTe8vV13NldzlnnOdF3UHYUOLfV69Xnyy5sYM+GzSSQW9PzNChWvbZ5U3bzZYy/HckQWu5lE4UJoAn+3NL6/zIgecepA/mh8Dam2lLI4uuix2uF5mt5kLHv Received: from evan.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id k21-20020a635a55000000b005dc98d9114bsm1140255pgm.43.2024.02.14.06.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 06:32:44 -0800 (PST) From: Evan Green To: libc-alpha@sourceware.org Cc: vineetg@rivosinc.com, Florian Weimer , slewis@rivosinc.com, palmer@rivosinc.com, Evan Green Subject: [PATCH v12 2/7] linux: Introduce INTERNAL_VSYSCALL Date: Wed, 14 Feb 2024 06:31:53 -0800 Message-Id: <20240214143159.2951158-3-evan@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214143159.2951158-1-evan@rivosinc.com> References: <20240214143159.2951158-1-evan@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 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 --- (no changes since v10) 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 189319ad98..f7d4b29b25 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