Page 1 of 1

Jumping to CS defined thro LDT

Posted: Thu Mar 22, 2007 6:37 am
by sampath
Hi,
I have a CS/DS/SS segment defined through LDT.I hav loaded the LDTR with GDT index of the LDT descriptor.Loaded the DS,SS values with TI = 1.Then I am pushing the Code segment selector with TI =1 into stack and ip and try to do retf..it says 'invalid opcode' .

Can any one help in this regard ?

Thanks & Regards,
Sampath S

Posted: Thu Mar 22, 2007 6:48 am
by os64dev
don't do a retf but a far jump ljmp and use the new cs width TI=1 as your selector.

Posted: Thu Mar 22, 2007 7:33 am
by sampath
Hi..
Thx 4 the reply...

I have tried with jmp CS:EIP with ti = 1,still the result is same.i get invalid opcode

Posted: Thu Mar 22, 2007 9:22 am
by AJ
Hi,

Every time I have had this problem, it has been either a misaligned stack, or overrunning the stack.

* Are you mixing privilege levels? If so, have you included your ss3 and esp3 on the return stack?
* Is the same LDT present in the process you are jumping from and to?
* If you are using Bochs, does it look like all the segment registers, EIP and ESP are in a sensible place when the crash happens?

Cheers,
Adam