Home > Linux/Linux kernel > signal handlers are executed in the context of their own private stack frame

signal handlers are executed in the context of their own private stack frame

See arch specific setup_frame() function in the kernel. For mips, it installs the signal trampoline, the user context (the registers) and the siginfo (when appropriate). The trampoline is just a syscall trap to the kernel to call sigreturn(). The address of the trampoline is set in the RA register, the arguments (signr, siginfo and the signal context) in registers 4, 5 and 6 respectively, pc points to the sighandler, reg# 29 (stack ptr) points to the allocated stack frame and off you go! On completion of the handler, the user land code returns to the address pointed to by RA register which has the trampoline. This it traps to the kernel in sysexit() syscall and this syscall then restores the user context through the saved register set, saved earlier in reg# 6.

Advertisements
Categories: Linux/Linux kernel
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: