Ok Guys

>From user space

try this

#include <linux/kernel.h>
#include <linux/version.h>
#include <unistd.h>
#include <asm/io.h>

#define SER_PORT 0x02f8

main()
{
   int i,n;
   ioperm(SER_PORT,10,3);
   for (i = 0; i < 100; i++)
      n = inb(SER_PORT);

}

This will STILL core dump unless you run as root

works on 2.0.36 and 2.2.9

try...
        man iopl
        man ioperm


regards
   Phil Wilshire


Arturo Espinosa Soley wrote:
> 
> > You should add -O2 option during compile your program.
> > Example: cc -O2 -o example example.c
> 
> Adolf, this is my command line,
> gcc -o artur -O2 -I/usr/src/linux/include/linux artur.c
> 
> >       im getting this message (segmentation fault) when i try to run a
> > program
> >       with a simple
> >
> >       readb(0x02f8)
> >
> >       in it.
> 
> and this is the program
> 
> #include <linux/kernel.h>
> #include <linux/version.h>
> #include <linux/cons.h>
> #include <asm/io.h>
> 
> #define SER_PORT 0x02f8
> 
> main()
> {
>    int i,n;
> 
>    for (i = 0; i < 100; i++)
>       n = readb(SER_PORT);
> 
> }
> 
> >
> >       whats wrong?
> >
> >       thanks,
> >       Art.
> 
> --- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> ----
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/~rtlinux/
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to