@@ -410,6 +410,8 @@ vcpu .req r0 @ vcpu pointer always in r0
/* Compute the address of struct vgic_cpu */
add r11, vcpu, #VCPU_VGIC_CPU
+ /* Get HW configuration */
+ ldr r12, [r11, #VGIC_CPU_HW_CFG]
/* Save all interesting registers */
ldr r3, [r2, #GICH_HCR]
@@ -419,7 +421,9 @@ vcpu .req r0 @ vcpu pointer always in r0
ldr r7, [r2, #GICH_EISR1]
ldr r8, [r2, #GICH_ELRSR0]
ldr r9, [r2, #GICH_ELRSR1]
- ldr r10, [r2, #GICH_APR]
+ /* Extract APR offset */
+ ubfx r10, r12, #16, #16
+ ldr r10, [r2, r10]
str r3, [r11, #VGIC_V2_CPU_HCR]
str r4, [r11, #VGIC_V2_CPU_VMCR]
@@ -434,10 +438,16 @@ vcpu .req r0 @ vcpu pointer always in r0
mov r5, #0
str r5, [r2, #GICH_HCR]
+ /* Compute GICH_LR0 address */
+ ubfx r6, r12, #16, #16
+ add r6, r6, #0x10
+ add r2, r2, r6
+
+ /* Extract NR_LR */
+ ubfx r4, r12, #0, #16
+
/* Save list registers */
- add r2, r2, #GICH_LR0
add r3, r11, #VGIC_V2_CPU_LR
- ldr r4, [r11, #VGIC_CPU_NR_LR]
1: ldr r6, [r2], #4
str r6, [r3], #4
subs r4, r4, #1