]>
Commit | Line | Data |
---|---|---|
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 | ||
40 | enum 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, | |
62 | STATE_REG_SS, | |
63 | STATE_REG_DS, | |
64 | STATE_REG_ES, | |
65 | STATE_REG_FS, | |
66 | STATE_REG_GS, | |
67 | ||
68 | /* 64-bit registers */ | |
69 | STATE_REG_RAX, | |
70 | STATE_REG_RBX, | |
71 | STATE_REG_RCX, | |
72 | STATE_REG_RDX, | |
73 | STATE_REG_RSI, | |
74 | STATE_REG_RDI, | |
75 | STATE_REG_RSP, | |
76 | STATE_REG_RBP, | |
77 | STATE_REG_R8, | |
78 | STATE_REG_R9, | |
79 | STATE_REG_R10, | |
80 | STATE_REG_R11, | |
81 | STATE_REG_R12, | |
82 | STATE_REG_R13, | |
83 | STATE_REG_R14, | |
84 | STATE_REG_R15, | |
85 | STATE_REG_RIP | |
86 | }; | |
87 | ||
88 | enum smm_type { | |
89 | SMM_TYPE_UNKNOWN, | |
90 | SMM_TYPE_32, | |
91 | SMM_TYPE_64 | |
92 | }; | |
93 | ||
94 | uint64_t state_get_reg (enum state_reg_t reg); | |
95 | int state_reg_size (enum state_reg_t reg); | |
96 | int state_set_reg (enum state_reg_t reg, uint64_t value); | |
97 | ||
98 | #endif /* __STATE_H */ | |
99 |