Skip to content

Commit

Permalink
Add configurable option for interrupts debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
lutoma committed Aug 31, 2018
1 parent d16b338 commit 8582e6e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ menu "Debugging"
config SYSCALL_DEBUG
bool "Syscall debugging"

config INTERRUPTS_DEBUG
bool "Interrupts debugging"

config LOG_PRINT_LEVEL
int "TTY log level"
default 2
Expand Down
15 changes: 15 additions & 0 deletions src/hw/interrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <memory/vmem.h>
#include <memory/paging.h>

#define debug(args...) log(LOG_DEBUG, "interrupts: " args)

/* This one get's called from the architecture-specific interrupt
* handlers, which do fiddling like EOIs (i386).
*/
Expand All @@ -33,6 +35,11 @@ cpu_state_t* __attribute__((fastcall)) interrupts_callback(cpu_state_t* regs) {
paging_apply(vmem_kernelContext);
interrupt_handler_t handler = interrupt_handlers[regs->interrupt];

#ifdef INTERRUPTS_DEBUG
debug("state before:\n");
dump_cpu_state(LOG_DEBUG, regs);
#endif

if(handler != NULL)
handler(regs);

Expand All @@ -46,11 +53,19 @@ cpu_state_t* __attribute__((fastcall)) interrupts_callback(cpu_state_t* regs) {
if(new_task && new_task->state && new_task->memory_context)
{
paging_apply(new_task->memory_context);
#ifdef INTERRUPTS_DEBUG
debug("state after (task selection):\n");
dump_cpu_state(LOG_DEBUG, new_task->state);
#endif
return new_task->state;
}
}

paging_apply(original_context);
#ifdef INTERRUPTS_DEBUG
debug("state after:\n");
dump_cpu_state(LOG_DEBUG, regs);
#endif
return regs;
}

Expand Down

0 comments on commit 8582e6e

Please sign in to comment.