diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2007-10-11 14:36:52 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-10-11 14:36:52 -0400 |
commit | 8a13c4f972e6c107d8cff54de647544c00e25b41 (patch) | |
tree | bd1e291a935fe8420b270d0a4f8e9d3b7a8e1bd1 | |
parent | f5d7d13cd96313a90f8d13fa5d6e0704f6d534ba (diff) |
[POWERPC] Use PAGE_OFFSET to tell if an address is user/kernel in SW TLB handlers
Move to using PAGE_OFFSET instead of TASK_SIZE or KERNELBASE value on
6xx/40x/44x/fsl-booke to determine if the faulting address is a kernel or
user space address. This mimics how the macro is_kernel_addr() works.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/kernel/head_32.S | 18 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_40x.S | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_44x.S | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_fsl_booke.S | 11 |
4 files changed, 19 insertions, 22 deletions
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index d83f04e5a599..a5b13ae7fd20 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S | |||
@@ -469,12 +469,12 @@ InstructionTLBMiss: | |||
469 | mfctr r0 | 469 | mfctr r0 |
470 | /* Get PTE (linux-style) and check access */ | 470 | /* Get PTE (linux-style) and check access */ |
471 | mfspr r3,SPRN_IMISS | 471 | mfspr r3,SPRN_IMISS |
472 | lis r1,KERNELBASE@h /* check if kernel address */ | 472 | lis r1,PAGE_OFFSET@h /* check if kernel address */ |
473 | cmplw 0,r3,r1 | 473 | cmplw 0,r1,r3 |
474 | mfspr r2,SPRN_SPRG3 | 474 | mfspr r2,SPRN_SPRG3 |
475 | li r1,_PAGE_USER|_PAGE_PRESENT /* low addresses tested as user */ | 475 | li r1,_PAGE_USER|_PAGE_PRESENT /* low addresses tested as user */ |
476 | lwz r2,PGDIR(r2) | 476 | lwz r2,PGDIR(r2) |
477 | blt+ 112f | 477 | bge- 112f |
478 | mfspr r2,SPRN_SRR1 /* and MSR_PR bit from SRR1 */ | 478 | mfspr r2,SPRN_SRR1 /* and MSR_PR bit from SRR1 */ |
479 | rlwimi r1,r2,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */ | 479 | rlwimi r1,r2,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */ |
480 | lis r2,swapper_pg_dir@ha /* if kernel address, use */ | 480 | lis r2,swapper_pg_dir@ha /* if kernel address, use */ |
@@ -543,12 +543,12 @@ DataLoadTLBMiss: | |||
543 | mfctr r0 | 543 | mfctr r0 |
544 | /* Get PTE (linux-style) and check access */ | 544 | /* Get PTE (linux-style) and check access */ |
545 | mfspr r3,SPRN_DMISS | 545 | mfspr r3,SPRN_DMISS |
546 | lis r1,KERNELBASE@h /* check if kernel address */ | 546 | lis r1,PAGE_OFFSET@h /* check if kernel address */ |
547 | cmplw 0,r3,r1 | 547 | cmplw 0,r1,r3 |
548 | mfspr r2,SPRN_SPRG3 | 548 | mfspr r2,SPRN_SPRG3 |
549 | li r1,_PAGE_USER|_PAGE_PRESENT /* low addresses tested as user */ | 549 | li r1,_PAGE_USER|_PAGE_PRESENT /* low addresses tested as user */ |
550 | lwz r2,PGDIR(r2) | 550 | lwz r2,PGDIR(r2) |
551 | blt+ 112f | 551 | bge- 112f |
552 | mfspr r2,SPRN_SRR1 /* and MSR_PR bit from SRR1 */ | 552 | mfspr r2,SPRN_SRR1 /* and MSR_PR bit from SRR1 */ |
553 | rlwimi r1,r2,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */ | 553 | rlwimi r1,r2,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */ |
554 | lis r2,swapper_pg_dir@ha /* if kernel address, use */ | 554 | lis r2,swapper_pg_dir@ha /* if kernel address, use */ |
@@ -615,12 +615,12 @@ DataStoreTLBMiss: | |||
615 | mfctr r0 | 615 | mfctr r0 |
616 | /* Get PTE (linux-style) and check access */ | 616 | /* Get PTE (linux-style) and check access */ |
617 | mfspr r3,SPRN_DMISS | 617 | mfspr r3,SPRN_DMISS |
618 | lis r1,KERNELBASE@h /* check if kernel address */ | 618 | lis r1,PAGE_OFFSET@h /* check if kernel address */ |
619 | cmplw 0,r3,r1 | 619 | cmplw 0,r1,r3 |
620 | mfspr r2,SPRN_SPRG3 | 620 | mfspr r2,SPRN_SPRG3 |
621 | li r1,_PAGE_RW|_PAGE_USER|_PAGE_PRESENT /* access flags */ | 621 | li r1,_PAGE_RW|_PAGE_USER|_PAGE_PRESENT /* access flags */ |
622 | lwz r2,PGDIR(r2) | 622 | lwz r2,PGDIR(r2) |
623 | blt+ 112f | 623 | bge- 112f |
624 | mfspr r2,SPRN_SRR1 /* and MSR_PR bit from SRR1 */ | 624 | mfspr r2,SPRN_SRR1 /* and MSR_PR bit from SRR1 */ |
625 | rlwimi r1,r2,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */ | 625 | rlwimi r1,r2,32-12,29,29 /* shift MSR_PR to _PAGE_USER posn */ |
626 | lis r2,swapper_pg_dir@ha /* if kernel address, use */ | 626 | lis r2,swapper_pg_dir@ha /* if kernel address, use */ |
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S index e312824bdd98..cfefc2df8f2a 100644 --- a/arch/powerpc/kernel/head_40x.S +++ b/arch/powerpc/kernel/head_40x.S | |||
@@ -289,7 +289,7 @@ label: | |||
289 | /* If we are faulting a kernel address, we have to use the | 289 | /* If we are faulting a kernel address, we have to use the |
290 | * kernel page tables. | 290 | * kernel page tables. |
291 | */ | 291 | */ |
292 | lis r11, TASK_SIZE@h | 292 | lis r11, PAGE_OFFSET@h |
293 | cmplw r10, r11 | 293 | cmplw r10, r11 |
294 | blt+ 3f | 294 | blt+ 3f |
295 | lis r11, swapper_pg_dir@h | 295 | lis r11, swapper_pg_dir@h |
@@ -481,7 +481,7 @@ label: | |||
481 | /* If we are faulting a kernel address, we have to use the | 481 | /* If we are faulting a kernel address, we have to use the |
482 | * kernel page tables. | 482 | * kernel page tables. |
483 | */ | 483 | */ |
484 | lis r11, TASK_SIZE@h | 484 | lis r11, PAGE_OFFSET@h |
485 | cmplw r10, r11 | 485 | cmplw r10, r11 |
486 | blt+ 3f | 486 | blt+ 3f |
487 | lis r11, swapper_pg_dir@h | 487 | lis r11, swapper_pg_dir@h |
@@ -581,7 +581,7 @@ label: | |||
581 | /* If we are faulting a kernel address, we have to use the | 581 | /* If we are faulting a kernel address, we have to use the |
582 | * kernel page tables. | 582 | * kernel page tables. |
583 | */ | 583 | */ |
584 | lis r11, TASK_SIZE@h | 584 | lis r11, PAGE_OFFSET@h |
585 | cmplw r10, r11 | 585 | cmplw r10, r11 |
586 | blt+ 3f | 586 | blt+ 3f |
587 | lis r11, swapper_pg_dir@h | 587 | lis r11, swapper_pg_dir@h |
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S index 864d63fbb204..409db6123924 100644 --- a/arch/powerpc/kernel/head_44x.S +++ b/arch/powerpc/kernel/head_44x.S | |||
@@ -319,7 +319,7 @@ interrupt_base: | |||
319 | /* If we are faulting a kernel address, we have to use the | 319 | /* If we are faulting a kernel address, we have to use the |
320 | * kernel page tables. | 320 | * kernel page tables. |
321 | */ | 321 | */ |
322 | lis r11, TASK_SIZE@h | 322 | lis r11, PAGE_OFFSET@h |
323 | cmplw r10, r11 | 323 | cmplw r10, r11 |
324 | blt+ 3f | 324 | blt+ 3f |
325 | lis r11, swapper_pg_dir@h | 325 | lis r11, swapper_pg_dir@h |
@@ -458,7 +458,7 @@ interrupt_base: | |||
458 | /* If we are faulting a kernel address, we have to use the | 458 | /* If we are faulting a kernel address, we have to use the |
459 | * kernel page tables. | 459 | * kernel page tables. |
460 | */ | 460 | */ |
461 | lis r11, TASK_SIZE@h | 461 | lis r11, PAGE_OFFSET@h |
462 | cmplw r10, r11 | 462 | cmplw r10, r11 |
463 | blt+ 3f | 463 | blt+ 3f |
464 | lis r11, swapper_pg_dir@h | 464 | lis r11, swapper_pg_dir@h |
@@ -528,7 +528,7 @@ interrupt_base: | |||
528 | /* If we are faulting a kernel address, we have to use the | 528 | /* If we are faulting a kernel address, we have to use the |
529 | * kernel page tables. | 529 | * kernel page tables. |
530 | */ | 530 | */ |
531 | lis r11, TASK_SIZE@h | 531 | lis r11, PAGE_OFFSET@h |
532 | cmplw r10, r11 | 532 | cmplw r10, r11 |
533 | blt+ 3f | 533 | blt+ 3f |
534 | lis r11, swapper_pg_dir@h | 534 | lis r11, swapper_pg_dir@h |
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S index ee33ddd97ef3..4b9822728aea 100644 --- a/arch/powerpc/kernel/head_fsl_booke.S +++ b/arch/powerpc/kernel/head_fsl_booke.S | |||
@@ -461,8 +461,7 @@ interrupt_base: | |||
461 | /* If we are faulting a kernel address, we have to use the | 461 | /* If we are faulting a kernel address, we have to use the |
462 | * kernel page tables. | 462 | * kernel page tables. |
463 | */ | 463 | */ |
464 | lis r11, TASK_SIZE@h | 464 | lis r11, PAGE_OFFSET@h |
465 | ori r11, r11, TASK_SIZE@l | ||
466 | cmplw 0, r10, r11 | 465 | cmplw 0, r10, r11 |
467 | bge 2f | 466 | bge 2f |
468 | 467 | ||
@@ -584,8 +583,7 @@ interrupt_base: | |||
584 | /* If we are faulting a kernel address, we have to use the | 583 | /* If we are faulting a kernel address, we have to use the |
585 | * kernel page tables. | 584 | * kernel page tables. |
586 | */ | 585 | */ |
587 | lis r11, TASK_SIZE@h | 586 | lis r11, PAGE_OFFSET@h |
588 | ori r11, r11, TASK_SIZE@l | ||
589 | cmplw 5, r10, r11 | 587 | cmplw 5, r10, r11 |
590 | blt 5, 3f | 588 | blt 5, 3f |
591 | lis r11, swapper_pg_dir@h | 589 | lis r11, swapper_pg_dir@h |
@@ -645,8 +643,7 @@ interrupt_base: | |||
645 | /* If we are faulting a kernel address, we have to use the | 643 | /* If we are faulting a kernel address, we have to use the |
646 | * kernel page tables. | 644 | * kernel page tables. |
647 | */ | 645 | */ |
648 | lis r11, TASK_SIZE@h | 646 | lis r11, PAGE_OFFSET@h |
649 | ori r11, r11, TASK_SIZE@l | ||
650 | cmplw 5, r10, r11 | 647 | cmplw 5, r10, r11 |
651 | blt 5, 3f | 648 | blt 5, 3f |
652 | lis r11, swapper_pg_dir@h | 649 | lis r11, swapper_pg_dir@h |
@@ -744,7 +741,7 @@ data_access: | |||
744 | * r10 - EA of fault | 741 | * r10 - EA of fault |
745 | * r11 - TLB (info from Linux PTE) | 742 | * r11 - TLB (info from Linux PTE) |
746 | * r12, r13 - available to use | 743 | * r12, r13 - available to use |
747 | * CR5 - results of addr < TASK_SIZE | 744 | * CR5 - results of addr >= PAGE_OFFSET |
748 | * MAS0, MAS1 - loaded with proper value when we get here | 745 | * MAS0, MAS1 - loaded with proper value when we get here |
749 | * MAS2, MAS3 - will need additional info from Linux PTE | 746 | * MAS2, MAS3 - will need additional info from Linux PTE |
750 | * Upon exit, we reload everything and RFI. | 747 | * Upon exit, we reload everything and RFI. |