On Thu, 31 May 2007 08:44:33 +0400 Eygene Ryabinkin <[EMAIL PROTECTED]> wrote, Wed, May 30, 2007 at 02:43:07AM -0400, Mike Meyer wrote:
>> I believe this should be $0x4, as you want to *set* the values, not >> get them. > Right. >> You also need to open the file "/dev/io". I believe that leaving this >> file open for anything more than a handful of instructions would be a >> bad thing, but I'm not going to verify it. > I feel that the i386_set_ioperm directly manipulates the task's I/O > bitmap referenced by the task state segment (TSS), so you don't > need to mangle with /dev/io. /dev/io itself is the higher-level > semi machine-indenepdent abstraction. Opening /dev/io grants the > global access to all ports, while using i386_set_ioperm gives the > fine-grained access. When you closing /dev/io, the port I/O access > is revoked. > To summarise: either you open /dev/io and do all your port I/O as > in the good old days of the real-mode programs, or you're using > i386_set_ioperm to obtain the access permissions to the I/O port > range and again, do all port I/O as usual. i rewrote my code and this time, all works fine. thanks to Mike and Eygene. here is the code as a proof of the above explanation: # test_io.S .include "system.inc" BUFSIZE = 0x80 .data params: .long 0x70,2,1,0 path: .asciz "/dev/io" .bss buffer: .fill BUFSIZE, 0 .text .global _start err: pushl $0x1 # return failure SysExit _start: addl $8,%esp # discard argc and argv[0] leal params,%eax pushl %eax pushl $4 movl $0xa5,%eax call bsd_kernel addl $12,%esp movl $0X330,%edx inb %dx,%al # if i try to read or write another port than 0x70/0x71, i have a segbus fault. leal path,%ecx pushl $0 # O_RDONLY pushl %ecx SysOpen jc err # open failed addl $8,%esp movl $0X330,%edx inb %dx,%al # all is ok! pushl $0 # return success SysExit Thanks again. Raoul [EMAIL PROTECTED] _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"