segfault with outb() in RTAI/fusion
Hannes Mayer
h.mayer at inode.at
Wed Jul 13 23:12:08 CEST 2005
Vincent Levesque wrote:
> Hi Philippe,
>
> Yes, I do check the return value of iopl(3) and it seems ok. I did a few
> more tests since sending that email:
>
> 1. I switched to linux 2.6.12-adeos-r12c3 and fusion 0.8.2.
> 2. I switched from C++ to C.
> 3. I cleaned up my code and wrote a minimal app that causes the failure.
>
> For some reason, I now get the segfault for all addresses of my IO cards
> (base addresses: 0x220, 0x240, io offset range: 0x00-0x1F, 0x400-0x411).
> The segfault now occurs only after the first call to
> rt_task_wait_period(). Interestingly, I don't get segfaults if I call
> iopl(3) after every rt_task_wait_period(). Is that a solution or will
> that throw my app into secondary mode on every cycle?
>
> I'm compiling the code with "gcc -o test main.c `rtai-config
> --fusion-cflags` `rtai-config --fusion-ldflags` -lrtai" with gcc-3.3.
>
> Here's the code:
FWIW, your code works here without segfaulting:
# ./test
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
rt_task_wait_period()...
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
outb...done
rt_task_wait_period()...
[...]
Kernel 2.6.12.2
Fusion 0.8.2
adeos-linux-2.6.12-i386-r12c3.patch
Best regards,
Hannes.
More information about the Rtai
mailing list