xref: /illumos-gate/usr/src/uts/intel/sys/bootregs.h (revision 16b76d3cb933ff92018a2a75594449010192eacb)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_BOOTREGS_H
28 #define	_SYS_BOOTREGS_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #if defined(_KERNEL) || defined(_BOOT)
35 
36 /*
37  *  This structure is used by bootops to save/restore registers when
38  *  transferring between protected and realmode code.
39  *
40  *  NOTE: The following macros require an ANSI compiler!
41  */
42 
43 #define	i8080reg(r) union {  /* 8080-like "general purpose" registers */\
44 	uint32_t e ## r ## x;					\
45 	struct { uint16_t r ## x; } word;				\
46 	struct { uint8_t  r ## l, r ## h; } byte;			\
47 }
48 
49 #define	i8086reg(r) union { /* 16/32-bit "special purpose" registers  */\
50 	uint32_t e ## r;						\
51 	struct { uint16_t r; } word;				\
52 }
53 
54 struct bop_regs {
55 	/*
56 	 *  Machine state structure for realmode <-> protected mode callout
57 	 *  operations:
58 	 */
59 
60 	i8080reg(a) eax;	/* The so-called "general purpose" registers */
61 	i8080reg(d) edx;
62 	i8080reg(c) ecx;
63 	i8080reg(b) ebx;
64 
65 	i8086reg(bp) ebp;	/* 16/32-bit "pointer" registers */
66 	i8086reg(si) esi;
67 	i8086reg(di) edi;
68 
69 	uint16_t ds;	/* Segment registers */
70 	uint16_t es;
71 	uint16_t fs;
72 	uint16_t gs;
73 
74 	uint32_t eflags;
75 };
76 
77 #undef	i8080reg
78 #undef	i8086reg
79 #endif	/* _KERNEL || _BOOT */
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif	/* _SYS_BOOTREGS_H */
86