Changeset 5d67baa in mainline
- Timestamp:
- 2008-06-30T20:33:18Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 939e9c1
- Parents:
- ac0e791
- Location:
- kernel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ppc32/src/mm/page.c
rac0e791 r5d67baa 48 48 uintptr_t hw_map(uintptr_t physaddr, size_t size) 49 49 { 50 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) 51 panic("Unable to map physical memory %p (%" PRIs " bytes)", physaddr, size) 50 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > 51 KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) 52 panic("Unable to map physical memory %p (%" PRIs " bytes)", 53 physaddr, size) 52 54 53 55 uintptr_t virtaddr = PA2KA(last_frame); 54 56 pfn_t i; 55 57 for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) 56 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE | PAGE_WRITE); 58 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), 59 physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE | PAGE_WRITE); 57 60 58 61 last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); -
kernel/arch/ppc32/src/mm/tlb.c
rac0e791 r5d67baa 48 48 * if lock is true. 49 49 * 50 * @param as Address space. 51 * @param lock Lock/unlock the address space. 52 * @param badvaddr Faulting virtual address. 53 * @param access Access mode that caused the fault. 54 * @param istate Pointer to interrupted state. 55 * @param pfrc Pointer to variable where as_page_fault() return code will be stored. 56 * @return PTE on success, NULL otherwise. 57 * 58 */ 59 static pte_t *find_mapping_and_check(as_t *as, bool lock, uintptr_t badvaddr, int access, istate_t *istate, int *pfrc) 50 * @param as Address space. 51 * @param lock Lock/unlock the address space. 52 * @param badvaddr Faulting virtual address. 53 * @param access Access mode that caused the fault. 54 * @param istate Pointer to interrupted state. 55 * @param pfrc Pointer to variable where as_page_fault() return code 56 * will be stored. 57 * @return PTE on success, NULL otherwise. 58 * 59 */ 60 static pte_t * 61 find_mapping_and_check(as_t *as, bool lock, uintptr_t badvaddr, int access, 62 istate_t *istate, int *pfrc) 60 63 { 61 64 /* … … 78 81 page_table_unlock(as, lock); 79 82 switch (rc = as_page_fault(badvaddr, access, istate)) { 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 83 case AS_PF_OK: 84 /* 85 * The higher-level page fault handler succeeded, 86 * The mapping ought to be in place. 87 */ 88 page_table_lock(as, lock); 89 pte = page_mapping_find(as, badvaddr); 90 ASSERT((pte) && (pte->p)); 91 *pfrc = 0; 92 return pte; 93 case AS_PF_DEFER: 94 page_table_lock(as, lock); 95 *pfrc = rc; 96 return NULL; 97 case AS_PF_FAULT: 98 page_table_lock(as, lock); 99 printf("Page fault.\n"); 100 *pfrc = rc; 101 return NULL; 102 default: 103 panic("unexpected rc (%d)\n", rc); 101 104 } 102 105 } … … 115 118 if (s) 116 119 sym2 = s; 117 panic("%p: PHT Refill Exception at %p (%s<-%s)\n", badvaddr, istate->pc, symbol, sym2); 120 panic("%p: PHT Refill Exception at %p (%s<-%s)\n", badvaddr, 121 istate->pc, symbol, sym2); 118 122 } 119 123 … … 148 152 PTE in PTEG */ 149 153 for (i = 0; i < 8; i++) { 150 if ((!phte[base + i].v) || ((phte[base + i].vsid == vsid) && (phte[base + i].api == api))) { 154 if ((!phte[base + i].v) || ((phte[base + i].vsid == vsid) && 155 (phte[base + i].api == api))) { 151 156 found = true; 152 157 break; … … 161 166 PTE in PTEG */ 162 167 for (i = 0; i < 8; i++) { 163 if ((!phte[base2 + i].v) || ((phte[base2 + i].vsid == vsid) && (phte[base2 + i].api == api))) { 168 if ((!phte[base2 + i].v) || 169 ((phte[base2 + i].vsid == vsid) && 170 (phte[base2 + i].api == api))) { 164 171 found = true; 165 172 base = base2; … … 215 222 PTE in PTEG */ 216 223 for (i = 0; i < 8; i++) { 217 if ((!phte_physical[base + i].v) || ((phte_physical[base + i].vsid == vsid) && (phte_physical[base + i].api == api))) { 224 if ((!phte_physical[base + i].v) || 225 ((phte_physical[base + i].vsid == vsid) && 226 (phte_physical[base + i].api == api))) { 218 227 found = true; 219 228 break; … … 228 237 PTE in PTEG */ 229 238 for (i = 0; i < 8; i++) { 230 if ((!phte_physical[base2 + i].v) || ((phte_physical[base2 + i].vsid == vsid) && (phte_physical[base2 + i].api == api))) { 239 if ((!phte_physical[base2 + i].v) || 240 ((phte_physical[base2 + i].vsid == vsid) && 241 (phte_physical[base2 + i].api == api))) { 231 242 found = true; 232 243 base = base2; … … 255 266 /** Process Instruction/Data Storage Interrupt 256 267 * 257 * @param n 258 * @param istate 268 * @param n Interrupt vector number. 269 * @param istate Interrupted register context. 259 270 * 260 271 */ … … 285 296 page_table_lock(as, lock); 286 297 287 pte = find_mapping_and_check(as, lock, badvaddr, PF_ACCESS_READ /* FIXME */, istate, &pfrc); 298 pte = find_mapping_and_check(as, lock, badvaddr, 299 PF_ACCESS_READ /* FIXME */, istate, &pfrc); 288 300 if (!pte) { 289 301 switch (pfrc) { 290 291 292 293 294 295 296 297 298 299 300 301 302 case AS_PF_FAULT: 303 goto fail; 304 break; 305 case AS_PF_DEFER: 306 /* 307 * The page fault came during copy_from_uspace() 308 * or copy_to_uspace(). 309 */ 310 page_table_unlock(as, lock); 311 return; 312 default: 313 panic("Unexpected pfrc (%d)\n", pfrc); 302 314 } 303 315 } … … 317 329 /** Process Instruction/Data Storage Interrupt in Real Mode 318 330 * 319 * @param n 320 * @param istate 331 * @param n Interrupt vector number. 332 * @param istate Interrupted register context. 321 333 * 322 334 */ … … 374 386 uint32_t i; 375 387 for (i = 0; i < 8192; i++) { 376 if ((phte[i].v) && (phte[i].vsid >= (asid << 4)) && (phte[i].vsid < ((asid << 4) + 16))) 388 if ((phte[i].v) && (phte[i].vsid >= (asid << 4)) && 389 (phte[i].vsid < ((asid << 4) + 16))) 377 390 phte[i].v = 0; 378 391 } … … 408 421 } else \ 409 422 length = 0; \ 410 printf(name ": page=%.*p frame=%.*p length=%d KB (mask=%#x)%s%s\n", sizeof(upper) * 2, upper & 0xffff0000, sizeof(lower) * 2, lower & 0xffff0000, length, mask, ((upper >> 1) & 1) ? " supervisor" : "", (upper & 1) ? " user" : ""); 423 printf(name ": page=%.*p frame=%.*p length=%d KB (mask=%#x)%s%s\n", \ 424 sizeof(upper) * 2, upper & 0xffff0000, sizeof(lower) * 2, \ 425 lower & 0xffff0000, length, mask, \ 426 ((upper >> 1) & 1) ? " supervisor" : "", \ 427 (upper & 1) ? " user" : ""); 411 428 412 429 … … 422 439 : "r" (sr << 28) 423 440 ); 424 printf("vsid[%d]: VSID=%.*p (ASID=%d)%s%s\n", sr, sizeof(vsid) * 2, vsid & 0xffffff, (vsid & 0xffffff) >> 4, ((vsid >> 30) & 1) ? " supervisor" : "", ((vsid >> 29) & 1) ? " user" : ""); 441 printf("vsid[%d]: VSID=%.*p (ASID=%d)%s%s\n", sr, 442 sizeof(vsid) * 2, vsid & 0xffffff, (vsid & 0xffffff) >> 4, 443 ((vsid >> 30) & 1) ? " supervisor" : "", 444 ((vsid >> 29) & 1) ? " user" : ""); 425 445 } 426 446 -
kernel/generic/src/console/kconsole.c
rac0e791 r5d67baa 170 170 171 171 /** Try to find a command beginning with prefix */ 172 static const char * 172 static const char *cmdtab_search_one(const char *name,link_t **startpos) 173 173 { 174 174 size_t namelen = strlen(name); … … 204 204 static int cmdtab_compl(char *name) 205 205 { 206 static char output[MAX_SYMBOL_NAME +1];206 static char output[MAX_SYMBOL_NAME + 1]; 207 207 link_t *startpos = NULL; 208 208 const char *foundtxt; … … 214 214 startpos = startpos->next; 215 215 if (!found) 216 strncpy(output, foundtxt, strlen(foundtxt) +1);216 strncpy(output, foundtxt, strlen(foundtxt) + 1); 217 217 else { 218 218 for (i = 0; output[i] && foundtxt[i] && … … 241 241 } 242 242 243 static char * clever_readline(const char *prompt, chardev_t *input) 243 //char *clever_readline(const char *prompt, chardev_t *input); 244 static char *clever_readline(const char *prompt, chardev_t *input) 244 245 { 245 246 static int histposition = 0; 246 247 247 static char tmp[MAX_CMDLINE +1];248 static char tmp[MAX_CMDLINE + 1]; 248 249 int curlen = 0, position = 0; 249 250 char *current = history[histposition]; … … 258 259 putchar(c); 259 260 break; 260 } if (c == '\b') { /* Backspace */ 261 } 262 if (c == '\b') { /* Backspace */ 261 263 if (position == 0) 262 264 continue; … … 544 546 strncpy(buf, (const char *) &cmdline[start], 545 547 min((end - start) + 2, cmd->argv[i].len)); 546 buf[min((end - start) + 1, cmd->argv[i].len - 1)] = '\0'; 548 buf[min((end - start) + 1, cmd->argv[i].len - 1)] = 549 '\0'; 547 550 break; 548 551 case ARG_TYPE_INT: … … 561 564 cmd->argv[i].intval = (unative_t) buf; 562 565 cmd->argv[i].vartype = ARG_TYPE_STRING; 563 } else if (!parse_int_arg(cmdline + start, end - start + 1,564 &cmd->argv[i].intval)) {566 } else if (!parse_int_arg(cmdline + start, 567 end - start + 1, &cmd->argv[i].intval)) { 565 568 cmd->argv[i].vartype = ARG_TYPE_INT; 566 569 } else { -
kernel/generic/src/main/main.c
rac0e791 r5d67baa 62 62 #include <main/version.h> 63 63 #include <console/kconsole.h> 64 #include <console/console.h> 64 65 #include <cpu.h> 65 66 #include <align.h> … … 81 82 #include <smp/smp.h> 82 83 #include <ddi/ddi.h> 83 #include <console/console.h> 84 84 85 85 86 /** Global configuration structure. */ … … 236 237 LOG_EXEC(slab_enable_cpucache()); 237 238 238 printf("Detected %" PRIc " CPU(s), %" PRIu64" M B free memory\n",239 239 printf("Detected %" PRIc " CPU(s), %" PRIu64" MiB free memory\n", 240 config.cpu_count, SIZE2MB(zone_total_size())); 240 241 241 242 LOG_EXEC(cpu_init()); … … 253 254 for (i = 0; i < init.cnt; i++) 254 255 printf("init[%" PRIc "].addr=%#" PRIp ", init[%" PRIc 255 "].size=%#" PRIs "\n", i, init.tasks[i].addr, 256 i , init.tasks[i].size);256 "].size=%#" PRIs "\n", i, init.tasks[i].addr, i, 257 init.tasks[i].size); 257 258 } else 258 259 printf("No init binaries found\n");
Note:
See TracChangeset
for help on using the changeset viewer.