diff mbox series

[kvm-unit-tests,v3,11/11] s390x: Restore registers in diag308_load_reset() error path

Message ID 20220421101130.23107-12-frankja@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Cleanup and maintenance 4 | expand

Commit Message

Janosch Frank April 21, 2022, 10:11 a.m. UTC
In case of an error we'll currently return with the wrong values in
gr0 and gr1. Let's fix that by restoring the registers before setting
the return value and branching to the return address.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/cpu.S | 1 +
 1 file changed, 1 insertion(+)

Comments

Claudio Imbrenda April 21, 2022, 11:59 a.m. UTC | #1
On Thu, 21 Apr 2022 10:11:30 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> In case of an error we'll currently return with the wrong values in
> gr0 and gr1. Let's fix that by restoring the registers before setting
> the return value and branching to the return address.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  s390x/cpu.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/s390x/cpu.S b/s390x/cpu.S
> index 82b5e25d..0bd8c0e3 100644
> --- a/s390x/cpu.S
> +++ b/s390x/cpu.S
> @@ -34,6 +34,7 @@ diag308_load_reset:
>  	stg     %r15, GEN_LC_SW_INT_GRS + 15 * 8
>  	/* Do the reset */
>  	diag    %r0,%r2,0x308
> +	RESTORE_REGS_STACK
>  	/* Failure path */
>  	xgr	%r2, %r2
>  	br	%r14
diff mbox series

Patch

diff --git a/s390x/cpu.S b/s390x/cpu.S
index 82b5e25d..0bd8c0e3 100644
--- a/s390x/cpu.S
+++ b/s390x/cpu.S
@@ -34,6 +34,7 @@  diag308_load_reset:
 	stg     %r15, GEN_LC_SW_INT_GRS + 15 * 8
 	/* Do the reset */
 	diag    %r0,%r2,0x308
+	RESTORE_REGS_STACK
 	/* Failure path */
 	xgr	%r2, %r2
 	br	%r14