|
48 | 48 | mtspr spr, reg
|
49 | 49 | #endif
|
50 | 50 |
|
| 51 | +/* Macro to test if an address is a kernel address */ |
| 52 | +#if CONFIG_TASK_SIZE <= 0x80000000 && CONFIG_PAGE_OFFSET >= 0x80000000 |
| 53 | +#define IS_KERNEL(tmp, addr) \ |
| 54 | + andis. tmp, addr, 0x8000 /* Address >= 0x80000000 */ |
| 55 | +#define BRANCH_UNLESS_KERNEL(label) beq label |
| 56 | +#else |
| 57 | +#define IS_KERNEL(tmp, addr) \ |
| 58 | + rlwinm tmp, addr, 16, 16, 31; \ |
| 59 | + cmpli cr0, tmp, PAGE_OFFSET >> 16 |
| 60 | +#define BRANCH_UNLESS_KERNEL(label) blt label |
| 61 | +#endif |
| 62 | + |
| 63 | + |
51 | 64 | /*
|
52 | 65 | * Value for the bits that have fixed value in RPN entries.
|
53 | 66 | * Also used for tagging DAR for DTLBerror.
|
@@ -322,9 +335,9 @@ InstructionTLBMiss:
|
322 | 335 | mfspr r11, SPRN_SRR0 /* Get effective address of fault */
|
323 | 336 | INVALIDATE_ADJACENT_PAGES_CPU15(r10, r11)
|
324 | 337 | mfcr r10
|
325 |
| - andis. r11, r11, 0x8000 /* Address >= 0x80000000 */ |
| 338 | + IS_KERNEL(r11, r11) |
326 | 339 | mfspr r11, SPRN_M_TW /* Get level 1 table */
|
327 |
| - beq 3f |
| 340 | + BRANCH_UNLESS_KERNEL(3f) |
328 | 341 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha
|
329 | 342 | 3:
|
330 | 343 | mtcr r10
|
@@ -379,9 +392,9 @@ DataStoreTLBMiss:
|
379 | 392 | * kernel page tables.
|
380 | 393 | */
|
381 | 394 | mfspr r11, SPRN_MD_EPN
|
382 |
| - andis. r11, r11, 0x8000 |
| 395 | + IS_KERNEL(r11, r11) |
383 | 396 | mfspr r11, SPRN_M_TW /* Get level 1 table */
|
384 |
| - beq 3f |
| 397 | + BRANCH_UNLESS_KERNEL(3f) |
385 | 398 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha
|
386 | 399 | 3:
|
387 | 400 | mtcr r10
|
@@ -513,9 +526,9 @@ FixupDAR:/* Entry point for dcbx workaround. */
|
513 | 526 | mtspr SPRN_SPRG_SCRATCH2, r10
|
514 | 527 | /* fetch instruction from memory. */
|
515 | 528 | mfspr r10, SPRN_SRR0
|
516 |
| - andis. r11, r10, 0x8000 /* Address >= 0x80000000 */ |
| 529 | + IS_KERNEL(r11, r10) |
517 | 530 | mfspr r11, SPRN_M_TW /* Get level 1 table */
|
518 |
| - beq 3f |
| 531 | + BRANCH_UNLESS_KERNEL(3f) |
519 | 532 | lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha
|
520 | 533 | /* Insert level 1 index */
|
521 | 534 | 3: rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29
|
|
0 commit comments