D - asm (in/out) don't work on DMD (0.71) Linux
- Mike Wynn (20/20) Sep 07 2003 I've checked the doc's the x86opcodes in and out do not work in inline a...
- Riccardo De Agostini (5/13) Sep 08 2003 asm.
- Mike Wynn (12/30) Sep 08 2003 as I've been using gas I'm getting very confused over which way
- Walter (1/1) Sep 08 2003 It's a bug, I'll take care of it. Thanks!
- Riccardo De Agostini (11/13) Sep 09 2003 I too get confused when I use gas; too much sniffing gives me bad headac...
- Mike Wynn (6/25) Sep 09 2003 I had hoped you where right too, .... took me a long time to realise
- Sean L. Palmer (14/19) Sep 09 2003 Check the precedence for operator & versus operator !=. This is hard to...
- Fabian Giesen (4/10) Sep 11 2003 The first C compilers didn't have || and &&, you used the normal binary
- Walter (4/6) Sep 10 2003 The rule the D inline assembler uses is it follows the format in the Int...
I've checked the doc's the x86opcodes in and out do not work in inline asm. void io_outp( ushort port, ubyte v ) { asm { mov DX, port; mov AL, v; out AL, DX; } } has to be rewritten as void io_outp( ushort port, ubyte v ) { asm { mov DX, port; mov AL, v; db 0xEE; // out AL, DX; } } outsb/w/d work. as in/out are D keywords I think the inline asm for in/out should be inb, inw, ind, outb, outw, outd (I did try this as some asm's support them)
Sep 07 2003
"Mike Wynn" <mike l8night.co.uk> ha scritto nel messaggio news:bjfob0$chd$1 digitaldaemon.com...I've checked the doc's the x86opcodes in and out do not work in inlineasm.void io_outp( ushort port, ubyte v ) { asm { mov DX, port; mov AL, v; out AL, DX; } }Maybe it's just a typo in your message, but it should be "out DX, AL". Ric
Sep 08 2003
Riccardo De Agostini wrote:"Mike Wynn" <mike l8night.co.uk> ha scritto nel messaggio news:bjfob0$chd$1 digitaldaemon.com...as I've been using gas I'm getting very confused over which way "out" should be written ... just tried asm { mov DX, 0xCF8; mov EAX, 0x80000000; out DX, EAX; } give the error dmain.d(124): opcode expected, not out as does all the other rearrangments of AL,AX, EAX, DX, [DX] {gas uses `out %eax, (%dx)` and `in (%dx), %eax`}I've checked the doc's the x86opcodes in and out do not work in inlineasm.void io_outp( ushort port, ubyte v ) { asm { mov DX, port; mov AL, v; out AL, DX; } }Maybe it's just a typo in your message, but it should be "out DX, AL".
Sep 08 2003
"Mike Wynn" <mike l8night.co.uk> ha scritto nel messaggio news:bjia4u$11ju$1 digitaldaemon.com...as I've been using gas I'm getting very confused over which way "out" should be written ... [...]I too get confused when I use gas; too much sniffing gives me bad headaches! :) Seriously speaking, I just hoped it was a classic typo case instead of a bug in DMD. Not that I thought you hadn't tested enough, but you know, sometimes the bug you've been hunting for days gets spotted at once by the first one passing by, just because he hasn't been frying his own brain over it for the last twenty work hours or so... It happens. Actually happened to me more than once <sigh> Ric
Sep 09 2003
Riccardo De Agostini wrote:"Mike Wynn" <mike l8night.co.uk> ha scritto nel messaggio news:bjia4u$11ju$1 digitaldaemon.com...I had hoped you where right too, .... took me a long time to realise that `if ( v & 0xFFFF != 0xFFFF ) { ... }` was not working as I'd expected partly due to me checking that db 0xEF; was `out` 'EAX->port(DX)' I agree spotting other ppls typos/bugs is a lot easier than spotting your own, especially when your as masterful at creating them as I am :)as I've been using gas I'm getting very confused over which way "out" should be written ... [...]I too get confused when I use gas; too much sniffing gives me bad headaches! :) Seriously speaking, I just hoped it was a classic typo case instead of a bug in DMD. Not that I thought you hadn't tested enough, but you know, sometimes the bug you've been hunting for days gets spotted at once by the first one passing by, just because he hasn't been frying his own brain over it for the last twenty work hours or so... It happens. Actually happened to me more than once <sigh> Ric
Sep 09 2003
Check the precedence for operator & versus operator !=. This is hard to do since there's not a precedence table anywhere on "The D Programming Language" website, that I can find. I for one vote that operators & and | and ^ should all be higher precedence than the comparison operators. I think they got this wrong in C. The most common case for use of operator & is as below, yet this isn't valid due to precedence, it evaluates to 'if ( v & (0xFFFF != 0xFFFF) ) { ... }' which is just nonsense. Most C compilers issue a warning if they see something like this (bitwise operation applied to a boolean value with an int). Just skip the warning and fix the precedence. Sean "Mike Wynn" <mike l8night.co.uk> wrote in message news:bjkp7t$1ku7$1 digitaldaemon.com...I had hoped you where right too, .... took me a long time to realise that `if ( v & 0xFFFF != 0xFFFF ) { ... }` was not working as I'd expected partly due to me checking that db 0xEF; was `out` 'EAX->port(DX)' I agree spotting other ppls typos/bugs is a lot easier than spotting your own, especially when your as masterful at creating them as I am :)
Sep 09 2003
Check the precedence for operator & versus operator !=. This is hard to do since there's not a precedence table anywhere on "The D Programming Language" website, that I can find. I for one vote that operators & and | and ^ should all be higher precedence than the comparison operators. I think they got this wrong in C.The first C compilers didn't have || and &&, you used the normal binary | and & operators. That explains the precedence in original C. However, it's ofcourse one of the historical issues that D tries to fix :) -fg
Sep 11 2003
"Mike Wynn" <mike l8night.co.uk> wrote in message news:bjia4u$11ju$1 digitaldaemon.com...as I've been using gas I'm getting very confused over which way "out" should be written ... just triedThe rule the D inline assembler uses is it follows the format in the Intel documentation.
Sep 10 2003