* [PATCH 2/2] xen: arm: traps: correct cond
@ 2015-09-21 7:07 Peng Fan
2015-09-21 10:10 ` Julien Grall
0 siblings, 1 reply; 5+ messages in thread
From: Peng Fan @ 2015-09-21 7:07 UTC (permalink / raw)
To: xen-devel; +Cc: Julien Grall, Peng.Fan, Stefano Stabellini, Ian Campbell
>From "G6.2.29 CPSR, Current Program Status Register" of Aarch64 ARM
and "B1.3.3 Program Status Registers (PSRs)" of ARMv7-A ARM:
"
IT[7:5] holds the base condition for the IT block. The base condition is
the top 3 bits of the condition code specified by the first
condition field of the IT instruction.
IT[4:0] encodes the size of the IT block, which is the number of
instructions that are to be conditionally executed, by the
position of the least significant 1 in this field. It also
encodes the value of the least significant bit of the condition
code for each instruction in the block.
"
So should be "cond = ( it >> 5 );" but not "cond = ( it >> 4 );"
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@citrix.com>
Cc: Julien Grall <julien.grall@citrix.com>
---
xen/arch/arm/traps.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 2e2b1f2..b2879b7 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1561,8 +1561,8 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
if ( it == 0 )
return 1;
- /* The cond for this instruction works out as the top 4 bits. */
- cond = ( it >> 4 );
+ /* The cond for this instruction works out as the top 3 bits. */
+ cond = ( it >> 5 );
}
cpsr_cond = cpsr >> 28;
--
1.8.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] xen: arm: traps: correct cond
2015-09-21 10:10 ` Julien Grall
@ 2015-09-21 9:08 ` Peng Fan
2015-09-21 10:33 ` Ian Campbell
0 siblings, 1 reply; 5+ messages in thread
From: Peng Fan @ 2015-09-21 9:08 UTC (permalink / raw)
To: Julien Grall; +Cc: Peng Fan, Stefano Stabellini, Ian Campbell, xen-devel
On Mon, Sep 21, 2015 at 11:10:11AM +0100, Julien Grall wrote:
>Hi Peng,
>
>On 21/09/15 08:07, Peng Fan wrote:
>> From "G6.2.29 CPSR, Current Program Status Register" of Aarch64 ARM
>> and "B1.3.3 Program Status Registers (PSRs)" of ARMv7-A ARM:
>> "
>
>The section number may change between the different version of the spec.
>Can you also precise the spec version?
>
>For instance on my ARM64 spec (ARM DDI 0497A.d) the section G6.2.29
>points to "CSSELR" and not "CPSR".
>
>> IT[7:5] holds the base condition for the IT block. The base condition is
>> the top 3 bits of the condition code specified by the first
>> condition field of the IT instruction.
>> IT[4:0] encodes the size of the IT block, which is the number of
>> instructions that are to be conditionally executed, by the
>> position of the least significant 1 in this field. It also
>> encodes the value of the least significant bit of the condition
>> code for each instruction in the block.
>> "
>> So should be "cond = ( it >> 5 );" but not "cond = ( it >> 4 );"
>
>IT[7:5] encodes the top 3 bits of the condition code and one bit of
>IT[4:0] will contain the least significant bit of the condition code.
>
>In order to get the full condition code you have to use IT[7:4] which
>the current code does (see A2.5.2 ARM DDI 0406C.b).
>
>So the current code looks valid to me. Did I miss something?
No, you are correct.
Thanks,
Peng.
>
>Regards,
>
>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>> Cc: Ian Campbell <ian.campbell@citrix.com>
>> Cc: Stefano Stabellini <stefano.stabellini@citrix.com>
>> Cc: Julien Grall <julien.grall@citrix.com>
>> ---
>> xen/arch/arm/traps.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
>> index 2e2b1f2..b2879b7 100644
>> --- a/xen/arch/arm/traps.c
>> +++ b/xen/arch/arm/traps.c
>> @@ -1561,8 +1561,8 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
>> if ( it == 0 )
>> return 1;
>>
>> - /* The cond for this instruction works out as the top 4 bits. */
>> - cond = ( it >> 4 );
>> + /* The cond for this instruction works out as the top 3 bits. */
>> + cond = ( it >> 5 );
>> }
>>
>> cpsr_cond = cpsr >> 28;
>>
>
>--
>Julien Grall
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] xen: arm: traps: correct cond
2015-09-21 7:07 [PATCH 2/2] xen: arm: traps: correct cond Peng Fan
@ 2015-09-21 10:10 ` Julien Grall
2015-09-21 9:08 ` Peng Fan
0 siblings, 1 reply; 5+ messages in thread
From: Julien Grall @ 2015-09-21 10:10 UTC (permalink / raw)
To: Peng Fan, xen-devel; +Cc: Stefano Stabellini, Ian Campbell
Hi Peng,
On 21/09/15 08:07, Peng Fan wrote:
> From "G6.2.29 CPSR, Current Program Status Register" of Aarch64 ARM
> and "B1.3.3 Program Status Registers (PSRs)" of ARMv7-A ARM:
> "
The section number may change between the different version of the spec.
Can you also precise the spec version?
For instance on my ARM64 spec (ARM DDI 0497A.d) the section G6.2.29
points to "CSSELR" and not "CPSR".
> IT[7:5] holds the base condition for the IT block. The base condition is
> the top 3 bits of the condition code specified by the first
> condition field of the IT instruction.
> IT[4:0] encodes the size of the IT block, which is the number of
> instructions that are to be conditionally executed, by the
> position of the least significant 1 in this field. It also
> encodes the value of the least significant bit of the condition
> code for each instruction in the block.
> "
> So should be "cond = ( it >> 5 );" but not "cond = ( it >> 4 );"
IT[7:5] encodes the top 3 bits of the condition code and one bit of
IT[4:0] will contain the least significant bit of the condition code.
In order to get the full condition code you have to use IT[7:4] which
the current code does (see A2.5.2 ARM DDI 0406C.b).
So the current code looks valid to me. Did I miss something?
Regards,
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@citrix.com>
> Cc: Julien Grall <julien.grall@citrix.com>
> ---
> xen/arch/arm/traps.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 2e2b1f2..b2879b7 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -1561,8 +1561,8 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
> if ( it == 0 )
> return 1;
>
> - /* The cond for this instruction works out as the top 4 bits. */
> - cond = ( it >> 4 );
> + /* The cond for this instruction works out as the top 3 bits. */
> + cond = ( it >> 5 );
> }
>
> cpsr_cond = cpsr >> 28;
>
--
Julien Grall
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] xen: arm: traps: correct cond
2015-09-21 9:08 ` Peng Fan
@ 2015-09-21 10:33 ` Ian Campbell
2015-09-22 0:46 ` Peng Fan
0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2015-09-21 10:33 UTC (permalink / raw)
To: Peng Fan, Julien Grall; +Cc: Peng Fan, Stefano Stabellini, xen-devel
On Mon, 2015-09-21 at 17:08 +0800, Peng Fan wrote:
> On Mon, Sep 21, 2015 at 11:10:11AM +0100, Julien Grall wrote:
> > Hi Peng,
> >
> > On 21/09/15 08:07, Peng Fan wrote:
> > > From "G6.2.29 CPSR, Current Program Status Register" of Aarch64 ARM
> > > and "B1.3.3 Program Status Registers (PSRs)" of ARMv7-A ARM:
> > > "
> >
> > The section number may change between the different version of the
> > spec.
> > Can you also precise the spec version?
> >
> > For instance on my ARM64 spec (ARM DDI 0497A.d) the section G6.2.29
> > points to "CSSELR" and not "CPSR".
> >
> > > IT[7:5] holds the base condition for the IT block. The base condition
> > > is
> > > the top 3 bits of the condition code specified by the first
> > > condition field of the IT instruction.
> > > IT[4:0] encodes the size of the IT block, which is the number of
> > > instructions that are to be conditionally executed, by the
> > > position of the least significant 1 in this field. It also
> > > encodes the value of the least significant bit of the condition
> > > code for each instruction in the block.
> > > "
> > > So should be "cond = ( it >> 5 );" but not "cond = ( it >> 4 );"
> >
> > IT[7:5] encodes the top 3 bits of the condition code and one bit of
> > IT[4:0] will contain the least significant bit of the condition code.
> >
> > In order to get the full condition code you have to use IT[7:4] which
> > the current code does (see A2.5.2 ARM DDI 0406C.b).
> >
> > So the current code looks valid to me. Did I miss something?
>
> No, you are correct.
Were these two patches motivated by an actual issue you were seeing? Or
just from code inspection?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] xen: arm: traps: correct cond
2015-09-21 10:33 ` Ian Campbell
@ 2015-09-22 0:46 ` Peng Fan
0 siblings, 0 replies; 5+ messages in thread
From: Peng Fan @ 2015-09-22 0:46 UTC (permalink / raw)
To: Ian Campbell; +Cc: Julien Grall, Peng Fan, Stefano Stabellini, xen-devel
On Mon, Sep 21, 2015 at 11:33:10AM +0100, Ian Campbell wrote:
>On Mon, 2015-09-21 at 17:08 +0800, Peng Fan wrote:
>> On Mon, Sep 21, 2015 at 11:10:11AM +0100, Julien Grall wrote:
>> > Hi Peng,
>> >
>> > On 21/09/15 08:07, Peng Fan wrote:
>> > > From "G6.2.29 CPSR, Current Program Status Register" of Aarch64 ARM
>> > > and "B1.3.3 Program Status Registers (PSRs)" of ARMv7-A ARM:
>> > > "
>> >
>> > The section number may change between the different version of the
>> > spec.
>> > Can you also precise the spec version?
>> >
>> > For instance on my ARM64 spec (ARM DDI 0497A.d) the section G6.2.29
>> > points to "CSSELR" and not "CPSR".
>> >
>> > > IT[7:5] holds the base condition for the IT block. The base condition
>> > > is
>> > > the top 3 bits of the condition code specified by the first
>> > > condition field of the IT instruction.
>> > > IT[4:0] encodes the size of the IT block, which is the number of
>> > > instructions that are to be conditionally executed, by the
>> > > position of the least significant 1 in this field. It also
>> > > encodes the value of the least significant bit of the condition
>> > > code for each instruction in the block.
>> > > "
>> > > So should be "cond = ( it >> 5 );" but not "cond = ( it >> 4 );"
>> >
>> > IT[7:5] encodes the top 3 bits of the condition code and one bit of
>> > IT[4:0] will contain the least significant bit of the condition code.
>> >
>> > In order to get the full condition code you have to use IT[7:4] which
>> > the current code does (see A2.5.2 ARM DDI 0406C.b).
>> >
>> > So the current code looks valid to me. Did I miss something?
>>
>> No, you are correct.
>
>Were these two patches motivated by an actual issue you were seeing? Or
>just from code inspection?
Just code inspection, not an actual issue.
Regards,
Peng.
>
--
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-22 0:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21 7:07 [PATCH 2/2] xen: arm: traps: correct cond Peng Fan
2015-09-21 10:10 ` Julien Grall
2015-09-21 9:08 ` Peng Fan
2015-09-21 10:33 ` Ian Campbell
2015-09-22 0:46 ` Peng Fan
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 NNTP newsgroup(s).