aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/kernel/stack.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2011-05-02 13:49:14 -0400
committerChris Metcalf <cmetcalf@tilera.com>2011-05-02 13:49:14 -0400
commit93013a0f533fb3dd6875ca670d8e0bb4166a796e (patch)
treeb3967c2853ca9b8a6322d16d70400b10bb25ac53 /arch/tile/kernel/stack.c
parent8e10cd74342c7f5ce259cceca36f6eba084f5d58 (diff)
arch/tile: refactor backtracing code
This change is the result of some work to make the backtrace code more shareable between kernel, libc, and gdb. For the kernel, some good effects are to eliminate the hacky "VirtualAddress" typedef in favor of "unsigned long", to eliminate a bunch of spurious kernel doc comments, to remove the dead "bt_read_memory" function, and to use "__tilegx__" in #ifdefs instead of "TILE_CHIP". Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/kernel/stack.c')
-rw-r--r--arch/tile/kernel/stack.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c
index dd81713a90dc..37ee4d037e0b 100644
--- a/arch/tile/kernel/stack.c
+++ b/arch/tile/kernel/stack.c
@@ -36,7 +36,7 @@
36#define KBT_LOOP 3 /* Backtrace entered a loop */ 36#define KBT_LOOP 3 /* Backtrace entered a loop */
37 37
38/* Is address on the specified kernel stack? */ 38/* Is address on the specified kernel stack? */
39static int in_kernel_stack(struct KBacktraceIterator *kbt, VirtualAddress sp) 39static int in_kernel_stack(struct KBacktraceIterator *kbt, unsigned long sp)
40{ 40{
41 ulong kstack_base = (ulong) kbt->task->stack; 41 ulong kstack_base = (ulong) kbt->task->stack;
42 if (kstack_base == 0) /* corrupt task pointer; just follow stack... */ 42 if (kstack_base == 0) /* corrupt task pointer; just follow stack... */
@@ -45,7 +45,7 @@ static int in_kernel_stack(struct KBacktraceIterator *kbt, VirtualAddress sp)
45} 45}
46 46
47/* Is address valid for reading? */ 47/* Is address valid for reading? */
48static int valid_address(struct KBacktraceIterator *kbt, VirtualAddress address) 48static int valid_address(struct KBacktraceIterator *kbt, unsigned long address)
49{ 49{
50 HV_PTE *l1_pgtable = kbt->pgtable; 50 HV_PTE *l1_pgtable = kbt->pgtable;
51 HV_PTE *l2_pgtable; 51 HV_PTE *l2_pgtable;
@@ -97,7 +97,7 @@ static int valid_address(struct KBacktraceIterator *kbt, VirtualAddress address)
97} 97}
98 98
99/* Callback for backtracer; basically a glorified memcpy */ 99/* Callback for backtracer; basically a glorified memcpy */
100static bool read_memory_func(void *result, VirtualAddress address, 100static bool read_memory_func(void *result, unsigned long address,
101 unsigned int size, void *vkbt) 101 unsigned int size, void *vkbt)
102{ 102{
103 int retval; 103 int retval;
@@ -124,7 +124,7 @@ static struct pt_regs *valid_fault_handler(struct KBacktraceIterator* kbt)
124{ 124{
125 const char *fault = NULL; /* happy compiler */ 125 const char *fault = NULL; /* happy compiler */
126 char fault_buf[64]; 126 char fault_buf[64];
127 VirtualAddress sp = kbt->it.sp; 127 unsigned long sp = kbt->it.sp;
128 struct pt_regs *p; 128 struct pt_regs *p;
129 129
130 if (!in_kernel_stack(kbt, sp)) 130 if (!in_kernel_stack(kbt, sp))
@@ -163,7 +163,7 @@ static struct pt_regs *valid_fault_handler(struct KBacktraceIterator* kbt)
163} 163}
164 164
165/* Is the pc pointing to a sigreturn trampoline? */ 165/* Is the pc pointing to a sigreturn trampoline? */
166static int is_sigreturn(VirtualAddress pc) 166static int is_sigreturn(unsigned long pc)
167{ 167{
168 return (pc == VDSO_BASE); 168 return (pc == VDSO_BASE);
169} 169}
@@ -260,7 +260,7 @@ static void validate_stack(struct pt_regs *regs)
260void KBacktraceIterator_init(struct KBacktraceIterator *kbt, 260void KBacktraceIterator_init(struct KBacktraceIterator *kbt,
261 struct task_struct *t, struct pt_regs *regs) 261 struct task_struct *t, struct pt_regs *regs)
262{ 262{
263 VirtualAddress pc, lr, sp, r52; 263 unsigned long pc, lr, sp, r52;
264 int is_current; 264 int is_current;
265 265
266 /* 266 /*
@@ -331,7 +331,7 @@ EXPORT_SYMBOL(KBacktraceIterator_end);
331 331
332void KBacktraceIterator_next(struct KBacktraceIterator *kbt) 332void KBacktraceIterator_next(struct KBacktraceIterator *kbt)
333{ 333{
334 VirtualAddress old_pc = kbt->it.pc, old_sp = kbt->it.sp; 334 unsigned long old_pc = kbt->it.pc, old_sp = kbt->it.sp;
335 kbt->new_context = 0; 335 kbt->new_context = 0;
336 if (!backtrace_next(&kbt->it) && !KBacktraceIterator_restart(kbt)) { 336 if (!backtrace_next(&kbt->it) && !KBacktraceIterator_restart(kbt)) {
337 kbt->end = KBT_DONE; 337 kbt->end = KBT_DONE;