-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (27 loc) · 820 Bytes
/
Copy pathmain.cpp
File metadata and controls
38 lines (27 loc) · 820 Bytes
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
extern "C" {
#include "ppc.h"
}
#include "elf.hpp"
#include "mm.hpp"
int main(int argc, const char* argv[]) {
allity::memory_manager mm;
mm.load(argv[1]);
struct ppc_bus bus;
bus.read8 = allity::mm_read8;
bus.read16 = allity::mm_read16;
bus.read32 = allity::mm_read32;
bus.read64 = allity::mm_read64;
bus.write8 = allity::mm_write8;
bus.write16 = allity::mm_write16;
bus.write32 = allity::mm_write32;
bus.write64 = allity::mm_write64;
bus.udata = &mm;
struct ppc_state* ppu = ppc_create(bus);
ppu->pc = mm.read(mm.file().entry_point(), allity::MM_64);
mm.alloc(0xd0000000, 0x10000000);
ppu->r[1] = 0xdf000000;
ppu->r[2] = mm.read(mm.file().entry_point() + 8, allity::MM_64);
while (true)
ppc_execute(ppu);
ppc_destroy(ppu);
}