forked from KolibriOS/kolibrios
ddk: 4.4
git-svn-id: svn://kolibrios.org@6082 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -32,7 +32,18 @@
|
||||
#define E820_ACPI 3
|
||||
#define E820_NVS 4
|
||||
#define E820_UNUSABLE 5
|
||||
#define E820_PMEM 7
|
||||
|
||||
/*
|
||||
* This is a non-standardized way to represent ADR or NVDIMM regions that
|
||||
* persist over a reboot. The kernel will ignore their special capabilities
|
||||
* unless the CONFIG_X86_PMEM_LEGACY option is set.
|
||||
*
|
||||
* ( Note that older platforms also used 6 for the same type of memory,
|
||||
* but newer versions switched to 12 as 6 was assigned differently. Some
|
||||
* time they will learn... )
|
||||
*/
|
||||
#define E820_PRAM 12
|
||||
|
||||
/*
|
||||
* reserved RAM used by kernel itself
|
||||
|
@@ -1,8 +1,6 @@
|
||||
#ifndef _UAPI_ASM_X86_MSR_H
|
||||
#define _UAPI_ASM_X86_MSR_H
|
||||
|
||||
#include <asm/msr-index.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
@@ -1,5 +1,9 @@
|
||||
# ifdef CONFIG_X86_32
|
||||
#ifndef __KERNEL__
|
||||
# ifdef __i386__
|
||||
# include <asm/posix_types_32.h>
|
||||
# elif defined(__ILP32__)
|
||||
# include <asm/posix_types_x32.h>
|
||||
# else
|
||||
# include <asm/posix_types_64.h>
|
||||
# endif
|
||||
#endif
|
||||
|
@@ -37,8 +37,6 @@
|
||||
#define X86_EFLAGS_VM _BITUL(X86_EFLAGS_VM_BIT)
|
||||
#define X86_EFLAGS_AC_BIT 18 /* Alignment Check/Access Control */
|
||||
#define X86_EFLAGS_AC _BITUL(X86_EFLAGS_AC_BIT)
|
||||
#define X86_EFLAGS_AC_BIT 18 /* Alignment Check/Access Control */
|
||||
#define X86_EFLAGS_AC _BITUL(X86_EFLAGS_AC_BIT)
|
||||
#define X86_EFLAGS_VIF_BIT 19 /* Virtual Interrupt Flag */
|
||||
#define X86_EFLAGS_VIF _BITUL(X86_EFLAGS_VIF_BIT)
|
||||
#define X86_EFLAGS_VIP_BIT 20 /* Virtual Interrupt Pending */
|
||||
|
93
drivers/include/uapi/asm/ptrace-abi.h
Normal file
93
drivers/include/uapi/asm/ptrace-abi.h
Normal file
@@ -0,0 +1,93 @@
|
||||
#ifndef _ASM_X86_PTRACE_ABI_H
|
||||
#define _ASM_X86_PTRACE_ABI_H
|
||||
|
||||
#ifdef __i386__
|
||||
|
||||
#define EBX 0
|
||||
#define ECX 1
|
||||
#define EDX 2
|
||||
#define ESI 3
|
||||
#define EDI 4
|
||||
#define EBP 5
|
||||
#define EAX 6
|
||||
#define DS 7
|
||||
#define ES 8
|
||||
#define FS 9
|
||||
#define GS 10
|
||||
#define ORIG_EAX 11
|
||||
#define EIP 12
|
||||
#define CS 13
|
||||
#define EFL 14
|
||||
#define UESP 15
|
||||
#define SS 16
|
||||
#define FRAME_SIZE 17
|
||||
|
||||
#else /* __i386__ */
|
||||
|
||||
#if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS)
|
||||
/*
|
||||
* C ABI says these regs are callee-preserved. They aren't saved on kernel entry
|
||||
* unless syscall needs a complete, fully filled "struct pt_regs".
|
||||
*/
|
||||
#define R15 0
|
||||
#define R14 8
|
||||
#define R13 16
|
||||
#define R12 24
|
||||
#define RBP 32
|
||||
#define RBX 40
|
||||
/* These regs are callee-clobbered. Always saved on kernel entry. */
|
||||
#define R11 48
|
||||
#define R10 56
|
||||
#define R9 64
|
||||
#define R8 72
|
||||
#define RAX 80
|
||||
#define RCX 88
|
||||
#define RDX 96
|
||||
#define RSI 104
|
||||
#define RDI 112
|
||||
/*
|
||||
* On syscall entry, this is syscall#. On CPU exception, this is error code.
|
||||
* On hw interrupt, it's IRQ number:
|
||||
*/
|
||||
#define ORIG_RAX 120
|
||||
/* Return frame for iretq */
|
||||
#define RIP 128
|
||||
#define CS 136
|
||||
#define EFLAGS 144
|
||||
#define RSP 152
|
||||
#define SS 160
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/* top of stack page */
|
||||
#define FRAME_SIZE 168
|
||||
|
||||
#endif /* !__i386__ */
|
||||
|
||||
/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
|
||||
#define PTRACE_GETREGS 12
|
||||
#define PTRACE_SETREGS 13
|
||||
#define PTRACE_GETFPREGS 14
|
||||
#define PTRACE_SETFPREGS 15
|
||||
#define PTRACE_GETFPXREGS 18
|
||||
#define PTRACE_SETFPXREGS 19
|
||||
|
||||
#define PTRACE_OLDSETOPTIONS 21
|
||||
|
||||
/* only useful for access 32bit programs / kernels */
|
||||
#define PTRACE_GET_THREAD_AREA 25
|
||||
#define PTRACE_SET_THREAD_AREA 26
|
||||
|
||||
#ifdef __x86_64__
|
||||
# define PTRACE_ARCH_PRCTL 30
|
||||
#endif
|
||||
|
||||
#define PTRACE_SYSEMU 31
|
||||
#define PTRACE_SYSEMU_SINGLESTEP 32
|
||||
|
||||
#define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_X86_PTRACE_ABI_H */
|
@@ -1,262 +1,85 @@
|
||||
#ifndef _ASM_X86_PTRACE_H
|
||||
#define _ASM_X86_PTRACE_H
|
||||
#ifndef _UAPI_ASM_X86_PTRACE_H
|
||||
#define _UAPI_ASM_X86_PTRACE_H
|
||||
|
||||
#include <linux/compiler.h> /* For __user */
|
||||
#include <asm/ptrace-abi.h>
|
||||
#include <asm/processor-flags.h>
|
||||
|
||||
#include <asm/segment.h>
|
||||
#include <asm/page_types.h>
|
||||
#include <uapi/asm/ptrace.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#ifdef __i386__
|
||||
/* this struct defines the way the registers are stored on the
|
||||
stack during a system call. */
|
||||
|
||||
#ifndef __KERNEL__
|
||||
|
||||
struct pt_regs {
|
||||
unsigned long bx;
|
||||
unsigned long cx;
|
||||
unsigned long dx;
|
||||
unsigned long si;
|
||||
unsigned long di;
|
||||
unsigned long bp;
|
||||
unsigned long ax;
|
||||
unsigned long ds;
|
||||
unsigned long es;
|
||||
unsigned long fs;
|
||||
unsigned long gs;
|
||||
unsigned long orig_ax;
|
||||
unsigned long ip;
|
||||
unsigned long cs;
|
||||
unsigned long flags;
|
||||
unsigned long sp;
|
||||
unsigned long ss;
|
||||
long ebx;
|
||||
long ecx;
|
||||
long edx;
|
||||
long esi;
|
||||
long edi;
|
||||
long ebp;
|
||||
long eax;
|
||||
int xds;
|
||||
int xes;
|
||||
int xfs;
|
||||
int xgs;
|
||||
long orig_eax;
|
||||
long eip;
|
||||
int xcs;
|
||||
long eflags;
|
||||
long esp;
|
||||
int xss;
|
||||
};
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#else /* __i386__ */
|
||||
|
||||
#ifndef __KERNEL__
|
||||
|
||||
struct pt_regs {
|
||||
/*
|
||||
* C ABI says these regs are callee-preserved. They aren't saved on kernel entry
|
||||
* unless syscall needs a complete, fully filled "struct pt_regs".
|
||||
*/
|
||||
unsigned long r15;
|
||||
unsigned long r14;
|
||||
unsigned long r13;
|
||||
unsigned long r12;
|
||||
unsigned long bp;
|
||||
unsigned long bx;
|
||||
/* arguments: non interrupts/non tracing syscalls only save up to here*/
|
||||
unsigned long rbp;
|
||||
unsigned long rbx;
|
||||
/* These regs are callee-clobbered. Always saved on kernel entry. */
|
||||
unsigned long r11;
|
||||
unsigned long r10;
|
||||
unsigned long r9;
|
||||
unsigned long r8;
|
||||
unsigned long ax;
|
||||
unsigned long cx;
|
||||
unsigned long dx;
|
||||
unsigned long si;
|
||||
unsigned long di;
|
||||
unsigned long orig_ax;
|
||||
/* end of arguments */
|
||||
/* cpu exception frame or undefined */
|
||||
unsigned long ip;
|
||||
unsigned long rax;
|
||||
unsigned long rcx;
|
||||
unsigned long rdx;
|
||||
unsigned long rsi;
|
||||
unsigned long rdi;
|
||||
/*
|
||||
* On syscall entry, this is syscall#. On CPU exception, this is error code.
|
||||
* On hw interrupt, it's IRQ number:
|
||||
*/
|
||||
unsigned long orig_rax;
|
||||
/* Return frame for iretq */
|
||||
unsigned long rip;
|
||||
unsigned long cs;
|
||||
unsigned long flags;
|
||||
unsigned long sp;
|
||||
unsigned long eflags;
|
||||
unsigned long rsp;
|
||||
unsigned long ss;
|
||||
/* top of stack page */
|
||||
};
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* !__i386__ */
|
||||
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
#include <asm/paravirt_types.h>
|
||||
#endif
|
||||
|
||||
struct cpuinfo_x86;
|
||||
struct task_struct;
|
||||
|
||||
extern unsigned long profile_pc(struct pt_regs *regs);
|
||||
#define profile_pc profile_pc
|
||||
|
||||
extern unsigned long
|
||||
convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
|
||||
extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
|
||||
int error_code, int si_code);
|
||||
|
||||
|
||||
extern unsigned long syscall_trace_enter_phase1(struct pt_regs *, u32 arch);
|
||||
extern long syscall_trace_enter_phase2(struct pt_regs *, u32 arch,
|
||||
unsigned long phase1_result);
|
||||
|
||||
extern long syscall_trace_enter(struct pt_regs *);
|
||||
extern void syscall_trace_leave(struct pt_regs *);
|
||||
|
||||
static inline unsigned long regs_return_value(struct pt_regs *regs)
|
||||
{
|
||||
return regs->ax;
|
||||
}
|
||||
|
||||
/*
|
||||
* user_mode_vm(regs) determines whether a register set came from user mode.
|
||||
* This is true if V8086 mode was enabled OR if the register set was from
|
||||
* protected mode with RPL-3 CS value. This tricky test checks that with
|
||||
* one comparison. Many places in the kernel can bypass this full check
|
||||
* if they have already ruled out V8086 mode, so user_mode(regs) can be used.
|
||||
*/
|
||||
static inline int user_mode(struct pt_regs *regs)
|
||||
{
|
||||
#ifdef CONFIG_X86_32
|
||||
return (regs->cs & SEGMENT_RPL_MASK) == USER_RPL;
|
||||
#else
|
||||
return !!(regs->cs & 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int user_mode_vm(struct pt_regs *regs)
|
||||
{
|
||||
#ifdef CONFIG_X86_32
|
||||
return ((regs->cs & SEGMENT_RPL_MASK) | (regs->flags & X86_VM_MASK)) >=
|
||||
USER_RPL;
|
||||
#else
|
||||
return user_mode(regs);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int v8086_mode(struct pt_regs *regs)
|
||||
{
|
||||
#ifdef CONFIG_X86_32
|
||||
return (regs->flags & X86_VM_MASK);
|
||||
#else
|
||||
return 0; /* No V86 mode support in long mode */
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
static inline bool user_64bit_mode(struct pt_regs *regs)
|
||||
{
|
||||
#ifndef CONFIG_PARAVIRT
|
||||
/*
|
||||
* On non-paravirt systems, this is the only long mode CPL 3
|
||||
* selector. We do not allow long mode selectors in the LDT.
|
||||
*/
|
||||
return regs->cs == __USER_CS;
|
||||
#else
|
||||
/* Headers are too twisted for this to go in paravirt.h. */
|
||||
return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define current_user_stack_pointer() this_cpu_read(old_rsp)
|
||||
/* ia32 vs. x32 difference */
|
||||
#define compat_user_stack_pointer() \
|
||||
(test_thread_flag(TIF_IA32) \
|
||||
? current_pt_regs()->sp \
|
||||
: this_cpu_read(old_rsp))
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
extern unsigned long kernel_stack_pointer(struct pt_regs *regs);
|
||||
#else
|
||||
static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
|
||||
{
|
||||
return regs->sp;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define GET_IP(regs) ((regs)->ip)
|
||||
#define GET_FP(regs) ((regs)->bp)
|
||||
#define GET_USP(regs) ((regs)->sp)
|
||||
|
||||
#include <asm-generic/ptrace.h>
|
||||
|
||||
/* Query offset/name of register from its name/offset */
|
||||
extern int regs_query_register_offset(const char *name);
|
||||
extern const char *regs_query_register_name(unsigned int offset);
|
||||
#define MAX_REG_OFFSET (offsetof(struct pt_regs, ss))
|
||||
|
||||
/**
|
||||
* regs_get_register() - get register value from its offset
|
||||
* @regs: pt_regs from which register value is gotten.
|
||||
* @offset: offset number of the register.
|
||||
*
|
||||
* regs_get_register returns the value of a register. The @offset is the
|
||||
* offset of the register in struct pt_regs address which specified by @regs.
|
||||
* If @offset is bigger than MAX_REG_OFFSET, this returns 0.
|
||||
*/
|
||||
static inline unsigned long regs_get_register(struct pt_regs *regs,
|
||||
unsigned int offset)
|
||||
{
|
||||
if (unlikely(offset > MAX_REG_OFFSET))
|
||||
return 0;
|
||||
#ifdef CONFIG_X86_32
|
||||
/*
|
||||
* Traps from the kernel do not save sp and ss.
|
||||
* Use the helper function to retrieve sp.
|
||||
*/
|
||||
if (offset == offsetof(struct pt_regs, sp) &&
|
||||
regs->cs == __KERNEL_CS)
|
||||
return kernel_stack_pointer(regs);
|
||||
#endif
|
||||
return *(unsigned long *)((unsigned long)regs + offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* regs_within_kernel_stack() - check the address in the stack
|
||||
* @regs: pt_regs which contains kernel stack pointer.
|
||||
* @addr: address which is checked.
|
||||
*
|
||||
* regs_within_kernel_stack() checks @addr is within the kernel stack page(s).
|
||||
* If @addr is within the kernel stack, it returns true. If not, returns false.
|
||||
*/
|
||||
static inline int regs_within_kernel_stack(struct pt_regs *regs,
|
||||
unsigned long addr)
|
||||
{
|
||||
return ((addr & ~(THREAD_SIZE - 1)) ==
|
||||
(kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* regs_get_kernel_stack_nth() - get Nth entry of the stack
|
||||
* @regs: pt_regs which contains kernel stack pointer.
|
||||
* @n: stack entry number.
|
||||
*
|
||||
* regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
|
||||
* is specified by @regs. If the @n th entry is NOT in the kernel stack,
|
||||
* this returns 0.
|
||||
*/
|
||||
static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
|
||||
unsigned int n)
|
||||
{
|
||||
unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
|
||||
addr += n;
|
||||
if (regs_within_kernel_stack(regs, (unsigned long)addr))
|
||||
return *addr;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define arch_has_single_step() (1)
|
||||
#ifdef CONFIG_X86_DEBUGCTLMSR
|
||||
#define arch_has_block_step() (1)
|
||||
#else
|
||||
#define arch_has_block_step() (boot_cpu_data.x86 >= 6)
|
||||
#endif
|
||||
|
||||
#define ARCH_HAS_USER_SINGLE_STEP_INFO
|
||||
|
||||
/*
|
||||
* When hitting ptrace_stop(), we cannot return using SYSRET because
|
||||
* that does not restore the full CPU state, only a minimal set. The
|
||||
* ptracer can change arbitrary register values, which is usually okay
|
||||
* because the usual ptrace stops run off the signal delivery path which
|
||||
* forces IRET; however, ptrace_event() stops happen in arbitrary places
|
||||
* in the kernel and don't force IRET path.
|
||||
*
|
||||
* So force IRET path after a ptrace stop.
|
||||
*/
|
||||
#define arch_ptrace_stop_needed(code, info) \
|
||||
({ \
|
||||
set_thread_flag(TIF_NOTIFY_RESUME); \
|
||||
false; \
|
||||
})
|
||||
|
||||
struct user_desc;
|
||||
extern int do_get_thread_area(struct task_struct *p, int idx,
|
||||
struct user_desc __user *info);
|
||||
extern int do_set_thread_area(struct task_struct *p, int idx,
|
||||
struct user_desc __user *info, int can_allocate);
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* _ASM_X86_PTRACE_H */
|
||||
|
||||
#endif /* _UAPI_ASM_X86_PTRACE_H */
|
||||
|
@@ -1,221 +1,360 @@
|
||||
#ifndef _UAPI_ASM_X86_SIGCONTEXT_H
|
||||
#define _UAPI_ASM_X86_SIGCONTEXT_H
|
||||
|
||||
/*
|
||||
* Linux signal context definitions. The sigcontext includes a complex
|
||||
* hierarchy of CPU and FPU state, available to user-space (on the stack) when
|
||||
* a signal handler is executed.
|
||||
*
|
||||
* As over the years this ABI grew from its very simple roots towards
|
||||
* supporting more and more CPU state organically, some of the details (which
|
||||
* were rather clever hacks back in the days) became a bit quirky by today.
|
||||
*
|
||||
* The current ABI includes flexible provisions for future extensions, so we
|
||||
* won't have to grow new quirks for quite some time. Promise!
|
||||
*/
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define FP_XSTATE_MAGIC1 0x46505853U
|
||||
#define FP_XSTATE_MAGIC2 0x46505845U
|
||||
#define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
|
||||
#define FP_XSTATE_MAGIC1 0x46505853U
|
||||
#define FP_XSTATE_MAGIC2 0x46505845U
|
||||
#define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
|
||||
|
||||
/*
|
||||
* bytes 464..511 in the current 512byte layout of fxsave/fxrstor frame
|
||||
* are reserved for SW usage. On cpu's supporting xsave/xrstor, these bytes
|
||||
* are used to extended the fpstate pointer in the sigcontext, which now
|
||||
* includes the extended state information along with fpstate information.
|
||||
* Bytes 464..511 in the current 512-byte layout of the FXSAVE/FXRSTOR frame
|
||||
* are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes are
|
||||
* used to extend the fpstate pointer in the sigcontext, which now includes the
|
||||
* extended state information along with fpstate information.
|
||||
*
|
||||
* Presence of FP_XSTATE_MAGIC1 at the beginning of this SW reserved
|
||||
* area and FP_XSTATE_MAGIC2 at the end of memory layout
|
||||
* (extended_size - FP_XSTATE_MAGIC2_SIZE) indicates the presence of the
|
||||
* extended state information in the memory layout pointed by the fpstate
|
||||
* pointer in sigcontext.
|
||||
* If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a
|
||||
* sw_reserved.extended_size bytes large extended context area present. (The
|
||||
* last 32-bit word of this extended area (at the
|
||||
* fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to
|
||||
* FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.)
|
||||
*
|
||||
* This extended area typically grows with newer CPUs that have larger and
|
||||
* larger XSAVE areas.
|
||||
*/
|
||||
struct _fpx_sw_bytes {
|
||||
__u32 magic1; /* FP_XSTATE_MAGIC1 */
|
||||
__u32 extended_size; /* total size of the layout referred by
|
||||
* fpstate pointer in the sigcontext.
|
||||
*/
|
||||
__u64 xstate_bv;
|
||||
/* feature bit mask (including fp/sse/extended
|
||||
* state) that is present in the memory
|
||||
* layout.
|
||||
*/
|
||||
__u32 xstate_size; /* actual xsave state size, based on the
|
||||
* features saved in the layout.
|
||||
* 'extended_size' will be greater than
|
||||
* 'xstate_size'.
|
||||
*/
|
||||
__u32 padding[7]; /* for future use. */
|
||||
/*
|
||||
* If set to FP_XSTATE_MAGIC1 then this is an xstate context.
|
||||
* 0 if a legacy frame.
|
||||
*/
|
||||
__u32 magic1;
|
||||
|
||||
/*
|
||||
* Total size of the fpstate area:
|
||||
*
|
||||
* - if magic1 == 0 then it's sizeof(struct _fpstate)
|
||||
* - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate)
|
||||
* plus extensions (if any)
|
||||
*/
|
||||
__u32 extended_size;
|
||||
|
||||
/*
|
||||
* Feature bit mask (including FP/SSE/extended state) that is present
|
||||
* in the memory layout:
|
||||
*/
|
||||
__u64 xfeatures;
|
||||
|
||||
/*
|
||||
* Actual XSAVE state size, based on the xfeatures saved in the layout.
|
||||
* 'extended_size' is greater than 'xstate_size':
|
||||
*/
|
||||
__u32 xstate_size;
|
||||
|
||||
/* For future use: */
|
||||
__u32 padding[7];
|
||||
};
|
||||
|
||||
/*
|
||||
* As documented in the iBCS2 standard:
|
||||
*
|
||||
* The first part of "struct _fpstate" is just the normal i387 hardware setup,
|
||||
* the extra "status" word is used to save the coprocessor status word before
|
||||
* entering the handler.
|
||||
*
|
||||
* The FPU state data structure has had to grow to accommodate the extended FPU
|
||||
* state required by the Streaming SIMD Extensions. There is no documented
|
||||
* standard to accomplish this at the moment.
|
||||
*/
|
||||
|
||||
/* 10-byte legacy floating point register: */
|
||||
struct _fpreg {
|
||||
__u16 significand[4];
|
||||
__u16 exponent;
|
||||
};
|
||||
|
||||
/* 16-byte floating point register: */
|
||||
struct _fpxreg {
|
||||
__u16 significand[4];
|
||||
__u16 exponent;
|
||||
__u16 padding[3];
|
||||
};
|
||||
|
||||
/* 16-byte XMM register: */
|
||||
struct _xmmreg {
|
||||
__u32 element[4];
|
||||
};
|
||||
|
||||
#define X86_FXSR_MAGIC 0x0000
|
||||
|
||||
/*
|
||||
* The 32-bit FPU frame:
|
||||
*/
|
||||
struct _fpstate_32 {
|
||||
/* Legacy FPU environment: */
|
||||
__u32 cw;
|
||||
__u32 sw;
|
||||
__u32 tag;
|
||||
__u32 ipoff;
|
||||
__u32 cssel;
|
||||
__u32 dataoff;
|
||||
__u32 datasel;
|
||||
struct _fpreg _st[8];
|
||||
__u16 status;
|
||||
__u16 magic; /* 0xffff: regular FPU data only */
|
||||
/* 0x0000: FXSR FPU data */
|
||||
|
||||
/* FXSR FPU environment */
|
||||
__u32 _fxsr_env[6]; /* FXSR FPU env is ignored */
|
||||
__u32 mxcsr;
|
||||
__u32 reserved;
|
||||
struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
|
||||
struct _xmmreg _xmm[8]; /* First 8 XMM registers */
|
||||
union {
|
||||
__u32 padding1[44]; /* Second 8 XMM registers plus padding */
|
||||
__u32 padding[44]; /* Alias name for old user-space */
|
||||
};
|
||||
|
||||
union {
|
||||
__u32 padding2[12];
|
||||
struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* The 64-bit FPU frame. (FXSAVE format and later)
|
||||
*
|
||||
* Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is
|
||||
* larger: 'struct _xstate'. Note that 'struct _xstate' embedds
|
||||
* 'struct _fpstate' so that you can always assume the _fpstate portion
|
||||
* exists so that you can check the magic value.
|
||||
*
|
||||
* Note2: Reserved fields may someday contain valuable data. Always
|
||||
* save/restore them when you change signal frames.
|
||||
*/
|
||||
struct _fpstate_64 {
|
||||
__u16 cwd;
|
||||
__u16 swd;
|
||||
/* Note this is not the same as the 32-bit/x87/FSAVE twd: */
|
||||
__u16 twd;
|
||||
__u16 fop;
|
||||
__u64 rip;
|
||||
__u64 rdp;
|
||||
__u32 mxcsr;
|
||||
__u32 mxcsr_mask;
|
||||
__u32 st_space[32]; /* 8x FP registers, 16 bytes each */
|
||||
__u32 xmm_space[64]; /* 16x XMM registers, 16 bytes each */
|
||||
__u32 reserved2[12];
|
||||
union {
|
||||
__u32 reserved3[12];
|
||||
struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef __i386__
|
||||
/*
|
||||
* As documented in the iBCS2 standard..
|
||||
*
|
||||
* The first part of "struct _fpstate" is just the normal i387
|
||||
* hardware setup, the extra "status" word is used to save the
|
||||
* coprocessor status word before entering the handler.
|
||||
*
|
||||
* Pentium III FXSR, SSE support
|
||||
* Gareth Hughes <gareth@valinux.com>, May 2000
|
||||
*
|
||||
* The FPU state data structure has had to grow to accommodate the
|
||||
* extended FPU state required by the Streaming SIMD Extensions.
|
||||
* There is no documented standard to accomplish this at the moment.
|
||||
*/
|
||||
struct _fpreg {
|
||||
unsigned short significand[4];
|
||||
unsigned short exponent;
|
||||
};
|
||||
|
||||
struct _fpxreg {
|
||||
unsigned short significand[4];
|
||||
unsigned short exponent;
|
||||
unsigned short padding[3];
|
||||
};
|
||||
|
||||
struct _xmmreg {
|
||||
unsigned long element[4];
|
||||
};
|
||||
|
||||
struct _fpstate {
|
||||
/* Regular FPU environment */
|
||||
unsigned long cw;
|
||||
unsigned long sw;
|
||||
unsigned long tag;
|
||||
unsigned long ipoff;
|
||||
unsigned long cssel;
|
||||
unsigned long dataoff;
|
||||
unsigned long datasel;
|
||||
struct _fpreg _st[8];
|
||||
unsigned short status;
|
||||
unsigned short magic; /* 0xffff = regular FPU data only */
|
||||
|
||||
/* FXSR FPU environment */
|
||||
unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
|
||||
unsigned long mxcsr;
|
||||
unsigned long reserved;
|
||||
struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
|
||||
struct _xmmreg _xmm[8];
|
||||
unsigned long padding1[44];
|
||||
|
||||
union {
|
||||
unsigned long padding2[12];
|
||||
struct _fpx_sw_bytes sw_reserved; /* represents the extended
|
||||
* state info */
|
||||
};
|
||||
};
|
||||
|
||||
#define X86_FXSR_MAGIC 0x0000
|
||||
|
||||
#ifndef __KERNEL__
|
||||
/*
|
||||
* User-space might still rely on the old definition:
|
||||
*/
|
||||
struct sigcontext {
|
||||
unsigned short gs, __gsh;
|
||||
unsigned short fs, __fsh;
|
||||
unsigned short es, __esh;
|
||||
unsigned short ds, __dsh;
|
||||
unsigned long edi;
|
||||
unsigned long esi;
|
||||
unsigned long ebp;
|
||||
unsigned long esp;
|
||||
unsigned long ebx;
|
||||
unsigned long edx;
|
||||
unsigned long ecx;
|
||||
unsigned long eax;
|
||||
unsigned long trapno;
|
||||
unsigned long err;
|
||||
unsigned long eip;
|
||||
unsigned short cs, __csh;
|
||||
unsigned long eflags;
|
||||
unsigned long esp_at_signal;
|
||||
unsigned short ss, __ssh;
|
||||
struct _fpstate __user *fpstate;
|
||||
unsigned long oldmask;
|
||||
unsigned long cr2;
|
||||
};
|
||||
#endif /* !__KERNEL__ */
|
||||
|
||||
#else /* __i386__ */
|
||||
|
||||
/* FXSAVE frame */
|
||||
/* Note: reserved1/2 may someday contain valuable data. Always save/restore
|
||||
them when you change signal frames. */
|
||||
struct _fpstate {
|
||||
__u16 cwd;
|
||||
__u16 swd;
|
||||
__u16 twd; /* Note this is not the same as the
|
||||
32bit/x87/FSAVE twd */
|
||||
__u16 fop;
|
||||
__u64 rip;
|
||||
__u64 rdp;
|
||||
__u32 mxcsr;
|
||||
__u32 mxcsr_mask;
|
||||
__u32 st_space[32]; /* 8*16 bytes for each FP-reg */
|
||||
__u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */
|
||||
__u32 reserved2[12];
|
||||
union {
|
||||
__u32 reserved3[12];
|
||||
struct _fpx_sw_bytes sw_reserved; /* represents the extended
|
||||
* state information */
|
||||
};
|
||||
};
|
||||
|
||||
#ifndef __KERNEL__
|
||||
/*
|
||||
* User-space might still rely on the old definition:
|
||||
*/
|
||||
struct sigcontext {
|
||||
__u64 r8;
|
||||
__u64 r9;
|
||||
__u64 r10;
|
||||
__u64 r11;
|
||||
__u64 r12;
|
||||
__u64 r13;
|
||||
__u64 r14;
|
||||
__u64 r15;
|
||||
__u64 rdi;
|
||||
__u64 rsi;
|
||||
__u64 rbp;
|
||||
__u64 rbx;
|
||||
__u64 rdx;
|
||||
__u64 rax;
|
||||
__u64 rcx;
|
||||
__u64 rsp;
|
||||
__u64 rip;
|
||||
__u64 eflags; /* RFLAGS */
|
||||
__u16 cs;
|
||||
__u16 gs;
|
||||
__u16 fs;
|
||||
__u16 __pad0;
|
||||
__u64 err;
|
||||
__u64 trapno;
|
||||
__u64 oldmask;
|
||||
__u64 cr2;
|
||||
struct _fpstate __user *fpstate; /* zero when no FPU context */
|
||||
#ifdef __ILP32__
|
||||
__u32 __fpstate_pad;
|
||||
# define _fpstate _fpstate_32
|
||||
#else
|
||||
# define _fpstate _fpstate_64
|
||||
#endif
|
||||
__u64 reserved1[8];
|
||||
};
|
||||
#endif /* !__KERNEL__ */
|
||||
|
||||
#endif /* !__i386__ */
|
||||
|
||||
struct _xsave_hdr {
|
||||
__u64 xstate_bv;
|
||||
__u64 reserved1[2];
|
||||
__u64 reserved2[5];
|
||||
struct _header {
|
||||
__u64 xfeatures;
|
||||
__u64 reserved1[2];
|
||||
__u64 reserved2[5];
|
||||
};
|
||||
|
||||
struct _ymmh_state {
|
||||
/* 16 * 16 bytes for each YMMH-reg */
|
||||
__u32 ymmh_space[64];
|
||||
/* 16x YMM registers, 16 bytes each: */
|
||||
__u32 ymmh_space[64];
|
||||
};
|
||||
|
||||
/*
|
||||
* Extended state pointed by the fpstate pointer in the sigcontext.
|
||||
* In addition to the fpstate, information encoded in the xstate_hdr
|
||||
* indicates the presence of other extended state information
|
||||
* supported by the processor and OS.
|
||||
* Extended state pointed to by sigcontext::fpstate.
|
||||
*
|
||||
* In addition to the fpstate, information encoded in _xstate::xstate_hdr
|
||||
* indicates the presence of other extended state information supported
|
||||
* by the CPU and kernel:
|
||||
*/
|
||||
struct _xstate {
|
||||
struct _fpstate fpstate;
|
||||
struct _xsave_hdr xstate_hdr;
|
||||
struct _ymmh_state ymmh;
|
||||
/* new processor state extensions go here */
|
||||
struct _fpstate fpstate;
|
||||
struct _header xstate_hdr;
|
||||
struct _ymmh_state ymmh;
|
||||
/* New processor state extensions go here: */
|
||||
};
|
||||
|
||||
/*
|
||||
* The 32-bit signal frame:
|
||||
*/
|
||||
struct sigcontext_32 {
|
||||
__u16 gs, __gsh;
|
||||
__u16 fs, __fsh;
|
||||
__u16 es, __esh;
|
||||
__u16 ds, __dsh;
|
||||
__u32 di;
|
||||
__u32 si;
|
||||
__u32 bp;
|
||||
__u32 sp;
|
||||
__u32 bx;
|
||||
__u32 dx;
|
||||
__u32 cx;
|
||||
__u32 ax;
|
||||
__u32 trapno;
|
||||
__u32 err;
|
||||
__u32 ip;
|
||||
__u16 cs, __csh;
|
||||
__u32 flags;
|
||||
__u32 sp_at_signal;
|
||||
__u16 ss, __ssh;
|
||||
|
||||
/*
|
||||
* fpstate is really (struct _fpstate *) or (struct _xstate *)
|
||||
* depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
|
||||
* bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
|
||||
* of extended memory layout. See comments at the definition of
|
||||
* (struct _fpx_sw_bytes)
|
||||
*/
|
||||
__u32 fpstate; /* Zero when no FPU/extended context */
|
||||
__u32 oldmask;
|
||||
__u32 cr2;
|
||||
};
|
||||
|
||||
/*
|
||||
* The 64-bit signal frame:
|
||||
*/
|
||||
struct sigcontext_64 {
|
||||
__u64 r8;
|
||||
__u64 r9;
|
||||
__u64 r10;
|
||||
__u64 r11;
|
||||
__u64 r12;
|
||||
__u64 r13;
|
||||
__u64 r14;
|
||||
__u64 r15;
|
||||
__u64 di;
|
||||
__u64 si;
|
||||
__u64 bp;
|
||||
__u64 bx;
|
||||
__u64 dx;
|
||||
__u64 ax;
|
||||
__u64 cx;
|
||||
__u64 sp;
|
||||
__u64 ip;
|
||||
__u64 flags;
|
||||
__u16 cs;
|
||||
__u16 gs;
|
||||
__u16 fs;
|
||||
__u16 __pad0;
|
||||
__u64 err;
|
||||
__u64 trapno;
|
||||
__u64 oldmask;
|
||||
__u64 cr2;
|
||||
|
||||
/*
|
||||
* fpstate is really (struct _fpstate *) or (struct _xstate *)
|
||||
* depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
|
||||
* bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
|
||||
* of extended memory layout. See comments at the definition of
|
||||
* (struct _fpx_sw_bytes)
|
||||
*/
|
||||
__u64 fpstate; /* Zero when no FPU/extended context */
|
||||
__u64 reserved1[8];
|
||||
};
|
||||
|
||||
/*
|
||||
* Create the real 'struct sigcontext' type:
|
||||
*/
|
||||
#ifdef __KERNEL__
|
||||
# ifdef __i386__
|
||||
# define sigcontext sigcontext_32
|
||||
# else
|
||||
# define sigcontext sigcontext_64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The old user-space sigcontext definition, just in case user-space still
|
||||
* relies on it. The kernel definition (in asm/sigcontext.h) has unified
|
||||
* field names but otherwise the same layout.
|
||||
*/
|
||||
#ifndef __KERNEL__
|
||||
|
||||
#define _fpstate_ia32 _fpstate_32
|
||||
#define sigcontext_ia32 sigcontext_32
|
||||
|
||||
|
||||
# ifdef __i386__
|
||||
struct sigcontext {
|
||||
__u16 gs, __gsh;
|
||||
__u16 fs, __fsh;
|
||||
__u16 es, __esh;
|
||||
__u16 ds, __dsh;
|
||||
__u32 edi;
|
||||
__u32 esi;
|
||||
__u32 ebp;
|
||||
__u32 esp;
|
||||
__u32 ebx;
|
||||
__u32 edx;
|
||||
__u32 ecx;
|
||||
__u32 eax;
|
||||
__u32 trapno;
|
||||
__u32 err;
|
||||
__u32 eip;
|
||||
__u16 cs, __csh;
|
||||
__u32 eflags;
|
||||
__u32 esp_at_signal;
|
||||
__u16 ss, __ssh;
|
||||
struct _fpstate __user *fpstate;
|
||||
__u32 oldmask;
|
||||
__u32 cr2;
|
||||
};
|
||||
# else /* __x86_64__: */
|
||||
struct sigcontext {
|
||||
__u64 r8;
|
||||
__u64 r9;
|
||||
__u64 r10;
|
||||
__u64 r11;
|
||||
__u64 r12;
|
||||
__u64 r13;
|
||||
__u64 r14;
|
||||
__u64 r15;
|
||||
__u64 rdi;
|
||||
__u64 rsi;
|
||||
__u64 rbp;
|
||||
__u64 rbx;
|
||||
__u64 rdx;
|
||||
__u64 rax;
|
||||
__u64 rcx;
|
||||
__u64 rsp;
|
||||
__u64 rip;
|
||||
__u64 eflags; /* RFLAGS */
|
||||
__u16 cs;
|
||||
__u16 gs;
|
||||
__u16 fs;
|
||||
__u16 __pad0;
|
||||
__u64 err;
|
||||
__u64 trapno;
|
||||
__u64 oldmask;
|
||||
__u64 cr2;
|
||||
struct _fpstate __user *fpstate; /* Zero when no FPU context */
|
||||
# ifdef __ILP32__
|
||||
__u32 __fpstate_pad;
|
||||
# endif
|
||||
__u64 reserved1[8];
|
||||
};
|
||||
# endif /* __x86_64__ */
|
||||
#endif /* !__KERNEL__ */
|
||||
|
||||
#endif /* _UAPI_ASM_X86_SIGCONTEXT_H */
|
||||
|
Reference in New Issue
Block a user