[PATCH 10/13] target/hppa: Check privilege only when PSW.P is set

deller@kernel.org posted 13 patches 9 months, 3 weeks ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Helge Deller <deller@gmx.de>
There is a newer version of this series
[PATCH 10/13] target/hppa: Check privilege only when PSW.P is set
Posted by deller@kernel.org 9 months, 3 weeks ago
From: Helge Deller <deller@gmx.de>

CHECK_MOST_PRIVILEGED() should check the privilege level only when the PSW.P
bit is set.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 target/hppa/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index 7e58775bbf..21c2734a1f 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -604,7 +604,7 @@ static bool gen_illegal(DisasContext *ctx)
 #else
 #define CHECK_MOST_PRIVILEGED(EXCP) \
     do {                                     \
-        if (ctx->privilege != 0) {           \
+        if (ctx->privilege != 0 && (ctx->tb_flags & PSW_P)) { \
             return gen_excp_iir(ctx, EXCP);  \
         }                                    \
     } while (0)
-- 
2.43.0
Re: [PATCH 10/13] target/hppa: Check privilege only when PSW.P is set
Posted by Richard Henderson 9 months, 3 weeks ago
On 2/7/24 08:20, deller@kernel.org wrote:
> From: Helge Deller <deller@gmx.de>
> 
> CHECK_MOST_PRIVILEGED() should check the privilege level only when the PSW.P
> bit is set.
> 
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
>   target/hppa/translate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
> index 7e58775bbf..21c2734a1f 100644
> --- a/target/hppa/translate.c
> +++ b/target/hppa/translate.c
> @@ -604,7 +604,7 @@ static bool gen_illegal(DisasContext *ctx)
>   #else
>   #define CHECK_MOST_PRIVILEGED(EXCP) \
>       do {                                     \
> -        if (ctx->privilege != 0) {           \
> +        if (ctx->privilege != 0 && (ctx->tb_flags & PSW_P)) { \
>               return gen_excp_iir(ctx, EXCP);  \
>           }                                    \
>       } while (0)

PSW_P is documented as applying only to protection identifiers.
I do not believe this to be correct at all.


r~