k_printf causes a page fault

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
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

k_printf causes a page fault

Post by earlz »

I have a bug free k_printf working and it works everywhere except for when i decide to put it in my getkey code
I have debugged my keyboard isr but i just can't seem to get the getkey to stay in a loop until you input a key
here is my problem code

Code: Select all


sasc getkey(void){
	sasc ret_key;
	for(;;){ //loop until..
            if ((volatile)keycount!=0){k_printf("break");break;} //there is a key in the buffer, printf causes page fault
			key_back(); //this is to do stuff in background when waiting for key
		
	}

	keycount--;
	ret_key.scan=keys[keycount];
	keycount--;
	ret_key.asc=keys[keycount];
	

	
	return ret_key;
}
blackcatcoder
Member
Member
Posts: 132
Joined: Wed Nov 03, 2004 12:00 am
Location: Austria
Contact:

Re: k_printf causes a page fault

Post by blackcatcoder »

hmm...

try to debug the ss and esp register !

Which scheduleing do you use (tss or software)
Are you handling dpls ?

Can the isr be called from user code ? (RING 3)
If it is a ring3 interrupt check the rights of the task
and set the register correct before you do anything
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: k_printf causes a page fault

Post by earlz »

how would you go about debugging the esp register(ss stays constant currently)
i dont have anything besides ring3 and no secheduling, im still trying to get the keyboard driver working.
blackcatcoder
Member
Member
Posts: 132
Joined: Wed Nov 03, 2004 12:00 am
Location: Austria
Contact:

Re: k_printf causes a page fault

Post by blackcatcoder »

can you post the isr with the asm code if there is one?

if there is a mem address in esp beyond a page marked useable then you get a page fault!
Post Reply