From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Gabriele Moabiti <gabmoa@domain.hid>
Cc: Xenomai help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] trap exceptions in user
Date: Wed, 08 Oct 2008 12:09:02 +0200 [thread overview]
Message-ID: <48EC86BE.3010308@domain.hid> (raw)
In-Reply-To: <296620.67855.qm@domain.hid>
Gabriele Moabiti wrote:
Please do not drop the list from the CC.
> The asm x86 code is a "legacy" code developed in x86 plain binary asm
> (written with tasm and can't be re-written of course)
I do not understant the "of course". If this is assembly, then run a
disassembler and you will get the source.
> with fixed addresses for data and code (I'll call SIS in the follow).
> When one of the follow exception occurred
>
> * 0x00 Divide by zero
> * 0x01 Debug exception
> * 0x03 Int3
> * 0x04 Overflow
> * 0x05 Array bounds check
> * 0x06 Illegal Opcode
> * 0x07 FPU not available
> * 0x08 Double fault
> * 0x09 Coprocessor segment overrun
> * 0x0a Invalid task state
> * 0x0b Segment not present
> * 0x0c Stack exception
> * 0x0d General Protection Fault
> * 0x0e Page fault
> * 0x0f Reserved
> * 0x10 Coprocessor error
>
> SIS expects some custom actions (set internal flags, save errors and so on).
>
> I have mapped SIS in a kernel module and mapped to user space with xenomai.
> Now I though to execute SIS in ring 3 (as rt task) and trap the exceptions at ring 0 (always inside real time constraints).
>
> The result should be
>
> <C code>
> <set custom exceptions>
> <SIS code>
> <set default exceptions>
> <C code>
>
> In the "C code" part I'll use rtnet.
I think you are traping yourself with impossible constraints.
Anyway, the only way is register a custom exception handler using rthal
functions. In your trap handler, you may wake up a user-space server
thread which role is to handle exceptions (in user-space). This means that:
- upon exception, you have a switch to the user-space server thread
context, this will be slow;
- you have to rewrite the exception handling code, you can not rely
on the exception handling code that was written in the assembly blob.
I do not think it is a good idea to simply override the exception
vectors, the kernel uses them, and you certainly want the kernel to
continue working.
--
Gilles.
next parent reply other threads:[~2008-10-08 10:09 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <296620.67855.qm@domain.hid>
2008-10-08 10:09 ` Gilles Chanteperdrix [this message]
2008-10-24 19:17 [Xenomai-help] trap exceptions in user Gabriele Moabiti
2008-10-26 23:49 ` Gilles Chanteperdrix
-- strict thread matches above, loose matches on Subject: below --
2008-10-24 15:30 Gabriele Moabiti
2008-10-24 13:53 Gabriele Moabiti
2008-10-24 17:43 ` Gilles Chanteperdrix
2008-10-24 17:44 ` Gilles Chanteperdrix
2008-10-15 15:30 Gabriele Moabiti
2008-10-15 15:39 ` Jan Kiszka
2008-10-14 10:01 Gabriele Moabiti
2008-10-14 10:21 ` Jan Kiszka
2008-10-14 12:13 ` Gilles Chanteperdrix
2008-10-13 9:55 Gabriele Moabiti
2008-10-11 19:32 Gabriele Moabiti
2008-10-11 19:34 ` Gilles Chanteperdrix
2008-10-11 21:35 ` Philippe Gerum
2008-10-10 17:57 Gabriele Moabiti
2008-10-10 16:02 Gabriele Moabiti
2008-10-10 16:04 ` Gilles Chanteperdrix
2008-10-11 11:24 ` Gilles Chanteperdrix
2008-10-10 15:24 Gabriele Moabiti
2008-10-10 15:38 ` Gilles Chanteperdrix
2008-10-10 13:50 Gabriele Moabiti
2008-10-10 14:00 ` Gilles Chanteperdrix
2008-10-08 11:32 Gabriele Moabiti
2008-10-08 12:29 ` Gilles Chanteperdrix
2008-10-08 10:34 Gabriele Moabiti
2008-10-08 10:50 ` Gilles Chanteperdrix
2008-10-03 12:30 Gabriele Moabiti
2008-10-03 14:58 ` Gilles Chanteperdrix
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=48EC86BE.3010308@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=gabmoa@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.