Far jump to code segment with D inline assembler

Alexander Panek alexander.panek at brainsware.org
Mon Mar 12 21:24:44 PDT 2007


Hello,

I am just doing some R&D regarding low level development with D. Due to the
multiboot standard, and the weird things you have to do at bootup on the x86
architecture, one has to perform a far jump to a specific code segment given
as an offset to the prior registered GDT. Now, with nasm/Intel syntax, you
can just do:

/+ ... +/
jmp 0x08:flush

flush:
/+ ... +/

.. in D, my brain tells me, the syntax would theoretically look like this:

void flush ( )

    asm {
        naked;

        /+ ... +/
        jmp int far ptr 0x08:flush;

        flush:
            /+ ... +/

        ret;
    }
}

Yet, the compiler (1.009) yells at me, that either the operand size for
`jmp` is wrong, or it would have expected nops instead of the jump
statement.

Any advice one could give?

Thanks in advance, and best regards,
Alex






More information about the Digitalmars-d-learn mailing list