RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
xpexp.h
1#ifndef XPEXP_H
2#define XPEXP_H
3
4#include "../common.h"
5#include "../linker/linker.h"
6#include "../linker/reader.h"
7#include "../linker/writer.h"
8
9/* TODO: unimplemented */
10
11namespace Ergo
12{
17 {
18 public:
19 std::string stub_file; // TODO
20
21 struct Segment
22 {
23 public:
24 uint16_t limit;
25 uint32_t base;
26 enum
27 {
28 ACCESS_DATA = 0x92,
29 ACCESS_CODE = 0x9A,
30
31 ACCESS_CPL0 = 0x00,
32 ACCESS_CPL1 = 0x20,
33 ACCESS_CPL2 = 0x40,
34 ACCESS_CPL3 = 0x60,
35 };
36 uint8_t access;
37 enum
38 {
39 FLAG_ALIAS = 0x10,
40 FLAG_WINDOW = 0x20,
41 FLAG_32BIT = 0x40,
42 FLAG_PAGES = 0x80, // instead of bytes, for limit size
43 };
44 uint8_t flags;
45
46 static Segment ReadFile(Linker::Reader& rd);
47 void WriteFile(Linker::Writer& wr);
48 };
49
50 uint32_t offset = 0;
51 uint32_t ldt_offset = 0;
52 uint32_t image_offset = 0;
53 uint32_t relocation_offset = 0; // TODO: unsure
54 uint32_t minimum_extent = 0;
55 uint32_t maximum_extent = 0;
56 uint32_t unknown_field = 0;
57 uint32_t gs, fs, ds, ss, cs, es, edi, esi, ebp, esp, ebx, edx, ecx, eax, eflags, eip;
58 std::vector<Segment> ldt;
59 std::shared_ptr<Linker::Writable> image;
60
61 void Clear() override;
62 void CalculateValues() override;
63 void ReadFile(Linker::Reader& in) override;
64 void WriteFile(Linker::Writer& out) override;
65 /* TODO */
66
67 std::string GetDefaultExtension(Linker::Module& module, std::string filename) override;
68 };
69}
70
71#endif /* XPEXP_H */
Ergo OS/286 and OS/386 "XP" .exp file (Ergo was formerly A.I. Architects, then Eclipse)
Definition xpexp.h:17
void Clear() override
Resets all fields to their default values, deallocate memory.
Definition xpexp.cc:22
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition xpexp.cc:8
void WriteFile(Linker::Writer &out) override
Stores data in memory to file.
Definition xpexp.cc:81
void ReadFile(Linker::Reader &in) override
Loads file into memory.
Definition xpexp.cc:36
std::string GetDefaultExtension(Linker::Module &module, std::string filename) override
Appends a default extension to the filename.
Definition xpexp.cc:124
A helper class to collect sections into segments.
Definition linker.h:19
Encodes an object module file as a collection of sections, symbols and relocations.
Definition module.h:20
A class that provides a general interface to setting up generation for a format.
Definition format.h:56
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:16
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15
Definition xpexp.h:22