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
24 #include <asm/asm-const.h>
106 * pointer. This is 288 in the 64-bit big-endian ELF ABI, and 512 in
107 * the new ELFv2 little-endian ABI, so we allow the larger amount.
109 * For kernel code we allow a 288-byte redzone, in order to conserve
153 extern unsigned long profile_pc(struct pt_regs *regs);
155 #define profile_pc(regs) instruction_pointer(regs) argument
158 long do_syscall_trace_enter(struct pt_regs *regs);
159 void do_syscall_trace_leave(struct pt_regs *regs);
164 local_paca->hsrr_valid = 0; in set_return_regs_changed()
165 local_paca->srr_valid = 0; in set_return_regs_changed()
169 static inline void regs_set_return_ip(struct pt_regs *regs, unsigned long ip) in regs_set_return_ip() argument
171 regs->nip = ip; in regs_set_return_ip()
175 static inline void regs_set_return_msr(struct pt_regs *regs, unsigned long msr) in regs_set_return_msr() argument
177 regs->msr = msr; in regs_set_return_msr()
181 static inline void regs_add_return_ip(struct pt_regs *regs, long offset) in regs_add_return_ip() argument
183 regs_set_return_ip(regs, regs->nip + offset); in regs_add_return_ip()
186 static inline unsigned long instruction_pointer(struct pt_regs *regs) in instruction_pointer() argument
188 return regs->nip; in instruction_pointer()
191 static inline void instruction_pointer_set(struct pt_regs *regs, in instruction_pointer_set() argument
194 regs_set_return_ip(regs, val); in instruction_pointer_set()
197 static inline unsigned long user_stack_pointer(struct pt_regs *regs) in user_stack_pointer() argument
199 return regs->gpr[1]; in user_stack_pointer()
202 static inline unsigned long frame_pointer(struct pt_regs *regs) in frame_pointer() argument
207 #define user_mode(regs) (((regs)->msr & MSR_PR) != 0) argument
215 ((struct pt_regs *)((unsigned long)task_stack_page(current) + THREAD_SIZE) - 1)
231 #define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0) argument
232 #define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0) argument
233 #define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0) argument
235 #define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK) argument
237 static __always_inline void set_trap(struct pt_regs *regs, unsigned long val) in set_trap() argument
239 regs->trap = (regs->trap & TRAP_FLAGS_MASK) | (val & ~TRAP_FLAGS_MASK); in set_trap()
242 static inline bool trap_is_scv(struct pt_regs *regs) in trap_is_scv() argument
244 return (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && TRAP(regs) == 0x3000); in trap_is_scv()
247 static inline bool trap_is_unsupported_scv(struct pt_regs *regs) in trap_is_unsupported_scv() argument
249 return IS_ENABLED(CONFIG_PPC_BOOK3S_64) && TRAP(regs) == 0x7ff0; in trap_is_unsupported_scv()
252 static inline bool trap_is_syscall(struct pt_regs *regs) in trap_is_syscall() argument
254 return (trap_is_scv(regs) || TRAP(regs) == 0xc00); in trap_is_syscall()
257 static inline bool trap_norestart(struct pt_regs *regs) in trap_norestart() argument
259 return regs->trap & 0x1; in trap_norestart()
262 static __always_inline void set_trap_norestart(struct pt_regs *regs) in set_trap_norestart() argument
264 regs->trap |= 0x1; in set_trap_norestart()
267 #define kernel_stack_pointer(regs) ((regs)->gpr[1]) argument
268 static inline int is_syscall_success(struct pt_regs *regs) in is_syscall_success() argument
270 if (trap_is_scv(regs)) in is_syscall_success()
271 return !IS_ERR_VALUE((unsigned long)regs->gpr[3]); in is_syscall_success()
273 return !(regs->ccr & 0x10000000); in is_syscall_success()
276 static inline long regs_return_value(struct pt_regs *regs) in regs_return_value() argument
278 if (trap_is_scv(regs)) in regs_return_value()
279 return regs->gpr[3]; in regs_return_value()
281 if (is_syscall_success(regs)) in regs_return_value()
282 return regs->gpr[3]; in regs_return_value()
284 return -regs->gpr[3]; in regs_return_value()
287 static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) in regs_set_return_value() argument
289 regs->gpr[3] = rc; in regs_set_return_value()
297 static inline bool regs_is_unrecoverable(struct pt_regs *regs) in regs_is_unrecoverable() argument
299 return unlikely(cpu_has_msr_ri() && !(regs->msr & MSR_RI)); in regs_is_unrecoverable()
302 static inline void regs_set_recoverable(struct pt_regs *regs) in regs_set_recoverable() argument
305 regs_set_return_msr(regs, regs->msr | MSR_RI); in regs_set_recoverable()
308 static inline void regs_set_unrecoverable(struct pt_regs *regs) in regs_set_unrecoverable() argument
311 regs_set_return_msr(regs, regs->msr & ~MSR_RI); in regs_set_unrecoverable()
319 * kprobe-based event tracer support
329 * regs_get_register() - get register value from its offset
330 * @regs: pt_regs from which register value is gotten
333 * regs_get_register returns the value of a register whose offset from @regs.
337 static inline unsigned long regs_get_register(struct pt_regs *regs, in regs_get_register() argument
342 return *(unsigned long *)((unsigned long)regs + offset); in regs_get_register()
346 * regs_within_kernel_stack() - check the address in the stack
347 * @regs: pt_regs which contains kernel stack pointer.
354 static inline bool regs_within_kernel_stack(struct pt_regs *regs, in regs_within_kernel_stack() argument
357 return ((addr & ~(THREAD_SIZE - 1)) == in regs_within_kernel_stack()
358 (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1))); in regs_within_kernel_stack()
362 * regs_get_kernel_stack_nth() - get Nth entry of the stack
363 * @regs: pt_regs which contains kernel stack pointer.
367 * is specified by @regs. If the @n th entry is NOT in the kernel stack,
370 static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, in regs_get_kernel_stack_nth() argument
373 unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs); in regs_get_kernel_stack_nth()
375 if (regs_within_kernel_stack(regs, (unsigned long)addr)) in regs_get_kernel_stack_nth()
387 #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */
388 #define PT_VR0_32 164 /* each Vector reg occupies 4 slots in 32-bit */
391 #define PT_VSR0_32 300 /* each VSR reg occupies 4 slots in 32-bit */