In: Computer Science
Draw the stack (use, word/pdf) before every instruction that is marked red is executed to show your understanding of the call and return functions. Use N/A to represent unpredictable values.
Main Proc 4040018 mov ecx, 0000000Ch 404001C mov ebx, 0000000Bh 4040020 call FADD 4040026 mov eax, ebx … … Main EndP FADD PROC 4041040 Push ecx 4041044 Push ebx 4041048 mov eax, edx … … 404A060 Pop ebx 404A062 Pop ecx 404A064 ret FADD EndP
Answer:
Main Process will start
At instruction 4040018 the ecx variable will be having 0000000Ch as a value
At instruction 404001C the ebx variable will be having 0000000Bh as a value
ecx
0000000Bh |
ebx
0000000Ch |
At instruction 4040020 the FMul process will be called
The control will be under the FMul process now
At instruction 4041040 the value of variable ecx will be pushed in Stack
At instruction 4041044 the value of variable ebx will be pushed in Stack
At instruction 4041048 the value(N/A) of variable edx will be moved to eax variable
At instruction 404A060 the value of variable ebx will be poped out from Stack
At instruction 404A062 the value of variable ecx will be poped out from Stack
At instruction 404A064 the value of variable ebx and ecx will be returned and provided to the Main Process
Now the control will be under Main Process once the execution of FMul Process is completed
At instruction 4040026 the value of variable ebx will be moved to the variable eax.