Changeset 76fca31 in mainline for kernel/arch
- Timestamp:
- 2008-12-16T19:02:07Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5ae4443
- Parents:
- 8fe5980
- Location:
- kernel/arch
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/debugger.c
r8fe5980 r76fca31 55 55 SPINLOCK_INITIALIZE(bkpoint_lock); 56 56 57 #ifdef CONFIG_KCONSOLE 58 57 59 static int cmd_print_breakpoints(cmd_arg_t *argv); 58 60 static cmd_info_t bkpts_info = { … … 100 102 }; 101 103 102 #endif 103 104 /** Print table of active breakpoints */ 105 int cmd_print_breakpoints(cmd_arg_t *argv __attribute__((unused))) 106 { 107 unsigned int i; 108 char *symbol; 109 110 #ifdef __32_BITS__ 111 printf("# Count Address In symbol\n"); 112 printf("-- ----- ---------- ---------\n"); 113 #endif 114 115 #ifdef __64_BITS__ 116 printf("# Count Address In symbol\n"); 117 printf("-- ----- ------------------ ---------\n"); 118 #endif 119 120 for (i = 0; i < BKPOINTS_MAX; i++) 121 if (breakpoints[i].address) { 122 symbol = get_symtab_entry(breakpoints[i].address); 123 124 #ifdef __32_BITS__ 125 printf("%-2u %-5d %#10zx %s\n", i, 126 breakpoints[i].counter, breakpoints[i].address, 127 symbol); 128 #endif 129 130 #ifdef __64_BITS__ 131 printf("%-2u %-5d %#18zx %s\n", i, 132 breakpoints[i].counter, breakpoints[i].address, 133 symbol); 134 #endif 135 136 } 137 return 1; 138 } 104 #endif /* CONFIG_DEBUG_AS_WATCHPOINT */ 105 #endif /* CONFIG_KCONSOLE */ 139 106 140 107 /* Setup DR register according to table */ … … 268 235 printf("Reached breakpoint %d:%lx(%s)\n", slot, getip(istate), 269 236 get_symtab_entry(getip(istate))); 270 printf("***Type 'exit' to exit kconsole.\n"); 271 atomic_set(&haltstate,1); 272 kconsole((void *) "debug"); 273 atomic_set(&haltstate,0); 237 238 #ifdef CONFIG_KCONSOLE 239 atomic_set(&haltstate, 1); 240 kconsole("debug", "Debug console ready (type 'exit' to continue)\n", false); 241 atomic_set(&haltstate, 0); 242 #endif 274 243 } 275 244 … … 300 269 } 301 270 302 #ifndef CONFIG_DEBUG_AS_WATCHPOINT 303 304 /** Remove breakpoint from table */ 305 int cmd_del_breakpoint(cmd_arg_t *argv) 306 { 307 unative_t bpno = argv->intval; 308 if (bpno > BKPOINTS_MAX) { 309 printf("Invalid breakpoint number.\n"); 310 return 0; 311 } 312 breakpoint_del(argv->intval); 313 return 1; 314 } 315 316 /** Add new breakpoint to table */ 317 static int cmd_add_breakpoint(cmd_arg_t *argv) 318 { 319 int flags; 320 int id; 321 322 if (argv == &add_argv) { 323 flags = BKPOINT_INSTR; 324 } else { /* addwatchp */ 325 flags = BKPOINT_WRITE; 326 } 327 printf("Adding breakpoint on address: %p\n", argv->intval); 328 id = breakpoint_add((void *)argv->intval, flags, -1); 329 if (id < 0) 330 printf("Add breakpoint failed.\n"); 331 else 332 printf("Added breakpoint %d.\n", id); 333 334 return 1; 335 } 336 #endif 271 337 272 338 273 static void debug_exception(int n __attribute__((unused)), istate_t *istate) … … 380 315 for (i = 0; i < BKPOINTS_MAX; i++) 381 316 breakpoints[i].address = NULL; 382 317 318 #ifdef CONFIG_KCONSOLE 383 319 cmd_initialize(&bkpts_info); 384 320 if (!cmd_register(&bkpts_info)) 385 p anic("couldnot register command %s\n", bkpts_info.name);321 printf("Cannot register command %s\n", bkpts_info.name); 386 322 387 323 #ifndef CONFIG_DEBUG_AS_WATCHPOINT 388 324 cmd_initialize(&delbkpt_info); 389 325 if (!cmd_register(&delbkpt_info)) 390 p anic("couldnot register command %s\n", delbkpt_info.name);326 printf("Cannot register command %s\n", delbkpt_info.name); 391 327 392 328 cmd_initialize(&addbkpt_info); 393 329 if (!cmd_register(&addbkpt_info)) 394 p anic("couldnot register command %s\n", addbkpt_info.name);330 printf("Cannot register command %s\n", addbkpt_info.name); 395 331 396 332 cmd_initialize(&addwatchp_info); 397 333 if (!cmd_register(&addwatchp_info)) 398 panic("could not register command %s\n", addwatchp_info.name); 399 #endif 334 printf("Cannot register command %s\n", addwatchp_info.name); 335 #endif /* CONFIG_DEBUG_AS_WATCHPOINT */ 336 #endif /* CONFIG_KCONSOLE */ 400 337 401 338 exc_register(VECTOR_DEBUG, "debugger", debug_exception); … … 405 342 } 406 343 344 #ifdef CONFIG_KCONSOLE 345 /** Print table of active breakpoints */ 346 int cmd_print_breakpoints(cmd_arg_t *argv __attribute__((unused))) 347 { 348 unsigned int i; 349 char *symbol; 350 351 #ifdef __32_BITS__ 352 printf("# Count Address In symbol\n"); 353 printf("-- ----- ---------- ---------\n"); 354 #endif 355 356 #ifdef __64_BITS__ 357 printf("# Count Address In symbol\n"); 358 printf("-- ----- ------------------ ---------\n"); 359 #endif 360 361 for (i = 0; i < BKPOINTS_MAX; i++) 362 if (breakpoints[i].address) { 363 symbol = get_symtab_entry(breakpoints[i].address); 364 365 #ifdef __32_BITS__ 366 printf("%-2u %-5d %#10zx %s\n", i, 367 breakpoints[i].counter, breakpoints[i].address, 368 symbol); 369 #endif 370 371 #ifdef __64_BITS__ 372 printf("%-2u %-5d %#18zx %s\n", i, 373 breakpoints[i].counter, breakpoints[i].address, 374 symbol); 375 #endif 376 377 } 378 return 1; 379 } 380 381 #ifndef CONFIG_DEBUG_AS_WATCHPOINT 382 383 /** Remove breakpoint from table */ 384 int cmd_del_breakpoint(cmd_arg_t *argv) 385 { 386 unative_t bpno = argv->intval; 387 if (bpno > BKPOINTS_MAX) { 388 printf("Invalid breakpoint number.\n"); 389 return 0; 390 } 391 breakpoint_del(argv->intval); 392 return 1; 393 } 394 395 /** Add new breakpoint to table */ 396 static int cmd_add_breakpoint(cmd_arg_t *argv) 397 { 398 int flags; 399 int id; 400 401 if (argv == &add_argv) { 402 flags = BKPOINT_INSTR; 403 } else { /* addwatchp */ 404 flags = BKPOINT_WRITE; 405 } 406 printf("Adding breakpoint on address: %p\n", argv->intval); 407 id = breakpoint_add((void *)argv->intval, flags, -1); 408 if (id < 0) 409 printf("Add breakpoint failed.\n"); 410 else 411 printf("Added breakpoint %d.\n", id); 412 413 return 1; 414 } 415 #endif /* CONFIG_DEBUG_AS_WATCHPOINT */ 416 #endif /* CONFIG_KCONSOLE */ 417 407 418 /** @} 408 419 */ -
kernel/arch/ia32/include/drivers/ega.h
r8fe5980 r76fca31 41 41 #define SCREEN (ROW * ROWS) 42 42 43 extern void ega_redraw(void); 43 44 extern void ega_init(void); 44 45 -
kernel/arch/ia32/include/drivers/vesa.h
r8fe5980 r76fca31 37 37 38 38 extern int vesa_present(void); 39 extern void vesa_redraw(void); 39 40 extern void vesa_init(void); 40 41 -
kernel/arch/ia32/src/cpu/cpu.c
r8fe5980 r76fca31 66 66 static char *vendor_str[] = { 67 67 "Unknown Vendor", 68 "A uthenticAMD",69 " GenuineIntel"68 "AMD", 69 "Intel" 70 70 }; 71 71 … … 78 78 : 79 79 : 80 : "%eax"80 : "%eax" 81 81 ); 82 82 } … … 90 90 : 91 91 : 92 : "%eax"92 : "%eax" 93 93 ); 94 94 } … … 141 141 * Check for AMD processor. 142 142 */ 143 if (info.cpuid_ebx==AMD_CPUID_EBX && info.cpuid_ecx==AMD_CPUID_ECX && info.cpuid_edx==AMD_CPUID_EDX) { 143 if ((info.cpuid_ebx == AMD_CPUID_EBX) 144 && (info.cpuid_ecx == AMD_CPUID_ECX) 145 && (info.cpuid_edx == AMD_CPUID_EDX)) 144 146 CPU->arch.vendor = VendorAMD; 145 } 146 147 147 148 /* 148 149 * Check for Intel processor. 149 150 */ 150 if (info.cpuid_ebx==INTEL_CPUID_EBX && info.cpuid_ecx==INTEL_CPUID_ECX && info.cpuid_edx==INTEL_CPUID_EDX) { 151 if ((info.cpuid_ebx == INTEL_CPUID_EBX) 152 && (info.cpuid_ecx == INTEL_CPUID_ECX) 153 && (info.cpuid_edx == INTEL_CPUID_EDX)) 151 154 CPU->arch.vendor = VendorIntel; 152 } 153 155 154 156 cpuid(1, &info); 155 CPU->arch.family = (info.cpuid_eax >>8)&0xf;156 CPU->arch.model = (info.cpuid_eax >>4)&0xf;157 CPU->arch.stepping = (info.cpuid_eax >>0)&0xf;157 CPU->arch.family = (info.cpuid_eax >> 8) & 0x0f; 158 CPU->arch.model = (info.cpuid_eax >> 4) & 0x0f; 159 CPU->arch.stepping = (info.cpuid_eax >> 0) & 0x0f; 158 160 } 159 161 } 160 162 161 void cpu_print_report(cpu_t* m)163 void cpu_print_report(cpu_t* cpu) 162 164 { 163 printf("cpu% d: (%s family=%d model=%d stepping=%d) %dMHz\n",164 m->id, vendor_str[m->arch.vendor], m->arch.family, m->arch.model, m->arch.stepping,165 m->frequency_mhz);165 printf("cpu%u: (%s family=%u model=%u stepping=%u) %" PRIu16 " MHz\n", 166 cpu->id, vendor_str[cpu->arch.vendor], cpu->arch.family, 167 cpu->arch.model, cpu->arch.stepping, cpu->frequency_mhz); 166 168 } 167 169 -
kernel/arch/ia32/src/drivers/vesa.c
r8fe5980 r76fca31 98 98 } 99 99 100 void vesa_redraw(void) 101 { 102 fb_redraw(); 103 } 104 100 105 #endif 101 106 -
kernel/arch/ia32/src/ia32.c
r8fe5980 r76fca31 94 94 else 95 95 #endif 96 ega_init(); 96 ega_init(); /* video */ 97 97 98 98 /* Enable debugger */ … … 160 160 void arch_grab_console(void) 161 161 { 162 #ifdef CONFIG_FB 163 vesa_redraw(); 164 #else 165 ega_redraw(); 166 #endif 167 162 168 i8042_grab(); 163 169 } 170 164 171 /** Return console to userspace 165 172 * -
kernel/arch/mips32/src/cpu/cpu.c
r8fe5980 r76fca31 49 49 { "MIPS", "R3000" }, /* 0x02 */ 50 50 { "MIPS", "R6000" }, /* 0x03 */ 51 { "MIPS", " 51 { "MIPS", "R4000/R4400" }, /* 0x04 */ 52 52 { "LSI Logic", "R3000" }, /* 0x05 */ 53 53 { "MIPS", "R6000A" }, /* 0x06 */ … … 124 124 } 125 125 126 printf("cpu% d: %s %s (rev=%d.%d, imp=%d)\n",126 printf("cpu%u: %s %s (rev=%d.%d, imp=%d)\n", 127 127 m->id, data->vendor, data->model, m->arch.rev_num >> 4, 128 m->arch.rev_num & 0x f, m->arch.imp_num);128 m->arch.rev_num & 0x0f, m->arch.imp_num); 129 129 } 130 130 -
kernel/arch/mips32/src/debugger.c
r8fe5980 r76fca31 47 47 bpinfo_t breakpoints[BKPOINTS_MAX]; 48 48 SPINLOCK_INITIALIZE(bkpoint_lock); 49 50 #ifdef CONFIG_KCONSOLE 49 51 50 52 static int cmd_print_breakpoints(cmd_arg_t *argv); … … 124 126 }; 125 127 128 126 129 /** Test, if the given instruction is a jump or branch instruction 127 130 * 128 131 * @param instr Instruction code 129 132 * @return true - it is jump instruction, false otherwise 133 * 130 134 */ 131 135 static bool is_jump(unative_t instr) … … 268 272 } 269 273 274 #endif 275 270 276 /** Initialize debugger */ 271 277 void debugger_init() … … 275 281 for (i = 0; i < BKPOINTS_MAX; i++) 276 282 breakpoints[i].address = NULL; 277 283 284 #ifdef CONFIG_KCONSOLE 278 285 cmd_initialize(&bkpts_info); 279 286 if (!cmd_register(&bkpts_info)) 280 p anic("couldnot register command %s\n", bkpts_info.name);287 printf("Cannot register command %s\n", bkpts_info.name); 281 288 282 289 cmd_initialize(&delbkpt_info); 283 290 if (!cmd_register(&delbkpt_info)) 284 p anic("couldnot register command %s\n", delbkpt_info.name);291 printf("Cannot register command %s\n", delbkpt_info.name); 285 292 286 293 cmd_initialize(&addbkpt_info); 287 294 if (!cmd_register(&addbkpt_info)) 288 p anic("couldnot register command %s\n", addbkpt_info.name);295 printf("Cannot register command %s\n", addbkpt_info.name); 289 296 290 297 cmd_initialize(&addbkpte_info); 291 298 if (!cmd_register(&addbkpte_info)) 292 panic("could not register command %s\n", addbkpte_info.name); 299 printf("Cannot register command %s\n", addbkpte_info.name); 300 #endif 293 301 } 294 302 … … 368 376 cur->bkfunc(cur, istate); 369 377 } else { 370 printf("***Type 'exit' to exit kconsole.\n"); 378 #ifdef CONFIG_KCONSOLE 371 379 /* This disables all other processors - we are not SMP, 372 380 * actually this gets us to cpu_halt, if scheduler() is run … … 374 382 * so this is a good idea 375 383 */ 376 atomic_set(&haltstate, 1);384 atomic_set(&haltstate, 1); 377 385 spinlock_unlock(&bkpoint_lock); 378 379 kconsole("debug" );380 386 387 kconsole("debug", "Debug console ready (type 'exit' to continue)\n", false); 388 381 389 spinlock_lock(&bkpoint_lock); 382 atomic_set(&haltstate,0); 390 atomic_set(&haltstate, 0); 391 #endif 383 392 } 384 393 if (cur && cur->address == fireaddr && (cur->flags & BKPOINT_INPROG)) { -
kernel/arch/mips32/src/exception.c
r8fe5980 r76fca31 46 46 #include <interrupt.h> 47 47 #include <func.h> 48 #include <console/kconsole.h>49 48 #include <ddi/irq.h> 50 49 #include <arch/debugger.h>
Note:
See TracChangeset
for help on using the changeset viewer.