Changeset 7e7c8747 in mainline for kernel/arch/sparc64/src/start.S
- Timestamp:
- 2006-12-17T12:11:00Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 95155b0c
- Parents:
- 771cd22
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/start.S
r771cd22 r7e7c8747 78 78 79 79 wrpr %g0, NWINDOWS - 2, %cansave ! set maximum saveable windows 80 wrpr %g0, 0, %canrestore ! get rid of windows we will never need again 81 wrpr %g0, 0, %otherwin ! make sure the window state is consistent 82 wrpr %g0, NWINDOWS - 1, %cleanwin ! prevent needless clean_window traps for kernel 83 84 wrpr %g0, 0, %tl ! TL = 0, primary context register is used 85 86 wrpr %g0, PSTATE_PRIV_BIT, %pstate ! Disable interrupts and disable 32-bit address masking. 80 wrpr %g0, 0, %canrestore ! get rid of windows we will 81 ! never need again 82 wrpr %g0, 0, %otherwin ! make sure the window state is 83 ! consistent 84 wrpr %g0, NWINDOWS - 1, %cleanwin ! prevent needless clean_window 85 ! traps for kernel 86 87 wrpr %g0, 0, %tl ! TL = 0, primary context 88 ! register is used 89 90 wrpr %g0, PSTATE_PRIV_BIT, %pstate ! disable interrupts and disable 91 ! 32-bit address masking 87 92 88 93 wrpr %g0, 0, %pil ! intialize %pil … … 95 100 96 101 /* 97 * Take over the DMMU by installing global locked 98 * TTE entry identically mapping the first 4M 99 * of memory. 102 * Take over the DMMU by installing global locked TTE entry identically 103 * mapping the first 4M of memory. 100 104 * 101 * In case of DMMU, no FLUSH instructions need to be 102 * issued. Because of that, the old DTLB contents can 103 * be demapped pretty straightforwardly and without 104 * causing any traps. 105 * In case of DMMU, no FLUSH instructions need to be issued. Because of 106 * that, the old DTLB contents can be demapped pretty straightforwardly 107 * and without causing any traps. 105 108 */ 106 109 … … 108 111 109 112 #define SET_TLB_DEMAP_CMD(r1, context_id) \ 110 set (TLB_DEMAP_CONTEXT<<TLB_DEMAP_TYPE_SHIFT) | (context_id<<TLB_DEMAP_CONTEXT_SHIFT), %r1 113 set (TLB_DEMAP_CONTEXT << TLB_DEMAP_TYPE_SHIFT) | (context_id << \ 114 TLB_DEMAP_CONTEXT_SHIFT), %r1 111 115 112 116 ! demap context 0 … … 116 120 117 121 #define SET_TLB_TAG(r1, context) \ 118 set VMA | (context <<TLB_TAG_ACCESS_CONTEXT_SHIFT), %r1122 set VMA | (context << TLB_TAG_ACCESS_CONTEXT_SHIFT), %r1 119 123 120 124 ! write DTLB tag … … 145 149 146 150 /* 147 * Because we cannot use global mappings (because we want to 148 * have separate 64-bit address spaces for both the kernel 149 * and the userspace), we prepare the identity mapping also in 150 * context 1. This step is required by the 151 * code installing the ITLB mapping. 151 * Because we cannot use global mappings (because we want to have 152 * separate 64-bit address spaces for both the kernel and the 153 * userspace), we prepare the identity mapping also in context 1. This 154 * step is required by the code installing the ITLB mapping. 152 155 */ 153 156 ! write DTLB tag of context 1 (i.e. MEM_CONTEXT_TEMP) … … 162 165 163 166 /* 164 * Now is time to take over the IMMU. 165 * Unfortunatelly, it cannot be done as easily as the DMMU,166 * because the IMMU is mapping the code itexecutes.167 * Now is time to take over the IMMU. Unfortunatelly, it cannot be done 168 * as easily as the DMMU, because the IMMU is mapping the code it 169 * executes. 167 170 * 168 * [ Note that brave experiments with disabling the IMMU 169 * and using the DMMU approach failed after a dozen170 * of desparate days with only littlesuccess. ]171 * [ Note that brave experiments with disabling the IMMU and using the 172 * DMMU approach failed after a dozen of desparate days with only little 173 * success. ] 171 174 * 172 * The approach used here is inspired from OpenBSD. 173 * First, the kernel creates IMMU mapping for itself 174 * in context 1 (MEM_CONTEXT_TEMP) and switches to 175 * it. Context 0 (MEM_CONTEXT_KERNEL) can be demapped 176 * afterwards and replaced with the kernel permanent 177 * mapping. Finally, the kernel switches back to 178 * context 0 and demaps context 1. 175 * The approach used here is inspired from OpenBSD. First, the kernel 176 * creates IMMU mapping for itself in context 1 (MEM_CONTEXT_TEMP) and 177 * switches to it. Context 0 (MEM_CONTEXT_KERNEL) can be demapped 178 * afterwards and replaced with the kernel permanent mapping. Finally, 179 * the kernel switches back to context 0 and demaps context 1. 179 180 * 180 * Moreover, the IMMU requires use of the FLUSH instructions. 181 * But that is OK because we always use operands with182 * addresses already mapped bythe taken over DTLB.181 * Moreover, the IMMU requires use of the FLUSH instructions. But that 182 * is OK because we always use operands with addresses already mapped by 183 * the taken over DTLB. 183 184 */ 184 185 … … 292 293 #ifdef CONFIG_SMP 293 294 /* 294 * Active loop for APs until the BSP picks them up. 295 * A processor cannot leave the loop until the 296 * global variable 'waking_up_mid' equals its 295 * Active loop for APs until the BSP picks them up. A processor cannot 296 * leave the loop until the global variable 'waking_up_mid' equals its 297 297 * MID. 298 298 */ … … 327 327 328 328 /* 329 * Create small stack to be used by the bootstrap processor. 330 * It is going to be used only for a very limited period of 331 * time, but we switch to it anyway, just to be sure we are 332 * properly initialized. 329 * Create small stack to be used by the bootstrap processor. It is going to be 330 * used only for a very limited period of time, but we switch to it anyway, 331 * just to be sure we are properly initialized. 333 332 * 334 * What is important is that this piece of memory is covered 335 * by the 4M DTLB locked entry and therefore there will be 336 * no surprises like deadly combinations of spill trap and 337 * and TLB miss on the stack address. 333 * What is important is that this piece of memory is covered by the 4M DTLB 334 * locked entry and therefore there will be no surprises like deadly 335 * combinations of spill trap and and TLB miss on the stack address. 338 336 */ 339 337 … … 355 353 356 354 /* 357 * This variable is used by the fast_data_MMU_miss trap handler. 358 * In runtime, it is further modified to reflect the starting address of 359 * physical memory. 355 * This variable is used by the fast_data_MMU_miss trap handler. In runtime, it 356 * is further modified to reflect the starting address of physical memory. 360 357 */ 361 358 .global kernel_8k_tlb_data_template 362 359 kernel_8k_tlb_data_template: 363 360 #ifdef CONFIG_VIRT_IDX_DCACHE 364 .quad ((1 << TTE_V_SHIFT) | (PAGESIZE_8K << TTE_SIZE_SHIFT) | TTE_CP | TTE_CV | TTE_P | TTE_W) 361 .quad ((1 << TTE_V_SHIFT) | (PAGESIZE_8K << TTE_SIZE_SHIFT) | TTE_CP | \ 362 TTE_CV | TTE_P | TTE_W) 365 363 #else /* CONFIG_VIRT_IDX_DCACHE */ 366 .quad ((1 << TTE_V_SHIFT) | (PAGESIZE_8K << TTE_SIZE_SHIFT) | TTE_CP | TTE_P | TTE_W) 364 .quad ((1 << TTE_V_SHIFT) | (PAGESIZE_8K << TTE_SIZE_SHIFT) | TTE_CP | \ 365 TTE_P | TTE_W) 367 366 #endif /* CONFIG_VIRT_IDX_DCACHE */ 367
Note:
See TracChangeset
for help on using the changeset viewer.