* [PATCH] Clean reg class and base_reg for input output operand (%dx).
@ 2023-12-06 13:12 Cui, Lili
2023-12-07 7:11 ` Jan Beulich
0 siblings, 1 reply; 6+ messages in thread
From: Cui, Lili @ 2023-12-06 13:12 UTC (permalink / raw)
To: binutils; +Cc: jbeulich, hongjiu.lu
This patch is to clean reg class and base_reg for input output operand (%dx).
For special processing of input and output operands (%dx),
the state of some variables needs to be cleared.
gas/ChangeLog:
* config/tc-i386.c (i386_att_operand): Clean reg class and
i.base_reg for input output operand (%dx).
---
gas/config/tc-i386.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 4f3864f2ba7..ffb2f14c4ec 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
&& !operand_type_check (i.types[this_operand], disp))
{
i.types[this_operand] = i.base_reg->reg_type;
+ i.types[this_operand].bitfield.class = 0;
+ i.base_reg = NULL;
i.input_output_operand = true;
return 1;
}
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Clean reg class and base_reg for input output operand (%dx).
2023-12-06 13:12 [PATCH] Clean reg class and base_reg for input output operand (%dx) Cui, Lili
@ 2023-12-07 7:11 ` Jan Beulich
2023-12-07 8:48 ` Cui, Lili
0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2023-12-07 7:11 UTC (permalink / raw)
To: Cui, Lili; +Cc: hongjiu.lu, binutils
On 06.12.2023 14:12, Cui, Lili wrote:
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
> && !operand_type_check (i.types[this_operand], disp))
> {
> i.types[this_operand] = i.base_reg->reg_type;
> + i.types[this_operand].bitfield.class = 0;
> + i.base_reg = NULL;
I agree with the latter, but I don't understand the former. The more
that in earlier discussion on the APX subthread I clearly indicated
what I think needs doing here.
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] Clean reg class and base_reg for input output operand (%dx).
2023-12-07 7:11 ` Jan Beulich
@ 2023-12-07 8:48 ` Cui, Lili
2023-12-07 8:51 ` Jan Beulich
0 siblings, 1 reply; 6+ messages in thread
From: Cui, Lili @ 2023-12-07 8:48 UTC (permalink / raw)
To: Beulich, Jan; +Cc: Lu, Hongjiu, binutils
> On 06.12.2023 14:12, Cui, Lili wrote:
> > --- a/gas/config/tc-i386.c
> > +++ b/gas/config/tc-i386.c
> > @@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
> > && !operand_type_check (i.types[this_operand], disp))
> > {
> > i.types[this_operand] = i.base_reg->reg_type;
> > + i.types[this_operand].bitfield.class = 0;
> > + i.base_reg = NULL;
>
> I agree with the latter, but I don't understand the former. The more that in
> earlier discussion on the APX subthread I clearly indicated what I think needs
> doing here.
>
The original issue was that we encountered a segment fault when accessing i.op[op].regs->reg_flags, and since the input was (%dx), we treat it as memory, so I think we need to clean up i.types[this_operand]. bitfield.class = 0 and leave i.base_reg there, it means i.base_reg does not need to be cleaned.
Lili.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Clean reg class and base_reg for input output operand (%dx).
2023-12-07 8:48 ` Cui, Lili
@ 2023-12-07 8:51 ` Jan Beulich
2023-12-12 7:51 ` Cui, Lili
0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2023-12-07 8:51 UTC (permalink / raw)
To: Cui, Lili; +Cc: Lu, Hongjiu, binutils
On 07.12.2023 09:48, Cui, Lili wrote:
>> On 06.12.2023 14:12, Cui, Lili wrote:
>>> --- a/gas/config/tc-i386.c
>>> +++ b/gas/config/tc-i386.c
>>> @@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
>>> && !operand_type_check (i.types[this_operand], disp))
>>> {
>>> i.types[this_operand] = i.base_reg->reg_type;
>>> + i.types[this_operand].bitfield.class = 0;
>>> + i.base_reg = NULL;
>>
>> I agree with the latter, but I don't understand the former. The more that in
>> earlier discussion on the APX subthread I clearly indicated what I think needs
>> doing here.
>>
>
> The original issue was that we encountered a segment fault when accessing i.op[op].regs->reg_flags, and since the input was (%dx), we treat it as memory, so I think we need to clean up i.types[this_operand]. bitfield.class = 0 and leave i.base_reg there, it means i.base_reg does not need to be cleaned.
As said before - what is missing as far as I understand it is the updating
of i.op[].regs in the code above. That ought to be (much) preferred over
invalidating .class (and thus perhaps causing new latent issues).
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] Clean reg class and base_reg for input output operand (%dx).
2023-12-07 8:51 ` Jan Beulich
@ 2023-12-12 7:51 ` Cui, Lili
2023-12-12 8:15 ` Jan Beulich
0 siblings, 1 reply; 6+ messages in thread
From: Cui, Lili @ 2023-12-12 7:51 UTC (permalink / raw)
To: Beulich, Jan, Lu, Hongjiu; +Cc: binutils
> >>> --- a/gas/config/tc-i386.c
> >>> +++ b/gas/config/tc-i386.c
> >>> @@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
> >>> && !operand_type_check (i.types[this_operand], disp))
> >>> {
> >>> i.types[this_operand] = i.base_reg->reg_type;
> >>> + i.types[this_operand].bitfield.class = 0;
> >>> + i.base_reg = NULL;
> >>
> >> I agree with the latter, but I don't understand the former. The more
> >> that in earlier discussion on the APX subthread I clearly indicated
> >> what I think needs doing here.
> >>
> >
> > The original issue was that we encountered a segment fault when accessing
> i.op[op].regs->reg_flags, and since the input was (%dx), we treat it as
> memory, so I think we need to clean up i.types[this_operand]. bitfield.class =
> 0 and leave i.base_reg there, it means i.base_reg does not need to be
> cleaned.
>
> As said before - what is missing as far as I understand it is the updating of
> i.op[].regs in the code above. That ought to be (much) preferred over
> invalidating .class (and thus perhaps causing new latent issues).
>
Changed. Can I check in this patch ?
Clean base_reg and assign correct values to regs for input_output_operand (%dx).
For special processing of input and output operands (%dx),
the state of some variables needs to be cleaned.
gas/ChangeLog:
* config/tc-i386.c (i386_att_operand): Assign values to regs and
clean i.base_reg for input output operand (%dx).
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 4f3864f2ba7..3f1b39baddc 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
&& !operand_type_check (i.types[this_operand], disp))
{
i.types[this_operand] = i.base_reg->reg_type;
+ i.op[this_operand].regs = i.base_reg;
+ i.base_reg = NULL;
i.input_output_operand = true;
return 1;
}
Thanks,
Lili.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Clean reg class and base_reg for input output operand (%dx).
2023-12-12 7:51 ` Cui, Lili
@ 2023-12-12 8:15 ` Jan Beulich
0 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2023-12-12 8:15 UTC (permalink / raw)
To: Cui, Lili; +Cc: binutils, Lu, Hongjiu
On 12.12.2023 08:51, Cui, Lili wrote:
>>>>> --- a/gas/config/tc-i386.c
>>>>> +++ b/gas/config/tc-i386.c
>>>>> @@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
>>>>> && !operand_type_check (i.types[this_operand], disp))
>>>>> {
>>>>> i.types[this_operand] = i.base_reg->reg_type;
>>>>> + i.types[this_operand].bitfield.class = 0;
>>>>> + i.base_reg = NULL;
>>>>
>>>> I agree with the latter, but I don't understand the former. The more
>>>> that in earlier discussion on the APX subthread I clearly indicated
>>>> what I think needs doing here.
>>>>
>>>
>>> The original issue was that we encountered a segment fault when accessing
>> i.op[op].regs->reg_flags, and since the input was (%dx), we treat it as
>> memory, so I think we need to clean up i.types[this_operand]. bitfield.class =
>> 0 and leave i.base_reg there, it means i.base_reg does not need to be
>> cleaned.
>>
>> As said before - what is missing as far as I understand it is the updating of
>> i.op[].regs in the code above. That ought to be (much) preferred over
>> invalidating .class (and thus perhaps causing new latent issues).
>>
>
> Changed. Can I check in this patch ?
If the change is enough to avoid any respective oddities in the APX
patches, then yes, please go ahead.
Jan
> Clean base_reg and assign correct values to regs for input_output_operand (%dx).
>
> For special processing of input and output operands (%dx),
> the state of some variables needs to be cleaned.
>
> gas/ChangeLog:
>
> * config/tc-i386.c (i386_att_operand): Assign values to regs and
> clean i.base_reg for input output operand (%dx).
>
> diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
> index 4f3864f2ba7..3f1b39baddc 100644
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -13016,6 +13016,8 @@ i386_att_operand (char *operand_string)
> && !operand_type_check (i.types[this_operand], disp))
> {
> i.types[this_operand] = i.base_reg->reg_type;
> + i.op[this_operand].regs = i.base_reg;
> + i.base_reg = NULL;
> i.input_output_operand = true;
> return 1;
> }
>
> Thanks,
> Lili.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-12-12 8:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-06 13:12 [PATCH] Clean reg class and base_reg for input output operand (%dx) Cui, Lili
2023-12-07 7:11 ` Jan Beulich
2023-12-07 8:48 ` Cui, Lili
2023-12-07 8:51 ` Jan Beulich
2023-12-12 7:51 ` Cui, Lili
2023-12-12 8:15 ` Jan Beulich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).