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.
blackoil wrote:Then I use lodsb instead, no page fault though
Maybe the page is read-only? The error code from the page fault (pushed on the page fault handler's stack by the CPU) should tell you the cause...
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.
Ok, first is the code snippet what you are actually using to read the data? Because it seems that you are reading the data to address 0, which is usually not what you want.
Second check the address that the page fault occurs at and check that you have mapped it in.
Afik, the instruction LODSB reads a byte from memory into eax, so it is probebly not what you want to do for port reads.
I suggest using the Bochs Debugger and breaking the program at the "rep insw" and doing a page table dump (type 'info tab' at the bochs prompt) then stepping through the code ('s') until you reach the page fault. Then check if this address is actually mapped into your address space.
If you can't figure out the error then please give us the address the error occured at, the paging dump, a register dump ('r') and the exact source code that causes the error. (i.e. an unedited snippet)