linux-mips
[Top] [All Lists]

Re: siginfo structure in 64-bit kernel

To: Carsten Langgaard <carstenl@mips.com>
Subject: Re: siginfo structure in 64-bit kernel
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Date: Fri, 9 Aug 2002 10:39:57 +0200 (MET DST)
Cc: Ralf Baechle <ralf@oss.sgi.com>, linux-mips@oss.sgi.com
In-reply-to: <3D52CE5B.CD8C72C4@mips.com>
Organization: Technical University of Gdansk
Sender: owner-linux-mips@oss.sgi.com
On Thu, 8 Aug 2002, Carsten Langgaard wrote:

> >  I checked the patch and discovered you somehow made the order of struct
> > members wrong.
> 
> Good spotted, that's what happens when MIPS is the only one that put
> 'si_code' before 'si_errno' in the structure. 

 That's why I'm always using MIPS-specific definitions as a reference
first.  The actual reason of the differences is the SysV ABI supplement
for MIPS which defines things a bit differently than the others here and
there, often with no justified reason (well, the reason is really Irix,
but then again, there is no justified reason for Irix to be different
there).

> >  Here is an updated version that works for me.  It includes
> > both the ordering fix and unsigned type changes I suggested before.
> 
> With your sign changes we are doing things a little bit different than
> others, I know that's not really an argument, but does the unsigned
> types not work for you ? 

 Others are different here, actually.  With a signed type if a 32-bit
address is cast to "long" or "void *" implicitly (the latter is normally
spotted by the compiler and marked with a warning; the former is usually
silent), it becomes a valid 64-bit address that still refers to the same
location.  With an unsigned one it doesn't work for KSEG addresses
anymore.  That's because addresses are signed on MIPS -- 32-bit addresses
are sign-extended (as opposed to zero-extended) by the hardware the 32-bit
address space is in the middle of the 64-bit one (and not at the bottom as
in the zero-extension variant). 

 I suppose the unsigned types would usually work if casts were applied
carefully everywhere.  I'd prefer code to work automatically, though,
without corner cases triggered every now and then. 

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +


<Prev in Thread] Current Thread [Next in Thread>