Browse Source

ps: Add current stack pointer and start of stack to isr_stack ps output (DEVELHELP)

pr/spi.typo
Joakim Nohlgård 7 years ago
parent
commit
b02e0eca47
  1. 10
      core/include/arch/thread_arch.h
  2. 12
      cpu/arm7_common/arm_cpu.c
  3. 12
      cpu/atmega_common/thread_arch.c
  4. 11
      cpu/cortexm_common/thread_arch.c
  5. 12
      cpu/msp430-common/cpu.c
  6. 10
      cpu/native/irq_cpu.c
  7. 10
      cpu/x86/x86_threading.c
  8. 6
      sys/ps/ps.c

10
core/include/arch/thread_arch.h

@ -63,6 +63,16 @@ char *thread_arch_stack_init(thread_task_func_t task_func, void *arg, void *stac
*/
int thread_arch_isr_stack_usage(void);
/**
* @brief Get the current ISR stack pointer
*/
void *thread_arch_isr_stack_pointer(void);
/**
* @brief Get the start of the ISR stack
*/
void *thread_arch_isr_stack_start(void);
/**
* @brief Print the current stack to stdout
*/

12
cpu/arm7_common/arm_cpu.c

@ -35,6 +35,18 @@ int thread_arch_isr_stack_usage(void)
return -1;
}
void *thread_arch_isr_stack_pointer(void)
{
/* TODO */
return (void *)-1;
}
void *thread_arch_isr_stack_start(void)
{
/* TODO */
return (void *)-1;
}
/*----------------------------------------------------------------------------
* Processor specific routine - here for ARM7
* sizeof(void*) = sizeof(int)

12
cpu/atmega_common/thread_arch.c

@ -205,6 +205,18 @@ int thread_arch_isr_stack_usage(void)
return -1;
}
void *thread_arch_isr_stack_pointer(void)
{
/* TODO */
return (void *)-1;
}
void *thread_arch_isr_stack_start(void)
{
/* TODO */
return (void *)-1;
}
void thread_arch_start_threading(void) __attribute__((naked));
void thread_arch_start_threading(void)
{

11
cpu/cortexm_common/thread_arch.c

@ -267,6 +267,17 @@ int thread_arch_isr_stack_usage(void)
return num_used_words * sizeof(*ptr);
}
void *thread_arch_isr_stack_pointer(void)
{
void *msp = (void *)__get_MSP();
return msp;
}
void *thread_arch_isr_stack_start(void)
{
return (void *)&_sstack;
}
__attribute__((naked)) void NORETURN thread_arch_start_threading(void)
{
__asm__ volatile (

12
cpu/msp430-common/cpu.c

@ -40,6 +40,18 @@ int thread_arch_isr_stack_usage(void)
return -1;
}
void *thread_arch_isr_stack_pointer(void)
{
/* TODO */
return (void *)-1;
}
void *thread_arch_isr_stack_start(void)
{
/* TODO */
return (void *)-1;
}
NORETURN void cpu_switch_context_exit(void)
{
sched_active_thread = sched_threads[0];

10
cpu/native/irq_cpu.c

@ -62,6 +62,16 @@ int _sig_pipefd[2];
static _native_callback_t native_irq_handlers[255];
char sigalt_stk[SIGSTKSZ];
void *thread_arch_isr_stack_pointer(void)
{
return native_isr_context.uc_stack.ss_sp;
}
void *thread_arch_isr_stack_start(void)
{
return __isr_stack;
}
void print_thread_sigmask(ucontext_t *cp)
{
sigset_t *p = &cp->uc_sigmask;

10
cpu/x86/x86_threading.c

@ -117,6 +117,16 @@ void thread_yield_higher(void)
irq_restore(old_intr);
}
void *thread_arch_isr_stack_pointer(void)
{
return isr_context.uc_stack.ss_sp;
}
void *thread_arch_isr_stack_start(void)
{
return isr_stack;
}
void isr_cpu_switch_context_exit(void)
{
DEBUG("XXX: cpu_switch_context_exit(), num_tasks = %d\n", sched_num_threads);

6
sys/ps/ps.c

@ -72,9 +72,11 @@ void ps(void)
"state");
#ifdef DEVELHELP
int isr_usage = thread_arch_isr_stack_usage(); /* ISR stack usage */
int isr_usage = thread_arch_isr_stack_usage();
void *isr_start = thread_arch_isr_stack_start();
void *isr_sp = thread_arch_isr_stack_pointer();
printf("\t - | isr_stack | - - |"
" - | %5i (%5i) | -\n", ISR_STACKSIZE, isr_usage);
" - | %5i (%5i) | %10p | %10p\n", ISR_STACKSIZE, isr_usage, isr_start, isr_sp);
overall_stacksz += ISR_STACKSIZE;
if (isr_usage > 0) {
overall_used += isr_usage;

Loading…
Cancel
Save