Customising the NMI handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I am using Linux on a Compact PCI system with a System Controller and a set
of Peripheral boards.  Each time one of these peripheral boards is hot
swapped a NMI interrupt is generated on the System Controller board.  I have
in mind to write a driver that handles these NMI interrupts.  I don't really
want to start hacking the kernel source, but would rather like to build a
module that can be loaded at some point.  My idea is to get the module to
replace the NMI vector to the existing NMI handler function (in
linux/arch/i386/kernel/entry.S that is set from the trap_init function in
/linux/arch/i386/kernel/traps.c) with my own handler function, calling the
previous handler if necessary after my handler has done its bit.  A pretty
standard idea.  Now, in terms of swimming, I still have my inflatable
armbands on here! So I was wondering if this were possible?  I guess that I
would need to first save the existing content of the NMI IDT entry, the
entry point to the existing NMI handler, then modify the NMI IDT entry with
the pointer to my NMI handler.  I am still guessing, but would the saved
entry point be an address relative to a particular memory page? And would
the new entry saved there also be seen as relative to the same page? i.e.
not only would I not be able to call the previous NMI handler from my
module, but my own NMI handler would not get called either, and the system
would crash? Also would I be allowed to modify the NMI IDT entry from my
module? Looking through the traps.c file I see that there is a function
trap_init_f00f_bug which makes the IDT read only?

As I said above, my armbands are fully inflated here, so I hope some this
makes sense, and any help or pointers you could give me would be warmly
welcomed,

Many thanks for you time,

Best wishes,

Simon. 


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux