-
Notifications
You must be signed in to change notification settings - Fork 40
/
DOSKernel.h
91 lines (76 loc) · 1.91 KB
/
DOSKernel.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
// Copyright (c) 2009-present, the libcpu developers. All Rights Reserved.
// Read LICENSE.txt for licensing information.
#ifndef __DOSKernel_h
#define __DOSKernel_h
#include <string>
#include <map>
#include <vector>
#include <Hypervisor/hv_vmx.h>
class DOSKernel {
public:
enum {
STATUS_HANDLED,
STATUS_STOP,
STATUS_UNHANDLED,
STATUS_UNSUPPORTED,
STATUS_NORETURN
};
private:
char *_memory;
hv_vcpuid_t _vcpu;
std::map <int, int> _fdtable;
std::vector <bool> _fdbits;
uint16_t _dta;
int _exitStatus;
public:
DOSKernel(char *memory, hv_vcpuid_t vcpu, int argc, char **argv);
~DOSKernel();
public:
int dispatch(uint8_t IntNo);
private:
int int20();
int int21();
private:
int int21Func02();
int int21Func08();
int int21Func09();
int int21Func0A();
int int21Func0C();
int int21Func0E();
int int21Func19();
int int21Func1A();
int int21Func25();
int int21Func26();
int int21Func30();
int int21Func33();
int int21Func35();
int int21Func3C();
int int21Func3D();
int int21Func3E();
int int21Func3F();
int int21Func40();
int int21Func41();
int int21Func42();
int int21Func43();
int int21Func4C();
int int21Func4E();
int int21Func4F();
int int21Func57();
private:
int getDOSError() const;
void makePSP(uint16_t seg, int argc, char **argv);
private:
void flushConsoleInput();
int internalGetChar(bool Echo);
private:
int allocFD(int HostFD);
void deallocFD(int FD);
int findFD(int FD);
private:
void writeMem(uint16_t const &Address, void const *Bytes,
size_t Length);
std::string readString(uint16_t const &Address, size_t Length);
std::string readCString(uint16_t const &Address,
char Terminator = '\0');
};
#endif // !__DOSKernel_h