Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * include/asm-xtensa/ptrace.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * License.  See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Copyright (C) 2001 - 2005 Tensilica Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #ifndef _XTENSA_PTRACE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define _XTENSA_PTRACE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <asm/kmem_layout.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <uapi/asm/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * Kernel stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *		+-----------------------+  -------- STACK_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *		|     register file     |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *		+-----------------------+  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *		|    struct pt_regs     |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *		+-----------------------+  | ------ PT_REGS_OFFSET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * double	:  16 bytes spill area  :  |  ^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * excetion	:- - - - - - - - - - - -:  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * frame	:    struct pt_regs     :  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *		:- - - - - - - - - - - -:  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *		|                       |  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  *		|     memory stack      |  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *		|                       |  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *		~                       ~  ~  ~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *		~                       ~  ~  ~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  *		|                       |  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  *		|                       |  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  *		+-----------------------+  |  | --- STACK_BIAS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  *		|  struct task_struct   |  |  |  ^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *  current --> +-----------------------+  |  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *		|  struct thread_info   |  |  |  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  *		+-----------------------+ --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define NO_SYSCALL (-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #ifndef __ASSEMBLY__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #include <asm/coprocessor.h>
^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 struct defines the way the registers are stored on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * kernel stack during a system call or other kernel entry.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) struct pt_regs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	unsigned long pc;		/*   4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	unsigned long ps;		/*   8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	unsigned long depc;		/*  12 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	unsigned long exccause;		/*  16 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	unsigned long excvaddr;		/*  20 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	unsigned long debugcause;	/*  24 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	unsigned long wmask;		/*  28 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	unsigned long lbeg;		/*  32 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	unsigned long lend;		/*  36 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	unsigned long lcount;		/*  40 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	unsigned long sar;		/*  44 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	unsigned long windowbase;	/*  48 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	unsigned long windowstart;	/*  52 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	unsigned long syscall;		/*  56 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	unsigned long icountlevel;	/*  60 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	unsigned long scompare1;	/*  64 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	unsigned long threadptr;	/*  68 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	/* Additional configurable registers that are used by the compiler. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	xtregs_opt_t xtregs_opt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	/* Make sure the areg field is 16 bytes aligned. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	int align[0] __attribute__ ((aligned(16)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	/* current register frame.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	 * Note: The ESF for kernel exceptions ends after 16 registers!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	unsigned long areg[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #include <asm/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) # define arch_has_single_step()	(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) # define task_pt_regs(tsk) ((struct pt_regs*) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	(task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) # define instruction_pointer(regs) ((regs)->pc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 					       (regs)->areg[1]))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) # ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #  define profile_pc(regs) instruction_pointer(regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) # else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #  define profile_pc(regs)						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	({								\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		in_lock_functions(instruction_pointer(regs)) ?		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		return_pointer(regs) : instruction_pointer(regs);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define user_stack_pointer(regs) ((regs)->areg[1])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static inline unsigned long regs_return_value(struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	return regs->areg[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #else	/* __ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) # include <asm/asm-offsets.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define PT_REGS_OFFSET	  (KERNEL_STACK_SIZE - PT_USER_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #endif	/* !__ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #endif	/* _XTENSA_PTRACE_H */