-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmemblocksobj.h
62 lines (50 loc) · 1.79 KB
/
memblocksobj.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
/*
$Id: memblocksobj.h 3136 2024-05-11 09:05:50Z soci $
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MEMBLOCKSOBJ_H
#define MEMBLOCKSOBJ_H
#include "obj.h"
#include "stdbool.h"
#include "inttypes.h"
struct section_s;
struct output_s;
extern struct Type *const MEMBLOCKS_OBJ;
struct memblock_s { /* starts and sizes */
address_t p;
address_t addr, len;
struct Memblocks *ref;
};
typedef struct Memblocks {
Obj v;
struct { /* Linear memory dump */
address_t p, len;
uint8_t *data;
} mem;
size_t p, len;
address_t lastp;
address_t lastaddr;
bool flattened, merged, enumeration;
struct memblock_s *data;
const struct section_s *section;
} Memblocks;
#define Memblocks(a) OBJ_CAST(Memblocks, a)
extern void memblocksobj_init(void);
static inline Memblocks *ref_memblocks(Memblocks *v1) {
v1->v.refcount++; return v1;
}
extern MUST_CHECK Memblocks *new_memblocks(address_t, size_t);
extern MUST_CHECK Memblocks *copy_memblocks(Memblocks *);
extern void printmemorymap(const Memblocks *);
extern void memorymapfile(const Memblocks *, const struct output_s *);
#endif