On Tue, 20 Oct 2009 18:45:50 +0300, sprucely <[email protected]> wrote:
This works with g++ and inline ATT assembly, but I have had no such luck
in D. I have many simple functions that need to be executed sequentially
and have identical stack frames. To avoid the overhead of setting up and
tearing down the stack frames I want to jmp from the body of one
function to the body of the next. A simplified example...
extern(C) byte jumpHere;
byte* jumpTo = &jumpHere;
void f1()
{
asm
{
//jmp dword ptr jumpTo;
mov EAX, jumpTo;
jmp EAX;
//jmp [EAX]
}
}
void f2()
{
asm{jumpHere:;}
}
No matter what I try I get a segfault. My assembly skills are very
limited. I'm not using the naked keyword yet, because I want to get a
proof-of-concept working first. Anyone see anything wrong with this? Any
suggestions?
Just disassemble the resulting machine code and look at what's going on.
--
Best regards,
Vladimir mailto:[email protected]