Page 1 of 1

Accessing Ports

Posted: Mon Feb 06, 2006 9:56 am
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?

Re:Accessing Ports

Posted: Mon Feb 06, 2006 10:16 am
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 ...

Re:Accessing Ports

Posted: Mon Feb 06, 2006 10:36 am
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.

Re:Accessing Ports

Posted: Mon Feb 06, 2006 10:45 am
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 ...

Re:Accessing Ports

Posted: Mon Feb 06, 2006 12:12 pm
by Tolga
Are you doing something for accessing to ports?

(Is error about IOPL? ) ::)

Re:Accessing Ports

Posted: Tue Feb 07, 2006 3:54 am
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.