Search code examples
linuxlinux-kernelkernelkernel-modulekernel-extension

Implement CPU extensions in a kernel module


I'm looking for information relating to implementing certain CPU extensions in a kernel module. I've found something related: http://www.mirrors.docunext.com/lxr/http/source/arch/mips/kernel/unaligned.c in fact, it's the only source code that I can find that is even close.

Basically, I have a binary only shared object built with certain CPU extensions, which I need to run on a slightly older CPU which has most of the instruction set, but not the fancy new stuff. Yeah, I know it'll be rather slow, but it's better than crashing with SIGILLs.


Solution

  • Well, after reading the kernel source, it seems like there is already minor support for this. I really can't see how much it's actually used, but there exists a linked list to store the various emulated instructions. If I'm able to actually get this going, I'll probably change it to the kernel-header supplied tree.

    If I'm understanding kernel modules right, there doesn't look like there would be an issue to support pluggable emulation.