Question: Recursion in x86-64 assembly code You are asked to use recursion to implement mul (multiplication of 2 numbers) function. In doing so, you must use
Recursion in x86-64 assembly code
You are asked to use recursion to implement mul (multiplication of 2 numbers) function. In doing so, you must use the stack (so we can get some practice), either by pushing/popping or by getting a section of it (e.g., subq $24, %rsp) and releasing it (e.g., addq $24, %rsp) at the end of your program. Yes, it is certainly possible to recursively implement mul without saving the values of the argument registers (edi and esi) onto the stack. However, for practice's sake, let's save them onto the stack as stated in the question.
Requirements:
mul: # performs integer multiplication
- when both operands are non-negative!
# x in edi, y in esi
# Requirements:
# - cannot use imul* instruction
# - you must use recursion (no loop) and the stack
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
