public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] linux: Introduce INTERNAL_VSYSCALL
@ 2024-03-01 15:17 Palmer Dabbelt
  0 siblings, 0 replies; only message in thread
From: Palmer Dabbelt @ 2024-03-01 15:17 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c6c33339b45281590f9db138ba6c9d79acb1da27

commit c6c33339b45281590f9db138ba6c9d79acb1da27
Author: Evan Green <evan@rivosinc.com>
Date:   Tue Feb 27 14:56:38 2024 -0800

    linux: Introduce INTERNAL_VSYSCALL
    
    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 <evan@rivosinc.com>
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

Diff:
---
 sysdeps/unix/sysv/linux/sysdep-vdso.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h
index 189319ad98..2f53ada6e5 100644
--- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
+++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
@@ -53,4 +53,16 @@
     sc_ret;								      \
   })
 
+#define INTERNAL_VSYSCALL(name, nr, args...)				      \
+  ({									      \
+    long int sc_ret = -ENOSYS;						      \
+									      \
+    __typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name);	      \
+    if (vdsop != NULL)							      \
+	sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args);		      \
+    if (sc_ret == -ENOSYS)						      \
+	sc_ret = INTERNAL_SYSCALL_CALL (name, ##args);			      \
+    sc_ret;								      \
+  })
+
 #endif /* SYSDEP_VDSO_LINUX_H  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-01 15:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-01 15:17 [glibc] linux: Introduce INTERNAL_VSYSCALL Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).