diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-07-14 16:52:54 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-08-19 20:12:27 -0400 |
commit | ee43eb788b3a06425fffb912677e2e1c8b00dd3b (patch) | |
tree | 7233cb47647837ab00af81270b3a16555d88a1f1 /arch/powerpc/kernel/head_44x.S | |
parent | 8aa34ab8b2dc96ca6c4feecfb87ed13f0d40ef98 (diff) |
powerpc: Use names rather than numbers for SPRGs (v2)
The kernel uses SPRG registers for various purposes, typically in
low level assembly code as scratch registers or to hold per-cpu
global infos such as the PACA or the current thread_info pointer.
We want to be able to easily shuffle the usage of those registers
as some implementations have specific constraints realted to some
of them, for example, some have userspace readable aliases, etc..
and the current choice isn't always the best.
This patch should not change any code generation, and replaces the
usage of SPRN_SPRGn everywhere in the kernel with a named replacement
and adds documentation next to the definition of the names as to
what those are used for on each processor family.
The only parts that still use the original numbers are bits of KVM
or suspend/resume code that just blindly needs to save/restore all
the SPRGs.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/head_44x.S')
-rw-r--r-- | arch/powerpc/kernel/head_44x.S | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S index 18d8a1677c4d..656cfb2d6666 100644 --- a/arch/powerpc/kernel/head_44x.S +++ b/arch/powerpc/kernel/head_44x.S | |||
@@ -239,7 +239,7 @@ skpinv: addi r4,r4,1 /* Increment */ | |||
239 | 239 | ||
240 | /* ptr to current thread */ | 240 | /* ptr to current thread */ |
241 | addi r4,r2,THREAD /* init task's THREAD */ | 241 | addi r4,r2,THREAD /* init task's THREAD */ |
242 | mtspr SPRN_SPRG3,r4 | 242 | mtspr SPRN_SPRG_THREAD,r4 |
243 | 243 | ||
244 | /* stack */ | 244 | /* stack */ |
245 | lis r1,init_thread_union@h | 245 | lis r1,init_thread_union@h |
@@ -350,12 +350,12 @@ interrupt_base: | |||
350 | 350 | ||
351 | /* Data TLB Error Interrupt */ | 351 | /* Data TLB Error Interrupt */ |
352 | START_EXCEPTION(DataTLBError) | 352 | START_EXCEPTION(DataTLBError) |
353 | mtspr SPRN_SPRG0, r10 /* Save some working registers */ | 353 | mtspr SPRN_SPRG_WSCRATCH0, r10 /* Save some working registers */ |
354 | mtspr SPRN_SPRG1, r11 | 354 | mtspr SPRN_SPRG_WSCRATCH1, r11 |
355 | mtspr SPRN_SPRG4W, r12 | 355 | mtspr SPRN_SPRG_WSCRATCH2, r12 |
356 | mtspr SPRN_SPRG5W, r13 | 356 | mtspr SPRN_SPRG_WSCRATCH3, r13 |
357 | mfcr r11 | 357 | mfcr r11 |
358 | mtspr SPRN_SPRG7W, r11 | 358 | mtspr SPRN_SPRG_WSCRATCH4, r11 |
359 | mfspr r10, SPRN_DEAR /* Get faulting address */ | 359 | mfspr r10, SPRN_DEAR /* Get faulting address */ |
360 | 360 | ||
361 | /* If we are faulting a kernel address, we have to use the | 361 | /* If we are faulting a kernel address, we have to use the |
@@ -374,7 +374,7 @@ interrupt_base: | |||
374 | 374 | ||
375 | /* Get the PGD for the current thread */ | 375 | /* Get the PGD for the current thread */ |
376 | 3: | 376 | 3: |
377 | mfspr r11,SPRN_SPRG3 | 377 | mfspr r11,SPRN_SPRG_THREAD |
378 | lwz r11,PGDIR(r11) | 378 | lwz r11,PGDIR(r11) |
379 | 379 | ||
380 | /* Load PID into MMUCR TID */ | 380 | /* Load PID into MMUCR TID */ |
@@ -446,12 +446,12 @@ tlb_44x_patch_hwater_D: | |||
446 | /* The bailout. Restore registers to pre-exception conditions | 446 | /* The bailout. Restore registers to pre-exception conditions |
447 | * and call the heavyweights to help us out. | 447 | * and call the heavyweights to help us out. |
448 | */ | 448 | */ |
449 | mfspr r11, SPRN_SPRG7R | 449 | mfspr r11, SPRN_SPRG_RSCRATCH4 |
450 | mtcr r11 | 450 | mtcr r11 |
451 | mfspr r13, SPRN_SPRG5R | 451 | mfspr r13, SPRN_SPRG_RSCRATCH3 |
452 | mfspr r12, SPRN_SPRG4R | 452 | mfspr r12, SPRN_SPRG_RSCRATCH2 |
453 | mfspr r11, SPRN_SPRG1 | 453 | mfspr r11, SPRN_SPRG_RSCRATCH1 |
454 | mfspr r10, SPRN_SPRG0 | 454 | mfspr r10, SPRN_SPRG_RSCRATCH0 |
455 | b DataStorage | 455 | b DataStorage |
456 | 456 | ||
457 | /* Instruction TLB Error Interrupt */ | 457 | /* Instruction TLB Error Interrupt */ |
@@ -461,12 +461,12 @@ tlb_44x_patch_hwater_D: | |||
461 | * to a different point. | 461 | * to a different point. |
462 | */ | 462 | */ |
463 | START_EXCEPTION(InstructionTLBError) | 463 | START_EXCEPTION(InstructionTLBError) |
464 | mtspr SPRN_SPRG0, r10 /* Save some working registers */ | 464 | mtspr SPRN_SPRG_WSCRATCH0, r10 /* Save some working registers */ |
465 | mtspr SPRN_SPRG1, r11 | 465 | mtspr SPRN_SPRG_WSCRATCH1, r11 |
466 | mtspr SPRN_SPRG4W, r12 | 466 | mtspr SPRN_SPRG_WSCRATCH2, r12 |
467 | mtspr SPRN_SPRG5W, r13 | 467 | mtspr SPRN_SPRG_WSCRATCH3, r13 |
468 | mfcr r11 | 468 | mfcr r11 |
469 | mtspr SPRN_SPRG7W, r11 | 469 | mtspr SPRN_SPRG_WSCRATCH4, r11 |
470 | mfspr r10, SPRN_SRR0 /* Get faulting address */ | 470 | mfspr r10, SPRN_SRR0 /* Get faulting address */ |
471 | 471 | ||
472 | /* If we are faulting a kernel address, we have to use the | 472 | /* If we are faulting a kernel address, we have to use the |
@@ -485,7 +485,7 @@ tlb_44x_patch_hwater_D: | |||
485 | 485 | ||
486 | /* Get the PGD for the current thread */ | 486 | /* Get the PGD for the current thread */ |
487 | 3: | 487 | 3: |
488 | mfspr r11,SPRN_SPRG3 | 488 | mfspr r11,SPRN_SPRG_THREAD |
489 | lwz r11,PGDIR(r11) | 489 | lwz r11,PGDIR(r11) |
490 | 490 | ||
491 | /* Load PID into MMUCR TID */ | 491 | /* Load PID into MMUCR TID */ |
@@ -542,12 +542,12 @@ tlb_44x_patch_hwater_I: | |||
542 | /* The bailout. Restore registers to pre-exception conditions | 542 | /* The bailout. Restore registers to pre-exception conditions |
543 | * and call the heavyweights to help us out. | 543 | * and call the heavyweights to help us out. |
544 | */ | 544 | */ |
545 | mfspr r11, SPRN_SPRG7R | 545 | mfspr r11, SPRN_SPRG_RSCRATCH4 |
546 | mtcr r11 | 546 | mtcr r11 |
547 | mfspr r13, SPRN_SPRG5R | 547 | mfspr r13, SPRN_SPRG_RSCRATCH3 |
548 | mfspr r12, SPRN_SPRG4R | 548 | mfspr r12, SPRN_SPRG_RSCRATCH2 |
549 | mfspr r11, SPRN_SPRG1 | 549 | mfspr r11, SPRN_SPRG_RSCRATCH1 |
550 | mfspr r10, SPRN_SPRG0 | 550 | mfspr r10, SPRN_SPRG_RSCRATCH0 |
551 | b InstructionStorage | 551 | b InstructionStorage |
552 | 552 | ||
553 | /* Debug Interrupt */ | 553 | /* Debug Interrupt */ |
@@ -593,12 +593,12 @@ finish_tlb_load: | |||
593 | 593 | ||
594 | /* Done...restore registers and get out of here. | 594 | /* Done...restore registers and get out of here. |
595 | */ | 595 | */ |
596 | mfspr r11, SPRN_SPRG7R | 596 | mfspr r11, SPRN_SPRG_RSCRATCH4 |
597 | mtcr r11 | 597 | mtcr r11 |
598 | mfspr r13, SPRN_SPRG5R | 598 | mfspr r13, SPRN_SPRG_RSCRATCH3 |
599 | mfspr r12, SPRN_SPRG4R | 599 | mfspr r12, SPRN_SPRG_RSCRATCH2 |
600 | mfspr r11, SPRN_SPRG1 | 600 | mfspr r11, SPRN_SPRG_RSCRATCH1 |
601 | mfspr r10, SPRN_SPRG0 | 601 | mfspr r10, SPRN_SPRG_RSCRATCH0 |
602 | rfi /* Force context change */ | 602 | rfi /* Force context change */ |
603 | 603 | ||
604 | /* | 604 | /* |