]> Joshua Wise's Git repositories - netwatch.git/blame - include/state.h
More ICH2-specific code diked out.
[netwatch.git] / include / state.h
CommitLineData
db9fad13
JAW
1/* state.h
2 * Definitions for SMM saved-state manipulation functions.
3 * NetWatch system management mode administration console
4 *
5 * Copyright 2009, Google Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following disclaimer
16 * in the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Google Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef __STATE_H
36#define __STATE_H
37
38#include <stdint.h>
39
40enum state_reg_t {
41 /* Common registers */
42 STATE_REV,
43 STATE_REG_SMBASE,
44 STATE_REG_IORESTART,
45 STATE_REG_HALTRESTART,
46
47 /* 32-bit registers (still available in 64-bit mode) */
48 STATE_REG_EAX,
49 STATE_REG_EBX,
50 STATE_REG_ECX,
51 STATE_REG_EDX,
52 STATE_REG_ESI,
53 STATE_REG_EDI,
54 STATE_REG_ESP,
55 STATE_REG_EBP,
56 STATE_REG_EIP,
57 STATE_REG_EFLAGS,
58 STATE_REG_CR0,
59 STATE_REG_CR3,
60
61 STATE_REG_CS,
4e3ef36b
JW
62 STATE_REG_CS_ATTRIB,
63 STATE_REG_CS_BASE,
64 STATE_REG_CS_LIMIT,
db9fad13 65 STATE_REG_SS,
4e3ef36b
JW
66 STATE_REG_SS_ATTRIB,
67 STATE_REG_SS_BASE,
68 STATE_REG_SS_LIMIT,
db9fad13 69 STATE_REG_DS,
4e3ef36b
JW
70 STATE_REG_DS_ATTRIB,
71 STATE_REG_DS_BASE,
72 STATE_REG_DS_LIMIT,
db9fad13 73 STATE_REG_ES,
4e3ef36b
JW
74 STATE_REG_ES_ATTRIB,
75 STATE_REG_ES_BASE,
76 STATE_REG_ES_LIMIT,
db9fad13 77 STATE_REG_FS,
4e3ef36b
JW
78 STATE_REG_FS_ATTRIB,
79 STATE_REG_FS_BASE,
80 STATE_REG_FS_LIMIT,
db9fad13 81 STATE_REG_GS,
4e3ef36b
JW
82 STATE_REG_GS_ATTRIB,
83 STATE_REG_GS_BASE,
84 STATE_REG_GS_LIMIT,
85 STATE_REG_IDT_BASE,
86 STATE_REG_IDT_LIMIT,
db9fad13
JAW
87
88 /* 64-bit registers */
89 STATE_REG_RAX,
90 STATE_REG_RBX,
91 STATE_REG_RCX,
92 STATE_REG_RDX,
93 STATE_REG_RSI,
94 STATE_REG_RDI,
95 STATE_REG_RSP,
96 STATE_REG_RBP,
97 STATE_REG_R8,
98 STATE_REG_R9,
99 STATE_REG_R10,
100 STATE_REG_R11,
101 STATE_REG_R12,
102 STATE_REG_R13,
103 STATE_REG_R14,
104 STATE_REG_R15,
4e3ef36b
JW
105 STATE_REG_RIP,
106 STATE_REG_RFLAGS,
107
108 STATE_REG_EFER,
109
110 NUM_REGISTERS
db9fad13
JAW
111};
112
4e3ef36b 113
db9fad13
JAW
114enum smm_type {
115 SMM_TYPE_UNKNOWN,
116 SMM_TYPE_32,
117 SMM_TYPE_64
118};
119
4e3ef36b
JW
120enum smm_type state_get_type(void);
121
db9fad13
JAW
122uint64_t state_get_reg (enum state_reg_t reg);
123int state_reg_size (enum state_reg_t reg);
124int state_set_reg (enum state_reg_t reg, uint64_t value);
3cfffb89 125int state_num_regs();
db9fad13 126
4e3ef36b
JW
127int state_dump_reg(char * dest, int max, enum state_reg_t reg);
128
db9fad13
JAW
129#endif /* __STATE_H */
130
This page took 0.026133 seconds and 4 git commands to generate.