Changeset b3b7e14a in mainline
- Timestamp:
- 2010-06-11T15:31:03Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 214ec25c
- Parents:
- be06914
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/debugger.c
rbe06914 rb3b7e14a 333 333 #endif /* CONFIG_KCONSOLE */ 334 334 335 exc_register(VECTOR_DEBUG, "debugger", debug_exception); 335 exc_register(VECTOR_DEBUG, "debugger", true, 336 debug_exception); 337 336 338 #ifdef CONFIG_SMP 337 exc_register(VECTOR_DEBUG_IPI, "debugger_smp", debug_ipi); 339 exc_register(VECTOR_DEBUG_IPI, "debugger_smp", true, 340 debug_ipi); 338 341 #endif /* CONFIG_SMP */ 339 342 } -
kernel/arch/amd64/src/interrupt.c
rbe06914 rb3b7e14a 199 199 void interrupt_init(void) 200 200 { 201 int i;201 unsigned int i; 202 202 203 203 for (i = 0; i < IVT_ITEMS; i++) 204 exc_register(i, "null", (iroutine) null_interrupt);204 exc_register(i, "null", false, (iroutine_t) null_interrupt); 205 205 206 206 for (i = 0; i < IRQ_COUNT; i++) { 207 207 if ((i != IRQ_PIC_SPUR) && (i != IRQ_PIC1)) 208 exc_register(IVT_IRQBASE + i, "irq", 209 (iroutine ) irq_interrupt);208 exc_register(IVT_IRQBASE + i, "irq", true, 209 (iroutine_t) irq_interrupt); 210 210 } 211 211 212 exc_register(0, "de_fault", (iroutine) de_fault);213 exc_register(7, "nm_fault", (iroutine) nm_fault);214 exc_register(12, "ss_fault", (iroutine) ss_fault);215 exc_register(13, "gp_fault", (iroutine) gp_fault);216 exc_register(14, "ident_mapper", (iroutine) ident_page_fault);212 exc_register(0, "de_fault", true, (iroutine_t) de_fault); 213 exc_register(7, "nm_fault", true, (iroutine_t) nm_fault); 214 exc_register(12, "ss_fault", true, (iroutine_t) ss_fault); 215 exc_register(13, "gp_fault", true, (iroutine_t) gp_fault); 216 exc_register(14, "ident_mapper", true, (iroutine_t) ident_page_fault); 217 217 218 218 #ifdef CONFIG_SMP 219 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", 220 (iroutine ) tlb_shootdown_ipi);219 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", true, 220 (iroutine_t) tlb_shootdown_ipi); 221 221 #endif 222 222 } -
kernel/arch/amd64/src/mm/page.c
rbe06914 rb3b7e14a 116 116 page_table_unlock(AS_KERNEL, true); 117 117 118 exc_register(14, "page_fault", (iroutine) page_fault);118 exc_register(14, "page_fault", true, (iroutine_t) page_fault); 119 119 write_cr3((uintptr_t) AS_KERNEL->genarch.page_table); 120 } else 120 } else 121 121 write_cr3((uintptr_t) AS_KERNEL->genarch.page_table); 122 122 } -
kernel/arch/arm32/include/ras.h
rbe06914 rb3b7e14a 1 1 /* 2 * Copyright (c) 2009 Jakub Jermar 2 * Copyright (c) 2009 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 40 40 #include <typedefs.h> 41 41 42 #define RAS_START 43 #define RAS_END 42 #define RAS_START 0 43 #define RAS_END 1 44 44 45 45 extern uintptr_t *ras_page; 46 46 47 47 extern void ras_init(void); 48 extern void ras_check( int, istate_t *);48 extern void ras_check(unsigned int, istate_t *); 49 49 50 50 #endif -
kernel/arch/arm32/src/exc_handler.S
rbe06914 rb3b7e14a 150 150 mov r0, #0 151 151 mov r1, r13 152 bl ras_check 152 bl ras_check 153 153 LOAD_REGS_FROM_STACK 154 154 … … 158 158 mov r0, #5 159 159 mov r1, r13 160 bl ras_check 160 bl ras_check 161 161 LOAD_REGS_FROM_STACK 162 162 … … 166 166 mov r0, #6 167 167 mov r1, r13 168 bl ras_check 168 bl ras_check 169 169 LOAD_REGS_FROM_STACK 170 170 … … 173 173 mov r0, #1 174 174 mov r1, r13 175 bl ras_check 175 bl ras_check 176 176 LOAD_REGS_FROM_STACK 177 177 … … 181 181 mov r0, #3 182 182 mov r1, r13 183 bl ras_check 183 bl ras_check 184 184 LOAD_REGS_FROM_STACK 185 185 … … 189 189 mov r0, #4 190 190 mov r1, r13 191 bl ras_check 191 bl ras_check 192 192 LOAD_REGS_FROM_STACK 193 193 -
kernel/arch/arm32/src/exception.c
rbe06914 rb3b7e14a 165 165 install_exception_handlers(); 166 166 167 exc_register(EXC_IRQ, "interrupt", (iroutine) irq_exception); 168 exc_register(EXC_PREFETCH_ABORT, "prefetch abort", 169 (iroutine) prefetch_abort); 170 exc_register(EXC_DATA_ABORT, "data abort", (iroutine) data_abort); 171 exc_register(EXC_SWI, "software interrupt", (iroutine) swi_exception); 167 exc_register(EXC_IRQ, "interrupt", true, 168 (iroutine_t) irq_exception); 169 exc_register(EXC_PREFETCH_ABORT, "prefetch abort", true, 170 (iroutine_t) prefetch_abort); 171 exc_register(EXC_DATA_ABORT, "data abort", true, 172 (iroutine_t) data_abort); 173 exc_register(EXC_SWI, "software interrupt", true, 174 (iroutine_t) swi_exception); 172 175 } 173 176 -
kernel/arch/arm32/src/ras.c
rbe06914 rb3b7e14a 1 1 /* 2 * Copyright (c) 2009 Jakub Jermar 2 * Copyright (c) 2009 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 66 66 } 67 67 68 void ras_check( int n, istate_t *istate)68 void ras_check(unsigned int n, istate_t *istate) 69 69 { 70 70 uintptr_t rewrite_pc = istate->pc; -
kernel/arch/ia32/src/drivers/i8259.c
rbe06914 rb3b7e14a 27 27 */ 28 28 29 /** @addtogroup ia32 29 /** @addtogroup ia32 30 30 * @{ 31 31 */ … … 76 76 * Register interrupt handler for the PIC spurious interrupt. 77 77 */ 78 exc_register(VECTOR_PIC_SPUR, "pic_spurious", (iroutine) pic_spurious); 78 exc_register(VECTOR_PIC_SPUR, "pic_spurious", false, 79 (iroutine_t) pic_spurious); 79 80 80 81 /* -
kernel/arch/ia32/src/interrupt.c
rbe06914 rb3b7e14a 215 215 void interrupt_init(void) 216 216 { 217 int i;217 unsigned int i; 218 218 219 219 for (i = 0; i < IVT_ITEMS; i++) 220 exc_register(i, "null", (iroutine) null_interrupt);220 exc_register(i, "null", false, (iroutine_t) null_interrupt); 221 221 222 222 for (i = 0; i < IRQ_COUNT; i++) { 223 223 if ((i != IRQ_PIC_SPUR) && (i != IRQ_PIC1)) 224 exc_register(IVT_IRQBASE + i, "irq", (iroutine) irq_interrupt); 224 exc_register(IVT_IRQBASE + i, "irq", true, 225 (iroutine_t) irq_interrupt); 225 226 } 226 227 227 exc_register(0, "de_fault", (iroutine) de_fault);228 exc_register(7, "nm_fault", (iroutine) nm_fault);229 exc_register(12, "ss_fault", (iroutine) ss_fault);230 exc_register(13, "gp_fault", (iroutine) gp_fault);231 exc_register(19, "simd_fp", (iroutine) simd_fp_exception);228 exc_register(0, "de_fault", true, (iroutine_t) de_fault); 229 exc_register(7, "nm_fault", true, (iroutine_t) nm_fault); 230 exc_register(12, "ss_fault", true, (iroutine_t) ss_fault); 231 exc_register(13, "gp_fault", true, (iroutine_t) gp_fault); 232 exc_register(19, "simd_fp", true, (iroutine_t) simd_fp_exception); 232 233 233 234 #ifdef CONFIG_SMP 234 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", (iroutine) tlb_shootdown_ipi); 235 exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", true, 236 (iroutine_t) tlb_shootdown_ipi); 235 237 #endif 236 238 } -
kernel/arch/ia32/src/mm/page.c
rbe06914 rb3b7e14a 70 70 page_table_unlock(AS_KERNEL, true); 71 71 72 exc_register(14, "page_fault", (iroutine) page_fault);72 exc_register(14, "page_fault", true, (iroutine_t) page_fault); 73 73 write_cr3((uintptr_t) AS_KERNEL->genarch.page_table); 74 74 } else -
kernel/arch/ia32/src/smp/apic.c
rbe06914 rb3b7e14a 157 157 void apic_init(void) 158 158 { 159 exc_register(VECTOR_APIC_SPUR, "apic_spurious", (iroutine) apic_spurious); 159 exc_register(VECTOR_APIC_SPUR, "apic_spurious", false, 160 (iroutine_t) apic_spurious); 160 161 161 162 enable_irqs_function = io_apic_enable_irqs; -
kernel/arch/mips32/src/exception.c
rbe06914 rb3b7e14a 167 167 void exception_init(void) 168 168 { 169 int i;169 unsigned int i; 170 170 171 171 /* Clear exception table */ 172 172 for (i = 0; i < IVT_ITEMS; i++) 173 exc_register(i, "undef", (iroutine) unhandled_exception); 173 exc_register(i, "undef", false, 174 (iroutine_t) unhandled_exception); 174 175 175 exc_register(EXC_Bp, "bkpoint", (iroutine) breakpoint_exception); 176 exc_register(EXC_RI, "resinstr", (iroutine) reserved_instr_exception); 177 exc_register(EXC_Mod, "tlb_mod", (iroutine) tlbmod_exception); 178 exc_register(EXC_TLBL, "tlbinvl", (iroutine) tlbinv_exception); 179 exc_register(EXC_TLBS, "tlbinvl", (iroutine) tlbinv_exception); 180 exc_register(EXC_Int, "interrupt", (iroutine) interrupt_exception); 176 exc_register(EXC_Bp, "bkpoint", true, 177 (iroutine_t) breakpoint_exception); 178 exc_register(EXC_RI, "resinstr", true, 179 (iroutine_t) reserved_instr_exception); 180 exc_register(EXC_Mod, "tlb_mod", true, 181 (iroutine_t) tlbmod_exception); 182 exc_register(EXC_TLBL, "tlbinvl", true, 183 (iroutine_t) tlbinv_exception); 184 exc_register(EXC_TLBS, "tlbinvl", true, 185 (iroutine_t) tlbinv_exception); 186 exc_register(EXC_Int, "interrupt", true, 187 (iroutine_t) interrupt_exception); 188 181 189 #ifdef CONFIG_FPU_LAZY 182 exc_register(EXC_CpU, "cpunus", (iroutine) cpuns_exception); 190 exc_register(EXC_CpU, "cpunus", true, 191 (iroutine_t) cpuns_exception); 183 192 #endif 184 exc_register(EXC_Sys, "syscall", (iroutine) syscall_exception); 193 194 exc_register(EXC_Sys, "syscall", true, 195 (iroutine_t) syscall_exception); 185 196 } 186 197 -
kernel/arch/ppc32/src/interrupt.c
rbe06914 rb3b7e14a 101 101 void interrupt_init(void) 102 102 { 103 exc_register(VECTOR_DATA_STORAGE, "data_storage", pht_refill); 104 exc_register(VECTOR_INSTRUCTION_STORAGE, "instruction_storage", pht_refill); 105 exc_register(VECTOR_EXTERNAL, "external", exception_external); 106 exc_register(VECTOR_DECREMENTER, "timer", exception_decrementer); 103 exc_register(VECTOR_DATA_STORAGE, "data_storage", true, 104 pht_refill); 105 exc_register(VECTOR_INSTRUCTION_STORAGE, "instruction_storage", true, 106 pht_refill); 107 exc_register(VECTOR_EXTERNAL, "external", true, 108 exception_external); 109 exc_register(VECTOR_DECREMENTER, "timer", true, 110 exception_decrementer); 107 111 } 108 112 -
kernel/arch/sparc64/include/sparc64.h
rbe06914 rb3b7e14a 38 38 #include <interrupt.h> 39 39 40 extern void interrupt_register( int n, const char *name, iroutine f);40 extern void interrupt_register(unsigned int, const char *, iroutine_t); 41 41 42 42 #endif -
kernel/arch/sparc64/src/trap/interrupt.c
rbe06914 rb3b7e14a 51 51 /** Register Interrupt Level Handler. 52 52 * 53 * @param n Interrupt Level (1 - 15). 54 * @param name Short descriptive string. 55 * @param f Handler. 53 * @param n Interrupt Level (1 - 15). 54 * @param name Short descriptive string. 55 * @param handler Handler. 56 * 56 57 */ 57 void interrupt_register( int n, const char *name, iroutine f)58 void interrupt_register(unsigned int n, const char *name, iroutine_t handler) 58 59 { 59 60 ASSERT(n >= IVT_FIRST && n <= IVT_ITEMS); 60 61 61 exc_register(n - 1, name, f);62 exc_register(n - IVT_FIRST, name, true, handler); 62 63 } 64 63 65 /** @} 64 66 */ -
kernel/generic/include/console/console.h
rbe06914 rb3b7e14a 37 37 38 38 #include <typedefs.h> 39 #include <print.h> 39 40 #include <console/chardev.h> 41 42 #define PAGING(counter, increment, before, after) \ 43 do { \ 44 (counter) += (increment); \ 45 if ((counter) > 23) { \ 46 before; \ 47 printf(" -- Press any key to continue -- "); \ 48 indev_pop_character(stdin); \ 49 after; \ 50 printf("\n"); \ 51 (counter) = 0; \ 52 } \ 53 } while (0) 40 54 41 55 extern indev_t *stdin; -
kernel/generic/include/interrupt.h
rbe06914 rb3b7e14a 44 44 #include <stacktrace.h> 45 45 46 typedef void (* iroutine )(int, istate_t *);46 typedef void (* iroutine_t)(int, istate_t *); 47 47 48 48 typedef struct { 49 49 const char *name; 50 iroutine f; 50 bool hot; 51 iroutine_t handler; 51 52 uint64_t cycles; 52 53 uint64_t count; … … 57 58 58 59 extern void fault_if_from_uspace(istate_t *, const char *, ...); 59 extern iroutine exc_register(int, const char *, iroutine);60 extern void exc_dispatch( int, istate_t *);60 extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t); 61 extern void exc_dispatch(unsigned int, istate_t *); 61 62 extern void exc_init(void); 62 63 -
kernel/generic/include/sysinfo/abi.h
rbe06914 rb3b7e14a 130 130 unsigned int id; /**< Exception ID */ 131 131 char desc[EXC_NAME_BUFLEN]; /**< Description */ 132 bool hot; /**< Active or inactive exception */ 132 133 uint64_t cycles; /**< Number of CPU cycles in the handler */ 133 134 uint64_t count; /**< Number of handled exceptions */ -
kernel/generic/src/interrupt/interrupt.c
rbe06914 rb3b7e14a 61 61 /** Register exception handler 62 62 * 63 * @param n Exception number 64 * @param name Description 65 * @param handler Exception handler 66 * 67 */ 68 iroutine exc_register(int n, const char *name, iroutine handler) 69 { 63 * @param n Exception number. 64 * @param name Description. 65 * @param hot Whether the exception is actually handled 66 * in any meaningful way. 67 * @param handler New exception handler. 68 * 69 * @return Previously registered exception handler. 70 * 71 */ 72 iroutine_t exc_register(unsigned int n, const char *name, bool hot, 73 iroutine_t handler) 74 { 75 #if (IVT_ITEMS > 0) 70 76 ASSERT(n < IVT_ITEMS); 77 #endif 71 78 72 79 irq_spinlock_lock(&exctbl_lock, true); 73 80 74 iroutine old = exc_table[n].f;75 exc_table[n]. f= handler;81 iroutine_t old = exc_table[n].handler; 82 exc_table[n].handler = handler; 76 83 exc_table[n].name = name; 84 exc_table[n].hot = hot; 77 85 exc_table[n].cycles = 0; 78 86 exc_table[n].count = 0; … … 89 97 * 90 98 */ 91 void exc_dispatch(int n, istate_t *istate) 92 { 99 void exc_dispatch(unsigned int n, istate_t *istate) 100 { 101 #if (IVT_ITEMS > 0) 93 102 ASSERT(n < IVT_ITEMS); 103 #endif 94 104 95 105 uint64_t begin_cycle = get_cycle(); … … 107 117 #endif 108 118 109 exc_table[n]. f(n + IVT_FIRST, istate);119 exc_table[n].handler(n + IVT_FIRST, istate); 110 120 111 121 #ifdef CONFIG_UDEBUG … … 185 195 #ifdef CONFIG_KCONSOLE 186 196 197 static char flag_buf[MAX_CMDLINE + 1]; 198 187 199 /** Print all exceptions 188 200 * … … 190 202 static int cmd_exc_print(cmd_arg_t *argv) 191 203 { 204 bool excs_all; 205 206 if (str_cmp(flag_buf, "-a") == 0) 207 excs_all = true; 208 else if (str_cmp(flag_buf, "") == 0) 209 excs_all = false; 210 else { 211 printf("Unknown argument \"%s\".\n", flag_buf); 212 return 1; 213 } 214 192 215 #if (IVT_ITEMS > 0) 193 216 unsigned int i; 217 unsigned int rows; 194 218 195 219 irq_spinlock_lock(&exctbl_lock, true); 196 220 197 221 #ifdef __32_BITS__ 198 printf("Exc Description Count Cycles Handler Symbol\n"); 199 printf("--- -------------------- ---------- ---------- ---------- --------\n"); 222 printf("[exc ] [description ] [count ] [cycles ]" 223 " [handler ] [symbol\n"); 224 rows = 1; 200 225 #endif 201 226 202 227 #ifdef __64_BITS__ 203 printf("Exc Description Count Cycles Handler Symbol\n"); 204 printf("--- -------------------- ---------- ---------- ------------------ --------\n"); 228 printf("[exc ] [description ] [count ] [cycles ]" 229 " [handler ]\n"); 230 printf(" [symbol\n"); 231 rows = 2; 205 232 #endif 206 233 207 234 for (i = 0; i < IVT_ITEMS; i++) { 235 if ((!excs_all) && (!exc_table[i].hot)) 236 continue; 237 208 238 uint64_t count; 209 239 char count_suffix; … … 217 247 218 248 const char *symbol = 219 symtab_fmt_name_lookup((unative_t) exc_table[i]. f);249 symtab_fmt_name_lookup((unative_t) exc_table[i].handler); 220 250 221 251 #ifdef __32_BITS__ 222 printf("%- 3u %-20s %9" PRIu64 "%c %9" PRIu64 "%c %10p %s\n",252 printf("%-8u %-20s %9" PRIu64 "%c %9" PRIu64 "%c %10p %s\n", 223 253 i + IVT_FIRST, exc_table[i].name, count, count_suffix, 224 cycles, cycles_suffix, exc_table[i].f, symbol); 254 cycles, cycles_suffix, exc_table[i].handler, symbol); 255 256 PAGING(rows, 1, irq_spinlock_unlock(&exctbl_lock, true), 257 irq_spinlock_lock(&exctbl_lock, true)); 225 258 #endif 226 259 227 260 #ifdef __64_BITS__ 228 printf("%- 3u %-20s %9" PRIu64 "%c %9" PRIu64 "%c %18p %s\n",261 printf("%-8u %-20s %9" PRIu64 "%c %9" PRIu64 "%c %18p\n", 229 262 i + IVT_FIRST, exc_table[i].name, count, count_suffix, 230 cycles, cycles_suffix, exc_table[i].f, symbol); 231 #endif 232 233 if (((i + 1) % 20) == 0) { 234 printf(" -- Press any key to continue -- "); 235 irq_spinlock_unlock(&exctbl_lock, true); 236 indev_pop_character(stdin); 237 irq_spinlock_lock(&exctbl_lock, true); 238 printf("\n"); 239 } 263 cycles, cycles_suffix, exc_table[i].handler); 264 printf(" %s\n", symbol); 265 266 PAGING(rows, 2, irq_spinlock_unlock(&exctbl_lock, true), 267 irq_spinlock_lock(&exctbl_lock, true)); 268 #endif 240 269 } 241 270 242 271 irq_spinlock_unlock(&exctbl_lock, true); 243 #endif 272 #else /* (IVT_ITEMS > 0) */ 273 274 printf("No exception table%s.\n", excs_all ? " (showing all exceptions)" : ""); 275 276 #endif /* (IVT_ITEMS > 0) */ 244 277 245 278 return 1; 246 279 } 280 281 static cmd_arg_t exc_argv = { 282 .type = ARG_TYPE_STRING_OPTIONAL, 283 .buffer = flag_buf, 284 .len = sizeof(flag_buf) 285 }; 247 286 248 287 static cmd_info_t exc_info = { 249 288 .name = "exc", 250 .description = "Print exception table .",289 .description = "Print exception table (use -a for all exceptions).", 251 290 .func = cmd_exc_print, 252 291 .help = NULL, 253 .argc = 0,254 .argv = NULL292 .argc = 1, 293 .argv = &exc_argv 255 294 }; 256 295 … … 268 307 269 308 for (i = 0; i < IVT_ITEMS; i++) 270 exc_register(i, "undef", (iroutine) exc_undef);309 exc_register(i, "undef", false, (iroutine_t) exc_undef); 271 310 #endif 272 311 -
kernel/generic/src/sysinfo/stats.c
rbe06914 rb3b7e14a 562 562 } 563 563 564 #if (IVT_ITEMS > 0) 564 565 /* Messing with exception table, avoid deadlock */ 565 566 irq_spinlock_lock(&exctbl_lock, true); … … 569 570 stats_exceptions[i].id = i + IVT_FIRST; 570 571 str_cpy(stats_exceptions[i].desc, EXC_NAME_BUFLEN, exc_table[i].name); 572 stats_exceptions[i].hot = exc_table[i].hot; 571 573 stats_exceptions[i].cycles = exc_table[i].cycles; 572 574 stats_exceptions[i].count = exc_table[i].count; … … 574 576 575 577 irq_spinlock_unlock(&exctbl_lock, true); 578 #endif 576 579 577 580 return ((void *) stats_exceptions); … … 606 609 return ret; 607 610 608 #if IVT_FIRST > 0611 #if (IVT_FIRST > 0) 609 612 if (excn < IVT_FIRST) 610 613 return ret; 611 614 #endif 612 615 616 #if (IVT_ITEMS + IVT_FIRST == 0) 617 return ret; 618 #else 613 619 if (excn >= IVT_ITEMS + IVT_FIRST) 614 620 return ret; 621 #endif 615 622 616 623 if (dry_run) { … … 638 645 stats_exception->id = excn; 639 646 str_cpy(stats_exception->desc, EXC_NAME_BUFLEN, exc_table[excn].name); 647 stats_exception->hot = exc_table[excn].hot; 640 648 stats_exception->cycles = exc_table[excn].cycles; 641 649 stats_exception->count = exc_table[excn].count; -
uspace/app/top/screen.c
rbe06914 rb3b7e14a 259 259 } 260 260 261 static inline void print_task _head(void)261 static inline void print_tasks_head(void) 262 262 { 263 263 screen_style_inverted(); … … 371 371 } 372 372 373 static inline void print_exc _head(void)373 static inline void print_excs_head(void) 374 374 { 375 375 screen_style_inverted(); … … 379 379 } 380 380 381 static inline void print_exc (data_t *data)381 static inline void print_excs(data_t *data) 382 382 { 383 383 ipcarg_t cols; … … 390 390 391 391 size_t i; 392 for (i = 0; (i < data->exceptions_count) && (row < rows); i++, row++) { 392 for (i = 0; (i < data->exceptions_count) && (row < rows); i++) { 393 /* Filter-out cold exceptions if not instructed otherwise */ 394 if ((!excs_all) && (!data->exceptions[i].hot)) 395 continue; 396 393 397 uint64_t count; 394 398 uint64_t cycles; … … 409 413 410 414 screen_newline(); 411 } 415 row++; 416 } 417 418 while (row < rows) { 419 screen_newline(); 420 row++; 421 } 422 } 423 424 static void print_help(void) 425 { 426 ipcarg_t cols; 427 ipcarg_t rows; 428 screen_get_size(&cols, &rows); 429 430 ipcarg_t col; 431 ipcarg_t row; 432 screen_get_pos(&col, &row); 433 434 screen_newline(); 435 436 printf("Operation modes:"); 437 screen_newline(); 438 439 printf(" t .. tasks statistics"); 440 screen_newline(); 441 442 printf(" i .. IPC statistics"); 443 screen_newline(); 444 445 printf(" e .. exceptions statistics"); 446 screen_newline(); 447 448 printf(" a .. toggle display of all/hot exceptions"); 449 screen_newline(); 450 451 row += 6; 412 452 413 453 while (row < rows) { … … 430 470 screen_newline(); 431 471 432 switch (op eration_type) {472 switch (op_mode) { 433 473 case OP_TASKS: 434 print_task _head();474 print_tasks_head(); 435 475 print_tasks(data); 436 476 break; … … 439 479 print_ipc(data); 440 480 break; 441 case OP_EXC :442 print_exc _head();443 print_exc (data);481 case OP_EXCS: 482 print_excs_head(); 483 print_excs(data); 444 484 break; 485 case OP_HELP: 486 print_tasks_head(); 487 print_help(); 445 488 } 446 489 -
uspace/app/top/top.c
rbe06914 rb3b7e14a 56 56 #define MINUTE 60 57 57 58 int operation_type; 58 op_mode_t op_mode = OP_TASKS; 59 bool excs_all = false; 59 60 60 61 static const char *read_data(data_t *target) … … 338 339 339 340 /* And paint screen until death */ 340 operation_type = OP_TASKS;341 341 while (true) { 342 342 int c = tgetchar(UPDATE_INTERVAL); … … 360 360 361 361 switch (c) { 362 case 't': 363 print_warning("Showing task statistics"); 364 op_mode = OP_TASKS; 365 break; 366 case 'i': 367 print_warning("Showing IPC statistics"); 368 op_mode = OP_IPC; 369 break; 370 case 'e': 371 print_warning("Showing exception statistics"); 372 op_mode = OP_EXCS; 373 break; 374 case 'h': 375 print_warning("Showing help"); 376 op_mode = OP_HELP; 377 break; 362 378 case 'q': 363 379 goto out; 364 case 'i': 365 print_warning("Showing IPC statistics"); 366 operation_type = OP_IPC; 367 break; 368 case 't': 369 print_warning("Showing task statistics"); 370 operation_type = OP_TASKS; 371 break; 372 case 'e': 373 print_warning("Showing exception statistics"); 374 operation_type = OP_EXC; 375 break; 380 case 'a': 381 if (op_mode == OP_EXCS) { 382 excs_all = !excs_all; 383 if (excs_all) 384 print_warning("Showing all exceptions"); 385 else 386 print_warning("Showing only hot exceptions"); 387 break; 388 } 376 389 default: 377 print_warning("Unknown command : %c", c);390 print_warning("Unknown command \"%c\", use \"h\" for help", c); 378 391 break; 379 392 } -
uspace/app/top/top.h
rbe06914 rb3b7e14a 40 40 41 41 #define FRACTION_TO_FLOAT(float, a, b) \ 42 { \42 do { \ 43 43 if ((b) != 0) { \ 44 44 (float).upper = (a); \ … … 48 48 (float).lower = 1; \ 49 49 } \ 50 } 50 } while (0) 51 51 52 #define OP_TASKS 1 53 #define OP_IPC 2 54 #define OP_EXC 3 52 typedef enum { 53 OP_TASKS, 54 OP_IPC, 55 OP_EXCS, 56 OP_HELP 57 } op_mode_t; 55 58 56 extern int operation_type; 59 extern op_mode_t op_mode; 60 extern bool excs_all; 57 61 58 62 typedef struct {
Note:
See TracChangeset
for help on using the changeset viewer.