lkml.org 
[lkml]   [2015]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectLKM based FIQ handler c-function
From
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>


\
 
 \ /
  Last update: 2015-09-28 20:41    [W:0.083 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site