cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

stacktrace.h (1088B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef _ASM_UML_STACKTRACE_H
      3#define _ASM_UML_STACKTRACE_H
      4
      5#include <linux/uaccess.h>
      6#include <linux/ptrace.h>
      7
      8struct stack_frame {
      9	struct stack_frame *next_frame;
     10	unsigned long return_address;
     11};
     12
     13struct stacktrace_ops {
     14	void (*address)(void *data, unsigned long address, int reliable);
     15};
     16
     17#ifdef CONFIG_FRAME_POINTER
     18static inline unsigned long
     19get_frame_pointer(struct task_struct *task, struct pt_regs *segv_regs)
     20{
     21	if (!task || task == current)
     22		return segv_regs ? PT_REGS_BP(segv_regs) : current_bp();
     23	return KSTK_EBP(task);
     24}
     25#else
     26static inline unsigned long
     27get_frame_pointer(struct task_struct *task, struct pt_regs *segv_regs)
     28{
     29	return 0;
     30}
     31#endif
     32
     33static inline unsigned long
     34*get_stack_pointer(struct task_struct *task, struct pt_regs *segv_regs)
     35{
     36	if (!task || task == current)
     37		return segv_regs ? (unsigned long *)PT_REGS_SP(segv_regs) : current_sp();
     38	return (unsigned long *)KSTK_ESP(task);
     39}
     40
     41void dump_trace(struct task_struct *tsk, const struct stacktrace_ops *ops, void *data);
     42
     43#endif /* _ASM_UML_STACKTRACE_H */