Yet another question at stack overflow that I answered involved around a query from the user looking for ways to switch from user mode to kernel mode in an application.
Assuming that the user wanted to switch over explicitly during the program code execution, below was my answer for the same. Hope this will be useful for some one else looking answers for similar questions:
0
|
The only way an user space application can explicitly initiate a switch to kernel mode during normal operation is by making an system call such as open, read, write etc.
Whenever a user application calls these system call APIs with appropriate parameters, a software interrupt/exception(SWI) is triggered.
As a result of this SWI, the control of the code execution jumps from the user application to a predefined location in the Interrupt Vector Table [IVT] provided by the OS.
This IVT contains an adress for the SWI exception handler routine, which performs all the necessary steps required to switch the user application to kernel mode and start executing kernel instructions on behalf of user process.
|