^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Copyright (C) 2013 Altera Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2004 Microtronix Datacom Ltd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * based on m68k asm/processor.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * License. See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #ifndef _ASM_NIOS2_PTRACE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define _ASM_NIOS2_PTRACE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <uapi/asm/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /* This struct defines the way the registers are stored on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) stack during a system call. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #ifndef __ASSEMBLY__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct pt_regs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) unsigned long r8; /* r8-r15 Caller-saved GP registers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) unsigned long r9;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) unsigned long r10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) unsigned long r11;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) unsigned long r12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) unsigned long r13;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unsigned long r14;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) unsigned long r15;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned long r1; /* Assembler temporary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) unsigned long r2; /* Retval LS 32bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) unsigned long r3; /* Retval MS 32bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) unsigned long r4; /* r4-r7 Register arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) unsigned long r5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) unsigned long r6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) unsigned long r7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) unsigned long orig_r2; /* Copy of r2 ?? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) unsigned long ra; /* Return address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) unsigned long fp; /* Frame pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) unsigned long sp; /* Stack pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unsigned long gp; /* Global pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) unsigned long estatus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) unsigned long ea; /* Exception return address (pc) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) unsigned long orig_r7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * This is the extended stack used by signal handlers and the context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * switcher: it's pushed after the normal "struct pt_regs".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct switch_stack {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) unsigned long r16; /* r16-r23 Callee-saved GP registers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) unsigned long r17;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) unsigned long r18;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) unsigned long r19;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) unsigned long r20;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) unsigned long r21;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) unsigned long r22;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) unsigned long r23;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) unsigned long fp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) unsigned long gp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) unsigned long ra;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define user_mode(regs) (((regs)->estatus & ESTATUS_EU))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define instruction_pointer(regs) ((regs)->ra)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define profile_pc(regs) instruction_pointer(regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define user_stack_pointer(regs) ((regs)->sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) extern void show_regs(struct pt_regs *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define current_pt_regs() \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) int do_syscall_trace_enter(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) void do_syscall_trace_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #endif /* __ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #endif /* _ASM_NIOS2_PTRACE_H */