-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab4 PartC Notes
30 lines (21 loc) · 1.92 KB
/
Lab4 PartC Notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Part C: Preemptive Multitasking and Inter-Process communication (IPC)
Exercise 13
While an NMI handler is executing, the processor ignores further interrupt signals at the NMI pin until the next IRET instruction is executed.
The IF (interrupt-enable flag) controls the acceptance of external interrupts signalled via the INTR pin.
When IF=0, INTR interrupts are inhibited; when IF=1, INTR interrupts are enabled. As with the other flag bits,
the processor clears IF in response to a RESET signal. The instructions CLI and STI alter the setting of IF.
CLI (Clear Interrupt-Enable Flag) and STI (Set Interrupt-Enable Flag) explicitly alter IF (bit 9 in the flag register).
These instructions may be executed only if CPL <= IOPL. A protection exception occurs if they are executed when CPL > IOPL.
Exercise 14 Handling Clock Interrupts
Easy
Exercise 15 Inter-Process communication (IPC)
It's better to be called Inter_environment communication in JOS
We've been focusing on the isolation aspects, now we should pay attention to IPC.
There are many models for interprocess communication, e.g. the Unix pipe model.
You will implement two system calls, sys_ipc_recv and sys_ipc_try_send. Then you will implement two library wrappers ipc_recv and ipc_send.
To sum up, We can use user program sendpage.c to analyse the IPC mechanism from a high level. In sendpage.c, we will use the fork we implemented
to create child and make parent and child send information to each other:
1. ipc_recv() calls sys_ipc_try_send => set relevant fields in Env struct, particularly set target env's state to ENV_RUNNABLE so that it can be
scheduled => most importantly, set e->env_tf.tf_regs.reg_eax = 0. The last step is because we wish to make target env return 0 when returning from
ipc_recv() function. I have analyzed the process of syscall in another note
2. ipc_send() calls sys_ipc_recv => if pg is valid, set state to ENV_NOT_RUNNABLE => call sys_yield to give up the CPU