Rev 895 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 895 | Rev 1777 | ||
|---|---|---|---|
| Line 41... | Line 41... | ||
| 41 | * the kernel relocates itself to its VMA. |
41 | * the kernel relocates itself to its VMA. |
| 42 | */ |
42 | */ |
| 43 | 43 | ||
| 44 | .global kernel_image_start |
44 | .global kernel_image_start |
| 45 | kernel_image_start: |
45 | kernel_image_start: |
| 46 | 0: |
- | |
| 47 | b 1f |
- | |
| 48 | nop |
- | |
| 49 | - | ||
| 50 | /* |
- | |
| 51 | * This header forces SILO to load the kernel at 0x4000. |
- | |
| 52 | * More precisely, SILO will think this is an old version of Linux. |
- | |
| 53 | */ |
- | |
| 54 | .ascii "HdrS" |
- | |
| 55 | .word 0 |
- | |
| 56 | .half 0 |
- | |
| 57 | - | ||
| 58 | .align 8 |
- | |
| 59 | - | ||
| 60 | 1: |
- | |
| 61 | flushw ! flush all but the active register window |
46 | flushw ! flush all but the active register window |
| 62 | 47 | ||
| 63 | /* |
- | |
| 64 | * Prepare to copy the kernel image to 4M. |
- | |
| 65 | */ |
- | |
| 66 | - | ||
| 67 | set LMA, %g1 ! source address |
- | |
| 68 | set VMA, %g2 ! destination address |
- | |
| 69 | set hardcoded_ktext_size, %g3 ! link address of hardcoded_ktext_size |
- | |
| 70 | set hardcoded_kdata_size, %g4 ! link address of hardcoded_kdata_size |
- | |
| 71 | - | ||
| 72 | sub %g3, %g2, %g3 ! offset of hardcoded_ktext_size from the beginning of the load address |
- | |
| 73 | sub %g4, %g2, %g4 ! offset of hardcoded_kdata_size from the beginning of the load address |
- | |
| 74 | - | ||
| 75 | ldx [%g3 + %g1], %g3 ! hardcoded_ktext_size -> %g3 |
- | |
| 76 | ldx [%g4 + %g1], %g4 ! hardcoded_kdata_size -> %g4 |
- | |
| 77 | - | ||
| 78 | add %g3, %g4, %g3 ! size of kernel text and data |
- | |
| 79 | - | ||
| 80 | /* |
- | |
| 81 | * Start copying the kernel from higher addresses towards lower addresses. |
- | |
| 82 | */ |
- | |
| 83 | - | ||
| 84 | 2: dec %g3 |
- | |
| 85 | ldub [%g1 + %g3], %g4 |
- | |
| 86 | stb %g4, [%g2 + %g3] |
- | |
| 87 | cmp %g3, 0 |
- | |
| 88 | bnz 2b |
- | |
| 89 | nop |
- | |
| 90 | - | ||
| 91 | set relocated, %g1 |
- | |
| 92 | jmp %g1 |
- | |
| 93 | nop |
- | |
| 94 | - | ||
| 95 | relocated: |
- | |
| 96 | set ofw, %l0 |
48 | set ofw, %l0 |
| 97 | 49 | ||
| 98 | call ofw_init |
50 | call ofw_init |
| 99 | stx %o4, [%l0] |
51 | stx %o4, [%l0] |
| 100 | 52 | ||