| 1 |
|
| 2 |
|
| 3 |
#ifndef __AMD64_SAVE_STATE_H__ |
| 4 |
#define __AMD64_SAVE_STATE_H__ |
| 5 |
#endif |
| 6 |
|
| 7 |
#include <types.h> |
| 8 |
#include <cpu/x86/smm.h> |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#define SMM_AMD64_ARCH_OFFSET 0x7e00 |
| 14 |
#define SMM_AMD64_SAVE_STATE_OFFSET \ |
| 15 |
SMM_SAVE_STATE_BEGIN(SMM_AMD64_ARCH_OFFSET) |
| 16 |
typedef struct { |
| 17 |
u16 es_selector; |
| 18 |
u16 es_attributes; |
| 19 |
u32 es_limit; |
| 20 |
u64 es_base; |
| 21 |
|
| 22 |
u16 cs_selector; |
| 23 |
u16 cs_attributcs; |
| 24 |
u32 cs_limit; |
| 25 |
u64 cs_base; |
| 26 |
|
| 27 |
u16 ss_selector; |
| 28 |
u16 ss_attributss; |
| 29 |
u32 ss_limit; |
| 30 |
u64 ss_base; |
| 31 |
|
| 32 |
u16 ds_selector; |
| 33 |
u16 ds_attributds; |
| 34 |
u32 ds_limit; |
| 35 |
u64 ds_base; |
| 36 |
|
| 37 |
u16 fs_selector; |
| 38 |
u16 fs_attributfs; |
| 39 |
u32 fs_limit; |
| 40 |
u64 fs_base; |
| 41 |
|
| 42 |
u16 gs_selector; |
| 43 |
u16 gs_attributgs; |
| 44 |
u32 gs_limit; |
| 45 |
u64 gs_base; |
| 46 |
|
| 47 |
u8 reserved0[4]; |
| 48 |
u16 gdtr_limit; |
| 49 |
u8 reserved1[2]; |
| 50 |
u64 gdtr_base; |
| 51 |
|
| 52 |
u16 ldtr_selector; |
| 53 |
u16 ldtr_attributes; |
| 54 |
u32 ldtr_limit; |
| 55 |
u64 ldtr_base; |
| 56 |
|
| 57 |
u8 reserved2[4]; |
| 58 |
u16 idtr_limit; |
| 59 |
u8 reserved3[2]; |
| 60 |
u64 idtr_base; |
| 61 |
|
| 62 |
u16 tr_selector; |
| 63 |
u16 tr_attributes; |
| 64 |
u32 tr_limit; |
| 65 |
u64 tr_base; |
| 66 |
|
| 67 |
u64 io_restart_rip; |
| 68 |
u64 io_restart_rcx; |
| 69 |
u64 io_restart_rsi; |
| 70 |
u64 io_restart_rdi; |
| 71 |
u32 smm_io_trap_offset; |
| 72 |
u32 local_smi_status; |
| 73 |
|
| 74 |
u8 io_restart; |
| 75 |
u8 autohalt_restart; |
| 76 |
|
| 77 |
u8 reserved5[6]; |
| 78 |
|
| 79 |
u64 efer; |
| 80 |
|
| 81 |
u8 reserved6[36]; |
| 82 |
|
| 83 |
u32 smm_revision; |
| 84 |
u32 smbase; |
| 85 |
|
| 86 |
u8 reserved7[68]; |
| 87 |
|
| 88 |
u64 cr4; |
| 89 |
u64 cr3; |
| 90 |
u64 cr0; |
| 91 |
u64 dr7; |
| 92 |
u64 dr6; |
| 93 |
|
| 94 |
u64 rflags; |
| 95 |
u64 rip; |
| 96 |
u64 r15; |
| 97 |
u64 r14; |
| 98 |
u64 r13; |
| 99 |
u64 r12; |
| 100 |
u64 r11; |
| 101 |
u64 r10; |
| 102 |
u64 r9; |
| 103 |
u64 r8; |
| 104 |
|
| 105 |
u64 rdi; |
| 106 |
u64 rsi; |
| 107 |
u64 rpb; |
| 108 |
u64 rsp; |
| 109 |
u64 rbx; |
| 110 |
u64 rdx; |
| 111 |
u64 rcx; |
| 112 |
u64 rax; |
| 113 |
} __packed amd64_smm_state_save_area_t; |