[ELFLOADER] Last improvment to elfloader memory managment, should be good now

This commit is contained in:
ptitSeb 2023-11-01 18:13:34 +01:00
parent 3f12bde9ff
commit 08d8407056
2 changed files with 2 additions and 1 deletions

View File

@ -1121,7 +1121,7 @@ static void* findBlockHinted(void* hint, size_t size)
if(addr<=h && end>=h && end-h+1>=size)
return hint;
uintptr_t aaddr = (addr+0xffff)&~0xffff;
if(addr<=aaddr && end>aaddr && end-aaddr+1>=size)
if(aaddr>=h && end>aaddr && end-aaddr+1>=size)
return (void*)aaddr;
if(end>=0xc0000000 && h<0xc0000000)
return NULL;

View File

@ -266,6 +266,7 @@ int AllocLoadElfMemory(box86context_t* context, elfheader_t* head, int mainbin)
return 1;
}
setProtection_mmap((uintptr_t)p, head->multiblocks[n].asize, prot);
head->multiblocks[n].p = p;
if(e->p_filesz) {
fseeko64(head->file, head->multiblocks[n].offs, SEEK_SET);
if(fread((void*)head->multiblocks[n].paddr, head->multiblocks[n].size, 1, head->file)!=1) {