The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: nemesis9 on August 06, 2007, 06:01:58 AM

Title: long jump after lgdt instruction
Post by: nemesis9 on August 06, 2007, 06:01:58 AM
I've just executed the lgdt instruction.  I need to code the long jump immediately following that, how do I do it?

for example:
                           lgdt gdt_descriptor
                           jump far ptr LONG_JUMP_TO_HERE    <- this doesn't assemble

LONG_JUMP_TO HERE:   mov eax, 018h
                                   mov ds, eax
                                   ...

if I code it as 'jmp LONG_JUMP_TO_HERE'   it will assemble but it wont give me the 0EAh opcode with the cs:dword address that is necessary.
I've tried all kinds of syntax with no luck.   
Thanks.


Title: Re: long jump after lgdt instruction
Post by: Tedd on August 06, 2007, 12:09:57 PM
http://support.microsoft.com/kb/49900
and/or
http://www.phatcode.net/res/224/files/html/ch09/09-07.html
(see LISTING 9.7)

Although, if you've just loaded the gdt, you'll probably want to jump to one of your newly defined segments, so that won't help you much anyway. You'll need to code in the jump yourself, with the correct new cs value (usually 8, depending how you've set out your gdt) and the offset of the location within that segment (not the segment you're jumping from.)