Your just not getting the points mentioned throughout this thread. Above all, with the points you've agreed that is correct, the pseudo code doesn't make sense.JAAman wrote: dont tell me im assuming something that i didnt even think about -- you obviously didnt get what i meant
what i meant is in my OS, there is only 2 possible CS values (say 0x10 (kernel CS) and 0x1B (user CS --entry 0x18+ring3) -- it would be easy to change this -- or add more CS values for rings 1&2)
then you try:
if (esp+8) == 0x10
call withErrorCode
if (esp+8) == 0x1B
call withErrorCode
call withoutErrorCode // if you get here, then it cannot be CS
What you've given us here assumes when theres no error code, [esp+8h] should be the return segment. This is based on your default procedure: call withoutErrorCode and that your checking [esp+8h] is corresponding to a specific segment to determin when theres an error code, which is logically all wrong. We know that when theres no error code [esp+8h] should be EFLAGS, so this conflicts with your pseudo's logic to detect error/no error code. The pseudo before hand, also checks if that corresponds with a specific ring0 segment to determin if theres an error code (for the ring3, hold your horses, I will say something about this after), really what is the differnts to what I stated which I think your assuming?
As for the pseudo: if (esp+8) == 0x1B that checks if its a specific ring3 segment, now why would do this and call withErrorCode when we know that only ring0 can software interrupt and that rings 1, 2, and 3 can only generate exceptions ?, while for exception cases whether it has an error code or not depends on the which exception where when theres none I can just push a fake error code, because even in a software generated case theres none.