Changeset 7de7cde in mainline


Ignore:
Timestamp:
2010-05-21T18:53:26Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
31198c12
Parents:
8aa9265
Message:

ppc32: add basic support for generating stack traces
(this does not cover the whole ABI, but it should still work in common cases)

Location:
kernel/arch/ppc32/src/debug
Files:
2 edited

Legend:

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

    r8aa9265 r7de7cde  
    3737#include <typedefs.h>
    3838
     39#define FRAME_OFFSET_FP_PREV  0
     40#define FRAME_OFFSET_RA       1
     41
    3942bool kernel_frame_pointer_validate(uintptr_t fp)
    4043{
    41         return false;
     44        return fp != 0;
    4245}
    4346
    4447bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev)
    4548{
    46         return false;
     49        uint32_t *stack = (void *) fp;
     50        *prev = stack[FRAME_OFFSET_FP_PREV];
     51        return true;
    4752}
    4853
    4954bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra)
    5055{
    51         return false;
     56        uint32_t *stack = (void *) fp;
     57        *ra = stack[FRAME_OFFSET_RA];
     58        return true;
    5259}
    5360
    5461bool uspace_frame_pointer_validate(uintptr_t fp)
    5562{
    56         return false;
     63        return fp != 0;
    5764}
    5865
  • kernel/arch/ppc32/src/debug/stacktrace_asm.S

    r8aa9265 r7de7cde  
    2727#
    2828
     29#include <arch/asm/regname.h>
     30
    2931.text
    3032
     
    3335
    3436frame_pointer_get:
     37        mr r3, sp
    3538        blr
    3639
    3740program_counter_get:
     41        mflr r3
    3842        blr
Note: See TracChangeset for help on using the changeset viewer.