Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Feb 2011 08:12:36 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric <dim@freebsd.org>
Subject:   Re: svn commit: r219079 - in head/sys/boot/i386: gptboot gptzfsboot zfsboot
Message-ID:  <201102280812.36867.jhb@freebsd.org>
In-Reply-To: <20110227133227.S1974@besplex.bde.org>
References:  <201102270206.p1R269VO021432@svn.freebsd.org> <20110227133227.S1974@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102280812.36867.jhb>