Rev 863 | Rev 877 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 863 | Rev 873 | ||
---|---|---|---|
Line 35... | Line 35... | ||
35 | #include <arch/types.h> |
35 | #include <arch/types.h> |
36 | #include <typedefs.h> |
36 | #include <typedefs.h> |
37 | #include <config.h> |
37 | #include <config.h> |
38 | #include <arch/trap/trap.h> |
38 | #include <arch/trap/trap.h> |
39 | #include <panic.h> |
39 | #include <panic.h> |
- | 40 | #include <arch/asm.h> |
|
- | 41 | #include <symtab.h> |
|
- | 42 | ||
- | 43 | char *context_encoding[] = { |
|
- | 44 | "Primary", |
|
- | 45 | "Secondary", |
|
- | 46 | "Nucleus", |
|
- | 47 | "Reserved" |
|
- | 48 | }; |
|
40 | 49 | ||
41 | /** Initialize ITLB and DTLB. |
50 | /** Initialize ITLB and DTLB. |
42 | * |
51 | * |
43 | * The goal of this function is to disable MMU |
52 | * The goal of this function is to disable MMU |
44 | * so that both TLBs can be purged and new |
53 | * so that both TLBs can be purged and new |
Line 94... | Line 103... | ||
94 | 103 | ||
95 | tlb_invalidate_all(); |
104 | tlb_invalidate_all(); |
96 | 105 | ||
97 | dmmu_enable(); |
106 | dmmu_enable(); |
98 | immu_enable(); |
107 | immu_enable(); |
- | 108 | ||
- | 109 | /* |
|
- | 110 | * Quick hack: map frame buffer |
|
- | 111 | */ |
|
- | 112 | fr.address = 0x1C901000000ULL; |
|
- | 113 | pg.address = 0xc0000000; |
|
- | 114 | ||
- | 115 | tag.value = 0; |
|
- | 116 | tag.vpn = pg.vpn; |
|
- | 117 | ||
- | 118 | dtlb_tag_access_write(tag.value); |
|
- | 119 | ||
- | 120 | data.value = 0; |
|
- | 121 | data.v = true; |
|
- | 122 | data.size = PAGESIZE_4M; |
|
- | 123 | data.pfn = fr.pfn; |
|
- | 124 | data.l = true; |
|
- | 125 | data.cp = 0; |
|
- | 126 | data.cv = 0; |
|
- | 127 | data.p = true; |
|
- | 128 | data.w = true; |
|
- | 129 | data.g = true; |
|
- | 130 | ||
- | 131 | dtlb_data_in_write(data.value); |
|
- | 132 | ||
99 | } |
133 | } |
100 | 134 | ||
101 | /** ITLB miss handler. */ |
135 | /** ITLB miss handler. */ |
102 | void fast_instruction_access_mmu_miss(void) |
136 | void fast_instruction_access_mmu_miss(void) |
103 | { |
137 | { |
Line 105... | Line 139... | ||
105 | } |
139 | } |
106 | 140 | ||
107 | /** DTLB miss handler. */ |
141 | /** DTLB miss handler. */ |
108 | void fast_data_access_mmu_miss(void) |
142 | void fast_data_access_mmu_miss(void) |
109 | { |
143 | { |
- | 144 | tlb_sfsr_reg_t status; |
|
- | 145 | __address address, tpc; |
|
- | 146 | char *tpc_str; |
|
- | 147 | ||
- | 148 | status.value = dtlb_sfsr_read(); |
|
- | 149 | address = dtlb_sfar_read(); |
|
- | 150 | tpc = tpc_read(); |
|
- | 151 | tpc_str = get_symtab_entry(tpc); |
|
- | 152 | ||
- | 153 | printf("ASI=%B, Context=%s\n", status.asi, context_encoding[status.ct]); |
|
- | 154 | printf("Faulting address: %P\n", dtlb_sfar_read()); |
|
- | 155 | printf("TPC=%P, (%s)\n", tpc, tpc_str ? tpc_str : "?"); |
|
110 | panic("%s\n", __FUNCTION__); |
156 | panic("%s\n", __FUNCTION__); |
111 | } |
157 | } |
112 | 158 | ||
113 | /** DTLB protection fault handler. */ |
159 | /** DTLB protection fault handler. */ |
114 | void fast_data_access_protection(void) |
160 | void fast_data_access_protection(void) |