xref: /titanic_41/usr/src/uts/intel/sys/bootregs.h (revision bdb9230ac765cb7af3fc1f4119caf2c5720dceb3)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #if defined(_KERNEL) || defined(_BOOT)
37 
38 /*
39  *  This structure is used by bootops to save/restore registers when
40  *  transferring between protected and realmode code.
41  *
42  *  NOTE: The following macros require an ANSI compiler!
43  */
44 
45 #define	i8080reg(r) union {  /* 8080-like "general purpose" registers */\
46 	uint32_t e ## r ## x;					\
47 	struct { uint16_t r ## x; } word;				\
48 	struct { uint8_t  r ## l, r ## h; } byte;			\
49 }
50 
51 #define	i8086reg(r) union { /* 16/32-bit "special purpose" registers  */\
52 	uint32_t e ## r;						\
53 	struct { uint16_t r; } word;				\
54 }
55 
56 struct bop_regs {
57 	/*
58 	 *  Machine state structure for realmode <-> protected mode callout
59 	 *  operations:
60 	 */
61 
62 	i8080reg(a) eax;	/* The so-called "general purpose" registers */
63 	i8080reg(d) edx;
64 	i8080reg(c) ecx;
65 	i8080reg(b) ebx;
66 
67 	i8086reg(bp) ebp;	/* 16/32-bit "pointer" registers */
68 	i8086reg(si) esi;
69 	i8086reg(di) edi;
70 
71 	uint16_t ds;	/* Segment registers */
72 	uint16_t es;
73 	uint16_t fs;
74 	uint16_t gs;
75 
76 	uint32_t eflags;
77 };
78 
79 #undef	i8080reg
80 #undef	i8086reg
81 #endif	/* _KERNEL || _BOOT */
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif	/* _SYS_BOOTREGS_H */
88