segfault with outb() in RTAI/fusion

Philippe Gerum rpm at xenomai.org
Wed Jul 13 23:34:11 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

No, there must be something else to fix or do differently.

> or will 
> that throw my app into secondary mode on every cycle?
> 

Yes, it would.

> I'm compiling the code with "gcc -o test main.c `rtai-config 
> --fusion-cflags` `rtai-config --fusion-ldflags` -lrtai" with gcc-3.3.

Just for the purpose of chasing this issue, could you apply and check 
your program with this patch applied (i.e. it's _not_ how this should 
work since the following patch will also reintroduce some latency):

--- include/nucleus/asm-i386/system.h~	2005-07-10 12:51:38.000000000 +0200
+++ include/nucleus/asm-i386/system.h	2005-07-13 23:30:48.000000000 +0200
@@ -254,6 +254,7 @@

      __switch_threads(out_tcb,in_tcb,outproc,inproc);

+#if 0
      if (xnarch_shadow_p(out_tcb,outproc)) {

          /* Eagerly reinstate the I/O bitmap of any incoming shadow
@@ -284,6 +285,7 @@
              }
          }
      }
+#endif

      stts();
  }

-- 

Philippe.




More information about the Rtai mailing list