-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmodule.h
137 lines (98 loc) · 2.94 KB
/
module.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
127
128
129
130
131
132
133
134
135
136
137
#ifndef INCLUDE_MODULE_H
#define INCLUDE_MODULE_H
// module.h
// Revision 3-jul-2006
#include "segment.h"
#include "relfile.h"
#include "var.h"
#include <set>
#include <map>
namespace pasmo {
namespace impl {
//*********************************************************
// class Module
//*********************************************************
class Module {
public:
Module (ostream & debout_n, ostream & warnout_n);
Module (const Module & module);
string getname () const;
void clear ();
void setdebout (ostream & debout_n);
void loadrelfile (const string & relname);
void saverel (RelFileOut & rel);
void closerel (RelFileOut & rel);
void setentrypoint (const string & name, const Value & v);
void savemodule (RelFileOut & rel, const string & modulename);
bool hasstartpos () const;
address getstartpos () const;
void setstartpos (const Value & vstart);
void setcodebase (address base);
void setdatabase (address base);
address getcodesize () const;
address getdatasize () const;
address getafterabs () const;
void setcurrentsegment (ValueType newseg);
ValueType getcurrentsegment () const;
void gencode (byte b);
void genword (address w);
void genrelative (Value v);
void genextern (const string & varname, address externoff);
byte getbyte (address pos) const;
Value getpos () const;
void setpos (address pos);
void setorg (address pos);
address phase (address value) const;
void evallimits ();
void evalrelatives ();
void publicvars (Vars & vars);
void solveextern (Vars & vars);
void install (Segment & mainseg);
typedef std::map <Value, Value> Relative;
typedef std::set <string> PublicName;
typedef std::map <string, Value> PublicValue;
typedef std::map <string, Value> Chain;
typedef std::map <Value, Value> Offset;
typedef std::set <address> RelocTable;
private:
ostream debout;
ostream warnout;
string module_name;
bool startposdefined;
Value startpos;
PublicName publicname;
PublicValue publicvalue;
Segment absseg;
Segment codeseg;
Segment dataseg;
ValueType inuse;
//typedef std::map <address, Value> Relative;
//Relative relinabs;
//Relative relincode;
//Relative relindata;
Relative relative;
Chain chainextern;
Offset offset;
RelocTable reloctable;
const Segment & getseg (ValueType typeseg) const;
Segment & getseg (ValueType typeseg);
const Segment & curseg () const;
Segment & curseg ();
void prog_relative (RelFileIn & rel);
void data_relative (RelFileIn & rel);
void entry_symbol (RelFileIn & rel);
void program_name (RelFileIn & rel);
void extension_item (RelFileIn & rel);
void define_entry_point (RelFileIn & rel);
void chain_external (RelFileIn & rel);
void external_plus_offset (RelFileIn & rel);
void data_size (RelFileIn & rel);
void location_counter (RelFileIn & rel);
void program_size (RelFileIn & rel);
void end_module (RelFileIn & rel);
void savesegment (RelFileOut & rel, ValueType type);
};
} // namespace impl
} // namespace pasmo
#endif
// End of module.h