All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Daniele Lugli <daniele.lugli@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] newbie question
Date: Thu, 16 Mar 2006 12:18:56 +0100	[thread overview]
Message-ID: <441949A0.8060100@domain.hid> (raw)
In-Reply-To: <0915ad1443edb7af745736fe4aaf3551@domain.hid>

Daniele Lugli wrote:
> Hello all,
> I am new to xenomai although I have already used rtai.
> I see that xenomai has a user mode which looks equivalent to rtai's lxrt.
> What about calling real-time functions implemented in a module 
> (rtai_lxrt call, rt_fun_entry table and so on)?
> Thank you,
> Daniele Lugli
> 
> 

Have a look at the way a simple skin does it, e.g. ksrc/skins/uvm.

The UVM module exports a set of 12 syscalls, from __uvm_thread_shadow to 
__uvm_timer_tsc, as declared in include/asm-uvm/syscalls.h.

To do that, the module registers as a Xenomai skin by calling the 
xnshadow_register_interface() service, during its initialization phase. Some of 
the parameters for this function are the address and the number of entries of the 
module's syscall table.

The table is made of tuples, { <syscall-entry-addr> , <syscall-mode> }
The syscall mode bits define the operations Xenomai will do to 1) check that the 
caller is in the proper context for calling, 2) possibly switch the caller's mode 
so that the operation can be properly carried out. Switching refers to whether the 
caller must run over the real-time thread context (we call it "primary" mode), or 
may or should run over Linux directly (i.e. "secondary" mode). A terse explanation 
of the various syscall mode bits is available in include/asm-generic/syscall.h 
(i.e. __xn_exec_lostage and friends). Messing with the mode bits is the first and 
likely only cause of strange failures; be careful when setting them.

In order to issue the syscalls from user-space that will end up calling the 
routines listed in the syscall table, you will need to use the XENOMAI_SKINCALL 
macros available from include/asm-*/syscall.h depending on your arch. Have a look 
at src/skins/uvm/uvm.c to get an example of implementation. Before those syscalls 
could be invoked, your user-space program must bind to the registered skin in 
kernel space, which means getting back its internal id, so that such id could be 
specified in subsequent syscalls. This work is done in src/skins/uvm/init.c; 
intelligent paste/copy of that file will lead you rather easily to something 
working. Make sure to properly differentiate XENOMAI_SYSCALL and XENOMAI_SKINCALL. 
The former runs internal Xenomai syscalls setting up the environment for your 
application; the latter refers to the syscalls you added by mean of registering a 
new skin module.

There is no much more documentation than that for now, I'm afraid.

HTH,

-- 

Philippe.


  reply	other threads:[~2006-03-16 11:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-16 10:46 [Xenomai-help] newbie question Daniele Lugli
2006-03-16 11:18 ` Philippe Gerum [this message]
2006-03-16 11:38   ` Jan Kiszka
2006-03-16 12:33     ` Philippe Gerum
  -- strict thread matches above, loose matches on Subject: below --
2007-08-06 15:15 rolfetas bambolas
2007-08-06 17:57 ` Gilles Chanteperdrix
2007-08-06 18:23   ` juanba romance
2007-08-06 19:29     ` Gilles Chanteperdrix
     [not found]       ` <e39c9190708061427y2d5ceed2td804b0990b88f282@domain.hid>
2007-08-06 21:37         ` Gilles Chanteperdrix
2007-08-06 19:27   ` Philippe Gerum
2005-10-17 18:44 [Xenomai-help] compiling xenomai on x86_64 Jan Kiszka
2005-10-17 18:57 ` Heikki Lindholm
2005-10-17 19:16   ` Jan Kiszka
2005-10-17 19:59     ` Heikki Lindholm
2005-10-17 20:04       ` Philippe Gerum
2005-10-17 20:10         ` Jan Kiszka
2005-10-17 20:17           ` Philippe Gerum
2005-10-17 20:26             ` Philippe Gerum
2005-10-17 21:37               ` Jan Kiszka
2005-10-18  8:07                 ` Jan Kiszka
2005-10-18 17:49                   ` Gilles Chanteperdrix
2005-10-18 18:29                     ` Jan Kiszka
2005-10-18 19:20                       ` Gilles Chanteperdrix
2005-10-18 19:24                         ` Jan Kiszka
2005-10-18 19:34                           ` Gilles Chanteperdrix
2005-10-18 19:43                             ` Jan Kiszka
2005-10-19  8:37                               ` Jan Kiszka
2005-10-19 17:15                                 ` [Xenomai-help] newbie question Ignacio García Pérez
2005-10-19 17:34                                   ` Jan Kiszka
2005-10-19 17:44                                   ` Philippe Gerum
2005-10-19 18:16                                     ` Gilles Chanteperdrix
2005-10-19 18:31                                       ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=441949A0.8060100@domain.hid \
    --to=rpm@xenomai.org \
    --cc=daniele.lugli@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.