/[lkdp]/lkdp/pm/signal.tex
ViewVC logotype

Diff of /lkdp/pm/signal.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by kdlinux2001, Tue Dec 17 08:58:20 2002 UTC revision 1.4 by kdlinux2001, Wed Feb 26 06:38:24 2003 UTC
# Line 5  Line 5 
5               \textbf{\Large S}ystem calls are used to perform "low-level" operations on the system. System calls are the bridges between user space and kernel space. So it is the bridge between a user application and the system hardware.               \textbf{\Large S}ystem calls are used to perform "low-level" operations on the system. System calls are the bridges between user space and kernel space. So it is the bridge between a user application and the system hardware.
6          \par Each system call \footnote{System calls are defined in \url{include/asm-i386/unistd.h}} has its own unique identifying number. The kernel uses this number as an index into a table of system call entry points, which point to where the system calls reside in memory along with the number of arguments that should be passed to them.          \par Each system call \footnote{System calls are defined in \url{include/asm-i386/unistd.h}} has its own unique identifying number. The kernel uses this number as an index into a table of system call entry points, which point to where the system calls reside in memory along with the number of arguments that should be passed to them.
7          \par When a process makes a system call, the behavior is similar to that with interrupts and exceptions. Like exception handling, the general purpose registers and the number of the system call are pushed onto the stack. And, the system call handler is invoked, which calls the routine within the kernel that will do the actual work.          \par When a process makes a system call, the behavior is similar to that with interrupts and exceptions. Like exception handling, the general purpose registers and the number of the system call are pushed onto the stack. And, the system call handler is invoked, which calls the routine within the kernel that will do the actual work.
8          \par When a user mode program invokes a system call, the libc library transfers control to kernel mode using software interrupt 0x80 registered during IRQ initialization \footnote{set\_system\_gate(SYSCALL\_VECTOR,\&system\_call); in trap\_init() in \url{arch/i386/kernel/traps.c}} and the kernel executes the system call related function. The system call within the kernel is its counterpart in user space prefixed by sys. So, when user calls fork/clone/vfork, kernel executes sys\_fork/sys\_clone/sys\_vfork function. Since, the system call is invoked from user space in order to enter kernel space,it has to pass through the call gate \footnote{Call gates are used to change priviledge level to perform priviledged operations. Refer appendix ~\ref{appendix B}.} to ensure that user code moves up to the higher privilege level at a specific location within the kernel.          \par When a user mode program invokes a system call, the libc library transfers control to kernel mode using software interrupt 0x80 registered during IRQ initialization \footnote{set\_system\_gate(SYSCALL\_VECTOR,\&system\_call); in trap\_init() in \url{arch/i386/kernel/traps.c}} and the kernel executes the system call related function. The system call within the kernel is its counterpart in user space prefixed by sys. So, when user calls fork/clone/vfork, kernel executes sys\_fork/sys\_clone/sys\_vfork function. Since, the system call is invoked from user space in order to enter kernel space,it has to pass through the call gate \footnote{Call gates are used to change priviledge level to perform priviledged operations. Refer appendix ~\ref{appendix2}.} to ensure that user code moves up to the higher privilege level at a specific location within the kernel.
9          \subsection{sys\_call\_table} \index{sys\_call\_table}          \subsection{sys\_call\_table} \index{sys\_call\_table}
10          The \textit{system\_call} code and the \textit{sys\_call\_table} is defined in the asm code \url{arch/i386/kernel/entry.S}          The \textit{system\_call} code and the \textit{sys\_call\_table} is defined in the asm code \url{arch/i386/kernel/entry.S}
11          \begin{verbatim}          \begin{verbatim}
# Line 145  Line 145 
145    
146          \end{verbatim}          \end{verbatim}
147    
148          \subsection{signal\_struct} \index{signal\_struct}          \subsection{signal\_struct} \index{signal\_struct} \label{signalstruct}
149          The \textit{signal\_struct} is a generic signal structure defined in \url{include/linux/sched.h}. This contains the signal count per process and the spin-lock to protect the signals over multiple CPUs. It also contains an array of size \textit{\_NSIG} \footnote{NSIG is the maximum number of signals supported.} and of type \textit{k\_sigaction} defined below. This array defines the actions to be taken upon receiving any of the \_NSIG [NSIG = 64] signals.          The \textit{signal\_struct} is a generic signal structure defined in \url{include/linux/sched.h}. This contains the signal count per process and the spin-lock to protect the signals over multiple CPUs. It also contains an array of size \textit{\_NSIG} \footnote{NSIG is the maximum number of signals supported.} and of type \textit{k\_sigaction} defined below. This array defines the actions to be taken upon receiving any of the \_NSIG [NSIG = 64] signals.
150          \begin{verbatim}          \begin{verbatim}
151    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26