mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-22 04:53:50 +01:00
Merge pull request #5559 from gebart/pr/ps-stack-pointer
sys/ps: Add current stack pointer to DEVELHELP output
This commit is contained in:
commit
048daf1b3b
@ -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);
|
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
|
* @brief Print the current stack to stdout
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -35,6 +35,18 @@ int thread_arch_isr_stack_usage(void)
|
|||||||
return -1;
|
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
|
* Processor specific routine - here for ARM7
|
||||||
* sizeof(void*) = sizeof(int)
|
* sizeof(void*) = sizeof(int)
|
||||||
|
|||||||
@ -205,6 +205,18 @@ int thread_arch_isr_stack_usage(void)
|
|||||||
return -1;
|
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) __attribute__((naked));
|
||||||
void thread_arch_start_threading(void)
|
void thread_arch_start_threading(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -267,6 +267,17 @@ int thread_arch_isr_stack_usage(void)
|
|||||||
return num_used_words * sizeof(*ptr);
|
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)
|
__attribute__((naked)) void NORETURN thread_arch_start_threading(void)
|
||||||
{
|
{
|
||||||
__asm__ volatile (
|
__asm__ volatile (
|
||||||
|
|||||||
@ -40,6 +40,18 @@ int thread_arch_isr_stack_usage(void)
|
|||||||
return -1;
|
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)
|
NORETURN void cpu_switch_context_exit(void)
|
||||||
{
|
{
|
||||||
sched_active_thread = sched_threads[0];
|
sched_active_thread = sched_threads[0];
|
||||||
|
|||||||
@ -62,6 +62,16 @@ int _sig_pipefd[2];
|
|||||||
static _native_callback_t native_irq_handlers[255];
|
static _native_callback_t native_irq_handlers[255];
|
||||||
char sigalt_stk[SIGSTKSZ];
|
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)
|
void print_thread_sigmask(ucontext_t *cp)
|
||||||
{
|
{
|
||||||
sigset_t *p = &cp->uc_sigmask;
|
sigset_t *p = &cp->uc_sigmask;
|
||||||
|
|||||||
@ -117,6 +117,16 @@ void thread_yield_higher(void)
|
|||||||
irq_restore(old_intr);
|
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)
|
void isr_cpu_switch_context_exit(void)
|
||||||
{
|
{
|
||||||
DEBUG("XXX: cpu_switch_context_exit(), num_tasks = %d\n", sched_num_threads);
|
DEBUG("XXX: cpu_switch_context_exit(), num_tasks = %d\n", sched_num_threads);
|
||||||
|
|||||||
12
sys/ps/ps.c
12
sys/ps/ps.c
@ -60,7 +60,7 @@ void ps(void)
|
|||||||
#endif
|
#endif
|
||||||
"%-9sQ | pri "
|
"%-9sQ | pri "
|
||||||
#ifdef DEVELHELP
|
#ifdef DEVELHELP
|
||||||
"| stack ( used) | location "
|
"| stack ( used) | base | current "
|
||||||
#endif
|
#endif
|
||||||
#ifdef MODULE_SCHEDSTATISTICS
|
#ifdef MODULE_SCHEDSTATISTICS
|
||||||
"| runtime | switches"
|
"| runtime | switches"
|
||||||
@ -72,9 +72,11 @@ void ps(void)
|
|||||||
"state");
|
"state");
|
||||||
|
|
||||||
#ifdef DEVELHELP
|
#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 | - - |"
|
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;
|
overall_stacksz += ISR_STACKSIZE;
|
||||||
if (isr_usage > 0) {
|
if (isr_usage > 0) {
|
||||||
overall_used += isr_usage;
|
overall_used += isr_usage;
|
||||||
@ -104,7 +106,7 @@ void ps(void)
|
|||||||
#endif
|
#endif
|
||||||
" | %-8s %.1s | %3i"
|
" | %-8s %.1s | %3i"
|
||||||
#ifdef DEVELHELP
|
#ifdef DEVELHELP
|
||||||
" | %5i (%5i) | %p "
|
" | %5i (%5i) | %10p | %10p "
|
||||||
#endif
|
#endif
|
||||||
#ifdef MODULE_SCHEDSTATISTICS
|
#ifdef MODULE_SCHEDSTATISTICS
|
||||||
" | %6.3f%% | %8d"
|
" | %6.3f%% | %8d"
|
||||||
@ -116,7 +118,7 @@ void ps(void)
|
|||||||
#endif
|
#endif
|
||||||
sname, queued, p->priority
|
sname, queued, p->priority
|
||||||
#ifdef DEVELHELP
|
#ifdef DEVELHELP
|
||||||
, p->stack_size, stacksz, (void *)p->stack_start
|
, p->stack_size, stacksz, (void *)p->stack_start, (void *)p->sp
|
||||||
#endif
|
#endif
|
||||||
#ifdef MODULE_SCHEDSTATISTICS
|
#ifdef MODULE_SCHEDSTATISTICS
|
||||||
, runtime_ticks, switches
|
, runtime_ticks, switches
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user