To try to be sure I had the correct syntax I tried the -S option of g++ along with a switch for intel syntax to output the assembly. However the portion corresponding to the inline assembly was still in ATT syntax.
For my resulting D executable I tried using hte, but it would abort after mentioning something about a nonexistent htcfg file. I didn't find much info after a cursory search. I gave up easily because I wasn't sure if I would be able to make proper use of it. Maybe I should take an x86 assembly course. Vladimir Panteleev Wrote: > 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]
