kernel: ashmem: use kallsyms_lookup_name for internal symbol access
This commit is contained in:
parent
0887abe263
commit
f2110223d1
3 changed files with 6 additions and 27 deletions
|
|
@ -1,14 +1,7 @@
|
|||
ccflags-y += -I$(src) -Wno-error=implicit-int
|
||||
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
ccflags-y += -I$(src) -Wno-error=implicit-int -Wno-int-conversion
|
||||
obj-m := ashmem_linux.o
|
||||
ashmem_linux-y := deps.o ashmem.o
|
||||
|
||||
$(obj)/deps.o: $(src)/deps.h
|
||||
|
||||
$(obj)/deps.h: $(src)/gen_deps.sh
|
||||
sudo $(src)/gen_deps.sh > $@
|
||||
else
|
||||
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
|
||||
|
||||
all:
|
||||
|
|
@ -19,4 +12,3 @@ install:
|
|||
|
||||
clean:
|
||||
rm -rf deps.h *.o *.ko *.mod.c *.symvers *.order .*.cmd .tmp_versions
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
#include <linux/mm.h>
|
||||
#include <linux/kallsyms.h>
|
||||
|
||||
#include "deps.h"
|
||||
|
||||
static int (*shmem_zero_setup_ptr)(struct vm_area_struct *) = SHMEM_ZERO_SETUP;
|
||||
static int (*shmem_zero_setup_ptr)(struct vm_area_struct *) = NULL;
|
||||
|
||||
int shmem_zero_setup(struct vm_area_struct *vma)
|
||||
{
|
||||
return shmem_zero_setup_ptr(vma);
|
||||
if (!shmem_zero_setup_ptr)
|
||||
shmem_zero_setup_ptr = kallsyms_lookup_name("shmem_zero_setup");
|
||||
return shmem_zero_setup_ptr(vma);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
SYMS="shmem_zero_setup"
|
||||
|
||||
for sym in $SYMS; do
|
||||
addr=`cat /proc/kallsyms | grep -Ee '^[0-9a-f]+ T '$sym'$' | sed -e 's/\s.*$//g'`
|
||||
if [ a$addr = 'a' ]; then
|
||||
echo "Error: can't find symbol $sym"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
name=`echo $sym | tr '[:lower:]' '[:upper:]'`
|
||||
echo "#define $name\t(void *)0x$addr"
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue