Commit 2dcda22d authored by Philippe Gerum's avatar Philippe Gerum
Browse files

lib/syscall: convert to prctl-based syscall form



The syscall form used for issuing requests to the companion core is
based on ORing __OOB_SYSCALL_BIT to the syscall register for tagging
an out-of-band syscall, which is outside of the valid in-band range
for syscall numbers.

Unfortunately, this method has a major drawback: tools like Valgrind
which track system calls issued by applications may choke on
out-of-band system calls since these do not belong to the common set
it recognizes. Although adding syscall wrappers to Valgrind might be a
solution, this would not be the most practical one for dual kernel
syscall interfaces. The most practical approach would be to piggyback
on an existing system call which Valgrind (and others) already
recognizes. For this reason, Dovetail introduced a new syscall form
based on the regular prctl(2) syscall.

In order to benefit from this feature, EVL syscalls are now folded
into a prctl() request, which the core receives.

This change introduces ABI #27. Recent revisions of the EVL core
support both the former ABI and the new (prctl-based) one
indifferently.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent 5c9efb88
......@@ -22,7 +22,7 @@
#define __EVL__ 18 /* API version */
#define EVL_ABI_PREREQ 26
#define EVL_ABI_PREREQ 27
struct evl_version {
int api_level; /* libevl.so: __EVL__ */
......
......@@ -8,18 +8,22 @@
#define _LIB_EVL_X86_SYSCALL_H
#include <uapi/asm-generic/dovetail.h>
#include <sys/syscall.h>
#define evl_syscall3(__nr, __a0, __a1, __a2) \
({ \
register long int _a0 asm ("rdi") = (long)(__a0); \
register long int _a1 asm ("rsi") = (long)(__a1); \
register long int _a2 asm ("rdx") = (long)(__a2); \
register long int _nr asm ("rdi") = (__nr) | __OOB_SYSCALL_BIT; \
register long int _a0 asm ("rsi") = (long)(__a0); \
register long int _a1 asm ("rdx") = (long)(__a1); \
register long int _a2 asm ("r10") = (long)(__a2); \
register long int _a3 asm ("r8") = 0L; \
long int __res; \
__asm__ __volatile__ ( \
"syscall;\n\t" \
: "=a" (__res) \
: "0" ((__nr)|__OOB_SYSCALL_BIT), \
"r" (_a0), "r" (_a1), "r" (_a2) \
: "0" (__NR_prctl), \
"r" (_nr), \
"r" (_a0), "r" (_a1), "r" (_a2), "r" (_a3) \
: "cc", "memory", "r11", "cx"); \
(int)__res; \
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment