I want to make a task switch in my os, the selector for the TSS is in a int "selector". I tryed the following methods:
1. asm("ljmp *(_selector)");
2. asm(".intel_syntax");
asm("ljmp _selector");
asm("att_syntax");
When i disassamble with ndisasm it shows:
jmp far [0x12757]
what i want is of course jmp far 0x12757 (0x12757 is the address to selector).
How to do this?? Please HELP!!!
how to use ljmp in gcc with indirect address??
Re:how to use ljmp in gcc with indirect address??
I think LJMP requires two operands: one for the code selector, and one for the offset address. In your case, the offset address would be zero.
Re:how to use ljmp in gcc with indirect address??
Yes, on a direct jump, but i want to make a indirect jump, so i should specify a memory location wich contains the seg:offset pair.... (offset is ignored when jumping to a TSS they write in the Intel manual)
Re:how to use ljmp in gcc with indirect address??
even though it is ignored, you must still specify it.still Unknown wrote: Yes, on a direct jump, but i want to make a indirect jump, so i should specify a memory location wich contains the seg:offset pair.... (offset is ignored when jumping to a TSS they write in the Intel manual)
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:how to use ljmp in gcc with indirect address??
<intel syntax>
loads CS with 0x1234 and eip with 0x5678abcd.
looks up a dword:word memory location and loads CS with the word located at 0x12345678+4 and eip with the dword located at 0x12345678 ...
Check intel manual volume 2 for more info.
Code: Select all
jmp far 0x1234:0x5678abcd
Code: Select all
jmp far [0x12345678]
Check intel manual volume 2 for more info.