Managing Ports

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Managing Ports

Post 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
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Managing Ports

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Thanks for that - I'll have a look at that section.

Adam
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Re: Managing Ports

Post 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.
Post Reply