Inline assembly question
Basile B.
b2.temp at gmx.com
Sun Nov 12 22:00:58 UTC 2017
On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar
wrote:
> On Sunday, 12 November 2017 at 18:48:02 UTC, Eugene Wissner
> wrote:
>>>> https://dlang.org/spec/iasm.html#agregate_member_offsets
>>>>
>>>> aggregate.member.offsetof[someregister]
>>>
>>> Sorry I didn't phrase my question accurately. Presumably to
>>> use above with the mnemonics I would need additional mixin
>>> templates where the aggregate type and member etc would need
>>> to be parameters?
>>
>> You can use just string parameters instead of enums, then you
>> can pass arbitrary arguments to the instructions. The compiler
>> will tell you if something is wrong with the syntax of the
>> generated assembly.
>
> Okay thank you. Sigh. It would be so much simpler to be able to
> just define mnemonics for registers.
>
> Anyway, another question:
>
> Does the compiler generate appropriate unwind information on
> Win64? Prsumably if a function is marked 'naked' then it
> doesn't?
>
> Thanks and Regards
> Dibyendu
yeah about stack frame..., also don't forget to mark the asm
block "pure nothrow" if possible...
It's not documented but the syntax is like that:
```
void foo()
{
asm pure nothrow
{
naked;
ret;
}
}
```
More information about the Digitalmars-d-learn
mailing list