August 15, 2005
Hello,
I'm trying to use D to setup a GDT for some low level code, as in:
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.learn/834. However, in
trying to do this, I can't seem to refer to any labels. Here's what I'm trying
to do:

void flushGDT()
{
asm
{
lgdt [gp];
mov AX, 0x10;
mov DS, AX;
mov ES, AX;
mov FS, AX;
mov GS, AX;

push 0x08;
push flush;      //also tried 'push [flush]'
ret;

flush: nop;
}
}

The compiler says "unidentified identifier 'flush'". The only other reference to anything like this which I could find was the following post in the D archives, which seemed to think that the behavior was a bug.

>
> D - [BUG] Labels can't be moved, pushed, etc. in asm block
>
> The following codes cause a compile error "undefined identifier 'LABEL'".
> 
> asm {
> LABEL: mov EAX, offset LABEL;
> push offset LABEL;
> lea EAX, LABEL;
> }
> 
> and so on.
> 
> Robert (Japanese)"

So, is this a bug in the compiler? Is what I'm trying to do even valid? I'm not really an asm expert, I'm just trying to get code from http://www.osdever.net/bkerndev/index.php?the_id=90 working in D.

Thanks for any help anybody can give me!

-Jon Andrew