鏇存柊浜嗗唴瀛樼鐞嗕箣椤靛紡绠$悊鏈哄埗...

This commit is contained in:
gatieme
2016-08-07 16:35:13 +08:00
parent 0a5d402edf
commit 212a9fac6e
59 changed files with 686 additions and 686 deletions
@@ -0,0 +1,18 @@
ifneq ($(KERNELRELEASE),)
obj-m := crs_pgd.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
all:
make -C $(KERNELDIR) M=$(PWD) modules
clean:
make -C $(KERNELDIR) M=$(PWD) clean
endif
@@ -0,0 +1,31 @@
//#include <asm/system.h>
#include <linux/mm.h>
#include <linux/mm_types.h>
#include <linux/sched.h>
#include <linux/types.h>
static unsigned long read_pgd(void)
{
return (unsigned long)current->mm->pgd;
}
static int __init init_cr3_pgd(void)
{
unsigned long cr3;
unsigned long pgd = 0;
cr3 = read_cr3();
printk("cr3----------------->0x%lx\n", cr3);
pgd = __pa(read_pgd());
printk("pgd----------------->0x%lx\n", pgd);
return 0;
}
static void __exit exit_cr3_pgd(void)
{
printk("--------------------->exit!\n");
return ;
}
module_init(init_cr3_pgd);
module_exit(exit_cr3_pgd);