1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

LibC: Communicate malloc() and free() operations to UserspaceEmulator

Use the sneaky SALC secret mechanism of UserspaceEmulator to inform it
about malloc operations.
This commit is contained in:
Andreas Kling 2020-07-15 21:54:18 +02:00
parent c314292319
commit 4aa81a4fd9
2 changed files with 24 additions and 0 deletions

View file

@ -70,4 +70,21 @@ int perf_event(int type, uintptr_t arg1, uintptr_t arg2);
int get_stack_bounds(uintptr_t* user_stack_base, size_t* user_stack_size);
ALWAYS_INLINE void send_secret_data_to_userspace_emulator(uintptr_t data1, uintptr_t data2, uintptr_t data3)
{
asm volatile(
".byte 0xd6\n"
".byte 0xd6\n" ::
: "eax");
asm volatile(
"push %%eax\n"
"push %%ecx\n"
"push %%edx\n"
"pop %%edx\n"
"pop %%ecx\n"
"pop %%eax\n" ::"a"(data1),
"c"(data2), "d"(data3)
: "memory");
}
__END_DECLS