The document discusses two software exceptions - Supervisor Call (SVC) and Pendable Service Call (PendSV). SVC generates system function calls when a user program wants to use hardware. It executes the operating system exception handler to provide requested services. PendSV can pend an exception so the OS can perform an action after important tasks. For example, it is used for context switching between two active tasks triggered by an SVC call or timer interrupt. The OS prepares for switching, pends PendSV, then it performs the switch when PendSV is entered.
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
Supervisor call and pendable service call
1. Supervisor Call and Pendable service call
● Two exceptions targeted at software and operating systems
2. Supervisor Call
● Generates system function calls.
● When a user program wants to use certain hardware, it generates the
SVC exception using SVC instructions
● The software exception handler in the operating system is executed
and provides the service the user application requested
● SVC can also make software more portable because the user
application does not need to know the programming details of the
hardware
3. Instructions in SVC
● SVC exception is generated using the SVC instruction.
Ex:
SVC #0x3 ; Call SVC function 3
SVC 0x3 ; Call SVC function 3
5. Pendable Service Call
● PendSV can be pended and is useful for an OS to pend an exception
so that an action can be performed after other important tasks are
completed.
● PendSV is generated by writing 1 to the PENDSVSET bit in the NVIC
Interrupt Control State register.
● A typical use of PendSV is context switching
6. Example
A system might have two active tasks, and context switching can be
triggered by the following:
• Calling an SVC function
• The system timer (SYSTICK)
10. Context switching example with PendSV
1. Task A calls SVC for task switching (for example, waiting for some work
to complete).
2. The OS receives the request, prepares for context switching, and
pends the PendSV exception.
3. When the CPU exits SVC, it enters PendSV immediately and does the
context switch.
4. When PendSV finishes and returns to the thread level, it executes Task
B.
11. Contd...
5. An interrupt occurs and the interrupt handler is entered.
6. While running the interrupt handler routine, a SYSTICK exception (for
OS tick) takes place.
7. The OS carries out the essential operation, then pends the PendSV
exception and gets ready for the context switch.
8. When the SYSTICK exception exits, it returns to the interrupt service
routine.
12. Contd...
9. When the interrupt service routine completes, the PendSV starts and
does the actual context switch operations.
10. When PendSV is complete, the program returns to the thread level;
this time it returns to Task A and continues the processing.