diff options
Diffstat (limited to 'arch/arm/kernel/head.S')
-rw-r--r-- | arch/arm/kernel/head.S | 65 |
1 files changed, 15 insertions, 50 deletions
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 742b6108a001..673c806cc106 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -95,7 +95,7 @@ ENTRY(stext) | |||
95 | sub r4, r3, r4 @ (PHYS_OFFSET - PAGE_OFFSET) | 95 | sub r4, r3, r4 @ (PHYS_OFFSET - PAGE_OFFSET) |
96 | add r8, r8, r4 @ PHYS_OFFSET | 96 | add r8, r8, r4 @ PHYS_OFFSET |
97 | #else | 97 | #else |
98 | ldr r8, =PLAT_PHYS_OFFSET | 98 | ldr r8, =PHYS_OFFSET @ always constant in this case |
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | /* | 101 | /* |
@@ -234,7 +234,7 @@ __create_page_tables: | |||
234 | * This allows debug messages to be output | 234 | * This allows debug messages to be output |
235 | * via a serial console before paging_init. | 235 | * via a serial console before paging_init. |
236 | */ | 236 | */ |
237 | addruart r7, r3 | 237 | addruart r7, r3, r0 |
238 | 238 | ||
239 | mov r3, r3, lsr #20 | 239 | mov r3, r3, lsr #20 |
240 | mov r3, r3, lsl #2 | 240 | mov r3, r3, lsl #2 |
@@ -488,13 +488,8 @@ __fixup_pv_table: | |||
488 | add r5, r5, r3 @ adjust table end address | 488 | add r5, r5, r3 @ adjust table end address |
489 | add r7, r7, r3 @ adjust __pv_phys_offset address | 489 | add r7, r7, r3 @ adjust __pv_phys_offset address |
490 | str r8, [r7] @ save computed PHYS_OFFSET to __pv_phys_offset | 490 | str r8, [r7] @ save computed PHYS_OFFSET to __pv_phys_offset |
491 | #ifndef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT | ||
492 | mov r6, r3, lsr #24 @ constant for add/sub instructions | 491 | mov r6, r3, lsr #24 @ constant for add/sub instructions |
493 | teq r3, r6, lsl #24 @ must be 16MiB aligned | 492 | teq r3, r6, lsl #24 @ must be 16MiB aligned |
494 | #else | ||
495 | mov r6, r3, lsr #16 @ constant for add/sub instructions | ||
496 | teq r3, r6, lsl #16 @ must be 64kiB aligned | ||
497 | #endif | ||
498 | THUMB( it ne @ cross section branch ) | 493 | THUMB( it ne @ cross section branch ) |
499 | bne __error | 494 | bne __error |
500 | str r6, [r7, #4] @ save to __pv_offset | 495 | str r6, [r7, #4] @ save to __pv_offset |
@@ -510,20 +505,8 @@ ENDPROC(__fixup_pv_table) | |||
510 | .text | 505 | .text |
511 | __fixup_a_pv_table: | 506 | __fixup_a_pv_table: |
512 | #ifdef CONFIG_THUMB2_KERNEL | 507 | #ifdef CONFIG_THUMB2_KERNEL |
513 | #ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT | 508 | lsls r6, #24 |
514 | lsls r0, r6, #24 | 509 | beq 2f |
515 | lsr r6, #8 | ||
516 | beq 1f | ||
517 | clz r7, r0 | ||
518 | lsr r0, #24 | ||
519 | lsl r0, r7 | ||
520 | bic r0, 0x0080 | ||
521 | lsrs r7, #1 | ||
522 | orrcs r0, #0x0080 | ||
523 | orr r0, r0, r7, lsl #12 | ||
524 | #endif | ||
525 | 1: lsls r6, #24 | ||
526 | beq 4f | ||
527 | clz r7, r6 | 510 | clz r7, r6 |
528 | lsr r6, #24 | 511 | lsr r6, #24 |
529 | lsl r6, r7 | 512 | lsl r6, r7 |
@@ -532,43 +515,25 @@ __fixup_a_pv_table: | |||
532 | orrcs r6, #0x0080 | 515 | orrcs r6, #0x0080 |
533 | orr r6, r6, r7, lsl #12 | 516 | orr r6, r6, r7, lsl #12 |
534 | orr r6, #0x4000 | 517 | orr r6, #0x4000 |
535 | b 4f | 518 | b 2f |
536 | 2: @ at this point the C flag is always clear | 519 | 1: add r7, r3 |
537 | add r7, r3 | 520 | ldrh ip, [r7, #2] |
538 | #ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT | ||
539 | ldrh ip, [r7] | ||
540 | tst ip, 0x0400 @ the i bit tells us LS or MS byte | ||
541 | beq 3f | ||
542 | cmp r0, #0 @ set C flag, and ... | ||
543 | biceq ip, 0x0400 @ immediate zero value has a special encoding | ||
544 | streqh ip, [r7] @ that requires the i bit cleared | ||
545 | #endif | ||
546 | 3: ldrh ip, [r7, #2] | ||
547 | and ip, 0x8f00 | 521 | and ip, 0x8f00 |
548 | orrcc ip, r6 @ mask in offset bits 31-24 | 522 | orr ip, r6 @ mask in offset bits 31-24 |
549 | orrcs ip, r0 @ mask in offset bits 23-16 | ||
550 | strh ip, [r7, #2] | 523 | strh ip, [r7, #2] |
551 | 4: cmp r4, r5 | 524 | 2: cmp r4, r5 |
552 | ldrcc r7, [r4], #4 @ use branch for delay slot | 525 | ldrcc r7, [r4], #4 @ use branch for delay slot |
553 | bcc 2b | 526 | bcc 1b |
554 | bx lr | 527 | bx lr |
555 | #else | 528 | #else |
556 | #ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT | 529 | b 2f |
557 | and r0, r6, #255 @ offset bits 23-16 | 530 | 1: ldr ip, [r7, r3] |
558 | mov r6, r6, lsr #8 @ offset bits 31-24 | ||
559 | #else | ||
560 | mov r0, #0 @ just in case... | ||
561 | #endif | ||
562 | b 3f | ||
563 | 2: ldr ip, [r7, r3] | ||
564 | bic ip, ip, #0x000000ff | 531 | bic ip, ip, #0x000000ff |
565 | tst ip, #0x400 @ rotate shift tells us LS or MS byte | 532 | orr ip, ip, r6 @ mask in offset bits 31-24 |
566 | orrne ip, ip, r6 @ mask in offset bits 31-24 | ||
567 | orreq ip, ip, r0 @ mask in offset bits 23-16 | ||
568 | str ip, [r7, r3] | 533 | str ip, [r7, r3] |
569 | 3: cmp r4, r5 | 534 | 2: cmp r4, r5 |
570 | ldrcc r7, [r4], #4 @ use branch for delay slot | 535 | ldrcc r7, [r4], #4 @ use branch for delay slot |
571 | bcc 2b | 536 | bcc 1b |
572 | mov pc, lr | 537 | mov pc, lr |
573 | #endif | 538 | #endif |
574 | ENDPROC(__fixup_a_pv_table) | 539 | ENDPROC(__fixup_a_pv_table) |