github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/include/memory_dump.h (about) 1 /* 2 * Copyright (c) 2013 Intel Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * Unless required by applicable law or agreed to in writing, software 9 * distributed under the License is distributed on an "AS IS" BASIS, 10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 * See the License for the specific language governing permissions and 12 * limitations under the License. 13 */ 14 15 #ifndef _MEMORY_DUMP_H_ 16 #define _MEMORY_DUMP_H_ 17 18 #define OFFSET_EXCEPTION 0x02C0 19 #define OFFSET_GPR 0x0300 20 #define OFFSET_STACK 0x0400 21 #define OFFSET_VMCS 0x0800 22 23 // Number of stack trace entries copied to debug buffer 24 // The buffer has space to save up to 128 entries 25 #define STACK_TRACE_SIZE 48 26 27 // Space in buffer reserved for VMCS 28 #define VMCS_SIZE 2048 29 30 // version log 31 // 1.0 - 1st release 32 // 1.5 - add complete exception info, stack trace to buffer 33 // - change to have data saved in binary format 34 // 1.7 - add support for 80 CPUs 35 #define VERSION "01.7" 36 37 typedef struct _FILE_LINE_INFO { 38 char file_code[4]; 39 char line_number[4]; 40 } FILE_LINE_INFO; 41 42 typedef struct _DEBUG_INFO { 43 char signature[8]; 44 char flags[4]; // debug buffer format flag 45 char cpu_id[4]; // cpu of the first deadloop/assert 46 FILE_LINE_INFO file_line[MAX_CPUS]; // support up to 80 CPUs 47 } DEBUG_INFO; 48 49 typedef struct _EXCEPT_INFO { 50 UINT64 base_address; // uVmm image base address 51 ADDRESS cr2; // page fault address 52 ISR_PARAMETERS_ON_STACK exception_stack; 53 } EXCEPT_INFO; 54 55 typedef struct _DEADLOOP_DUMP { 56 DEBUG_INFO header; 57 EXCEPT_INFO exception; 58 } DEADLOOP_DUMP; 59 60 #pragma PACK_ON 61 62 // only the existing vmcs fields are copied to guest buffer 63 typedef struct _VMCS_ENTRY { 64 UINT16 index; // index to g_field_data 65 UINT64 value; // vmcs value 66 } PACKED VMCS_ENTRY; 67 68 // the vmcs fields are arranged in the order of control, guest, host area 69 typedef struct _VMCS_GROUP { 70 UINT16 count; // number of entries copied to guest 71 VMCS_ENTRY entries; // list of entries 72 } VMCS_GROUP; 73 74 // this is the layout of the 4K guest buffer 75 // the actual starting offsets are defined by the symbolic constants 76 typedef struct _MEMORY_DUMP { 77 DEADLOOP_DUMP deadloop_info; 78 VMM_GP_REGISTERS gp_regs; 79 UINT64 stack[STACK_TRACE_SIZE]; 80 VMCS_GROUP vmcs_groups; // list of groups 81 } MEMORY_DUMP; 82 83 #pragma PACK_OFF 84 85 #define DEADLOOP_SIGNATURE "TMSLASST" 86 87 88 extern UINT64 g_debug_gpa; 89 extern UINT64 g_initial_vmcs[VMM_MAX_CPU_SUPPORTED]; 90 extern UINT64 ept_compute_eptp(GUEST_HANDLE guest, UINT64 ept_root_table_hpa, UINT32 gaw); 91 extern void ept_get_default_ept(GUEST_HANDLE guest, UINT64 *ept_root_table_hpa, UINT32 *ept_gaw); 92 extern BOOLEAN vmcs_sw_shadow_disable[]; 93 94 void vmm_deadloop_internal(UINT32 file_code, UINT32 line_num, GUEST_CPU_HANDLE gcpu); 95 96 #endif // _MEMORY_DUMP_H_