privregs.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 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.
*/
};
#endif /* !_ASM */
#ifdef _KERNEL
#endif /* _KERNEL */
/*
* 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 \
pusha; \
je 7f; \
7:
#define INTR_POP \
popa; \
#define INTR_POP_USER \
#define INTR_POP_KERNEL \
/*
* Macros for saving the original segment registers and restoring them
* for fast traps.
*/
#define FAST_INTR_PUSH \
#define FAST_INTR_POP \
#define DISABLE_INTR_FLAGS \
#define ENABLE_INTR_FLAGS \
/*
* Macros for saving all registers necessary on system call entry,
* and restoring them on exit.
*/
#define SYSCALL_PUSH \
pusha; \
pushfl; \
#define SYSENTER_PUSH \
pusha; \
#define SYSCALL_POP \
#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 */