Fork us on GitHub Follow us on Facebook Follow us on Twitter

Ignore:
Timestamp:
2010-05-21T22:34:33Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
0242621
Parents:
2ee907e
Message:

On sparc64, we have a problem with determining the end of the kernel stack
because the preemptible trap handler cannot easily terminate the stack trace by
writing -STACK_BIAS to %fp as that %fp is unfortunatelly an %sp of the previous
context (user or kernel).

Without sacrifying performance via the FLUSHW instruction, we simply have to
stop tracing when we see the stack frame with %sp created by the SAVE
instruction inside the preemptible trap handler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/debug/stacktrace.c

    r2ee907e r819a768  
    3737#include <typedefs.h>
    3838
     39#include <arch.h>
    3940#include <arch/stack.h>
     41#include <arch/trap/trap_table.h>
     42
     43#if defined(SUN4V)
     44#include <arch/sun4v/arch.h>
     45#endif
    4046
    4147#define FRAME_OFFSET_FP_PREV    14
     
    4652bool kernel_frame_pointer_validate(uintptr_t fp)
    4753{
     54        uintptr_t kstack;
     55       
     56#if defined(SUN4U)
     57        kstack = read_from_ag_g6();
     58#elif defined(SUN4V)
     59        kstack = asi_u64_read(ASI_SCRATCHPAD, SCRATCHPAD_KSTACK);
     60#endif
     61
     62        kstack += STACK_BIAS;
     63        kstack -= PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE;
     64
     65        if (THREAD && (fp == kstack))
     66                return false;
    4867        return fp != 0;
    4968}
Note: See TracChangeset for help on using the changeset viewer.