svn commit: r219079 - in head/sys/boot/i386: gptboot gptzfsboot zfsboot

John Baldwin jhb at freebsd.org
Mon Feb 28 13:38:42 UTC 2011


On Saturday, February 26, 2011 10:04:00 pm Bruce Evans wrote:
> On Sun, 27 Feb 2011, Dimitry Andric wrote:
> 
> > Log:
> >  Clang's integrated assembler can now handle sys/boot/i386/boot2/sio.S.
> >  It used to choke on the notation "inb (%dx),%al" for "inb %dx,%al"; GNU
> >  as accepts both forms.  Which notation is more 'correct' is an open
> >  question. :)
> 
> Nah, the former is just a syntax error since %dx is not dereferenced :-).
> 
> It is a syntax error at the design level that parentheses are used for
> indirection.  In better assembler syntaxes like Intel/Microsoft's one
> for x86 and Motorola's one for 6809, brackets are used for indirections
> so parentheses are not context-dependent.  Then extra parentheses
> around expressions can have no effect.  But dx isn't an expression,
> so (dx) should still be a syntax error.  I think it is in I/M syntax
> but I can't test that easily.  It is a syntax error in my x86/6809
> assembler.  My assembler doesn't check, but emits a diagnostic for
> this :-).  (My assembler wants brackets for indirection, but it has
> an option to to implement some bugs including use of parentheses for
> indirection.)

OTOH, I actually prefer the ()'s.  One could argue that I/O ports are simply
an alternate address space, and 'inb (%dx),%al' for more closely matches
'movb (%dx),%al' than something like 'movzb %dx,%al'.   I find it even more 
compelling for 'outb' as 'outb' clearly does not modify %dx, but %dx is an 
address register, and addresses are in ()'s in x86 assembly.

In an assembly language where load and store are separate from inter-register 
copies so that you have 'ld %r0,%r1', then I would be fine with the address 
argument to inb/outb not using ()'s.

-- 
John Baldwin


More information about the svn-src-all mailing list