source: mainline/kernel/arch/sparc32/src/debug/stacktrace.c@ d18ad61

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since d18ad61 was d18ad61, checked in by Martin Decky <martin@…>, 12 years ago

fix small omissions and API incompatibilities

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 2010 Jakub Jermar
3 * Copyright (c) 2013 Jakub Klama
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup sparc32
31 * @{
32 */
33/** @file
34 */
35
36#include <stacktrace.h>
37#include <syscall/copy.h>
38#include <typedefs.h>
39#include <arch.h>
40#include <arch/stack.h>
41
42#define FRAME_OFFSET_FP_PREV 14
43#define FRAME_OFFSET_RA 15
44
45static void alloc_window_and_flush(void)
46{
47 // FIXME TODO
48}
49
50bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
51{
52 uintptr_t kstack;
53 uint32_t l1;
54 uint32_t l2;
55
56 read_from_invalid(&kstack, &l1, &l2);
57 kstack -= 128;
58
59 if ((THREAD) && (ctx->fp == kstack))
60 return false;
61
62 return (ctx->fp != 0);
63}
64
65bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
66{
67 uint64_t *stack = (void *) ctx->fp;
68 alloc_window_and_flush();
69 *prev = stack[FRAME_OFFSET_FP_PREV];
70 return true;
71}
72
73bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
74{
75 uint64_t *stack = (void *) ctx->fp;
76 alloc_window_and_flush();
77 *ra = stack[FRAME_OFFSET_RA];
78 return true;
79}
80
81bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
82{
83 return false;
84}
85
86bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
87{
88 return false;
89}
90
91bool uspace_return_address_get(stack_trace_context_t *ctx , uintptr_t *ra)
92{
93 return false;
94}
95
96/** @}
97 */
Note: See TracBrowser for help on using the repository browser.