Skip to contentSkip to conversation

xen: arm: traps: check hsr.ec for ARM32

PATCH In review Peng Fan 3 participants 3 messages Sep 21, 2015

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/2 xen: arm: traps: check hsr.ec for ARM32

To ARM64, "if ( hsr.ec >= 0x10 ) return 1;" is ok for unconditional check, but to ARM32, we need to use 'hsr.ec >> 30' to check.

Cc Ian Campbell <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>
---
 xen/arch/arm/traps.c | 5 +++++
 1 file changed, 5 insertions(+)
xen/arch/arm/traps.c +5 -0
index 9d2bd6a..2e2b1f2 100644
@@ -1531,8 +1531,13 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
     int cond;
 
     /* Unconditional Exception classes */
+#ifdef CONFIG_ARM_64
     if ( hsr.ec >= 0x10 )
         return 1;
+#else
+    if ( hsr.ec >> 30 )
+        return 1;
+#endif
 
     /* Check for valid condition in hsr */
     cond = hsr.cond.ccvalid ? hsr.cond.cc : -1;
Signature · 1 line
1.8.4
#2 lore raw
In reply to Julien Grall

Hi Julien,

Quoted 8 lines · Julien Grall

Hi Peng,

Quoted 2 lines · Peng Fan

To ARM64, "if ( hsr.ec >= 0x10 ) return 1;" is ok for unconditional check, but to ARM32, we need to use 'hsr.ec >> 30' to check.

hsr.ec is encoded on 5 bits, therefore the shift you suggest is wrong. Maybe you wanted to use (hsr.ec >> 4)?

Thanks for correcting me. 0x10 can handle hsr.ec >> 4. My bad, this patch is wrong.

Regards,
Peng.

Quoted 36 lines

Although, can you explain why you need a different check for ARM32?

Regards,

Quoted 27 lines
Cc Ian Campbell <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>
---
 xen/arch/arm/traps.c | 5 +++++
 1 file changed, 5 insertions(+)
xen/arch/arm/traps.c +5 -0
index 9d2bd6a..2e2b1f2 100644
@@ -1531,8 +1531,13 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
     int cond;
 
     /* Unconditional Exception classes */
+#ifdef CONFIG_ARM_64
     if ( hsr.ec >= 0x10 )
         return 1;
+#else
+    if ( hsr.ec >> 30 )
+        return 1;
+#endif
 
     /* Check for valid condition in hsr */
     cond = hsr.cond.ccvalid ? hsr.cond.cc : -1;
Signature · 1 line
Julien Grall
#1 lore raw
In reply to Peng Fan

Hi Peng,

Quoted 2 lines · Peng Fan

To ARM64, "if ( hsr.ec >= 0x10 ) return 1;" is ok for unconditional check, but to ARM32, we need to use 'hsr.ec >> 30' to check.

hsr.ec is encoded on 5 bits, therefore the shift you suggest is wrong. Maybe you wanted to use (hsr.ec >> 4)?

Although, can you explain why you need a different check for ARM32?

Regards,

Quoted 27 lines
Cc Ian Campbell <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>
---
 xen/arch/arm/traps.c | 5 +++++
 1 file changed, 5 insertions(+)
xen/arch/arm/traps.c +5 -0
index 9d2bd6a..2e2b1f2 100644
@@ -1531,8 +1531,13 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
     int cond;
 
     /* Unconditional Exception classes */
+#ifdef CONFIG_ARM_64
     if ( hsr.ec >= 0x10 )
         return 1;
+#else
+    if ( hsr.ec >> 30 )
+        return 1;
+#endif
 
     /* Check for valid condition in hsr */
     cond = hsr.cond.ccvalid ? hsr.cond.cc : -1;
Signature · 1 line
Julien Grall