[PATCH] opcodes: i386: fix dw2_regnum data type in reg_entry

Kong, Lingling lingling.kong@intel.com
Thu Jan 11 01:35:16 GMT 2024



> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Tuesday, January 9, 2024 4:25 PM
> To: Indu Bhagat <indu.bhagat@oracle.com>; Cui, Lili <lili.cui@intel.com>; H.J. Lu
> <hjl.tools@gmail.com>; Kong, Lingling <lingling.kong@intel.com>; Hu, Lin1
> <lin1.hu@intel.com>
> Cc: binutils@sourceware.org
> Subject: Re: [PATCH] opcodes: i386: fix dw2_regnum data type in reg_entry
> 
> On 09.01.2024 02:12, Indu Bhagat wrote:
> > The DWARF register numbers for the APX EGRPs start with 130.  The data
> > type holding the same currently is signed char.
> >
> > ChangeLog:
> > 	* opcodes/i386-opc.h (reg_entry): Bump to signed short.
> 
> So yes, something needs doing. But there are further questions to be raised to the
> original authors: Was the code tested at all in this regard? Why do numbers start
> at 130, when according to i386-reg.tbl
> 128 and 129 are unused (and would hence be more natural to [also] use)?
> 

Hi,

This is because for some historical reasons, some numbers(126-129) have been agreed to be reserved.
Details can be found in https://groups.google.com/g/x86-64-abi/c/GS8LZf5nQFk.

Thanks!
Lingling

-> > --- a/opcodes/i386-opc.h
> > +++ b/opcodes/i386-opc.h
> > @@ -1047,7 +1047,7 @@ typedef struct
> >  #define RegIZ	(RegIP - 1)
> >  /* FLAT is a fake segment register (Intel mode).  */
> >  #define RegFlat     ((unsigned char) ~0)
> > -  signed char dw2_regnum[2];
> > +  signed short dw2_regnum[2];
> >  #define Dw2Inval (-1)
> >  }
> >  reg_entry;
> 
> It's a little sad that non-64-bit field also has its size increased.
> Right now either way the structure size as a whole is the same, but down the
> road this may end up a little wasteful.
> 
> Jan


More information about the Binutils mailing list