privregs.h revision ae115bc77f6fcde83175c75b4206dc2e50747966
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _IA32_SYS_PRIVREGS_H
#define _IA32_SYS_PRIVREGS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file describes the cpu's privileged register set, and
* how the machine state is saved on the stack when a trap occurs.
*/
#if !defined(__i386)
#error "non-i386 code depends on i386 privileged header!"
#endif
#ifndef _ASM
/*
* This is NOT the structure to use for general purpose debugging;
* see /proc for that. This is NOT the structure to use to decode
*/
struct regs {
/*
* Extra frame for mdb to follow through high level interrupts and
* system traps. Set them to 0 to terminate stacktrace.
*/
};
#ifdef _KERNEL
#endif /* _KERNEL */
#else /* !_ASM */
#if defined(_MACHDEP)
#include <sys/machprivregs.h>
/*
* Save current frame on the stack. Uses %eax.
*/
#define __FRAME_PUSH \
/*
* Save segment registers on the stack.
*/
#define __SEGREGS_PUSH \
/*
* Load segment register with kernel selectors.
* %gs must be the last one to be set to make the
* check in cmnint valid.
*/
#define __SEGREGS_LOAD_KERNEL \
/*
* Restore segment registers off the stack.
*
* NOTE THE ORDER IS VITAL!
*
* Also note the subtle interdependency with kern_gpfault()
* that needs to disassemble these instructions to diagnose
* what happened when things (like bad segment register
* values) go horribly wrong.
*/
#define __SEGREGS_POP \
/*
* Macros for saving all registers necessary on interrupt entry,
* and restoring them on exit.
*/
#define INTR_PUSH \
cld; \
pusha; \
je 8f; \
8: CLEAN_CS
#define __INTR_POP \
popa; \
#define INTR_POP_USER \
#define INTR_POP_KERNEL \
/*
* Macros for saving all registers necessary on system call entry,
* and restoring them on exit.
*/
#define SYSCALL_PUSH \
cld; \
pusha; \
pushfl; \
#define SYSENTER_PUSH \
cld; \
pusha; \
#define SYSCALL_POP \
#endif /* _MACHDEP */
/*
* This is used to set eflags to known values at the head of an
* interrupt gate handler, i.e. interrupts are -already- disabled.
*/
#define INTGATE_INIT_KERNEL_FLAGS \
#endif /* !_ASM */
#include <sys/controlregs.h>
/* Control register layout for panic dump */
#define CREGSZ 36
#define CREG_GDT 0
#define CREG_IDT 8
#define CREG_LDT 16
#define CREG_TASKR 18
#define CREG_CR0 20
#define CREG_CR2 24
#define CREG_CR3 28
#define CREG_CR4 32
#if !defined(_ASM) && defined(_INT64_TYPE)
struct cregs {
};
#if defined(_KERNEL)
#endif /* _KERNEL */
#endif /* !_ASM && _INT64_TYPE */
#ifdef __cplusplus
}
#endif
#endif /* !_IA32_SYS_PRIVREGS_H */