Ignore:
File:
1 edited

Legend:

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

    rd99c1d2 rb92ee1e  
    3737#include <typedefs.h>
    3838
    39 bool kernel_frame_pointer_validate(uintptr_t fp)
     39#define FRAME_OFFSET_FP_PREV  0
     40#define FRAME_OFFSET_RA       1
     41
     42bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
    4043{
    41         return false;
     44        return ctx->fp != 0;
    4245}
    4346
    44 bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev)
     47bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
    4548{
    46         return false;
     49        uint32_t *stack = (void *) ctx->fp;
     50        *prev = stack[FRAME_OFFSET_FP_PREV];
     51        return true;
    4752}
    4853
    49 bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra)
     54bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
    5055{
    51         return false;
     56        uint32_t *stack = (void *) ctx->fp;
     57        *ra = stack[FRAME_OFFSET_RA];
     58        return true;
    5259}
    5360
    54 bool uspace_frame_pointer_validate(uintptr_t fp)
     61bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
    5562{
    56         return false;
     63        return ctx->fp != 0;
    5764}
    5865
    59 bool uspace_frame_pointer_prev(uintptr_t fp, uintptr_t *prev)
     66bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
    6067{
    61         return false;
     68        return !copy_from_uspace((void *) prev,
     69            (uint32_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));
    6270}
    6371
    64 bool uspace_return_address_get(uintptr_t fp, uintptr_t *ra)
     72bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
    6573{
    66         return false;
     74        return !copy_from_uspace((void *) ra,
     75            (uint32_t *) ctx->fp + FRAME_OFFSET_RA, sizeof(*ra));
    6776}
    6877
Note: See TracChangeset for help on using the changeset viewer.