Commit 2cc2f54b authored by Philippe Gerum's avatar Philippe Gerum Committed by Jan Kiszka

cobalt/syscall: pipeline: abstract syscall entry points

The I-pipe and Dovetail differ only marginally with respect to syscall
handling. Abstract only the few details we need to cope with both
interfaces.

No functional change is introduced.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent dd1080db
Pipeline #5811 passed with stage
in 19 minutes and 55 seconds
......@@ -7,6 +7,9 @@
#ifndef _COBALT_KERNEL_IPIPE_KEVENTS_H
#define _COBALT_KERNEL_IPIPE_KEVENTS_H
#define KEVENT_PROPAGATE 0
#define KEVENT_STOP 1
struct cobalt_process;
struct cobalt_thread;
......
......@@ -11,6 +11,8 @@
#include <pipeline/machine.h>
#define xnsched_realtime_domain cobalt_pipeline.domain
#define PIPELINE_NR_IRQS IPIPE_NR_IRQS
typedef unsigned long spl_t;
......
......@@ -233,8 +233,6 @@ static inline void xnsched_set_self_resched(struct xnsched *sched)
sched->status |= XNRESCHED;
}
#define xnsched_realtime_domain cobalt_pipeline.domain
/* Set resched flag for the given scheduler. */
#ifdef CONFIG_SMP
......
......@@ -2,4 +2,4 @@ ccflags-y += -I$(srctree)/kernel
obj-y += pipeline.o
pipeline-y := init.o intr.o kevents.o apc.o tick.o
pipeline-y := init.o intr.o kevents.o apc.o tick.o syscall.o
/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>
* Copyright (C) 2005 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
*/
#include <pipeline/pipeline.h>
#include <pipeline/kevents.h>
#include <cobalt/kernel/assert.h>
#include <xenomai/posix/syscall.h>
int ipipe_syscall_hook(struct ipipe_domain *ipd, struct pt_regs *regs)
{
if (unlikely(is_secondary_domain()))
return handle_root_syscall(regs);
return handle_head_syscall(ipd != &xnsched_realtime_domain, regs);
}
int ipipe_fastcall_hook(struct pt_regs *regs)
{
int ret;
ret = handle_head_syscall(false, regs);
XENO_BUG_ON(COBALT, ret == KEVENT_PROPAGATE);
return ret;
}
......@@ -23,9 +23,6 @@
#include <pipeline/thread.h>
#include <cobalt/kernel/ppd.h>
#define KEVENT_PROPAGATE 0
#define KEVENT_STOP 1
#define NR_PERSONALITIES 4
#if BITS_PER_LONG < NR_PERSONALITIES
#error "NR_PERSONALITIES overflows internal bitmap"
......
......@@ -18,7 +18,6 @@
*/
#include <linux/types.h>
#include <linux/err.h>
#include <linux/ipipe.h>
#include <linux/sched.h>
#include <linux/kconfig.h>
#include <linux/unistd.h>
......@@ -26,6 +25,7 @@
#include <cobalt/kernel/tree.h>
#include <cobalt/kernel/vdso.h>
#include <cobalt/kernel/init.h>
#include <pipeline/kevents.h>
#include <asm/syscall.h>
#include "internal.h"
#include "thread.h"
......@@ -475,7 +475,7 @@ static inline int allowed_syscall(struct cobalt_process *process,
return cap_raised(current_cap(), CAP_SYS_NICE);
}
static int handle_head_syscall(struct ipipe_domain *ipd, struct pt_regs *regs)
int handle_head_syscall(bool caller_is_relaxed, struct pt_regs *regs)
{
struct cobalt_process *process;
int switched, sigs, sysflags;
......@@ -553,7 +553,7 @@ restart:
/*
* The syscall must run from the Linux domain.
*/
if (ipd == &xnsched_realtime_domain) {
if (!caller_is_relaxed) {
/*
* Request originates from the Xenomai domain:
* relax the caller then invoke the syscall
......@@ -578,7 +578,7 @@ restart:
* hand it over to our secondary-mode dispatcher.
* Otherwise, invoke the syscall handler immediately.
*/
if (ipd != &xnsched_realtime_domain)
if (caller_is_relaxed)
return KEVENT_PROPAGATE;
}
......@@ -667,7 +667,7 @@ bad_syscall:
return KEVENT_STOP;
}
static int handle_root_syscall(struct ipipe_domain *ipd, struct pt_regs *regs)
int handle_root_syscall(struct pt_regs *regs)
{
int sysflags, switched, sigs;
struct xnthread *thread;
......@@ -777,24 +777,6 @@ ret_handled:
return KEVENT_STOP;
}
int ipipe_syscall_hook(struct ipipe_domain *ipd, struct pt_regs *regs)
{
if (unlikely(is_secondary_domain()))
return handle_root_syscall(ipd, regs);
return handle_head_syscall(ipd, regs);
}
int ipipe_fastcall_hook(struct pt_regs *regs)
{
int ret;
ret = handle_head_syscall(&xnsched_realtime_domain, regs);
XENO_BUG_ON(COBALT, ret == KEVENT_PROPAGATE);
return ret;
}
long cobalt_restart_syscall_placeholder(struct restart_block *param)
{
return -EINVAL;
......
......@@ -20,6 +20,8 @@
#include <cobalt/uapi/syscall.h>
struct pt_regs;
/* Regular (native) syscall handler implementation. */
#define COBALT_SYSCALL(__name, __mode, __args) \
long CoBaLt_ ## __name __args
......@@ -30,4 +32,9 @@
#include <asm/xenomai/syscall32.h>
int handle_head_syscall(bool caller_is_relaxed,
struct pt_regs *regs);
int handle_root_syscall(struct pt_regs *regs);
#endif /* !_COBALT_POSIX_SYSCALL_H */
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