Page 1 of 1

Still stuck on this dayummed keyboard issue

Posted: Sun Jan 29, 2012 2:54 pm
by casnix
I made a previous topic here about this same problem in May, and considering the age of that topic and the persistence of this problem, I'm making a new topic.
They way I have my KB isr set up is:
Write scancode to two different buffers
getch functions check for content of the buffers, and if either one is empty, return -'1';
If not empty, return the last char in the buffers.

This works fine and dandy in kernel mode, but the moment I travel to user_land, I hit a page fault. Two, actually. At least now I'm getting an error instead of a frozen box >:/. But anyhow could someone look over my code and help me understand why this is happening?

The full source is at github, http://github.com/casnix/trollos, or the files I think are concerned are attached.

Re: Still stuck on this dayummed keyboard issue

Posted: Sun Jan 29, 2012 5:40 pm
by Brendan
Hi,
casnix wrote:This works fine and dandy in kernel mode, but the moment I travel to user_land, I hit a page fault.
When a page fault occurs the CPU gives you the address of the instruction that caused the fault (in the interrupt handler's "return CS:EIP"), an error code that describes the problem (e.g. if the page fault was caused by a write to a not present page, a read from a supervisor only page, etc), and it also sets CR2 to the address that the faulty instruction tried to access.

If you listen to what the CPU tells you, it should be very easy to figure out exactly what happened.


Cheers,

Brendan