lkml.org 
[lkml]   [1999]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Catching signals in a Kernel Module?
Date
From
> my module working.  However, when a user tries to read or 
> write an unsupported MSR, the Intel Pentium II returns with a GP(0).
> This causes my module to die with a SEGV.
>
> How can I catch this signal within my module? I have

Be careful about signal versus exception. Signal has a specific meaning in
Unix that is different.

> the Linux Device Drivers book, but it doesn't
> appear to cover this type of problem.

I'm not suprised 8). You can do this. The best example of it is the
copy_*_user functions (include/asm-i386/uaccess.h)

You want the asm code to look like

1: wrmsr blah
2:
.section .fixup, "ax"
3: code to handle fault
jmp 2b # Back to the original code path
.previous
.section __ex_table, "a"
.align 4
.long 1b,3b
.previous

What happens when you get a fault is the kernel walks the exception table
looking for the fault address (thats the piece in the __ex_table. If it
finds the address it jumps to the fault handler address. If not it
follows the normal path.





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.032 / U:1.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site