s390x/tcg: always enable AFP for linux-user
PATCH 1/1 s390x/tcg: always enable AFP for linux-user
linux-user should always enable AFP, otherwise our emulated binary might crash once it tries to make use of additional floating-point registers or instructions.
--- target/s390x/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)
target/s390x/cpu.c +5 -0
@@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s) env->cregs[0 ] =CR0_RESET ; env->cregs[14 ] =CR14_RESET ; +#if defined(CONFIG_USER_ONLY ) +/* user mode should always be allowed to use the full FPU */ + env->cregs[0 ] |=CR0_AFP ; +#endif +/* architectured initial value for Breaking-Event-Address register */ env->gbea =1 ;
Signature · 1 line
2.17.1
Quoted 20 lines · David Hildenbrand
linux-user should always enable AFP, otherwise our emulated binary might crash once it tries to make use of additional floating-point registers or instructions.
Cc Peter Maydell <[email protected]>Cc Alex Bennée <[email protected]>Fixes db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")Reported-by Alex Bennée <[email protected]>Signed-off-by David Hildenbrand <[email protected]>--- target/s390x/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)target/s390x/cpu.c +0
-0@@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s) env->cregs[0 ] =CR0_RESET ;
target/s390x/cpu.c static void s390_cpu_full_reset(CPUState *s) · line 155
Quoted 10 lines
target/s390x/cpu.c +5
-0env->cregs[14 ] =CR14_RESET ; +#if defined(CONFIG_USER_ONLY ) +/* user mode should always be allowed to use the full FPU */ + env->cregs[0 ] |=CR0_AFP ; +#endif +/* architectured initial value for Breaking-Event-Address register */ env->gbea =1 ;
Cornelia Huck
AppliedQuoted 19 lines · On Mon, 8 Oct 2018 17:32:04 +0200 David Hildenbrand <[email protected]> wrote:
linux-user should always enable AFP, otherwise our emulated binary might crash once it tries to make use of additional floating-point registers or instructions.
Cc Peter Maydell <[email protected]>Cc Alex Bennée <[email protected]>Fixes db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")Reported-by Alex Bennée <[email protected]>Signed-off-by David Hildenbrand <[email protected]>--- target/s390x/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)target/s390x/cpu.c +0
-0@@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s) env->cregs[0 ] =CR0_RESET ;
target/s390x/cpu.c static void s390_cpu_full_reset(CPUState *s) · line 155
Quoted 10 lines
target/s390x/cpu.c +5
-0env->cregs[14 ] =CR14_RESET ; +#if defined(CONFIG_USER_ONLY ) +/* user mode should always be allowed to use the full FPU */ + env->cregs[0 ] |=CR0_AFP ; +#endif +/* architectured initial value for Breaking-Event-Address register */ env->gbea =1 ;
I've reproduced the crash via make check-tcg, and this patch fixes it.
Thanks, applied.
Quoted 4 lines · David Hildenbrand
linux-user should always enable AFP, otherwise our emulated binary might crash once it tries to make use of additional floating-point registers or instructions.
Quoted 8 lines
Cc Peter Maydell <[email protected]>Cc Alex Bennée <[email protected]>Fixes db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")Reported-by Alex Bennée <[email protected]>Signed-off-by David Hildenbrand <[email protected]>--- target/s390x/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)
r~
Quoted 18 lines · David Hildenbrand
linux-user should always enable AFP, otherwise our emulated binary might crash once it tries to make use of additional floating-point registers or instructions.
Cc Peter Maydell <[email protected]>Cc Alex Bennée <[email protected]>Fixes db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")Reported-by Alex Bennée <[email protected]>Signed-off-by David Hildenbrand <[email protected]>--- target/s390x/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)target/s390x/cpu.c +0
-0
target/s390x/cpu.c static void s390_cpu_full_reset(CPUState *s) · line 152
Quoted 8 lines
target/s390x/cpu.c +5
-0@@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s) env->cregs[0 ] =CR0_RESET ; env->cregs[14 ] =CR14_RESET ; +#if defined(CONFIG_USER_ONLY ) +/* user mode should always be allowed to use the full FPU */ + env->cregs[0 ] |=CR0_AFP ; +#endif +
target/s390x/cpu.c static void s390_cpu_full_reset(CPUState *s) · line 154
Quoted 2 lines
target/s390x/cpu.c +0
-0/* architectured initial value for Breaking-Event-Address register */ env->gbea =1 ;
--
Alex Bennée
Quoted 19 lines · On Mon, 8 Oct 2018 17:32:04 +0200 David Hildenbrand <[email protected]> wrote:
linux-user should always enable AFP, otherwise our emulated binary might crash once it tries to make use of additional floating-point registers or instructions.
Cc Peter Maydell <[email protected]>Cc Alex Bennée <[email protected]>Fixes db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")Reported-by Alex Bennée <[email protected]>Signed-off-by David Hildenbrand <[email protected]>--- target/s390x/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)target/s390x/cpu.c +0
-0@@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s) env->cregs[0 ] =CR0_RESET ;
target/s390x/cpu.c static void s390_cpu_full_reset(CPUState *s) · line 155
Quoted 10 lines
target/s390x/cpu.c +5
-0env->cregs[14 ] =CR14_RESET ; +#if defined(CONFIG_USER_ONLY ) +/* user mode should always be allowed to use the full FPU */ + env->cregs[0 ] |=CR0_AFP ; +#endif +/* architectured initial value for Breaking-Event-Address register */ env->gbea =1 ;
In case this is applied directly:
Quoted 35 lines · Cornelia Huck
Quoted 19 lines · On Mon, 8 Oct 2018 17:32:04 +0200 David Hildenbrand <[email protected]> wrote:
linux-user should always enable AFP, otherwise our emulated binary might crash once it tries to make use of additional floating-point registers or instructions.
Cc Peter Maydell <[email protected]>Cc Alex Bennée <[email protected]>Fixes db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")Reported-by Alex Bennée <[email protected]>Signed-off-by David Hildenbrand <[email protected]>--- target/s390x/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)target/s390x/cpu.c +0
-0@@ -145,6 +145,11 @@ static void s390_cpu_full_reset(CPUState *s) env->cregs[0 ] =CR0_RESET ;target/s390x/cpu.c static void s390_cpu_full_reset(CPUState *s) · line 155
Quoted 10 lines
target/s390x/cpu.c +5
-0env->cregs[14 ] =CR14_RESET ; +#if defined(CONFIG_USER_ONLY ) +/* user mode should always be allowed to use the full FPU */ + env->cregs[0 ] |=CR0_AFP ; +#endif +/* architectured initial value for Breaking-Event-Address register */ env->gbea =1 ;In case this is applied directly:
Quoted 2 lines
Reviewed-by Cornelia Huck <[email protected]>Tested-by Cornelia Huck <[email protected]>
Thanks; I've applied it to master, and also added 'make check-tcg' to my set of things I run as part of a merge, which should catch this kind of bug in future.
-- PMM