Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) The following C/C++ function: void sample(unsigned val1, unsigned val2, char

ID: 3623176 • Letter: 1

Question

1) The following C/C++ function:
void sample(unsigned val1, unsigned val2, char val3)
{
unsigned d1=0, d2=5;
char d3='x';
...
}
is called: sample(9,10,'a');
draw and label the contents of the function's stack frame
---------------------------------------------------------------------------------------------
2) Do all nodes in linked list need to reside in the same segment? explain your answer?
---------------------------------------------------------------------------------------------
3)What is the purpose of ES register? Given an example in C/C++ of its probable usage?
---------------------------------------------------------------------------------------------
4)what is the result of the execution of the following code fragment:
for (i=0; i<3600; i++)
geninterrupt(8);
---------------------------------------------------------------------------------------------5) How much memory is needed for the largest possible executable program on the 80x86?

Explanation / Answer

Dear, 1) The function call sample(9,10,'a')       the memory repreentation          push 9          push 10          push 'a'          mov esp <-----Represents of current memory address saved in to stack(Function call)           mov ebp, esp          sub esp ,9 <-- sizeof(d1)+sizeof(d2)+sizeof(d3)          mov esp, ebp
          pop ebp
           ret 9 ; sizeof(d1) + sizeof(d2) + sizeof(d3) 2) All nodes in a linked list doen't reside at same segment as nodes are created in free spaces called holes and linked up 3) ES - Extra segment register         It is the memory space used for coding part and depends on user for his usage. It is a 16-bit register containing address of 64KB segment, usually with program data. By default, the processor assumes that the DI register references the ES segment in string manipulation instructions. ES register can be changed directly using POP and LES instructions.
2) All nodes in a linked list doen't reside at same segment as nodes are created in free spaces called holes and linked up 3) ES - Extra segment register         It is the memory space used for coding part and depends on user for his usage. It is a 16-bit register containing address of 64KB segment, usually with program data. By default, the processor assumes that the DI register references the ES segment in string manipulation instructions. ES register can be changed directly using POP and LES instructions.