blob: 796a16c81daaf077a81273714f5c48a1259c367b (
plain)
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
|
#ifndef __DATABASE_TYPES_H__
#define __DATABASE_TYPES_H__
#include <generic.h>
/** The basic tags that describe the bytes of the database. The tag "CODE_FIRST_BYTE" is
* mainly for multi-bytes instructions, in order to help the UI displaying
* properly the instructions.
*/
enum basic_tags_t {
TAG_UNKNOWN = 0,
TAG_CODE,
TAG_DATA,
TAG_CODE_FIRST_BYTE,
};
/** The 8-bits tag for a byte. The certitude part
* A non-hollow database will be as big (at least) as the input file: in-memory-RLE is probably a good idea.
*/
struct memory_tags_t {
unsigned short basic_tag: 2;
unsigned short crawled: 1;
/** -1..15, 15 being "user hinted", 14 being "external reference" (entry point, exported symbol, ...)
* and -1 means something's fishy with that tag, and that it is probably completely wrong.
* Certitude will grow down with distance from a certain piece of info when the crawler goes away jumping around.
*/
unsigned short certitude: 5;
};
/** An absolute pointer can reference a segment from its ID, and a pointer within the segment.
*/
typedef union {
Uint64 raw_ptr;
struct {
Uint32 segment_id;
Uint32 ptr;
};
} absolute_ptr;
static inline Uint32 SEGID(absolute_ptr ptr) { return ptr.segment_id; }
static inline Uint32 SEGOFFSET(absolute_ptr ptr) { return ptr.ptr; }
static inline absolute_ptr ABSPTR(Uint32 id, Uint32 ptr) { absolute_ptr r; r.segment_id = id; r.ptr = ptr; return r; }
static const absolute_ptr ABSNUL = { 0 };
/** A function description.
*/
struct function_t {
absolute_ptr start;
Uint32 size;
};
#endif
|