Re: Inline assembly question

2017-11-13 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Monday, 13 November 2017 at 18:40:42 UTC, Basile B. wrote: TBH I wonder if this is not worth a enhancement (or even a DIP) to have in asm blocks a special alias syntax... { asm { version(...) { alias First = RDI; alias Second = RSI;

Re: Inline assembly question

2017-11-13 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Sunday, 12 November 2017 at 22:40:06 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 22:00:58 UTC, Basile B. wrote: no in naked mode you have to save and restore by hand. So how does one manually generate the .pdata and .xdata sections? Are you saying that this is what I

Re: Inline assembly question

2017-11-13 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 12 November 2017 at 22:20:46 UTC, Dibyendu Majumdar no in naked mode you have to save and restore by hand. Note that in Win64 even if not naked, you'll have to save/restore some registers like XMMx with x >= 6. Another question - how can I tell DMD to no generate the frame

Re: Inline assembly question

2017-11-13 Thread Guillaume Piolat via Digitalmars-d-learn
On Monday, 13 November 2017 at 18:40:42 UTC, Basile B. wrote: TBH I wonder if this is not worth a enhancement (or even a DIP) to have in asm blocks a special alias syntax... { asm { version(...) { alias First = RDI; alias Second = RSI; //

Re: Inline assembly question

2017-11-13 Thread Basile B. via Digitalmars-d-learn
On Monday, 13 November 2017 at 18:40:42 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: [...] TBH I wonder if this is not worth a enhancement (or even a DIP) to have in asm blocks a special alias syntax... { asm { version(...)

Re: Inline assembly question

2017-11-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: Hi, I have recently started work on building a VM for Lua (actually a derivative of Lua) in X86-64 assembly. I am using the dynasm tool that is part of LuaJIT. I was wondering whether I could also write this in D's inline

Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Sunday, 12 November 2017 at 22:24:08 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 22:20:46 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 22:00:58 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar I am not sure I have understood

Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Sunday, 12 November 2017 at 22:00:58 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar Does the compiler generate appropriate unwind information on Win64? Prsumably if a function is marked 'naked' then it doesn't? yeah about stack frame..., also don't

Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 22:20:46 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 22:00:58 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 21:27:28 UTC, Dibyendu Majumdar I am not sure I have understood above; will DMD generate the right Win64 unwind info for this

Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
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

Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn
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

Re: Inline assembly question

2017-11-12 Thread Eugene Wissner via Digitalmars-d-learn
On Sunday, 12 November 2017 at 15:25:43 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 12:32:09 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 12:17:51 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner wrote: [...] Thank you - I

Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Sunday, 12 November 2017 at 12:32:09 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 12:17:51 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner wrote: [...] Thank you - I probably could use something like this. It is uglier than the simpler

Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 12:17:51 UTC, Dibyendu Majumdar wrote: On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner wrote: [...] Thank you - I probably could use something like this. It is uglier than the simpler approach in dynasm of course. How about when I need to combine

Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:55:23 UTC, Eugene Wissner wrote: On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: I have recently started work on building a VM for Lua (actually a derivative of Lua) in X86-64 assembly. I am using the dynasm tool that is part of LuaJIT. I

Re: Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Sunday, 12 November 2017 at 12:00:00 UTC, Basile B. wrote: On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: [...] The assembly code uses static allocation of registers, but because of the differences in how registers are used in Win64 versus Unix X64 - different

Re: Inline assembly question

2017-11-12 Thread Eugene Wissner via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: Hi, I have recently started work on building a VM for Lua (actually a derivative of Lua) in X86-64 assembly. I am using the dynasm tool that is part of LuaJIT. I was wondering whether I could also write this in D's inline

Re: Inline assembly question

2017-11-12 Thread Basile B. via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: Hi, [...] The assembly code uses static allocation of registers, but because of the differences in how registers are used in Win64 versus Unix X64 - different registers are assigned depending on the architecture. dynasm

Re: Inline assembly question

2017-11-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 12 November 2017 at 11:01:39 UTC, Dibyendu Majumdar wrote: Hi, I have recently started work on building a VM for Lua (actually a derivative of Lua) in X86-64 assembly. I am using the dynasm tool that is part of LuaJIT. I was wondering whether I could also write this in D's inline

Inline assembly question

2017-11-12 Thread Dibyendu Majumdar via Digitalmars-d-learn
Hi, I have recently started work on building a VM for Lua (actually a derivative of Lua) in X86-64 assembly. I am using the dynasm tool that is part of LuaJIT. I was wondering whether I could also write this in D's inline assembly perhaps, but there is one aspect that I am not sure how to