Accessing 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
Tolga

Accessing Ports

Post by Tolga »

Hi. In my os, i did these:

- Boot loads setup.
- Setup activates A20, loads kernel, defines GDTR and enters protected mode

There is no problem. But after these, i am using "in al, 0x60" for test. There is an error. What is the problem? Simply, what i can do?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Accessing Ports

Post by Pype.Clicker »

- figure out what error it is (e.g. running the code in a bochs could help)
- figure out whether the code executed is the one you expect (e.g. trace-on in bochs debugger can help too)
- try to gather state information, e.g. the IOPL and CPL bits could be of some importance here ...
Tolga

Re:Accessing Ports

Post by Tolga »

I am testing my oses at VMware. It's showing:

"Virtual Machine Kernel Stack Fault". But it's showing this error for many error.

CPL = 0

I didn't look to IOPL.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Accessing Ports

Post by Pype.Clicker »

then it's unlikely to be anyhow related to the specific "in al,60h" instruction ... or maybe you have not-quite-perfectly-setup interrupts somewhere that could explain why VMware don't like your stack setup.

Honnestly, i experienced a similar problem once but VMware is not really helpful with its error messages, so i turned to Bochs and QEMU instead.

Maybe having a first experience with bochs instead wouldn't be a bad thing for you aswell ...
Tolga

Re:Accessing Ports

Post by Tolga »

Are you doing something for accessing to ports?

(Is error about IOPL? ) ::)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Accessing Ports

Post by Pype.Clicker »

no, afaik at CPL0, you can access any port regardless of the IOPL or IO bitmap value. As i said above, i don't think your error is about the I/O instruction: i rather expect it to be either another fault that VMware reports lately or that it is a bug in VMware itself (that is, your code would work anywhere else but for obscure reasons, it makes VMware crash)

So running your code on real hardware could check hyp. 2, and running your code in bochs will give you more hints about what might be going wrong in the case of hyp. 1.
Post Reply