MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / KMemoryData

Method KMemoryData

source/emulation/softmmu/kmemory_soft.cpp:44–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44KMemoryData::KMemoryData(KMemory* memory) : memory(memory) {
45 ::memset(mmu, 0, sizeof(mmu));
46#ifdef BOXEDWINE_MEM_CACHE
47 ::memset(readCache, 0, sizeof(readCache));
48 ::memset(writeCache, 0, sizeof(writeCache));
49#endif
50 if(!callbackRam.value) {
51 callbackRam = ramPageAlloc();
52 addCallback(onExitSignal);
53 }
54 this->allocPages(nullptr, CALL_BACK_ADDRESS >> K_PAGE_SHIFT, 1, K_PROT_READ | K_PROT_EXEC, -1, 0, nullptr, &callbackRam);
55 // in case another thread is using it right when we free it
56 codeMemory.delayedFree = 1000; // 10s
57#ifdef BOXEDWINE_HOST_EXCEPTIONS
58 codeMemory.delayedFreeCallback = [this](void* p, U32 len) {
59 auto startIt = this->jitAddressToEip.upper_bound((U8*)p);
60 auto endIt = this->jitAddressToEip.lower_bound((U8*)p + len);
61 auto it = startIt;
62
63 while (it != endIt) {
64 it = this->jitAddressToEip.erase(it);
65 }
66 };
67#endif
68 codeMemory.isCodeMemory = true;
69}
70
71KMemoryData::~KMemoryData() {
72 codeMemory.freeAll();

Callers

nothing calls this directly

Calls 3

allocPagesMethod · 0.95
ramPageAllocFunction · 0.85
eraseMethod · 0.45

Tested by

no test coverage detected