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
60 /* CS selector */
61 u64 cs : 16, member
105 * C ABI says these regs are callee-preserved. They aren't saved on
116 /* These regs are callee-clobbered. Always saved on kernel entry. */
129 * - the syscall number (syscall, sysenter, int80)
130 * - error_code stored by the CPU on traps and exceptions
131 * - the interrupt number for device interrupts
145 /* CS selector */
146 u16 cs; member
147 /* The extended 64-bit data slot containing CS */
149 /* The FRED CS extension */
159 /* The extended 64-bit data slot containing SS */
192 return regs->ax; in regs_return_value()
197 regs->ax = rc; in regs_set_return_value()
203 * register set was from protected mode with RPL-3 CS value. This
212 return ((regs->cs & SEGMENT_RPL_MASK) | (regs->flags & X86_VM_MASK)) >= USER_RPL; in user_mode()
214 return !!(regs->cs & 3); in user_mode()
221 return (regs->flags & X86_VM_MASK); in v8086_mode()
232 * On non-paravirt systems, this is the only long mode CPL 3 in user_64bit_mode()
235 return regs->cs == __USER_CS; in user_64bit_mode()
238 return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs; in user_64bit_mode()
247 * 64-bit mode.
259 #define current_user_stack_pointer() current_pt_regs()->sp
260 #define compat_user_stack_pointer() current_pt_regs()->sp
264 bool ret = (regs->ip >= (unsigned long)entry_SYSCALL_64 && in ip_within_syscall_gap()
265 regs->ip < (unsigned long)entry_SYSCALL_64_safe_stack); in ip_within_syscall_gap()
267 ret = ret || (regs->ip >= (unsigned long)entry_SYSRETQ_unsafe_stack && in ip_within_syscall_gap()
268 regs->ip < (unsigned long)entry_SYSRETQ_end); in ip_within_syscall_gap()
270 ret = ret || (regs->ip >= (unsigned long)entry_SYSCALL_compat && in ip_within_syscall_gap()
271 regs->ip < (unsigned long)entry_SYSCALL_compat_safe_stack); in ip_within_syscall_gap()
272 ret = ret || (regs->ip >= (unsigned long)entry_SYSRETL_compat_unsafe_stack && in ip_within_syscall_gap()
273 regs->ip < (unsigned long)entry_SYSRETL_compat_end); in ip_within_syscall_gap()
282 return regs->sp; in kernel_stack_pointer()
287 return regs->ip; in instruction_pointer()
293 regs->ip = val; in instruction_pointer_set()
298 return regs->bp; in frame_pointer()
303 return regs->sp; in user_stack_pointer()
309 regs->sp = val; in user_stack_pointer_set()
314 return !(regs->flags & X86_EFLAGS_IF); in regs_irqs_disabled()
323 * regs_get_register() - get register value from its offset
325 * @offset: offset number of the register.
337 /* The selector fields are 16-bit. */ in regs_get_register()
338 if (offset == offsetof(struct pt_regs, cs) || in regs_get_register()
352 * regs_within_kernel_stack() - check the address in the stack
362 return ((addr & ~(THREAD_SIZE - 1)) == (regs->sp & ~(THREAD_SIZE - 1))); in regs_within_kernel_stack()
366 * regs_get_kernel_stack_nth_addr() - get the address of the Nth entry on stack
368 * @n: stack entry number.
376 unsigned long *addr = (unsigned long *)regs->sp; in regs_get_kernel_stack_nth_addr()
389 * regs_get_kernel_stack_nth() - get Nth entry of the stack
391 * @n: stack entry number.
414 * regs_get_kernel_argument() - get Nth function argument in kernel
416 * @n: function argument number (start from 0)
445 n -= NR_REG_ARGUMENTS - 1; in regs_get_kernel_argument()