Lines Matching refs:regs
61 * C ABI says these regs are callee-preserved. They aren't saved on kernel entry
70 /* These regs are callee-clobbered. Always saved on kernel entry. */
105 extern unsigned long profile_pc(struct pt_regs *regs);
108 convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
109 extern void send_sigtrap(struct pt_regs *regs, int error_code, int si_code);
112 static inline unsigned long regs_return_value(struct pt_regs *regs)
114 return regs->ax;
117 static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
119 regs->ax = rc;
123 * user_mode(regs) determines whether a register set came from user
131 static __always_inline int user_mode(struct pt_regs *regs)
134 return ((regs->cs & SEGMENT_RPL_MASK) | (regs->flags & X86_VM_MASK)) >= USER_RPL;
136 return !!(regs->cs & 3);
140 static __always_inline int v8086_mode(struct pt_regs *regs)
143 return (regs->flags & X86_VM_MASK);
149 static inline bool user_64bit_mode(struct pt_regs *regs)
157 return regs->cs == __USER_CS;
160 return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;
171 static inline bool any_64bit_mode(struct pt_regs *regs)
174 return !user_mode(regs) || user_64bit_mode(regs);
184 static __always_inline bool ip_within_syscall_gap(struct pt_regs *regs)
186 bool ret = (regs->ip >= (unsigned long)entry_SYSCALL_64 &&
187 regs->ip < (unsigned long)entry_SYSCALL_64_safe_stack);
189 ret = ret || (regs->ip >= (unsigned long)entry_SYSRETQ_unsafe_stack &&
190 regs->ip < (unsigned long)entry_SYSRETQ_end);
192 ret = ret || (regs->ip >= (unsigned long)entry_SYSCALL_compat &&
193 regs->ip < (unsigned long)entry_SYSCALL_compat_safe_stack);
194 ret = ret || (regs->ip >= (unsigned long)entry_SYSRETL_compat_unsafe_stack &&
195 regs->ip < (unsigned long)entry_SYSRETL_compat_end);
202 static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
204 return regs->sp;
207 static inline unsigned long instruction_pointer(struct pt_regs *regs)
209 return regs->ip;
212 static inline void instruction_pointer_set(struct pt_regs *regs,
215 regs->ip = val;
218 static inline unsigned long frame_pointer(struct pt_regs *regs)
220 return regs->bp;
223 static inline unsigned long user_stack_pointer(struct pt_regs *regs)
225 return regs->sp;
228 static inline void user_stack_pointer_set(struct pt_regs *regs,
231 regs->sp = val;
234 static __always_inline bool regs_irqs_disabled(struct pt_regs *regs)
236 return !(regs->flags & X86_EFLAGS_IF);
246 * @regs: pt_regs from which register value is gotten.
250 * offset of the register in struct pt_regs address which specified by @regs.
253 static inline unsigned long regs_get_register(struct pt_regs *regs,
266 return *(u16 *)((unsigned long)regs + offset);
270 return *(unsigned long *)((unsigned long)regs + offset);
275 * @regs: pt_regs which contains kernel stack pointer.
281 static inline int regs_within_kernel_stack(struct pt_regs *regs,
284 return ((addr & ~(THREAD_SIZE - 1)) == (regs->sp & ~(THREAD_SIZE - 1)));
289 * @regs: pt_regs which contains kernel stack pointer.
293 * kernel stack which is specified by @regs. If the @n th entry is NOT in
296 static inline unsigned long *regs_get_kernel_stack_nth_addr(struct pt_regs *regs, unsigned int n)
298 unsigned long *addr = (unsigned long *)regs->sp;
301 if (regs_within_kernel_stack(regs, (unsigned long)addr))
312 * @regs: pt_regs which contains kernel stack pointer.
316 * is specified by @regs. If the @n th entry is NOT in the kernel stack
319 static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
326 addr = regs_get_kernel_stack_nth_addr(regs, n);
337 * @regs: pt_regs of that context
343 * This is expected to be called from kprobes or ftrace with regs
346 static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs,
368 return regs_get_kernel_stack_nth(regs, n);
370 return regs_get_register(regs, argument_offs[n]);