Still stuck on this dayummed keyboard issue

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
casnix
Member
Member
Posts: 67
Joined: Fri Jan 14, 2011 7:24 pm

Still stuck on this dayummed keyboard issue

Post 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.
Attachments
kb.h
(1008 Bytes) Downloaded 15 times
main.c
(4.18 KiB) Downloaded 43 times
kb.c
(5.54 KiB) Downloaded 24 times
You are a computer.
~ MCS ~
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Still stuck on this dayummed keyboard issue

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