I am learning RE via a book.
It says that when a Callee function gets controlled, it does 3 things:
- Set up function stack frame
- Allocate space for local variables
- If required, preserve EBX,ESI,EDI
Why is step 3 needed? What are their purpose before the preservation? According to the book, EBX is used as pointer to data, ESI is used as pointer to source in string operations and EDI is used as pointer to destination string operations.
Why isn't step 3 carried out right before the callee function is called i.e when EAX,ECX and EDX registers are pushed onto the stack?