[Issue 1829] Inline assembler cannot get label addresses
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 10 12:45:13 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1829
------- Comment #3 from burton-radons at shaw.ca 2008-03-10 14:45 -------
That's a bizarre workaround. If I needed to get the address of a block of code
(such as an exception handler) I'd have to do something like this:
call grab_exception_handler_address; // Grab the exception handler and put it
in EAX.
...
grab_exception_handler_address:
// Try to make it as thread-safe as possible to tell the exception handler
we're pulling an address.
mov EAX, 0xDEADBEEF;
mov ECX, 0xBEEFDEAD;
mov EDX, 0x12345678;
call exception_handler;
mov EAX, [ESP];
ret;
exception_handler:
test EAX, 0xDEADBEEF;
jne exception_handler_body;
test ECX, 0xBEEFDEAD;
jne exception_handler_body;
test EDX, 0x12345678;
jne exception_handler_body;
// Pulling an address, do nothing.
ret;
exception_handler_body:
// Actually calling the exception.
I don't know that I'd call that "straightforward", but I understand you being
limited by your code.
--
More information about the Digitalmars-d-bugs
mailing list