target/mips: Fixes for 4.1
cover target/mips: Fixes for 4.1
From: Aleksandar Markovic <[email protected]>
At the moment, this includes fixes for problems in switch statements found by GCC 8.3 improved code analysis features.
Aleksandar Markovic (4):
target/mips: Add 'fall through' comments for handling nanoMips' SHXS,
SWXS
target/mips: Add missing 'break' for a case of MTHC0 handling target/mips: Add missing 'break' for certain cases of MFTR handling target/mips: Add missing 'break' for certain cases of MTTR handling
target/mips/translate.c | 7 +++++++ 1 file changed, 7 insertions(+)
Signature · 1 line
2.7.4
PATCH 1/4 target/mips: Add 'fall through' comments for handling nanoMips' SHXS, SWXS
From: Aleksandar Markovic <[email protected]>
This was found by GCC 8.3 static analysis.
--- target/mips/translate.c | 2 ++ 1 file changed, 2 insertions(+)
target/mips/translate.c +2 -0
@@ -20136,12 +20136,14 @@ static void gen_p_lsx(DisasContext *ctx, int rd, int rs, int rt)switch (extract32 (ctx->opcode,7 ,4 )) {case NM_SHXS :check_nms (ctx); +/* fall through */ case NM_LHXS :case NM_LHUXS :tcg_gen_shli_tl (t0, t0,1 );break ;case NM_SWXS :check_nms (ctx); +/* fall through */ case NM_LWXS :case NM_LWC1XS :case NM_SWC1XS :
Signature · 1 line
2.7.4
PATCH 2/4 target/mips: Add missing 'break' for a case of MTHC0 handling
In reply to Aleksandar MarkovicFrom: Aleksandar Markovic <[email protected]>
This was found by GCC 8.3 static analysis.
--- target/mips/translate.c | 1 + 1 file changed, 1 insertion(+)
target/mips/translate.c +1 -0
@@ -6745,6 +6745,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)default : goto cp0_unimplemented; } +break ;case CP0_REGISTER_17 :switch (sel) {case 0 :
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH for 4.1 2/4] target/mips: Add missing 'break' for a case of MTHC0 handling
Hi Aleksandar,
Quoted 4 lines · Aleksandar Markovic
From: Aleksandar Markovic <[email protected]>
This was found by GCC 8.3 static analysis.
I think you can amend:
Quoted 11 lines
Signed-off-by Aleksandar Markovic <[email protected]>--- target/mips/translate.c | 1 + 1 file changed, 1 insertion(+)target/mips/translate.c +0
-0
target/mips/translate.c static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel) · line 6751
Quoted 7 lines
target/mips/translate.c +1
-0@@ -6745,6 +6745,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)default : goto cp0_unimplemented; } +break ;case CP0_REGISTER_17 :switch (sel) {case 0 :
Thanks,
Phil.
Re: [Qemu-devel] ?==?utf-8?q? ?==?utf-8?q? [PATCH for 4.1?==?utf-8?q? 2/4]?==?utf-8?q? target/mips: Add missing 'break' for a case of MTHC0 handling
Quoted 5 lines
From: Philippe Mathieu-Daudé <[email protected]>
Quoted 2 lines
From: Aleksandar Markovic <[email protected]>
Quoted 8 lines
Quoted 2 lines
This was found by GCC 8.3 static analysis.
I think you can amend:Fixes 5fb2dcd1792Reported-by Stefan Weil <[email protected]>
Yes, indeed. This will be added in the next version.
Thanks,
Aleksandar
PATCH v2 1/1 linux-user: Fix structure target_ucontext for MIPS
In reply to Aleksandar MarkovicFrom: Aleksandar Markovic <[email protected]>
Structure ucontext for MIPS is defined in the following way in Linux kernel:
(arch/mips/include/uapi/asm/ucontext.h, lines 54-64)
struct ucontext {
/* Historic fields matching asm-generic */
unsigned long uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
struct sigcontext uc_mcontext;
sigset_t uc_sigmask;
/* Extended context structures may follow ucontext */
unsigned long long uc_extcontext[0];
};Fix the structure target_ucontext for MIPS to reflect the definition above, except the correction for field uc_extcontext, which will follow at some later time.
---
v2: rectified a commit message mistake with
s/target_sigset_t/target_ucontext
--- linux-user/mips/signal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
linux-user/mips/signal.c +2 -3
@@ -71,10 +71,9 @@ struct sigframe { };struct target_ucontext { -target_ulong tuc_flags; -target_ulong tuc_link; +abi_ulong tuc_flags; +abi_ulong tuc_link;target_stack_t tuc_stack; -target_ulong pad0;struct target_sigcontext tuc_mcontext;target_sigset_t tuc_sigmask; };
Signature · 1 line
2.7.4
Laurent Vivier
AppliedRe: [Qemu-devel] [PATCH for 4.1 v2] linux-user: Fix structure target_ucontext for MIPS
Le 12/07/2019 à 13:37, Aleksandar Markovic a écrit :
Quoted 45 lines
From: Aleksandar Markovic <[email protected]>
Structure ucontext for MIPS is defined in the following way in Linux kernel:
(
arch/mips/include/uapi/asm/ucontext.h, lines 54-64)struct ucontext { /* Historic fields matching asm-generic */ unsigned long uc_flags; struct ucontext *uc_link; stack_t uc_stack; struct sigcontext uc_mcontext; sigset_t uc_sigmask; /* Extended context structures may follow ucontext */ unsigned long long uc_extcontext[0]; };Fix the structure
target_ucontextfor MIPS to reflect the definition above, except the correction for fielduc_extcontext, which will follow at some later time.Fixes 94c5495dReported-by Dragan Mladjenovic <[email protected]>Signed-off-by Aleksandar Markovic <[email protected]>Reviewed-by Laurent Vivier <[email protected]>---
v2: rectified a commit message mistake with
s/target_sigset_t/target_ucontext--- linux-user/mips/signal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)linux-user/mips/signal.c +0
-0@@ -71,10 +71,9 @@ struct sigframe { };
linux-user/mips/signal.c struct sigframe { · line 79
Quoted 10 lines
linux-user/mips/signal.c +2
-3struct target_ucontext { -target_ulong tuc_flags; -target_ulong tuc_link; +abi_ulong tuc_flags; +abi_ulong tuc_link;target_stack_t tuc_stack; -target_ulong pad0;struct target_sigcontext tuc_mcontext;target_sigset_t tuc_sigmask; };
Applied to my linux-user branch.
Thanks,
Laurent
PATCH 3/4 target/mips: Add missing 'break' for certain cases of MFTR handling
In reply to Aleksandar MarkovicFrom: Aleksandar Markovic <[email protected]>
This was found by GCC 8.3 static analysis.
--- target/mips/translate.c | 2 ++ 1 file changed, 2 insertions(+)
target/mips/translate.c +2 -0
@@ -9826,6 +9826,7 @@ static void gen_mftr(CPUMIPSState *env, DisasContext *ctx, int rt, int rd,gen_mfc0 (ctx, t0, rt, sel);break ; } +break ;case 12 :switch (sel) {case 0 :
@@ -9835,6 +9836,7 @@ static void gen_mftr(CPUMIPSState *env, DisasContext *ctx, int rt, int rd,gen_mfc0 (ctx, t0, rt, sel);break ; } +break ;case 13 :switch (sel) {case 0 :
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH for 4.1 3/4] target/mips: Add missing 'break' for certain cases of MFTR handling
Quoted 4 lines · Aleksandar Markovic
From: Aleksandar Markovic <[email protected]>
This was found by GCC 8.3 static analysis.
Again, please amend:
Quoted 19 lines
Signed-off-by Aleksandar Markovic <[email protected]>--- target/mips/translate.c | 2 ++ 1 file changed, 2 insertions(+)target/mips/translate.c +1
-0@@ -9826,6 +9826,7 @@ static void gen_mftr(CPUMIPSState *env, DisasContext *ctx, int rt, int rd,gen_mfc0 (ctx, t0, rt, sel);break ; } +break ;case 12 :switch (sel) {case 0 :
target/mips/translate.c static void gen_mftr(CPUMIPSState *env, DisasContext *ctx, int rt, int rd, · line 9842
Quoted 7 lines
target/mips/translate.c +1
-0@@ -9835,6 +9836,7 @@ static void gen_mftr(CPUMIPSState *env, DisasContext *ctx, int rt, int rd,gen_mfc0 (ctx, t0, rt, sel);break ; } +break ;case 13 :switch (sel) {case 0 :
12 years missing...
Re: [Qemu-devel] ?==?utf-8?q? ?==?utf-8?q? [PATCH for 4.1?==?utf-8?q? 3/4]?==?utf-8?q? target/mips: Add missing 'break' for certain cases of MFTR handling
Quoted 11 lines
From: Philippe Mathieu-Daudé <[email protected]>
Quoted 4 lines
From: Aleksandar Markovic <[email protected]>
This was found by GCC 8.3 static analysis.
Again, please amend:Fixes ead9360e2fb
Who would think that this bug existed since 2007? ...étrange.
Thanks,
Aleksandar
PATCH 4/4 target/mips: Add missing 'break' for certain cases of MTTR handling
In reply to Aleksandar MarkovicFrom: Aleksandar Markovic <[email protected]>
This was found by GCC 8.3 static analysis.
--- target/mips/translate.c | 2 ++ 1 file changed, 2 insertions(+)
target/mips/translate.c +2 -0
@@ -10055,6 +10055,7 @@ static void gen_mttr(CPUMIPSState *env, DisasContext *ctx, int rd, int rt,gen_mtc0 (ctx, t0, rd, sel);break ; } +break ;case 12 :switch (sel) {case 0 :
@@ -10064,6 +10065,7 @@ static void gen_mttr(CPUMIPSState *env, DisasContext *ctx, int rd, int rt,gen_mtc0 (ctx, t0, rd, sel);break ; } +break ;case 13 :switch (sel) {case 0 :
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH for 4.1 4/4] target/mips: Add missing 'break' for certain cases of MTTR handling
Quoted 4 lines · Aleksandar Markovic
From: Aleksandar Markovic <[email protected]>
This was found by GCC 8.3 static analysis.
Similar to the previous one:
Quoted 1 line
Signed-off-by Aleksandar Markovic <[email protected]>
Thanks for cleaning this!
Regards,
Phil.
Quoted 25 lines
--- target/mips/translate.c | 2 ++ 1 file changed, 2 insertions(+)target/mips/translate.c +2
-0@@ -10055,6 +10055,7 @@ static void gen_mttr(CPUMIPSState *env, DisasContext *ctx, int rd, int rt,gen_mtc0 (ctx, t0, rd, sel);break ; } +break ;case 12 :switch (sel) {case 0 :@@ -10064,6 +10065,7 @@ static void gen_mttr(CPUMIPSState *env, DisasContext *ctx, int rd, int rt,gen_mtc0 (ctx, t0, rd, sel);break ; } +break ;case 13 :switch (sel) {case 0 :