History

mips/kvm: Make kvm_locore.S 64-bit buildable/safe.

We need to use more of the Macros in asm.h to allow kvm_locore.S to build in a 64-bit kernel. For 32-bit there is no change in the generated object code.

David Daney committed 13 years ago

Commit ea69f281 parent bb48c2f1 file · +27 −27Browse files

Unified · Split

arch/mips/kvm/kvm_locore.S+27−27
@@ -60,7 +60,7 @@ · 59 unmodified lines
6060
6161 FEXPORT(__kvm_mips_vcpu_run)
6262 /* k0/k1 not being used in host kernel context */
63− addiu k1, sp, -PT_SIZE
63+ INT_ADDIU k1, sp, -PT_SIZE
6464 LONG_S $0, PT_R0(k1)
6565 LONG_S $1, PT_R1(k1)
6666 LONG_S $2, PT_R2(k1)
@@ -121,7 +121,7 @@ FEXPORT(__kvm_mips_vcpu_run) · 54 unmodified lines
121121 mtc0 a1, CP0_DDATA_LO
122122
123123 /* Offset into vcpu->arch */
124− addiu k1, a1, VCPU_HOST_ARCH
124+ INT_ADDIU k1, a1, VCPU_HOST_ARCH
125125
126126 /*
127127 * Save the host stack to VCPU, used for exception processing
@@ -159,16 +159,16 @@ FEXPORT(__kvm_mips_vcpu_run) · 31 unmodified lines
159159
160160 FEXPORT(__kvm_mips_load_asid)
161161 /* Set the ASID for the Guest Kernel */
162− sll t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */
162+ INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */
163163 /* addresses shift to 0x80000000 */
164164 bltz t0, 1f /* If kernel */
165− addiu t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */
166− addiu t1, k1, VCPU_GUEST_USER_ASID /* else user */
165+ INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */
166+ INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */
167167 1:
168168 /* t1: contains the base of the ASID array, need to get the cpu id */
169169 LONG_L t2, TI_CPU($28) /* smp_processor_id */
170− sll t2, t2, 2 /* x4 */
171− addu t3, t1, t2
170+ INT_SLL t2, t2, 2 /* x4 */
171+ REG_ADDU t3, t1, t2
172172 LONG_L k0, (t3)
173173 andi k0, k0, 0xff
174174 mtc0 k0, CP0_ENTRYHI
@@ -236,10 +236,10 @@ VECTOR(MIPSX(exception), unknown) · 61 unmodified lines
236236 ehb #02:
237237
238238 mfc0 k0, CP0_EBASE #02: Get EBASE
239− srl k0, k0, 10 #03: Get rid of CPUNum
240− sll k0, k0, 10 #04
239+ INT_SRL k0, k0, 10 #03: Get rid of CPUNum
240+ INT_SLL k0, k0, 10 #04
241241 LONG_S k1, 0x3000(k0) #05: Save k1 @ offset 0x3000
242− addiu k0, k0, 0x2000 #06: Exception handler is installed @ offset 0x2000
242+ INT_ADDIU k0, k0, 0x2000 #06: Exception handler is installed @ offset 0x2000
243243 j k0 #07: jump to the function
244244 nop #08: branch delay slot
245245 VECTOR_END(MIPSX(exceptionEnd))
@@ -253,7 +253,7 @@ VECTOR_END(MIPSX(exceptionEnd)) · 7 unmodified lines
253253 NESTED (MIPSX(GuestException), CALLFRAME_SIZ, ra)
254254 /* Get the VCPU pointer from DDTATA_LO */
255255 mfc0 k1, CP0_DDATA_LO
256− addiu k1, k1, VCPU_HOST_ARCH
256+ INT_ADDIU k1, k1, VCPU_HOST_ARCH
257257
258258 /* Start saving Guest context to VCPU */
259259 LONG_S $0, VCPU_R0(k1)
@@ -304,7 +304,7 @@ NESTED (MIPSX(GuestException), CALLFRAME_SIZ, ra) · 44 unmodified lines
304304 LONG_S t0, VCPU_R26(k1)
305305
306306 /* Get GUEST k1 and save it in VCPU */
307− la t1, ~0x2ff
307+ PTR_LI t1, ~0x2ff
308308 mfc0 t0, CP0_EBASE
309309 and t0, t0, t1
310310 LONG_L t0, 0x3000(t0)
@@ -367,7 +367,7 @@ NESTED (MIPSX(GuestException), CALLFRAME_SIZ, ra) · 56 unmodified lines
367367 LONG_L sp, VCPU_HOST_STACK(k1)
368368
369369 /* Saved host state */
370− addiu sp, sp, -PT_SIZE
370+ INT_ADDIU sp, sp, -PT_SIZE
371371
372372 /* XXXKYMA do we need to load the host ASID, maybe not because the
373373 * kernel entries are marked GLOBAL, need to verify
@@ -378,7 +378,7 @@ NESTED (MIPSX(GuestException), CALLFRAME_SIZ, ra) · 4 unmodified lines
378378 mtc0 k0, CP0_DDATA_LO
379379
380380 /* Restore RDHWR access */
381− la k0, 0x2000000F
381+ PTR_LI k0, 0x2000000F
382382 mtc0 k0, CP0_HWRENA
383383
384384 /* Jump to handler */
@@ -386,9 +386,9 @@ FEXPORT(__kvm_mips_jump_to_handler) · 1 unmodified line
386386 /* XXXKYMA: not sure if this is safe, how large is the stack??
387387 * Now jump to the kvm_mips_handle_exit() to see if we can deal
388388 * with this in the kernel */
389− la t9, kvm_mips_handle_exit
389+ PTR_LA t9, kvm_mips_handle_exit
390390 jalr.hb t9
391− addiu sp, sp, -CALLFRAME_SIZ /* BD Slot */
391+ INT_ADDIU sp, sp, -CALLFRAME_SIZ /* BD Slot */
392392
393393 /* Return from handler Make sure interrupts are disabled */
394394 di
@@ -400,7 +400,7 @@ FEXPORT(__kvm_mips_jump_to_handler) · 5 unmodified lines
400400 */
401401
402402 move k1, s1
403− addiu k1, k1, VCPU_HOST_ARCH
403+ INT_ADDIU k1, k1, VCPU_HOST_ARCH
404404
405405 /* Check return value, should tell us if we are returning to the
406406 * host (handle I/O etc)or resuming the guest
@@ -438,16 +438,16 @@ __kvm_mips_return_to_guest: · 31 unmodified lines
438438 mtc0 t0, CP0_EPC
439439
440440 /* Set the ASID for the Guest Kernel */
441− sll t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */
441+ INT_SLL t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */
442442 /* addresses shift to 0x80000000 */
443443 bltz t0, 1f /* If kernel */
444− addiu t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */
445− addiu t1, k1, VCPU_GUEST_USER_ASID /* else user */
444+ INT_ADDIU t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */
445+ INT_ADDIU t1, k1, VCPU_GUEST_USER_ASID /* else user */
446446 1:
447447 /* t1: contains the base of the ASID array, need to get the cpu id */
448448 LONG_L t2, TI_CPU($28) /* smp_processor_id */
449− sll t2, t2, 2 /* x4 */
450− addu t3, t1, t2
449+ INT_SLL t2, t2, 2 /* x4 */
450+ REG_ADDU t3, t1, t2
451451 LONG_L k0, (t3)
452452 andi k0, k0, 0xff
453453 mtc0 k0,CP0_ENTRYHI
@@ -505,7 +505,7 @@ FEXPORT(__kvm_mips_skip_guest_restore) · 51 unmodified lines
505505 __kvm_mips_return_to_host:
506506 /* EBASE is already pointing to Linux */
507507 LONG_L k1, VCPU_HOST_STACK(k1)
508− addiu k1,k1, -PT_SIZE
508+ INT_ADDIU k1,k1, -PT_SIZE
509509
510510 /* Restore host DDATA_LO */
511511 LONG_L k0, PT_HOST_USERLOCAL(k1)
@@ -523,7 +523,7 @@ __kvm_mips_return_to_host: · 11 unmodified lines
523523
524524 /* r2/v0 is the return code, shift it down by 2 (arithmetic)
525525 * to recover the err code */
526− sra k0, v0, 2
526+ INT_SRA k0, v0, 2
527527 move $2, k0
528528
529529 LONG_L $3, PT_R3(k1)
@@ -563,7 +563,7 @@ __kvm_mips_return_to_host: · 33 unmodified lines
563563 mtlo k0
564564
565565 /* Restore RDHWR access */
566− la k0, 0x2000000F
566+ PTR_LI k0, 0x2000000F
567567 mtc0 k0, CP0_HWRENA
568568
569569
@@ -627,13 +627,13 @@ LEAF(MIPSX(SyncICache)) · 57 unmodified lines
627627 .set mips32r2
628628 beq a1, zero, 20f
629629 nop
630− addu a1, a0, a1
630+ REG_ADDU a1, a0, a1
631631 rdhwr v0, HW_SYNCI_Step
632632 beq v0, zero, 20f
633633 nop
634634 10:
635635 synci 0(a0)
636− addu a0, a0, v0
636+ REG_ADDU a0, a0, v0
637637 sltu v1, a0, a1
638638 bne v1, zero, 10b
639639 nop