Skip to contentSkip to conversation

s390x: sie: Only overwrite r3 if it isn't needed anymore

PATCH In review Janosch Frank 4 participants 4 messages Jun 2, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x: sie: Only overwrite r3 if it isn't needed anymore

The lmg overwrites r3 which we later use to reference the fprs and fpc. Let's do the lmg at the end where overwriting is fine.

---

Finding this took me longer than I'd like to admit. :)

---
 s390x/cpu.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/cpu.S +1 -1
index e2ad56c8..82b5e25d 100644
@@ -81,11 +81,11 @@ sie64a:
 	stg	%r3,__SF_SIE_SAVEAREA(%r15)	# save guest register save area
 
 	# Load guest's gprs, fprs and fpc
-	lmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3)
 	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
 	ld	\i, \i * 8 + SIE_SAVEAREA_GUEST_FPRS(%r3)
 	.endr
 	lfpc	SIE_SAVEAREA_GUEST_FPC(%r3)
+	lmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3)
 
 	# Move scb ptr into r14 for the sie instruction
 	lg	%r14,__SF_SIE_CONTROL(%r15)
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Janosch Frank

The lmg overwrites r3 which we later use to reference the fprs and fpc. Let's do the lmg at the end where overwriting is fine.

---

Finding this took me longer than I'd like to admit. :)

---
  s390x/cpu.S | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
s390x/cpu.S +0 -0
index e2ad56c8..82b5e25d 100644
@@ -81,11 +81,11 @@ sie64a:
  	stg	%r3,__SF_SIE_SAVEAREA(%r15)	# save guest register save area
 

s390x/cpu.S sie64a: · line 91

Quoted 10 lines
s390x/cpu.S +1 -1
  	# Load guest's gprs, fprs and fpc
-	lmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3)
  	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
  	ld	\i, \i * 8 + SIE_SAVEAREA_GUEST_FPRS(%r3)
  	.endr
  	lfpc	SIE_SAVEAREA_GUEST_FPC(%r3)
+	lmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3)
 
  	# Move scb ptr into r14 for the sie instruction
  	lg	%r14,__SF_SIE_CONTROL(%r15)

Oh, that's nasty

Signature · 3 lines
Thanks,

David / dhildenb
Reviewed-by
#2 lore raw
Quoted 5 lines · On Wed, 2 Jun 2021 11:47:12 +0200 David Hildenbrand <[email protected]> wrote:
Quoted 4 lines · Janosch Frank

The lmg overwrites r3 which we later use to reference the fprs and fpc. Let's do the lmg at the end where overwriting is fine.

Quoted 31 lines
Quoted 17 lines

---

Finding this took me longer than I'd like to admit. :)

---
  s390x/cpu.S | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
s390x/cpu.S +0 -0
index e2ad56c8..82b5e25d 100644
@@ -81,11 +81,11 @@ sie64a:
  	stg	%r3,__SF_SIE_SAVEAREA(%r15)	# save

guest register save area
# Load guest's gprs, fprs and fpc

s390x/cpu.S sie64a: · line 91

Quoted 9 lines
s390x/cpu.S +1 -1
-	lmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3)
  	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
  	ld	\i, \i * 8 + SIE_SAVEAREA_GUEST_FPRS(%r3)
  	.endr
  	lfpc	SIE_SAVEAREA_GUEST_FPC(%r3)
+	lmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3)
 
  	# Move scb ptr into r14 for the sie instruction
  	lg	%r14,__SF_SIE_CONTROL(%r15)

Oh, that's nasty