ECE391 Final 21-12-2021 Answer
ECE391 Final 21-12-2021 Answer
Notes - Students submit the question sheet together with the answer sheet
:
2. Suppose that you discover that RAM addresses 00125000 to 00526FFF are reserved for a PC
network adapter. How many bytes of memory is this? How many bits for this address is it?
What are the 32-bit data when we read a double-word at the address 0x0040 with Little Endian mode?
21 FD 7B 45
Problem 4: (L.O.5) (10pts) Write 80x86 assembly language code for the following C procedure:
C procedure ASM procedure
Assume that S is stored in EAX, n is store in EBX
int my_func(int n) my_func:
{
int S = 1000; mov eax,1000
while (n ≠ 0) loop: comp ebx,0
{ je equal0
S--; dec eax
n = n << 1; shl ebx,1
} jmp loop
return S; equal0: ret
}
Determine the address of ISR of a device with the interrupt vector 9Ah.
isNumberEven:
cmp bx,0
jle lessThanOrEqual
mov ax,bx
and ax,0x0001
not ax
ret
lessThanOrEqual:
mov ax,-1
ret
Interrupts and exceptions are events that indicate that a condition exists somewhere in the system, the
processor, or within the currently executing program or task that requires the attention of a processor. When
an interrupt is received or an exception is detected, the currently running procedure or task is suspended
while the processor executes an interrupt or exception handler. When execution of the handler is complete,
the processor resumes execution of the interrupted procedure or task. The processor receives interrupts from
two sources: External (hardware generated) interrupts. Software-generated interrupts.
No Question Answer
.
1 Explain the need of privilege levels.
Problem 10: (L.O.5) (10pts) What are memory problems with the following C codes? How to solve
the problems?
// After using s
delete[] s;
4 void error_func ()
{
int* ptr = new char(10);
return;
}
int main()
{
error_func();
return 0;
}