home *** CD-ROM | disk | FTP | other *** search
- >From riku.saikkonen@compart.fi Tue Oct 18 13:01:34 EDT 1994
-
- A number of people have been asking for this...
-
- To use IO ports in C programs:
- 1. #include <asm/io.h>
- 2. Call ioperm(port,num,1) at somewhere near the start of the program
- (before accessing ports).
- 3. Access ports using value=inb(port) and outb(value,port) (note the
- order of the parameters). Look into asm/io.h for more system calls.
- 4. Call ioperm(port,num,0) at somewhere near the end of the program
- (after all port accesses).
- 5. Compile your code with -O2 or a higher number, and no -g. (Sorry, you
- can't debug...)
- 6. The executable has to be setuid root.
-
- ioperm() syntax (also see the man page):
- The first parameter is the port number to set permissions of.
- The second parameter is the number of consecutive ports to set
- permissions of (i.e. if num==3, port, port+1, and port+2 are set).
- The third parameter is 1 to give the program permissions or 0 to remove
- them.
-
- Not too difficult... By the way, if anyone wants to add this to a FAQ or
- HOW-TO, feel free (but contact me first).
-
- -=- Rjs -=- riku.saikkonen@compart.fi - IRC: Rjs
- "From cavern pale the moist moon eyes / the white mists that from earth
- arise / to hide the morrow's sun and drip / all the grey day from each
- twig's tip." - J. R. R. Tolkien
-
-
-
-
-