Page 1 of 1

Managing Ports

Posted: Wed Apr 11, 2007 5:19 am
by AJ
Hi,

I am on the part of my OS where I am trying to manage ports using a device manager (in its own separate task space at present). I am currently running this device manager at CPL=3.

So, when I launch the device manager, I set IOPL to 3, whereas normally, IOPL=0 for my user tasks.

The thing is, I would expect a port read to cause a GPF exception in ring 3 when IOPL=0, but in Bochs, I get the error message:

Code: Select all

allow_io(): TR:io_base (0) <= 103
I have tried setting my TSS limit higher. I have been setting the IO Map field of my TSS to NULL, but have even tried creating a zeroed IO Map and I still get the same error message.

Can anyone help?

Thanks,
Adam

Re: Managing Ports

Posted: Wed Apr 11, 2007 7:38 am
by Brendan
Hi,

To make sure that no I/O permission bitmap (in the TSS) is used, you need to make the I/O bitmap base address greater than or equal to the TSS limit.

Basically, just put the value 0xFFFF at offset 0x66 in your TSS...

BTW for the I/O permission bitmap, '0' means allow access to the I/O port and '1' means don't allow access. Filling an I/O permission bitmap with zero will allow everything.

Also note that for some reason the information about the I/O permission bitmap is in Intel's "Basic Architecture" manual and not in the "System Programming Guide". I have no idea why (seems like it's in the wrong place to me)...


Cheers,

Brendan

Posted: Wed Apr 11, 2007 8:11 am
by AJ
Thanks for that - I'll have a look at that section.

Adam

Re: Managing Ports

Posted: Thu Apr 12, 2007 8:23 am
by Jeko
AJ wrote:Hi,

I am on the part of my OS where I am trying to manage ports using a device manager (in its own separate task space at present). I am currently running this device manager at CPL=3.

So, when I launch the device manager, I set IOPL to 3, whereas normally, IOPL=0 for my user tasks.

The thing is, I would expect a port read to cause a GPF exception in ring 3 when IOPL=0, but in Bochs, I get the error message:

Code: Select all

allow_io(): TR:io_base (0) <= 103
I resolved this error by setting to 1 all bits in the TSS's io map.