Lines Matching +full:cs +full:- +full:number
1 /* SPDX-License-Identifier: GPL-2.0 */
14 * NB: 32-bit x86 CPUs are inconsistent as what happens in the
17 * - pushl %seg: some do a 16-bit write and leave the high
19 * - movl %seg, [mem]: some do a 16-bit write despite the movl
20 * - IDT entry: some (e.g. 486) will leave the high bits of CS
23 * Fortunately, x86-32 doesn't read the high bits on POP or IRET,
24 * so we can just treat all of the segment registers as 16-bit
41 * On interrupt, gs and __gsh store the vector number. They never
49 unsigned short cs; member
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. */
82 * On hw interrupt, it's IRQ number:
87 unsigned long cs; member
114 return regs->ax; in regs_return_value()
119 regs->ax = rc; in regs_set_return_value()
125 * register set was from protected mode with RPL-3 CS value. This
134 return ((regs->cs & SEGMENT_RPL_MASK) | (regs->flags & X86_VM_MASK)) >= USER_RPL; in user_mode()
136 return !!(regs->cs & 3); in user_mode()
143 return (regs->flags & X86_VM_MASK); in v8086_mode()
154 * On non-paravirt systems, this is the only long mode CPL 3 in user_64bit_mode()
157 return regs->cs == __USER_CS; in user_64bit_mode()
160 return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs; in user_64bit_mode()
169 * 64-bit mode.
181 #define current_user_stack_pointer() current_pt_regs()->sp
182 #define compat_user_stack_pointer() current_pt_regs()->sp
186 bool ret = (regs->ip >= (unsigned long)entry_SYSCALL_64 && in ip_within_syscall_gap()
187 regs->ip < (unsigned long)entry_SYSCALL_64_safe_stack); in ip_within_syscall_gap()
189 ret = ret || (regs->ip >= (unsigned long)entry_SYSRETQ_unsafe_stack && in ip_within_syscall_gap()
190 regs->ip < (unsigned long)entry_SYSRETQ_end); in ip_within_syscall_gap()
192 ret = ret || (regs->ip >= (unsigned long)entry_SYSCALL_compat && in ip_within_syscall_gap()
193 regs->ip < (unsigned long)entry_SYSCALL_compat_safe_stack); in ip_within_syscall_gap()
194 ret = ret || (regs->ip >= (unsigned long)entry_SYSRETL_compat_unsafe_stack && in ip_within_syscall_gap()
195 regs->ip < (unsigned long)entry_SYSRETL_compat_end); in ip_within_syscall_gap()
204 return regs->sp; in kernel_stack_pointer()
209 return regs->ip; in instruction_pointer()
215 regs->ip = val; in instruction_pointer_set()
220 return regs->bp; in frame_pointer()
225 return regs->sp; in user_stack_pointer()
231 regs->sp = val; in user_stack_pointer_set()
236 return !(regs->flags & X86_EFLAGS_IF); in regs_irqs_disabled()
245 * regs_get_register() - get register value from its offset
247 * @offset: offset number of the register.
259 /* The selector fields are 16-bit. */ in regs_get_register()
260 if (offset == offsetof(struct pt_regs, cs) || in regs_get_register()
274 * regs_within_kernel_stack() - check the address in the stack
284 return ((addr & ~(THREAD_SIZE - 1)) == (regs->sp & ~(THREAD_SIZE - 1))); in regs_within_kernel_stack()
288 * regs_get_kernel_stack_nth_addr() - get the address of the Nth entry on stack
290 * @n: stack entry number.
298 unsigned long *addr = (unsigned long *)regs->sp; in regs_get_kernel_stack_nth_addr()
311 * regs_get_kernel_stack_nth() - get Nth entry of the stack
313 * @n: stack entry number.
336 * regs_get_kernel_argument() - get Nth function argument in kernel
338 * @n: function argument number (start from 0)
367 n -= NR_REG_ARGUMENTS - 1; in regs_get_kernel_argument()