Changeset 84060e2 in mainline
- Timestamp:
- 2006-10-09T19:29:42Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8ce8499
- Parents:
- e4398200
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc64/loader/boot.S
re4398200 r84060e2 1 1 # 2 2 # Copyright (C) 2006 Martin Decky 3 # Copyright (C) 2006 Jakub Jermar 3 4 # All rights reserved. 4 5 # -
kernel/arch/sparc64/include/arch.h
re4398200 r84060e2 43 43 #define ASI_UPA_CONFIG 0x4a /** ASI of the UPA_CONFIG register. */ 44 44 45 #define NWINDOW 8/** Number of register window sets. */45 #define NWINDOWS 8 /** Number of register window sets. */ 46 46 47 47 #endif -
kernel/arch/sparc64/src/cpu/cpu.c
re4398200 r84060e2 41 41 #include <arch/types.h> 42 42 #include <arch/drivers/tick.h> 43 #include <arch/mm/page.h> 44 #include <arch/mm/tlb.h> 45 #include <macros.h> 43 46 44 47 /** Perform sparc64 specific initialization of the processor structure for the current processor. */ … … 53 56 CPU->arch.mid = upa_config.mid; 54 57 58 /* 59 * Detect processor frequency. 60 */ 55 61 node = ofw_tree_find_child_by_device_type(ofw_tree_lookup("/"), "cpu"); 56 62 while (node) { … … 71 77 CPU->arch.clock_frequency = clock_frequency; 72 78 tick_init(); 79 80 /* 81 * Lock CPU stack in DTLB. 82 */ 83 uintptr_t base = ALIGN_DOWN(config.base, 1<<KERNEL_PAGE_WIDTH); 84 85 if (!overlaps((uintptr_t) CPU->stack, PAGE_SIZE, base, (1<<KERNEL_PAGE_WIDTH))) { 86 /* 87 * Kernel stack of this processor is not locked in DTLB. 88 * First, demap any already existing mappings. 89 * Second, create a locked mapping for it. 90 */ 91 dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, (uintptr_t) CPU->stack); 92 dtlb_insert_mapping((uintptr_t) CPU->stack, KA2PA(CPU->stack), PAGESIZE_8K, true, true); 93 } 94 73 95 } 74 96 -
kernel/arch/sparc64/src/mm/page.c
re4398200 r84060e2 120 120 { PAGESIZE_512K, 64*PAGE_SIZE, 4 }, /* 2M */ 121 121 { PAGESIZE_4M, 0, 1 } /* 4M */ 122 { PAGESIZE_4M, 512*PAGE_SIZE, 2 } /* 8M */ 122 123 }; 123 124 124 125 ASSERT(ALIGN_UP(physaddr, PAGE_SIZE) == physaddr); 125 ASSERT(size <= 4*1024*1024);126 ASSERT(size <= 8*1024*1024); 126 127 127 128 if (size <= FRAME_SIZE) -
kernel/arch/sparc64/src/mm/tsb.c
re4398200 r84060e2 88 88 */ 89 89 90 tsb->tag.invalid = 1; /* invalidate the entry (tag target has this set to 0 */90 tsb->tag.invalid = 1; /* invalidate the entry (tag target has this set to 0) */ 91 91 92 92 write_barrier(); -
kernel/arch/sparc64/src/start.S
re4398200 r84060e2 30 30 #include <arch/regdef.h> 31 31 #include <arch/boot/boot.h> 32 #include <arch/stack.h> 32 33 33 34 #include <arch/mm/mmu.h> … … 57 58 * - TLBs are on 58 59 * - identity mapping for the kernel image 59 * - identity mapping for memory stack60 60 */ 61 61 … … 68 68 */ 69 69 70 flushw ! flush all but the active register window 70 wrpr %g0, NWINDOWS - 2, %cansave ! set maximum saveable windows 71 wrpr %g0, 0, %canrestore ! get rid of windows we will never need again 72 wrpr %g0, 0, %otherwin ! make sure the window state is consistent 73 wrpr %g0, NWINDOWS - 1, %cleanwin ! prevent needless clean_window traps for kernel 71 74 72 75 wrpr %g0, 0, %tl ! TL = 0, primary context register is used … … 216 219 nop 217 220 221 /* 222 * So far, we have not touched the stack. 223 * It is a good idead to set the kernel stack to a known state now. 224 */ 225 sethi %hi(temporary_boot_stack), %sp 226 or %sp, %lo(temporary_boot_stack), %sp 227 sub %sp, STACK_BIAS, %sp 228 218 229 sethi %hi(bootinfo), %o0 219 230 call memcpy ! copy bootinfo … … 273 284 ba 0b 274 285 nop 286 287 288 .section K_DATA_START, "aw", @progbits 289 290 /* 291 * Create small stack to be used by the bootstrap processor. 292 * It is going to be used only for a very limited period of 293 * time, but we switch to it anyway, just to be sure we are 294 * properly initialized. 295 * 296 * What is important is that this piece of memory is covered 297 * by the 4M DTLB locked entry and therefore there will be 298 * no surprises like deadly combinations of spill trap and 299 * and TLB miss on the stack address. 300 */ 301 302 #define INITIAL_STACK_SIZE 1024 303 304 .align STACK_ALIGNMENT 305 .space INITIAL_STACK_SIZE 306 .align STACK_ALIGNMENT 307 temporary_boot_stack: 308 .space STACK_WINDOW_SAVE_AREA_SIZE -
kernel/arch/sparc64/src/trap/trap_table.S
re4398200 r84060e2 674 674 wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(2), %wstate 675 675 676 wrpr %g0, NWINDOW - 1, %cleanwin ! prevent unnecessary clean_window exceptions676 wrpr %g0, NWINDOWS - 1, %cleanwin ! prevent unnecessary clean_window exceptions 677 677 678 678 /* … … 831 831 and %g1, TSTATE_CWP_MASK, %l0 832 832 inc %l0 833 and %l0, NWINDOW - 1, %l0 ! %l0 mod NWINDOW833 and %l0, NWINDOWS - 1, %l0 ! %l0 mod NWINDOWS 834 834 rdpr %cwp, %l1 835 835 cmp %l0, %l1 … … 902 902 sub %g1, %g2, %g3 903 903 dec %g3 904 and %g3, NWINDOW - 1, %g3904 and %g3, NWINDOWS - 1, %g3 905 905 wrpr %g3, 0, %cwp 906 906 … … 934 934 935 935 dec %g3 936 and %g3, NWINDOW - 1, %g3936 and %g3, NWINDOWS - 1, %g3 937 937 wrpr %g3, 0, %cwp ! switch to the preceeding window 938 938 … … 947 947 wrpr %g1, 0, %cwp 948 948 add %g4, %g2, %g2 949 cmp %g2, NWINDOW - 2950 bg 2f ! fix the CANRESTORE=NWINDOW -1 anomaly951 mov NWINDOW - 2, %g1 ! use dealy slot for both cases949 cmp %g2, NWINDOWS - 2 950 bg 2f ! fix the CANRESTORE=NWINDOWS-1 anomaly 951 mov NWINDOWS - 2, %g1 ! use dealy slot for both cases 952 952 sub %g1, %g2, %g1 953 953 954 954 wrpr %g0, 0, %otherwin 955 wrpr %g1, 0, %cansave ! NWINDOW - 2 - CANRESTORE955 wrpr %g1, 0, %cansave ! NWINDOWS - 2 - CANRESTORE 956 956 wrpr %g2, 0, %canrestore ! OTHERWIN + windows in the buffer 957 957 wrpr %g2, 0, %cleanwin ! avoid information leak … … 973 973 * 974 974 * instruction trapped and spilled a register window into the userspace 975 * window buffer, we have just restored NWINDOW - 1 register windows.975 * window buffer, we have just restored NWINDOWS - 1 register windows. 976 976 * However, CANRESTORE can be only NWINDOW - 2 at most. 977 977 * 978 * The solution is to manually switch to (CWP - 1) mod NWINDOW 978 * The solution is to manually switch to (CWP - 1) mod NWINDOWS 979 979 * and set the window state registers so that: 980 980 * 981 * CANRESTORE = NWINDOW - 2982 * CLEANWIN = NWINDOW - 2981 * CANRESTORE = NWINDOWS - 2 982 * CLEANWIN = NWINDOWS - 2 983 983 * CANSAVE = 0 984 984 * OTHERWIN = 0 … … 994 994 rdpr %cwp, %g1 995 995 dec %g1 996 and %g1, NWINDOW - 1, %g1996 and %g1, NWINDOWS - 1, %g1 997 997 wrpr %g1, 0, %cwp ! CWP-- 998 998
Note:
See TracChangeset
for help on using the changeset viewer.