Everywhere: Use slon_mem_task for memory allocation

This commit is contained in:
Alec Murphy 2025-03-06 09:54:26 -05:00
parent 5333b64917
commit 64f31de070
24 changed files with 146 additions and 139 deletions

View file

@ -244,7 +244,7 @@ U0 process_elf_rela_plt_entries(Elf* elf)
for (i = 0; i < elf->rela_plt_size; i++) {
symbol_exists = FALSE;
entry_name = elf->dynstr + elf->dynsym[(rela_plt->r_info >> 32)].st_name;
handler = MAlloc(sizeof(unimplemented_symbol), adam_task->code_heap);
handler = MAlloc(sizeof(unimplemented_symbol), slon_mem_task->code_heap);
MemCpy(handler, &unimplemented_symbol, sizeof(unimplemented_symbol));
patch = handler + 0x0A;
*patch = entry_name;

View file

@ -14,7 +14,7 @@ U0 calloc()
{
PUSH_SYSV_REGS
GET_SYSV_ARGS
CAlloc(p0 * p1, adam_task->code_heap);
CAlloc(p0 * p1, slon_mem_task->code_heap);
POP_SYSV_REGS
}
@ -46,7 +46,7 @@ I64 @fwrite(U8* ptr, I64 size, I64 nmemb, U64 stream)
switch (stream) {
case stdout:
case stderr:
tmp = CAlloc((size * nmemb) + 1, adam_task->code_heap);
tmp = CAlloc((size * nmemb) + 1, slon_mem_task->code_heap);
MemCpy(tmp, ptr, (size * nmemb));
#ifdef QEMU_RUN_TESTS
QemuDebugMsg(tmp);
@ -122,7 +122,7 @@ U0 malloc()
{
PUSH_SYSV_REGS
GET_SYSV_ARGS
MAlloc(p0, adam_task->code_heap);
MAlloc(p0, slon_mem_task->code_heap);
POP_SYSV_REGS
}
@ -207,9 +207,9 @@ U8* @realloc(U8* ptr, I64 size)
{
U8* new;
if (!ptr) {
new = MAlloc(size, adam_task->code_heap);
new = MAlloc(size, slon_mem_task->code_heap);
} else {
new = MAlloc(size, adam_task->code_heap);
new = MAlloc(size, slon_mem_task->code_heap);
MemCpy(new, ptr, size);
Free(ptr);
}

View file

@ -21,7 +21,7 @@ U0 _Znwm()
// operator new(unsigned long)
PUSH_SYSV_REGS
GET_SYSV_ARGS
MAlloc(p0, adam_task);
MAlloc(p0, slon_mem_task);
POP_SYSV_REGS
}
@ -30,6 +30,6 @@ U0 _ZnwmRKSt9nothrow_t()
// operator new(unsigned long, std::nothrow_t const&)
PUSH_SYSV_REGS
GET_SYSV_ARGS
MAlloc(p0, adam_task);
MAlloc(p0, slon_mem_task);
POP_SYSV_REGS
}