at v6.0 60 lines 1.7 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (C) 2012 ARM Ltd. 4 */ 5#ifndef __ASM_STACKTRACE_H 6#define __ASM_STACKTRACE_H 7 8#include <linux/percpu.h> 9#include <linux/sched.h> 10#include <linux/sched/task_stack.h> 11#include <linux/llist.h> 12 13#include <asm/memory.h> 14#include <asm/pointer_auth.h> 15#include <asm/ptrace.h> 16#include <asm/sdei.h> 17 18#include <asm/stacktrace/common.h> 19 20extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk, 21 const char *loglvl); 22 23DECLARE_PER_CPU(unsigned long *, irq_stack_ptr); 24 25static inline bool on_irq_stack(unsigned long sp, unsigned long size, 26 struct stack_info *info) 27{ 28 unsigned long low = (unsigned long)raw_cpu_read(irq_stack_ptr); 29 unsigned long high = low + IRQ_STACK_SIZE; 30 31 return on_stack(sp, size, low, high, STACK_TYPE_IRQ, info); 32} 33 34static inline bool on_task_stack(const struct task_struct *tsk, 35 unsigned long sp, unsigned long size, 36 struct stack_info *info) 37{ 38 unsigned long low = (unsigned long)task_stack_page(tsk); 39 unsigned long high = low + THREAD_SIZE; 40 41 return on_stack(sp, size, low, high, STACK_TYPE_TASK, info); 42} 43 44#ifdef CONFIG_VMAP_STACK 45DECLARE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack); 46 47static inline bool on_overflow_stack(unsigned long sp, unsigned long size, 48 struct stack_info *info) 49{ 50 unsigned long low = (unsigned long)raw_cpu_ptr(overflow_stack); 51 unsigned long high = low + OVERFLOW_STACK_SIZE; 52 53 return on_stack(sp, size, low, high, STACK_TYPE_OVERFLOW, info); 54} 55#else 56static inline bool on_overflow_stack(unsigned long sp, unsigned long size, 57 struct stack_info *info) { return false; } 58#endif 59 60#endif /* __ASM_STACKTRACE_H */