Changeset ce031f0 in mainline
- Timestamp:
- 2005-10-04T11:23:21Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8e3f47b3
- Parents:
- 1e2aecca
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/mips32/include/cp0.h
r1e2aecca rce031f0 53 53 #define cp0_compare_value 10000 54 54 55 static inline void tlbp(void)56 {57 __asm__ volatile ("tlbp");58 }59 60 static inline void tlbr(void)61 {62 __asm__ volatile ("tlbr");63 }64 static inline void tlbwi(void)65 {66 __asm__ volatile ("tlbwi");67 }68 static inline void tlbwr(void)69 {70 __asm__ volatile ("tlbwr");71 }72 73 55 #define cp0_mask_all_int() cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask)) 74 56 #define cp0_unmask_all_int() cp0_status_write(cp0_status_read() | cp0_status_im_mask) … … 76 58 #define cp0_unmask_int(it) cp0_status_write(cp0_status_read() | (1<<(cp0_status_im_shift+(it)))) 77 59 78 79 60 extern __u32 cp0_index_read(void); 80 extern void cp0_i dnex_write(__u32 val);61 extern void cp0_index_write(__u32 val); 81 62 82 63 extern __u32 cp0_random_read(void); -
arch/mips32/include/mm/tlb.h
r1e2aecca rce031f0 31 31 32 32 #include <arch/exception.h> 33 34 #define TLB_SIZE 48 35 36 #define TLB_WIRED 1 37 #define TLB_KSTACK_WIRED_INDEX 0 38 39 #define TLB_PAGE_MASK_16K (0x3<<13) 33 40 34 41 #define PAGE_UNCACHED 2 … … 66 73 typedef struct entry_lo pte_t; 67 74 75 /** Read Indexed TLB Entry 76 * 77 * Read Indexed TLB Entry. 78 */ 79 static inline void tlbr(void) 80 { 81 __asm__ volatile ("tlbr\n\t"); 82 } 83 84 /** Write Indexed TLB Entry 85 * 86 * Write Indexed TLB Entry. 87 */ 88 static inline void tlbwi(void) 89 { 90 __asm__ volatile ("tlbwi\n\t"); 91 } 92 93 /** Write Random TLB Entry 94 * 95 * Write Random TLB Entry. 96 */ 97 static inline void tlbwr(void) 98 { 99 __asm__ volatile ("tlbwr\n\t"); 100 } 101 68 102 extern void tlb_invalid(struct exception_regdump *pstate); 69 103 extern void tlb_refill(struct exception_regdump *pstate); 104 extern void tlb_modified(struct exception_regdump *pstate); 70 105 71 106 #endif -
arch/mips32/src/asm.S
r1e2aecca rce031f0 63 63 .global cp0_count_read 64 64 .global cp0_count_write 65 .global cp0_ hi_read66 .global cp0_ hi_write65 .global cp0_entry_hi_read 66 .global cp0_entry_hi_write 67 67 .global cp0_compare_read 68 68 .global cp0_compare_write -
arch/mips32/src/exception.c
r1e2aecca rce031f0 81 81 break; 82 82 case EXC_Mod: 83 panic("unhandled TLB Modification Exception\n");83 tlb_modified(pstate); 84 84 break; 85 85 case EXC_AdEL: -
arch/mips32/src/mm/tlb.c
r1e2aecca rce031f0 33 33 #include <panic.h> 34 34 #include <arch.h> 35 #include <symtab.h> 35 36 36 #include <symtab.h> 37 void tlb_init_arch(void) 38 { 39 int i; 40 41 cp0_pagemask_write(TLB_PAGE_MASK_16K); 42 cp0_entry_hi_write(0); 43 cp0_entry_lo0_write(0); 44 cp0_entry_lo1_write(0); 45 46 /* 47 * Invalidate all entries. 48 */ 49 for (i = 0; i < TLB_SIZE; i++) { 50 cp0_index_write(0); 51 tlbwi(); 52 } 53 54 /* 55 * The kernel is going to make use of some wired 56 * entries (e.g. mapping kernel stacks). 57 */ 58 cp0_wired_write(TLB_WIRED); 59 } 37 60 38 61 void tlb_refill(struct exception_regdump *pstate) … … 47 70 if (s) 48 71 sym2 = s; 49 panic("%X: tlb_refill exception at %X(%s<-%s)\n", cp0_badvaddr_read(),50 pstate->epc, symbol, sym2);72 panic("%X: TLB Refill Exception at %X(%s<-%s)\n", cp0_badvaddr_read(), 73 pstate->epc, symbol, sym2); 51 74 } 52 75 … … 58 81 if (s) 59 82 symbol = s; 60 panic("%X: TLB exception at %X(%s)\n", cp0_badvaddr_read(),83 panic("%X: TLB Invalid Exception at %X(%s)\n", cp0_badvaddr_read(), 61 84 pstate->epc, symbol); 62 85 } 86 87 void tlb_modified(struct exception_regdump *pstate) 88 { 89 char *symbol = ""; 90 91 char *s = get_symtab_entry(pstate->epc); 92 if (s) 93 symbol = s; 94 panic("%X: TLB Modified Exception at %X(%s)\n", cp0_badvaddr_read(), 95 pstate->epc, symbol); 96 } 97 63 98 64 99 void tlb_invalidate(int asid) -
include/mm/tlb.h
r1e2aecca rce031f0 30 30 #define __TLB_H__ 31 31 32 extern void tlb_init(void); 33 32 34 #ifdef __SMP__ 33 extern void tlb_init(void);34 35 extern void tlb_shootdown_start(void); 35 36 extern void tlb_shootdown_finalize(void); 36 37 extern void tlb_shootdown_ipi_recv(void); 37 38 #else 38 39 #define tlb_init() ; 40 #define tlb_shootdown_start() ; 41 #define tlb_shootdown_finalize() ; 42 #define tlb_shootdown_ipi_recv() ; 43 39 # define tlb_shootdown_start() ; 40 # define tlb_shootdown_finalize() ; 41 # define tlb_shootdown_ipi_recv() ; 44 42 #endif /* __SMP__ */ 45 43 46 44 /* Export TLB interface that each architecture must implement. */ 45 extern void tlb_init_arch(void); 47 46 extern void tlb_invalidate(int asid); 48 47 extern void tlb_shootdown_ipi_send(void); -
src/main/main.c
r1e2aecca rce031f0 152 152 page_init(); 153 153 tlb_init(); 154 155 154 arch_post_mm_init(); 156 155 … … 231 230 frame_init(); 232 231 page_init(); 232 tlb_init(); 233 233 arch_post_mm_init(); 234 234 -
src/mm/tlb.c
r1e2aecca rce031f0 28 28 29 29 #include <mm/tlb.h> 30 #include <arch/mm/tlb.h> 30 31 #include <smp/ipi.h> 31 32 #include <synch/spinlock.h> … … 38 39 #ifdef __SMP__ 39 40 static spinlock_t tlblock; 41 #endif 40 42 41 43 void tlb_init(void) 42 44 { 43 spinlock_initialize(&tlblock); 45 if (config.cpu_active == 1) 46 spinlock_initialize(&tlblock); 47 48 tlb_init_arch(); 44 49 } 45 50 51 #ifdef __SMP__ 46 52 /* must be called with interrupts disabled */ 47 53 void tlb_shootdown_start(void)
Note:
See TracChangeset
for help on using the changeset viewer.