Jumping to CS defined thro LDT

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
sampath
Posts: 18
Joined: Wed Dec 20, 2006 4:00 am

Jumping to CS defined thro LDT

Post 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
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Post by os64dev »

don't do a retf but a far jump ljmp and use the new cs width TI=1 as your selector.
Author of COBOS
sampath
Posts: 18
Joined: Wed Dec 20, 2006 4:00 am

Post 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
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post 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
Post Reply