Hi guys, exactly what does the below error mean?
What could cause this error?
check_cs: non-conforming code seg descriptor dpl != cpl
Kernel error
Re:Kernel error
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).
Re:Kernel error
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???
This error occurs only when i turn multitasking on, so could it by my setjump & longjump routines arent saving the privalege levels???
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel error
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...
i suggest you set a breakpoint at your "longjmp" implementation and follow carefully step by step what's going on from there...
Re:Kernel error
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.
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.
Re:Kernel error
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
can you post the GDT and where you make the jump? also can you post the value of the registers when the error occurs