regset.h revision 7af88ac71631ebf259c6c4c22a9f649ddff3e270
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _SYS_REGSET_H
#define _SYS_REGSET_H
#include <sys/feature_tests.h>
#if !defined(_ASM)
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
/*
* The names and offsets defined here should be specified by the
* AMD64 ABI suppl.
*
* We make fsbase and gsbase part of the lwp context (since they're
* the only way to access the full 64-bit address range via the segment
* registers) and thus belong here too. However we treat them as
* read-only; if %fs or %gs are updated, the results of the descriptor
* table lookup that those updates implicitly cause will be reflected
* context can be inspected. However it is NOT possible to override
*
* Direct modification of the base registers (thus overriding the
* descriptor table base address) can be achieved with _lwp_setprivate.
*/
#define REG_GSBASE 27
#define REG_FSBASE 26
#define REG_DS 25
#define REG_ES 24
#define REG_GS 23
#define REG_FS 22
#define REG_SS 21
#define REG_RSP 20
#define REG_RFL 19
#define REG_CS 18
#define REG_RIP 17
#define REG_ERR 16
#define REG_TRAPNO 15
#define REG_RAX 14
#define REG_RCX 13
#define REG_RDX 12
#define REG_RBX 11
#define REG_RBP 10
#define REG_RSI 9
#define REG_RDI 8
#define REG_R8 7
#define REG_R9 6
#define REG_R10 5
#define REG_R11 4
#define REG_R12 3
#define REG_R13 2
#define REG_R14 1
#define REG_R15 0
/*
* The names and offsets defined here are specified by i386 ABI suppl.
*/
#define EFL 16
#define CS 15
#define EIP 14
#define ERR 13
#define TRAPNO 12
#define EAX 11
#define ECX 10
#define EDX 9
#define EBX 8
#define ESP 7
#define EBP 6
#define ESI 5
#define EDI 4
#define DS 3
#define ES 2
#define FS 1
#define GS 0
/* aliases for portability */
#if defined(__amd64)
#else /* __i386 */
#endif /* __i386 */
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
/*
* A gregset_t is defined as an array type for compatibility with the reference
* source. This is important due to differences in the way the C language
* treats arrays and structures as parameters.
*/
#if defined(__amd64)
#define _NGREG 28
#else
#define _NGREG 19
#endif
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#endif
#if !defined(_ASM)
typedef long greg_t;
#else
typedef int greg_t;
#endif
#if defined(_SYSCALL32)
#endif /* _SYSCALL32 */
#if defined(_SYSCALL32)
#define _NGREG32 19
#define _NGREG64 28
#endif /* _SYSCALL32 */
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
/*
* Floating point definitions.
*/
/*
* This structure is written to memory by an 'fnsave' instruction
*/
struct fnsave_state {
union {
} f_st[8];
}; /* 108 bytes */
/*
* This structure is written to memory by an 'fxsave' instruction
* Note the variant behaviour of this instruction between long mode
* and legacy environments!
*/
struct fxsave_state {
#if defined(__amd64)
#else
#endif
union {
} fx_st[8];
#if defined(__amd64)
#else
#endif
}; /* 512 bytes */
/*
* This structure is written to memory by an 'xsave' instruction.
* First 512 byte is compatible with the format of an 'fxsave' area.
*/
struct xsave_state {
struct fxsave_state xs_fxsave;
}; /* 832 bytes, asserted in fpnoextflt() */
#if defined(__amd64)
typedef struct fpu {
union {
struct fpchip_state {
union {
} st[8];
} fpchip_state;
} fp_reg_set;
} fpregset_t;
#else /* __i386 */
/*
* This definition of the floating point structure is binary
* compatible with the Intel386 psABI definition, and source
* compatible with that specification for x87-style floating point.
* possess such hardware capabilities.
*/
typedef struct fpu {
union {
struct fpchip_state {
} fpchip_state;
struct fp_emul_space { /* for emulator(s) */
} fp_reg_set;
} fpregset_t;
/*
* (This structure definition is specified in the i386 ABI supplement)
*/
typedef struct __old_fpu {
union {
struct __old_fpchip_state /* fp extension state */
{
int status; /* status word saved at */
/* exception */
} fpchip_state;
struct __old_fp_emul_space /* for emulator(s) */
{
char fp_emul[246];
char fp_epad[2];
} fp_reg_set;
#endif /* __i386 */
#if defined(_SYSCALL32)
/* Kernel view of user i386 fpu structure */
typedef struct fpu32 {
union {
struct fpchip32_state {
} fpchip_state;
} fp_reg_set;
} fpregset32_t;
#endif /* _SYSCALL32 */
/*
* Kernel's FPU save area
*/
typedef struct {
union _kfpu_u {
struct fxsave_state kfpu_fx;
#if defined(__i386)
struct fnsave_state kfpu_fn;
#endif
struct xsave_state kfpu_xs;
} kfpu_u;
} kfpu_t;
#if defined(__amd64)
#define NDEBUGREG 16
#else
#define NDEBUGREG 8
#endif
typedef struct dbregset {
} dbregset_t;
/*
* Structure mcontext defines the complete hardware machine state.
* (This structure is specified in the i386 ABI suppl.)
*/
typedef struct {
} mcontext_t;
#if defined(_SYSCALL32)
typedef struct {
} mcontext32_t;
#endif /* _SYSCALL32 */
#endif /* _ASM */
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
/*
* The version of privregs.h that is used on implementations that run on
* processors that support the AMD64 instruction set is deliberately not
* imported here.
*
* The amd64 'struct regs' definition may -not- compatible with either
* 32-bit or 64-bit core file contents, nor with the ucontext. As a result,
* the 'regs' structure cannot be used portably by applications, and should
* only be used by the kernel implementation.
*
* The inclusion of the i386 version of privregs.h allows for some limited
* source compatibility with 32-bit applications who expect to use
* 'struct regs' to match the context of a 32-bit core file, or a ucontext_t.
*
* Note that the ucontext_t actually describes the general register in terms
* of the gregset_t data type, as described in this file. Note also
* that the core file content is defined by core(4) in terms of data types
* defined by procfs -- see proc(4).
*/
#if defined(__i386) && \
#include <sys/privregs.h>
#endif /* __i386 (!_KERNEL && !_XPG4_2 || __EXTENSIONS__) */
/*
* The following is here for XPG4.2 standards compliance.
* regset.h is included in ucontext.h for the definition of
* mcontext_t, all of which breaks XPG4.2 namespace.
*/
/*
* The following is here for UNIX 95 compliance (XPG Issue 4, Version 2
* System Interfaces and Headers). The structures included here are identical
* to those visible elsewhere in this header except that the structure
* rules. Specifically, depending on the name and scope, the names have
* been prepended with a single or double underscore (_ or __). See the
* comments describing each of these structures.
*/
#if defined(__amd64)
typedef struct __fpu {
union {
struct __fpchip_state {
union {
} __fx_st[8];
} __fp_reg_set;
} fpregset_t;
#else /* __i386 */
typedef struct __fpu {
union {
struct __fpchip_state {
struct __fp_emul_space { /* for emulator(s) */
} __fp_reg_set;
} fpregset_t;
#endif /* __i386 */
typedef struct {
} mcontext_t;
#endif /* _XPG4_2 && !__EXTENSIONS__ && !_ASM */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_REGSET_H */