Lines Matching refs:regs

8  * this should only contain volatile regs
172 extern unsigned long profile_pc(struct pt_regs *regs);
174 #define profile_pc(regs) instruction_pointer(regs)
177 long do_syscall_trace_enter(struct pt_regs *regs);
178 void do_syscall_trace_leave(struct pt_regs *regs);
188 static inline void regs_set_return_ip(struct pt_regs *regs, unsigned long ip)
190 regs->nip = ip;
194 static inline void regs_set_return_msr(struct pt_regs *regs, unsigned long msr)
196 regs->msr = msr;
200 static inline void regs_add_return_ip(struct pt_regs *regs, long offset)
202 regs_set_return_ip(regs, regs->nip + offset);
205 static inline unsigned long instruction_pointer(struct pt_regs *regs)
207 return regs->nip;
210 static inline void instruction_pointer_set(struct pt_regs *regs,
213 regs_set_return_ip(regs, val);
216 static inline unsigned long user_stack_pointer(struct pt_regs *regs)
218 return regs->gpr[1];
221 static inline unsigned long frame_pointer(struct pt_regs *regs)
226 #define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
250 #define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0)
251 #define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0)
252 #define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0)
254 #define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
256 static __always_inline void set_trap(struct pt_regs *regs, unsigned long val)
258 regs->trap = (regs->trap & TRAP_FLAGS_MASK) | (val & ~TRAP_FLAGS_MASK);
261 static inline bool trap_is_scv(struct pt_regs *regs)
263 return (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && TRAP(regs) == 0x3000);
266 static inline bool trap_is_unsupported_scv(struct pt_regs *regs)
268 return IS_ENABLED(CONFIG_PPC_BOOK3S_64) && TRAP(regs) == 0x7ff0;
271 static inline bool trap_is_syscall(struct pt_regs *regs)
273 return (trap_is_scv(regs) || TRAP(regs) == 0xc00);
276 static inline bool trap_norestart(struct pt_regs *regs)
278 return regs->trap & 0x1;
281 static __always_inline void set_trap_norestart(struct pt_regs *regs)
283 regs->trap |= 0x1;
286 #define kernel_stack_pointer(regs) ((regs)->gpr[1])
287 static inline int is_syscall_success(struct pt_regs *regs)
289 if (trap_is_scv(regs))
290 return !IS_ERR_VALUE((unsigned long)regs->gpr[3]);
292 return !(regs->ccr & 0x10000000);
295 static inline long regs_return_value(struct pt_regs *regs)
297 if (trap_is_scv(regs))
298 return regs->gpr[3];
300 if (is_syscall_success(regs))
301 return regs->gpr[3];
303 return -regs->gpr[3];
306 static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
308 regs->gpr[3] = rc;
316 static inline bool regs_is_unrecoverable(struct pt_regs *regs)
318 return unlikely(cpu_has_msr_ri() && !(regs->msr & MSR_RI));
321 static inline void regs_set_recoverable(struct pt_regs *regs)
324 regs_set_return_msr(regs, regs->msr | MSR_RI);
327 static inline void regs_set_unrecoverable(struct pt_regs *regs)
330 regs_set_return_msr(regs, regs->msr & ~MSR_RI);
349 * @regs: pt_regs from which register value is gotten
352 * regs_get_register returns the value of a register whose offset from @regs.
356 static inline unsigned long regs_get_register(struct pt_regs *regs,
361 return *(unsigned long *)((unsigned long)regs + offset);
366 * @regs: pt_regs which contains kernel stack pointer.
373 static inline bool regs_within_kernel_stack(struct pt_regs *regs,
377 (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1)));
382 * @regs: pt_regs which contains kernel stack pointer.
386 * is specified by @regs. If the @n th entry is NOT in the kernel stack,
389 static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
392 unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
394 if (regs_within_kernel_stack(regs, (unsigned long)addr))
402 * @regs: pt_regs of that context
407 * kernel code. This is expected to be called from kprobes or ftrace with regs.
409 static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs, unsigned int n)
413 return regs_get_register(regs, offsetof(struct pt_regs, gpr[3 + n]));