Lines Matching +full:big +full:- +full:endian +full:- +full:regs
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
8 * this should only contain volatile regs
9 * since we can keep non-volatile in the thread_struct
23 #include <asm/asm-const.h>
69 * pointer. This is 288 in the 64-bit big-endian ELF ABI, and 512 in
70 * the new ELFv2 little-endian ABI, so we allow the larger amount.
72 * For kernel code we allow a 288-byte redzone, in order to conserve
114 static inline unsigned long instruction_pointer(struct pt_regs *regs) in instruction_pointer() argument
116 return regs->nip; in instruction_pointer()
119 static inline void instruction_pointer_set(struct pt_regs *regs, in instruction_pointer_set() argument
122 regs->nip = val; in instruction_pointer_set()
125 static inline unsigned long user_stack_pointer(struct pt_regs *regs) in user_stack_pointer() argument
127 return regs->gpr[1]; in user_stack_pointer()
130 static inline unsigned long frame_pointer(struct pt_regs *regs) in frame_pointer() argument
136 extern unsigned long profile_pc(struct pt_regs *regs);
138 #define profile_pc(regs) instruction_pointer(regs) argument
141 long do_syscall_trace_enter(struct pt_regs *regs);
142 void do_syscall_trace_leave(struct pt_regs *regs);
144 #define kernel_stack_pointer(regs) ((regs)->gpr[1]) argument
145 static inline int is_syscall_success(struct pt_regs *regs) in is_syscall_success() argument
147 return !(regs->ccr & 0x10000000); in is_syscall_success()
150 static inline long regs_return_value(struct pt_regs *regs) in regs_return_value() argument
152 if (is_syscall_success(regs)) in regs_return_value()
153 return regs->gpr[3]; in regs_return_value()
155 return -regs->gpr[3]; in regs_return_value()
158 static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) in regs_set_return_value() argument
160 regs->gpr[3] = rc; in regs_set_return_value()
164 #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) argument
166 #define user_mode(regs) (((regs)->msr & MSR_PR) != 0) argument
181 ((struct pt_regs *)((unsigned long)task_stack_page(current) + THREAD_SIZE) - 1)
186 #define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK) argument
187 #define FULL_REGS(regs) true argument
188 #define SET_FULL_REGS(regs) do { } while (0) argument
191 #define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK) argument
192 #define FULL_REGS(regs) (((regs)->trap & 1) == 0) argument
193 #define SET_FULL_REGS(regs) ((regs)->trap |= 1) argument
195 #define CHECK_FULL_REGS(regs) BUG_ON(!FULL_REGS(regs)) argument
199 * We use the least-significant bit of the trap field to indicate
206 #define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK) argument
207 #define FULL_REGS(regs) (((regs)->trap & 1) == 0) argument
208 #define SET_FULL_REGS(regs) ((regs)->trap |= 1) argument
209 #define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0) argument
210 #define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0) argument
211 #define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0) argument
213 #define CHECK_FULL_REGS(regs) \ argument
215 if ((regs)->trap & 1) \
220 static inline void set_trap(struct pt_regs *regs, unsigned long val) in set_trap() argument
222 regs->trap = (regs->trap & TRAP_FLAGS_MASK) | (val & ~TRAP_FLAGS_MASK); in set_trap()
225 static inline bool trap_is_scv(struct pt_regs *regs) in trap_is_scv() argument
227 return (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && TRAP(regs) == 0x3000); in trap_is_scv()
230 static inline bool trap_is_syscall(struct pt_regs *regs) in trap_is_syscall() argument
232 return (trap_is_scv(regs) || TRAP(regs) == 0xc00); in trap_is_syscall()
235 static inline bool trap_norestart(struct pt_regs *regs) in trap_norestart() argument
237 return regs->trap & 0x10; in trap_norestart()
240 static inline void set_trap_norestart(struct pt_regs *regs) in set_trap_norestart() argument
242 regs->trap |= 0x10; in set_trap_norestart()
250 * kprobe-based event tracer support
260 * regs_get_register() - get register value from its offset
261 * @regs: pt_regs from which register value is gotten
264 * regs_get_register returns the value of a register whose offset from @regs.
268 static inline unsigned long regs_get_register(struct pt_regs *regs, in regs_get_register() argument
273 return *(unsigned long *)((unsigned long)regs + offset); in regs_get_register()
277 * regs_within_kernel_stack() - check the address in the stack
278 * @regs: pt_regs which contains kernel stack pointer.
285 static inline bool regs_within_kernel_stack(struct pt_regs *regs, in regs_within_kernel_stack() argument
288 return ((addr & ~(THREAD_SIZE - 1)) == in regs_within_kernel_stack()
289 (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1))); in regs_within_kernel_stack()
293 * regs_get_kernel_stack_nth() - get Nth entry of the stack
294 * @regs: pt_regs which contains kernel stack pointer.
298 * is specified by @regs. If the @n th entry is NOT in the kernel stack,
301 static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, in regs_get_kernel_stack_nth() argument
304 unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs); in regs_get_kernel_stack_nth()
306 if (regs_within_kernel_stack(regs, (unsigned long)addr)) in regs_get_kernel_stack_nth()
318 #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */
319 #define PT_VR0_32 164 /* each Vector reg occupies 4 slots in 32-bit */
322 #define PT_VSR0_32 300 /* each VSR reg occupies 4 slots in 32-bit */