Question: A) Why is this code not reentrant? On what line would an interrupt haveto occur to cause the bug to manifest? Please explain your answer

A) Why is this code not reentrant? On what line would an interrupt haveto occur to cause the bug to manifest? Please explain your answer
B) How could you fix it so that it is reentrant? Please explain your answer
9. During a driver's interrupt handling routine, once the interrupt has been acknowledgedit is possible for another interrupt to occur that will invoke the same handler. Drivers that produce correct results in this scenario are called reentrant. Consider the following interrupt handler: or athe 1 char temp void interrupt hardlar(void) char , x2; x1-inb (Ox120); // read from 1/0 port x2 1nb (0x121); // read from 1/0 Port 1 acknovledgeinterrupt O 12 temp=x1; x1-x2 x2-tep printf("Cot and swapped x1-% d x2-%d .' x1, x2); is
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
