On Tue, Aug 03, 2004 at 11:17:12PM +0200, Philippe Gerum wrote:
> > I thought you would have said sth to this....
> > The exception of the faults is very labyrinthic :) It goes through
> Labyrinthic would mean that many ways are possible for progressing from
> this code path including a bunch of dead ends. This is clearly not the
> case here.
sorry - there is no only one code path :) But a little bit of code and
variables are unused...Have a look at the attached patch.
> > several 'real' layers. This was needed in RTAI 3.0 and 3.1 but I think
> > If somebody has enough/too much :) time, it should be redesigned...
> > xnpod_trap_fault should be directly registered within the Adeos layer.
> Nope, it should not. You still have to deal with on-demand memory
> mappings triggering valid page faults with the "real" HAL. But you don't
Who triggers these faults? The on-demand memory mapping.
What do you mean by on-demand memory mapping? When the heap goes out of
mem? I must admit, I havn't looked at the heap implementation.
[...]
> I've something better for the TODO list. Have the following written a
> zillion times in the documentation:
>
> Good layering provides efficient structuring, bad layering is no
> layering...
Okay - I'll write this in my diploma thesis :)
Marc
P.S.: Patch tested with my skin - the nullpointer exception is detected and
the svctable.faulhandler is called.
--
#!/bin/sh
set - `type $0` 'tr "[a-zA-Z]" "[n-za-mN-ZA-M]"';while [ "$2" != "" ];do \
shift;done; echo 'frq -a -rc '`echo "$0"| $1 `'>$UBZR/.`rpub signature|'`\
echo $1|$1`'`;rpub "Jr ner fvtangher bs obet. Erfvfgnapr vf shgvyr!"'|$1|sh
Index: arch/i386/hal/hal.c
===================================================================
RCS file: /cvs/rtai/fusion/arch/i386/hal/hal.c,v
retrieving revision 1.16
diff -u -p -r1.16 hal.c
--- arch/i386/hal/hal.c 4 Aug 2004 14:48:57 -0000 1.16
+++ arch/i386/hal/hal.c 4 Aug 2004 22:41:26 -0000
@@ -831,30 +831,6 @@ static void rthal_trap_fault (adevinfo_t
{
adeos_declare_cpuid;
- static const int trap2sig[] = {
- SIGFPE, // 0 - Divide error
- SIGTRAP, // 1 - Debug
- SIGSEGV, // 2 - NMI (but we ignore these)
- SIGTRAP, // 3 - Software breakpoint
- SIGSEGV, // 4 - Overflow
- SIGSEGV, // 5 - Bounds
- SIGILL, // 6 - Invalid opcode
- SIGSEGV, // 7 - Device not available
- SIGSEGV, // 8 - Double fault
- SIGFPE, // 9 - Coprocessor segment overrun
- SIGSEGV, // 10 - Invalid TSS
- SIGBUS, // 11 - Segment not present
- SIGBUS, // 12 - Stack segment
- SIGSEGV, // 13 - General protection fault
- SIGSEGV, // 14 - Page fault
- 0, // 15 - Spurious interrupt
- SIGFPE, // 16 - Coprocessor error
- SIGBUS, // 17 - Alignment check
- SIGSEGV, // 18 - Reserved
- SIGFPE, // 19 - XMM fault
- 0,0,0,0,0,0,0,0,0,0,0,0
- };
-
/* Notes:
1) GPF needs to be propagated downstream whichever domain caused
@@ -906,10 +882,7 @@ static void rthal_trap_fault (adevinfo_t
if (rthal_trap_handler != NULL &&
test_bit(cpuid,&rthal_cpu_realtime) &&
- rthal_trap_handler(evinfo->event,
- trap2sig[evinfo->event],
- (struct pt_regs *)evinfo->evdata,
- NULL) != 0)
+ rthal_trap_handler(evinfo) != 0)
goto endtrap;
}
Index: include/nucleus/asm-i386/hal.h
===================================================================
RCS file: /cvs/rtai/fusion/include/nucleus/asm-i386/hal.h,v
retrieving revision 1.6
diff -u -p -r1.6 hal.h
--- include/nucleus/asm-i386/hal.h 3 Aug 2004 14:51:37 -0000 1.6
+++ include/nucleus/asm-i386/hal.h 4 Aug 2004 22:41:26 -0000
@@ -348,10 +348,7 @@ void rthal_set_linux_task_priority(struc
#include <linux/kernel.h>
-typedef int (*rthal_trap_handler_t)(int trapnr,
- int signr,
- struct pt_regs *regs,
- void *siginfo);
+typedef int (*rthal_trap_handler_t)(adevinfo_t *evinfo);
#define rthal_printk printk /* This is safe over Adeos */
Index: include/nucleus/asm-i386/system.h
===================================================================
RCS file: /cvs/rtai/fusion/include/nucleus/asm-i386/system.h,v
retrieving revision 1.19
diff -u -p -r1.19 system.h
--- include/nucleus/asm-i386/system.h 4 Aug 2004 14:49:12 -0000 1.19
+++ include/nucleus/asm-i386/system.h 4 Aug 2004 22:41:27 -0000
@@ -752,16 +752,13 @@ void xnpod_schedule_handler(void);
static rthal_trap_handler_t xnarch_old_trap_handler;
-static int xnarch_trap_fault (int vector,
- int signo,
- struct pt_regs *regs,
- void *dummy)
+static int xnarch_trap_fault (adevinfo_t *evinfo)
{
xnarch_fltinfo_t fltinfo;
- fltinfo.vector = vector;
- fltinfo.errcode = regs->orig_eax;
- fltinfo.regs = regs;
+ fltinfo.vector = evinfo->event;
+ fltinfo.errcode = ((struct pt_regs *)evinfo->evdata)->orig_eax;
+ fltinfo.regs = (struct pt_regs *)evinfo->evdata;
return xnpod_trap_fault(&fltinfo);
}