完善了thread_info的学习...

This commit is contained in:
gatieme committed 2016-07-30 21:54:55 +08:00
1 parent b046115e94
commit d3526eace7
19 files changed
+177 -1363

No files matched your search

@@ -0,0 +1,78 @@
# ------------------------------------------------------------------------------
#
# Makefile for the LDD-LinuxDeviceDrivers.
#
# Author: gatieme
# Create: 2016-07-29 15:50:46
# Last modified: 2016-07-29 16:10:29
# Description:
# This program is loaded as a kernel(v2.6.18 or later) module.
# Use "make install" to load it into kernel.
# Use "make remove" to remove the module out of kernel.
#
# ------------------------------------------------------------------------------
ROOT=..
#PLATFORM=$(shell $(ROOT)/systype.sh)
#include $(ROOT)/Make.defines.$(PLATFORM)
# my driver description
DRIVER_VERSION := "1.0.0"
DRIVER_AUTHOR := "Gatieme @ AderStep Inc..."
DRIVER_DESC := "Demo module for LDD-LinuxDeviceDrivers devices"
DRIVER_LICENSE := "Dual BSD/GPL"
MODULE_NAME := smodule
ifneq ($(KERNELRELEASE),)
#CFG_FLAGS += -O2 -I./
#EXTRA_CFLAGS += $(C_FLAGS) $(CFG_INC) $(CFG_INC)
obj-m := $(MODULE_NAME).o #smodule.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
make -C $(KERNELDIR) M=$(PWD) modules
modules_install:
make -C $(KERNELDIR) M=$(PWD) modules_install
insmod:
sudo insmod $(MODULE_NAME).ko
reinsmod:
sudo rmmod $(MODULE_NAME)
sudo insmod $(MODULE_NAME).ko
github:
cd $(ROOT) && make github
rmmod:
sudo rmmod $(MODULE_NAME)
test :
sudo ../injector/memInjector -l stack -m random -t word_0 --time 1 --timeout 3 -p 1
clean:
make -C $(KERNELDIR) M=$(PWD) clean
rm -f modules.order Module.symvers Module.markers
.PHNOY:
modules modules_install clean
endif
@@ -0,0 +1,6 @@
#1.1.3 编写可加载模块
-------
http://book.51cto.com/art/201205/337662.htm
@@ -1 +0,0 @@
cmd_/mnt/hgfs/windows/src/1drivermodel/1-1simple/demo/smodule.ko := /usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-ld -EL -r -o /mnt/hgfs/windows/src/1drivermodel/1-1simple/demo/smodule.ko /mnt/hgfs/windows/src/1drivermodel/1-1simple/demo/smodule.o /mnt/hgfs/windows/src/1drivermodel/1-1simple/demo/smodule.mod.o
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,2 +0,0 @@
/mnt/hgfs/windows/src/1drivermodel/1-1simple/demo/smodule.ko
/mnt/hgfs/windows/src/1drivermodel/1-1simple/demo/smodule.o
Whitespace-only changes.
@@ -1 +0,0 @@
kernel//mnt/hgfs/windows/src/1drivermodel/1-1simple/demo/smodule.ko
@@ -1,21 +0,0 @@
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
@@ -1,5 +1,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/init.h>
@@ -7,13 +8,18 @@
static int demo_module_init(void)
{
printk("demo_module_init\n");
return 0;
return 0;
}
static void demo_module_exit(void)
{
printk("demo_module_exit\n");
}
module_init(demo_module_init);
module_exit(demo_module_exit);
@@ -1 +0,0 @@
cmd_/mnt/hgfs/windows/src/1drivermodel/1-2module/smodule.ko := /usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-ld -EL -r -o /mnt/hgfs/windows/src/1drivermodel/1-2module/smodule.ko /mnt/hgfs/windows/src/1drivermodel/1-2module/smodule.o /mnt/hgfs/windows/src/1drivermodel/1-2module/smodule.mod.o
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,2 +0,0 @@
/mnt/hgfs/windows/src/1drivermodel/1-2module/smodule.ko
/mnt/hgfs/windows/src/1drivermodel/1-2module/smodule.o
@@ -0,0 +1,80 @@
# ------------------------------------------------------------------------------
#
# Makefile for the LDD-LinuxDeviceDrivers.
#
# Author: gatieme
# Create: 2016-07-29 15:50:46
# Last modified: 2016-07-29 16:10:29
# Description:
# This program is loaded as a kernel(v2.6.18 or later) module.
# Use "make install" to load it into kernel.
# Use "make remove" to remove the module out of kernel.
#
# ------------------------------------------------------------------------------
ROOT=../../../../../
#PLATFORM=$(shell $(ROOT)/systype.sh)
#include $(ROOT)/Make.defines.$(PLATFORM)
# my driver description
DRIVER_VERSION := "1.0.0"
DRIVER_AUTHOR := "Gatieme @ AderStep Inc..."
DRIVER_DESC := "Demo module for LDD-LinuxDeviceDrivers devices"
DRIVER_LICENSE := "Dual BSD/GPL"
MODULE_NAME := smodule
ifneq ($(KERNELRELEASE),)
#CFG_FLAGS += -O2 -I./
#EXTRA_CFLAGS += $(C_FLAGS) $(CFG_INC) $(CFG_INC)
obj-m := $(MODULE_NAME).o #smodule.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
make -C $(KERNELDIR) M=$(PWD) modules
modules_install:
make -C $(KERNELDIR) M=$(PWD) modules_install
insmod:
sudo insmod $(MODULE_NAME).ko
reinsmod:
sudo rmmod $(MODULE_NAME)
sudo insmod $(MODULE_NAME).ko itype=2 btype=1 ctype=0xAC stype='a'
COMMIT="[1.1.4 带参数的可加载模块](http://book.51cto.com/art/201205/337663.htm)"
github:
cd $(ROOT) && make github
rmmod:
sudo rmmod $(MODULE_NAME)
test :
sudo ../injector/memInjector -l stack -m random -t word_0 --time 1 --timeout 3 -p 1
clean:
make -C $(KERNELDIR) M=$(PWD) clean
rm -f modules.order Module.symvers Module.markers
.PHNOY:
modules modules_install clean
endif
Whitespace-only changes.
@@ -0,0 +1,6 @@
#1.1.4 带参数的可加载模块
-------
http://book.51cto.com/art/201205/337663.htm
@@ -1 +0,0 @@
kernel//mnt/hgfs/windows/src/1drivermodel/1-2module/smodule.ko
@@ -1,21 +0,0 @@
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";