forked from Fraunhofer-AISEC/archie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaultdata.h
126 lines (106 loc) · 3.21 KB
/
faultdata.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#ifndef QEMU_FAULTPLUGIN_DATA
#define QEMU_FAULTPLUGIN_DATA
/*
* Copyright 2021 Florian Andreas Hauschild
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This File contains the headers for functions managing memory dumps
*/
#include <inttypes.h>
#include <stdlib.h>
#include "faultplugin.h"
#include <glib.h>
#include <qemu/qemu-plugin.h>
/**
* init_memory_module()
*
* Initialise the global variables.
* This only makes sure the plugin can deliver a valid response to memory_module_configured
*/
void init_memory_module(void);
/**
* memory_module_configured()
*
* returns 1 if configured otherwise 0
*/
int memory_module_configured(void);
/**
* init_memory
*
* Initialise the global pointer with the number_of_regions amount of structs.
*
* @param number_of_regions: Number of structs to initialise
*/
int init_memory(int number_of_regions);
/**
* delete_memory_dump
*
* Free the complete internal data structure. After this all data is no longer accessible
*/
void delete_memory_dump(void);
/**
* insert_memorydump_config
*
* Initialise one vector element with the memory region, that should be read.
*
* @param baseaddress: Baseaddress of memory region
* @param len: length of memory region in bytes
*/
int insert_memorydump_config(uint64_t baseaddress, uint64_t len);
/**
* read_all_memory
*
* Read all client memory regions defined by user.
*/
void read_all_memory(void);
/**
* read_specific_memoryregion
*
* Read a specific memory region as defined by baseaddress
*
* @param baseaddress: the start location provided by insert_memory_dump_config
*/
void read_specific_memoryregion(uint64_t baseaddress);
/**
* read_memoryregion
*
* Read one client memory region defined by user
*
* @param memorydump_position: select which region should be read in vector element position
*/
int read_memoryregion(uint64_t memorydump_position);
/**
* readout_memorydump_dump
*
* generate the string for data pipe for one memory region dump taken. It then writes each line directly to data pipe.
*
* @param memorydump_position: select which region should be read in vector element
* @param dump_pos: select which data dump should be written to pipe. Multiple can be taken during the execution of the config.
*/
int readout_memorydump_dump(uint64_t memorydump_position, uint64_t dump_pos);
/**
* readout_memorydump
*
* Call read_memorydump_dump for all available dumps inside the struct. All
* dumps are printed to data pipe. Also print config for this memorydump to data pipe
*
*/
int readout_memorydump(uint64_t memorydump_position);
/**
* readout_all_memorydump
*
* This function will send all memorydumps through the data pipe
*/
int readout_all_memorydump(void);
#endif