Why Does movl (%eax), %edx Crash After Using Custom malloc_ Implementation in Assembly?
I have implemented a custom memory allocation function using
sys_mmap
for memory allocation. Here’s my code for the malloc_
function:
In my main
function, I use malloc_
to allocate memory like this:
The issue I don’t understand is why the line movl (%eax), %edx
causes a crash, but using mov (%rax), %rdx
works perfectly fine.
If I use the system provided malloc
function instead, both lines work without issue. What could be causing this behavior with my custom malloc_
function?0 Replies