74.4k views
1 vote
suppose that you are given the following partial program.inside someprocedure, what numerical operand should be used with the ret instruction? (e.g. ret n, what should n be? ignore any decimal points that canvas adds).datax dword 153461y word 37z word 90.codemain proc push x push y push z call someprocedure inc eax mov ebx, z xor eax, ebx exitmain endp

User Senthil
by
8.0k points

1 Answer

6 votes

Final answer:

The correct numerical operand to be used with the 'ret' instruction after 'some procedure' in the given program is '8', corresponding to the total size of the variables pushed onto the stack (8 bytes).

Step-by-step explanation:

The numerical operand that should be used with the ret instruction in this context depends on the amount of data that was previously 'pushed' onto the stack before the 'call' to some procedure. Given the partial program, x (which is a dword or 4 bytes), y (which is a word or 2 bytes), and z (also a word or 2 bytes) are pushed onto the stack. This totals to 8 bytes. Therefore, when some procedure returns, it needs to clean up the stack by the size of the arguments pushed, which in this case is 8 bytes. So, the correct instruction would be ret 8.

User Tinytree
by
8.3k points