Kernel error

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
KieranFoot

Kernel error

Post by KieranFoot »

Hi guys, exactly what does the below error mean?
What could cause this error?

check_cs: non-conforming code seg descriptor dpl != cpl
nick8325
Member
Member
Posts: 200
Joined: Wed Oct 18, 2006 5:49 am

Re:Kernel error

Post by nick8325 »

I think it means that you've done a FAR CALL from a user mode segment to a kernel mode segment, or something like that. The only way (on 386 at least) to switch between rings is to use an INT or IRET or JMP to a call gate or task gate or TSS (apparently).
KieranFoot

Re:Kernel error

Post by KieranFoot »

Im not using privelage levels ata all, everything is Ring0.... ???
This error occurs only when i turn multitasking on, so could it by my setjump & longjump routines arent saving the privalege levels???
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Kernel error

Post by Pype.Clicker »

maybe you didn't made any "far call" nor did you defined different level of priviledges. Yet by e.g. returning from an interrupt, the cpu load new values to some segment registers ... and if something went wrong with the stack pointer, you might very well pop garbage into segment registers...

i suggest you set a breakpoint at your "longjmp" implementation and follow carefully step by step what's going on from there...
KieranFoot

Re:Kernel error

Post by KieranFoot »

Well it seems that somehow SP has been zeroed ???
KieranFoot

Re:Kernel error

Post by KieranFoot »

exception 14... My exception handler is not catching it!
paulbarker

Re:Kernel error

Post by paulbarker »

Well of course its not catching it if you have an invalid stack... I take it you're getting a triple fault?

You need to find out why SP is getting zeroed, I do have a couple of suggestions though:

- Are you properly handling the error codes passed by some exceptions? (meaning removing the error code from the stack before IRET).

- Does the order of the registers stored on the stack match the order they are reloaded, and the order they are given in a C structure (if you manipulate them through a C structure).

- (The most likely cause) Are you setting ebp = esp for a new thread? If not a C function may store the value in ebp to esp when it enters (or leaves, I dont know) a stack frame.
KieranFoot

Re:Kernel error

Post by KieranFoot »

well no, EBP is in the stack range of thew kernel/idle task
B.E

Re:Kernel error

Post by B.E »

I may be because you've miss type the segment value in the jump call.

can you post the GDT and where you make the jump? also can you post the value of the registers when the error occurs
Post Reply