Messages in this thread | | | Date | Mon, 28 Sep 2015 14:17:01 -0400 | Subject | LKM based FIQ handler c-function | From | Devan Lippman <> |
| |
Hello,
I'm trying to write a LKM that will init the FIQ to call a c-function. I think I'm running in to a problem though as the LKM code is vmalloc'd to a virtual page address.
I have used the FIQ asm handler from the RPi USB driver as a starting point http://mirrors.neusoft.edu.cn/rpi-kernel/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S This is basically saving the lower registers, performing the branch and then restoring the registers on return.
In order for this to work as an LKM I believe that I need to relocate the c function code to the Kernel-mode Virtual address space (gt 0xC0000000). Is this correct and if so are there already mechanisms in place to do this?
From what I can understand, the kernel does not like a LKM to have PIC code in it. I added `ccflags-y := -fPIC` to the makefile and when I attempt to insmod I am getting "Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)". I think I need the PIC code though in order to relocate the function to an area that is safely dereferenced from the FIQ (allocated with `__vmalloc(0x60, GFP_KERNEL, PAGE_KERNEL_EXEC)`).
How is this typically done?
Thanks, Devan Lippman <devan at lippman dot net>
| |