├── spinlock ├── README.md └── src │ └── Makefile ├── syscall ├── README.md └── src │ └── Makefile ├── procfs-read ├── README.md └── src │ └── Makefile ├── bus_device_driver ├── README.md └── src │ ├── simple_bus.h │ ├── Makefile │ └── xxx_chip_drv.c ├── mod_with_parameter └── README.md ├── procfs-read_write ├── README.md └── src │ └── Makefile ├── register_chrdev ├── README.md └── src │ └── Makefile ├── register_chrdev_region ├── README.md └── src │ └── Makefile ├── procfs-open_read_lseek_release ├── README.md └── src │ └── Makefile ├── procfs-read_write_open_release ├── README.md └── src │ └── Makefile ├── 001-helloworld └── README.md ├── 005-read_pfn-page ├── README.md └── src │ └── pfn_page.c ├── code ├── 1 │ ├── 1.2 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverMain.h │ │ └── DriverFileOperations.h │ ├── 1.3 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverMain.h │ │ └── DriverFileOperations.h │ └── 1.1 │ │ ├── PrintingDriver │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverMain.h │ │ └── DriverFileOperations.h │ │ └── UserApp │ │ └── main.cpp ├── 2 │ ├── 2.1 │ │ ├── PrintingDriver │ │ │ ├── IoCtlSupport.h │ │ │ ├── Makefile │ │ │ ├── ToolFunctions.h │ │ │ ├── ToolFunctions.c │ │ │ ├── DriverFileOperations.h │ │ │ └── DriverMain.h │ │ └── Userapp │ │ │ └── main.cpp │ ├── 2.6 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverMain.h │ │ └── DriverFileOperations.h │ ├── 2.7 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverMain.h │ │ └── DriverFileOperations.h │ ├── 2.9 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── ToolFunctions.c │ │ ├── DriverMain.h │ │ └── DriverFileOperations.h │ ├── 2.10 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverMain.h │ │ ├── ToolFunctions.c │ │ └── DriverFileOperations.h │ ├── 2.11 │ │ ├── PrintingDriver │ │ │ ├── Makefile │ │ │ ├── ToolFunctions.h │ │ │ ├── DriverMain.h │ │ │ ├── ToolFunctions.c │ │ │ └── DriverFileOperations.h │ │ └── UserApp │ │ │ └── main.cpp │ ├── 2.2 │ │ ├── PrintingDriver │ │ │ ├── Makefile │ │ │ ├── ToolFunctions.h │ │ │ ├── DriverMain.h │ │ │ ├── ToolFunctions.c │ │ │ └── DriverFileOperations.h │ │ └── UserApp │ │ │ └── main.cpp │ ├── 2.3 │ │ ├── PrintingDriver │ │ │ ├── Makefile │ │ │ ├── ToolFunctions.h │ │ │ ├── DriverMain.h │ │ │ ├── ToolFunctions.c │ │ │ └── DriverFileOperations.h │ │ └── UserApp │ │ │ └── main.cpp │ ├── 2.4 │ │ ├── PrintingDriver │ │ │ ├── Makefile │ │ │ ├── ToolFunctions.h │ │ │ ├── DriverMain.h │ │ │ ├── ToolFunctions.c │ │ │ └── DriverFileOperations.h │ │ └── UserApp │ │ │ └── main.cpp │ └── 2.5 │ │ ├── PrintingDriver │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverMain.h │ │ ├── ToolFunctions.c │ │ └── DriverFileOperations.h │ │ └── UserApp │ │ └── main.cpp ├── 3 │ ├── 3.1 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ ├── ToolFunctions.h │ │ └── ToolFunctions.c │ ├── 3.2 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ ├── ToolFunctions.h │ │ └── ToolFunctions.c │ ├── 3.3 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ ├── ToolFunctions.h │ │ └── ToolFunctions.c │ ├── 3.4 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ ├── ToolFunctions.h │ │ └── ToolFunctions.c │ ├── 3.5 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ ├── ToolFunctions.h │ │ └── ToolFunctions.c │ ├── 3.6 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ ├── ToolFunctions.h │ │ └── ToolFunctions.c │ ├── 3.7 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ ├── ToolFunctions.h │ │ └── ToolFunctions.c │ ├── 3.8 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ └── ToolFunctions.h │ ├── 3.9 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ └── ToolFunctions.h │ ├── 3.10 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ ├── ToolFunctions.h │ │ └── ToolFunctions.c │ ├── 3.11 │ │ ├── Makefile │ │ ├── DriverMain.h │ │ ├── DriverFileOperations.h │ │ ├── ToolFunctions.h │ │ └── ToolFunctions.c │ ├── 3.12 │ │ ├── Makefile │ │ ├── UserApp │ │ │ └── main.cpp │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ ├── DriverMain.h │ │ └── ToolFunctions.c │ ├── 3.13 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ ├── DriverMain.h │ │ └── ToolFunctions.c │ └── 3.14 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ ├── DriverMain.h │ │ └── ToolFunctions.c ├── 4 │ ├── 4.21 │ │ └── kfree.c │ ├── 4.22 │ │ └── kfree.c │ ├── 4.23 │ │ └── kfree.c │ ├── 4.24 │ │ └── kfree.c │ ├── 4.9 │ │ └── page.c │ ├── 4.13 │ │ └── kmalloc.c │ ├── 4.14 │ │ └── kmalloc.c │ ├── 4.15 │ │ └── kmalloc.c │ ├── 4.16 │ │ └── kmalloc.c │ ├── 4.17 │ │ └── kmalloc.c │ ├── 4.2 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.3 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.4 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.5 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.6 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.7 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.8 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.10 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.11 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.12 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.18 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.19 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.20 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ ├── 4.25 │ │ ├── Makefile │ │ ├── ToolFunctions.h │ │ ├── DriverFileOperations.h │ │ └── DriverMain.h │ └── 4.1 │ │ └── size.c └── 5 │ ├── 5.17 │ └── vfree.c │ ├── 5.8 │ └── find_hole.c │ ├── 5.9 │ └── alloc_pages.c │ ├── 5.4 │ └── virt_addr_valid.c │ ├── 5.13 │ ├── VMallocSpaceMangement.c │ ├── VMallocSpaceMangement.h │ ├── Makefile │ ├── UserApp │ │ └── main.cpp │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.14 │ ├── VMallocSpaceMangement.c │ ├── VMallocSpaceMangement.h │ ├── Makefile │ ├── UserApp │ │ └── main.cpp │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.1 │ ├── IoCtlSupport.h │ ├── Makefile │ ├── ToolFunctions.h │ ├── ToolFunctions.c │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.20 │ └── main.cpp │ ├── 5.2 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.3 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.5 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.6 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.7 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.10 │ ├── Makefile │ ├── UserApp │ │ └── main.cpp │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.11 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.12 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.15 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.16 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ ├── 5.18 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h │ └── 5.19 │ ├── Makefile │ ├── ToolFunctions.h │ ├── DriverFileOperations.h │ └── DriverMain.h ├── zz.appendix └── kernel-api.pdf ├── 002-read_gdtldt └── README.md ├── 004-read_zero-page └── README.md ├── 005-vaddr_to_paddr ├── README.md └── src │ └── tools.c ├── symbol_export ├── README.md └── src │ └── dmesg.log ├── 003-read_boot-params └── README.md ├── SUMMARY.md ├── procfs └── src │ └── Makefile ├── interrupt └── src │ └── Makefile ├── driver_template ├── Makefile ├── UserApp │ └── main.cpp ├── ToolFunctions.h ├── DriverFileOperations.h └── DriverMain.h ├── README.md └── .gitignore /spinlock/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /syscall/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /procfs-read/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bus_device_driver/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mod_with_parameter/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /procfs-read_write/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /register_chrdev/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /register_chrdev_region/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /procfs-open_read_lseek_release/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /procfs-read_write_open_release/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /001-helloworld/README.md: -------------------------------------------------------------------------------- 1 | # 001-helloworld 2 | 3 | -------------------------------------------------------------------------------- /005-read_pfn-page/README.md: -------------------------------------------------------------------------------- 1 | # 004-read_pfn-page 2 | 3 | -------------------------------------------------------------------------------- /code/4/4.21/kfree.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.21/kfree.c -------------------------------------------------------------------------------- /code/4/4.22/kfree.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.22/kfree.c -------------------------------------------------------------------------------- /code/4/4.23/kfree.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.23/kfree.c -------------------------------------------------------------------------------- /code/4/4.24/kfree.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.24/kfree.c -------------------------------------------------------------------------------- /code/4/4.9/page.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.9/page.c -------------------------------------------------------------------------------- /code/5/5.17/vfree.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/5/5.17/vfree.c -------------------------------------------------------------------------------- /code/4/4.13/kmalloc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.13/kmalloc.c -------------------------------------------------------------------------------- /code/4/4.14/kmalloc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.14/kmalloc.c -------------------------------------------------------------------------------- /code/4/4.15/kmalloc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.15/kmalloc.c -------------------------------------------------------------------------------- /code/4/4.16/kmalloc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.16/kmalloc.c -------------------------------------------------------------------------------- /code/4/4.17/kmalloc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/4/4.17/kmalloc.c -------------------------------------------------------------------------------- /code/5/5.8/find_hole.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/5/5.8/find_hole.c -------------------------------------------------------------------------------- /code/5/5.9/alloc_pages.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/5/5.9/alloc_pages.c -------------------------------------------------------------------------------- /zz.appendix/kernel-api.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/zz.appendix/kernel-api.pdf -------------------------------------------------------------------------------- /code/5/5.4/virt_addr_valid.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/5/5.4/virt_addr_valid.c -------------------------------------------------------------------------------- /code/5/5.13/VMallocSpaceMangement.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/5/5.13/VMallocSpaceMangement.c -------------------------------------------------------------------------------- /code/5/5.14/VMallocSpaceMangement.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yifengyou/linux-kernel-driver/HEAD/code/5/5.14/VMallocSpaceMangement.c -------------------------------------------------------------------------------- /002-read_gdtldt/README.md: -------------------------------------------------------------------------------- 1 | # read_gdtldt kernel module 2 | 3 | * 功能: 待录入 4 | * 创建时间: 2022-09-10 11:09:05 5 | 6 | --- 7 | 8 | 9 | 10 | 11 | --- 12 | 13 | -------------------------------------------------------------------------------- /004-read_zero-page/README.md: -------------------------------------------------------------------------------- 1 | # zero_page kernel module 2 | 3 | * 功能: 待录入 4 | * 创建时间: 2022-09-11 17:38:07 5 | 6 | --- 7 | 8 | 9 | 10 | 11 | --- 12 | 13 | -------------------------------------------------------------------------------- /005-vaddr_to_paddr/README.md: -------------------------------------------------------------------------------- 1 | # zero_page kernel module 2 | 3 | * 功能: 待录入 4 | * 创建时间: 2022-09-11 17:38:07 5 | 6 | --- 7 | 8 | 9 | 10 | 11 | --- 12 | 13 | -------------------------------------------------------------------------------- /symbol_export/README.md: -------------------------------------------------------------------------------- 1 | # symbol_export kernel module 2 | 3 | * 功能: 待录入 4 | * 创建时间: 2023-06-02 20:21:22 5 | 6 | --- 7 | 8 | 9 | 10 | 11 | --- 12 | 13 | -------------------------------------------------------------------------------- /005-vaddr_to_paddr/src/tools.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void 6 | GetVaddrInfo() 7 | { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /003-read_boot-params/README.md: -------------------------------------------------------------------------------- 1 | # 002-read_zero-page 2 | 3 | * 功能: 读取0号页面 4 | * 创建时间: 2022-09-08 17:15:48 5 | 6 | 7 | https://01.org/linuxgraphics/gfx-docs/drm/x86/zero-page.html 8 | 9 | 10 | --- 11 | -------------------------------------------------------------------------------- /code/5/5.13/VMallocSpaceMangement.h: -------------------------------------------------------------------------------- 1 | #ifndef VMallocSpaceMangement_H 2 | #define VMallocSpaceMangement_H 3 | 4 | void *VMallocAtAddr(unsigned long addr, unsigned long size); 5 | void VMallocAtAddrInitialize(void); 6 | 7 | #endif -------------------------------------------------------------------------------- /code/5/5.14/VMallocSpaceMangement.h: -------------------------------------------------------------------------------- 1 | #ifndef VMallocSpaceMangement_H 2 | #define VMallocSpaceMangement_H 3 | 4 | void *VMallocAtAddr(unsigned long addr, unsigned long size); 5 | void VMallocAtAddrInitialize(void); 6 | 7 | #endif -------------------------------------------------------------------------------- /code/5/5.1/IoCtlSupport.h: -------------------------------------------------------------------------------- 1 | #ifndef IOCTLSUPPORT_H 2 | #define IOCTLSUPPORT_H 3 | 4 | #define PRINTER_IOC_MAGIC 'p' 5 | 6 | #define PRINTER_WRITE _IOW(PRINTER_IOC_MAGIC, 0, long) 7 | 8 | #define PRINTER_IOC_MAXNR 1 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /code/2/2.1/PrintingDriver/IoCtlSupport.h: -------------------------------------------------------------------------------- 1 | #ifndef IOCTLSUPPORT_H 2 | #define IOCTLSUPPORT_H 3 | 4 | #define PRINTER_IOC_MAGIC 'p' 5 | 6 | #define PRINTER_WRITE _IOW(PRINTER_IOC_MAGIC, 0, long) 7 | 8 | #define PRINTER_IOC_MAXNR 1 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [Introduction](README.md) 4 | * [001-helloworld](001-helloworld/README.md) 5 | * [002-read_zero-page](002-read_zero-page/README.md) 6 | * [003-read_gdtldt](003-read_gdtldt/README.md) 7 | * [004-read_pfn-page](004-read_pfn-page/README.md) 8 | 9 | -------------------------------------------------------------------------------- /procfs/src/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := procfs.o 2 | 3 | KERNEL_VER = $(shell uname -r) 4 | #EXTRA_CFLAGS = -g -O0 5 | 6 | default: kernel_modules 7 | 8 | kernel_modules: 9 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) modules 10 | 11 | clean: 12 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) clean 13 | -------------------------------------------------------------------------------- /spinlock/src/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := spinlock.o 2 | 3 | KERNEL_VER = $(shell uname -r) 4 | EXTRA_CFLAGS = -g -O0 5 | 6 | default: kernel_modules 7 | 8 | kernel_modules: 9 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) modules 10 | 11 | clean: 12 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) clean 13 | -------------------------------------------------------------------------------- /syscall/src/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := syscall.o 2 | 3 | KERNEL_VER = $(shell uname -r) 4 | EXTRA_CFLAGS = -g -O0 5 | 6 | default: kernel_modules 7 | 8 | kernel_modules: 9 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) modules 10 | 11 | clean: 12 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) clean 13 | -------------------------------------------------------------------------------- /interrupt/src/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := interrupt.o 2 | 3 | KERNEL_VER = $(shell uname -r) 4 | EXTRA_CFLAGS = -g -O0 5 | 6 | default: kernel_modules 7 | 8 | kernel_modules: 9 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) modules 10 | 11 | clean: 12 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) clean 13 | -------------------------------------------------------------------------------- /procfs-read/src/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := procfs1.o 2 | 3 | KERNEL_VER = $(shell uname -r) 4 | EXTRA_CFLAGS = -g -O0 5 | 6 | default: kernel_modules 7 | 8 | kernel_modules: 9 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) modules 10 | 11 | clean: 12 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) clean 13 | -------------------------------------------------------------------------------- /procfs-read_write/src/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := procfs2.o 2 | 3 | KERNEL_VER = $(shell uname -r) 4 | EXTRA_CFLAGS = -g -O0 5 | 6 | default: kernel_modules 7 | 8 | kernel_modules: 9 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) modules 10 | 11 | clean: 12 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) clean 13 | -------------------------------------------------------------------------------- /bus_device_driver/src/simple_bus.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | struct sb_device { 8 | char* name; 9 | struct device dev; 10 | }; 11 | 12 | struct sb_driver { 13 | struct device_driver driver; 14 | }; 15 | -------------------------------------------------------------------------------- /code/5/5.20/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main(int argc, char *argv[], char *envp[]) 13 | { 14 | sleep(60); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /procfs-open_read_lseek_release/src/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := procfs4.o 2 | 3 | KERNEL_VER = $(shell uname -r) 4 | EXTRA_CFLAGS = -g -O1 5 | 6 | default: kernel_modules 7 | 8 | kernel_modules: 9 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) modules 10 | 11 | clean: 12 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) clean 13 | -------------------------------------------------------------------------------- /procfs-read_write_open_release/src/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := procfs3.o 2 | 3 | KERNEL_VER = $(shell uname -r) 4 | EXTRA_CFLAGS = -g -O1 5 | 6 | default: kernel_modules 7 | 8 | kernel_modules: 9 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) modules 10 | 11 | clean: 12 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) clean 13 | -------------------------------------------------------------------------------- /bus_device_driver/src/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += simple_bus.o xxx_chip.o xxx_chip_drv.o 2 | 3 | KERNEL_VER = $(shell uname -r) 4 | #EXTRA_CFLAGS = -g -O0 5 | 6 | default: kernel_modules 7 | 8 | kernel_modules: 9 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) modules 10 | 11 | clean: 12 | make -C /lib/modules/$(KERNEL_VER)/build M=$(CURDIR) clean 13 | -------------------------------------------------------------------------------- /code/5/5.1/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DNVM_DEBUG 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd 11 | endif 12 | -------------------------------------------------------------------------------- /code/1/1.2/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR = /root/kernelsrc/linux-3.13 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/2/2.6/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR = /root/kernelsrc/linux-3.13 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/2/2.1/PrintingDriver/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DNVM_DEBUG 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd 11 | endif 12 | -------------------------------------------------------------------------------- /code/1/1.2/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #ifdef TEST_DEBUG 5 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 6 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 7 | #else 8 | #define DEBUG_PRINT_LINE(...) 9 | #define DEBUG_PRINT(...) 10 | #endif 11 | 12 | #endif -------------------------------------------------------------------------------- /code/1/1.3/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O2 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/1/1.3/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #ifdef TEST_DEBUG 5 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 6 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 7 | #else 8 | #define DEBUG_PRINT_LINE(...) 9 | #define DEBUG_PRINT(...) 10 | #endif 11 | 12 | #endif -------------------------------------------------------------------------------- /code/2/2.6/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #ifdef TEST_DEBUG 5 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 6 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 7 | #else 8 | #define DEBUG_PRINT_LINE(...) 9 | #define DEBUG_PRINT(...) 10 | #endif 11 | 12 | #endif -------------------------------------------------------------------------------- /code/2/2.7/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR = /root/kernelsrc/linux-3.13 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/2/2.9/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR = /root/kernelsrc/linux-3.13 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/1/1.1/PrintingDriver/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/1/1.1/PrintingDriver/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #ifdef TEST_DEBUG 5 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 6 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 7 | #else 8 | #define DEBUG_PRINT_LINE(...) 9 | #define DEBUG_PRINT(...) 10 | #endif 11 | 12 | #endif -------------------------------------------------------------------------------- /code/2/2.10/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/2/2.11/PrintingDriver/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/2/2.2/PrintingDriver/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/2/2.3/PrintingDriver/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/2/2.4/PrintingDriver/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /code/2/2.5/PrintingDriver/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | PWD := $(shell pwd) 8 | default: 9 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 10 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 11 | endif 12 | -------------------------------------------------------------------------------- /register_chrdev/src/Makefile: -------------------------------------------------------------------------------- 1 | ENTRY := chardev 2 | obj-m := $(ENTRY).o 3 | KERNEL_VER = $(shell uname -r) 4 | default: build_module 5 | 6 | build_module: 7 | make -C /lib/modules/$(KERNEL_VER)/build M=$(PWD) modules 8 | ls -alh *.ko 9 | 10 | clean: 11 | make -C /lib/modules/$(KERNEL_VER)/build M=$(PWD) clean 12 | 13 | insmod: 14 | dmesg --clear 15 | insmod $(ENTRY).ko &> /dev/null && dmesg 16 | 17 | rmmod: 18 | rmmod $(ENTRY) && dmesg 19 | -------------------------------------------------------------------------------- /register_chrdev_region/src/Makefile: -------------------------------------------------------------------------------- 1 | ENTRY := register_chrdev_region 2 | obj-m := $(ENTRY).o 3 | KERNEL_VER = $(shell uname -r) 4 | default: build_module 5 | 6 | build_module: 7 | make -C /lib/modules/$(KERNEL_VER)/build M=$(PWD) modules 8 | ls -alh *.ko 9 | 10 | clean: 11 | make -C /lib/modules/$(KERNEL_VER)/build M=$(PWD) clean 12 | 13 | insmod: 14 | dmesg --clear 15 | insmod $(ENTRY).ko &> /dev/null && dmesg 16 | 17 | rmmod: 18 | rmmod $(ENTRY) && dmesg 19 | -------------------------------------------------------------------------------- /code/3/3.1/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.2/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.3/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.4/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.5/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.6/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.7/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.8/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.9/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.2/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.3/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.4/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.5/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.6/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.7/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.8/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.2/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.3/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.5/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.6/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.7/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.10/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.11/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.12/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.13/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/3/3.14/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.10/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.11/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.12/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.18/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.19/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.20/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/4/4.25/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.10/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.11/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.12/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.15/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.16/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.18/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.19/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /driver_template/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/2/2.7/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #ifdef TEST_DEBUG 5 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 6 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 7 | #else 8 | #define DEBUG_PRINT_LINE(...) 9 | #define DEBUG_PRINT(...) 10 | #endif 11 | 12 | int SetPageReadAndWriteAttribute(unsigned long ulAddress); 13 | 14 | #endif -------------------------------------------------------------------------------- /code/2/2.9/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #ifdef TEST_DEBUG 5 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 6 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 7 | #else 8 | #define DEBUG_PRINT_LINE(...) 9 | #define DEBUG_PRINT(...) 10 | #endif 11 | 12 | int SetPageReadAndWriteAttribute(unsigned long ulAddress); 13 | 14 | #endif -------------------------------------------------------------------------------- /code/5/5.13/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o VMallocSpaceMangement.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/5/5.14/Makefile: -------------------------------------------------------------------------------- 1 | ifneq ($(KERNELRELEASE),) 2 | obj-m := PrintModule.o 3 | PrintModule-objs := DriverMain.o DriverFileOperations.o ToolFunctions.o VMallocSpaceMangement.o 4 | EXTRA_CFLAGS := -DTEST_DEBUG -ggdb -O0 5 | else 6 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build 7 | #KERNELDIR ?= /root/kernelsrc/linux-3.13 8 | PWD := $(shell pwd) 9 | default: 10 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 11 | rm *.order *.symvers *.mod.c *.o .*.o.cmd .*.cmd .tmp_versions -rf 12 | endif 13 | -------------------------------------------------------------------------------- /code/2/2.9/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | int SetPageReadAndWriteAttribute(unsigned long addr) 6 | { 7 | pgd_t *pgd; 8 | pud_t *pud; 9 | pmd_t *pmd; 10 | pte_t *pte; 11 | 12 | pgd = pgd_offset(current->mm, addr); 13 | 14 | pud = pud_offset(pgd, addr); 15 | 16 | pmd = pmd_offset(pud, addr); 17 | 18 | pte = pte_offset_kernel(pmd, addr); 19 | 20 | pte->pte = pte->pte | 0x2UL; 21 | 22 | return 0; 23 | } -------------------------------------------------------------------------------- /code/5/5.1/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef NVM_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | void MEM_PRINT(unsigned long addr, unsigned long size); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.10/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | void MEM_PRINT(unsigned long addr, unsigned long size); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.1/PrintingDriver/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef NVM_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | void MEM_PRINT(unsigned long addr, unsigned long size); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.2/PrintingDriver/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | void MEM_PRINT(unsigned long addr, unsigned long size); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.3/PrintingDriver/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | void MEM_PRINT(unsigned long addr, unsigned long size); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.4/PrintingDriver/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | void MEM_PRINT(unsigned long addr, unsigned long size); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.5/PrintingDriver/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | void MEM_PRINT(unsigned long addr, unsigned long size); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.11/PrintingDriver/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | void MEM_PRINT(unsigned long addr, unsigned long size); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/1/1.2/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/1/1.3/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.10/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.6/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.7/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.9/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/5/5.1/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include "ToolFunctions.h" 2 | 3 | void MEM_PRINT(unsigned long addr, unsigned long size) 4 | { 5 | unsigned long i, j; 6 | unsigned char *p = (unsigned char *)addr; 7 | 8 | for(i = 0; i < size; ) 9 | { 10 | printk("%lx:\t", (unsigned long)p); 11 | 12 | for(j = 0; j < 8; j++) 13 | { 14 | if(i + j >= size) 15 | break; 16 | 17 | if(*(p+j) <= 0xf) 18 | printk("0%x ", *(p+j)); 19 | else 20 | printk("%x ", *(p+j)); 21 | } 22 | 23 | printk("\n"); 24 | 25 | i = i + 8; 26 | p = p + 8; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /code/1/1.1/PrintingDriver/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.10/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include "ToolFunctions.h" 2 | 3 | void MEM_PRINT(unsigned long addr, unsigned long size) 4 | { 5 | unsigned long i, j; 6 | unsigned char *p = (unsigned char *)addr; 7 | 8 | for(i = 0; i < size; ) 9 | { 10 | printk("%lx:\t", (unsigned long)p); 11 | 12 | for(j = 0; j < 8; j++) 13 | { 14 | if(i + j >= size) 15 | break; 16 | 17 | if(*(p+j) <= 0xf) 18 | printk("0%x ", *(p+j)); 19 | else 20 | printk("%x ", *(p+j)); 21 | } 22 | 23 | printk("\n"); 24 | 25 | i = i + 8; 26 | p = p + 8; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /code/2/2.11/PrintingDriver/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.2/PrintingDriver/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.3/PrintingDriver/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.4/PrintingDriver/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.5/PrintingDriver/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define DEVICE_NAME "msg_printer" 13 | 14 | struct SLDriverParameters 15 | { 16 | struct class *pslDriverClass; 17 | dev_t uiDeviceNumber; 18 | struct cdev slCharDevice; 19 | }; 20 | 21 | extern struct SLDriverParameters gslDriverParameters; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /code/2/2.1/PrintingDriver/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include "ToolFunctions.h" 2 | 3 | void MEM_PRINT(unsigned long addr, unsigned long size) 4 | { 5 | unsigned long i, j; 6 | unsigned char *p = (unsigned char *)addr; 7 | 8 | for(i = 0; i < size; ) 9 | { 10 | printk("%lx:\t", (unsigned long)p); 11 | 12 | for(j = 0; j < 8; j++) 13 | { 14 | if(i + j >= size) 15 | break; 16 | 17 | if(*(p+j) <= 0xf) 18 | printk("0%x ", *(p+j)); 19 | else 20 | printk("%x ", *(p+j)); 21 | } 22 | 23 | printk("\n"); 24 | 25 | i = i + 8; 26 | p = p + 8; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /code/2/2.2/PrintingDriver/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include "ToolFunctions.h" 2 | 3 | void MEM_PRINT(unsigned long addr, unsigned long size) 4 | { 5 | unsigned long i, j; 6 | unsigned char *p = (unsigned char *)addr; 7 | 8 | for(i = 0; i < size; ) 9 | { 10 | printk("%lx:\t", (unsigned long)p); 11 | 12 | for(j = 0; j < 8; j++) 13 | { 14 | if(i + j >= size) 15 | break; 16 | 17 | if(*(p+j) <= 0xf) 18 | printk("0%x ", *(p+j)); 19 | else 20 | printk("%x ", *(p+j)); 21 | } 22 | 23 | printk("\n"); 24 | 25 | i = i + 8; 26 | p = p + 8; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /code/2/2.3/PrintingDriver/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include "ToolFunctions.h" 2 | 3 | void MEM_PRINT(unsigned long addr, unsigned long size) 4 | { 5 | unsigned long i, j; 6 | unsigned char *p = (unsigned char *)addr; 7 | 8 | for(i = 0; i < size; ) 9 | { 10 | printk("%lx:\t", (unsigned long)p); 11 | 12 | for(j = 0; j < 8; j++) 13 | { 14 | if(i + j >= size) 15 | break; 16 | 17 | if(*(p+j) <= 0xf) 18 | printk("0%x ", *(p+j)); 19 | else 20 | printk("%x ", *(p+j)); 21 | } 22 | 23 | printk("\n"); 24 | 25 | i = i + 8; 26 | p = p + 8; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /code/2/2.4/PrintingDriver/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include "ToolFunctions.h" 2 | 3 | void MEM_PRINT(unsigned long addr, unsigned long size) 4 | { 5 | unsigned long i, j; 6 | unsigned char *p = (unsigned char *)addr; 7 | 8 | for(i = 0; i < size; ) 9 | { 10 | printk("%lx:\t", (unsigned long)p); 11 | 12 | for(j = 0; j < 8; j++) 13 | { 14 | if(i + j >= size) 15 | break; 16 | 17 | if(*(p+j) <= 0xf) 18 | printk("0%x ", *(p+j)); 19 | else 20 | printk("%x ", *(p+j)); 21 | } 22 | 23 | printk("\n"); 24 | 25 | i = i + 8; 26 | p = p + 8; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /code/2/2.5/PrintingDriver/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include "ToolFunctions.h" 2 | 3 | void MEM_PRINT(unsigned long addr, unsigned long size) 4 | { 5 | unsigned long i, j; 6 | unsigned char *p = (unsigned char *)addr; 7 | 8 | for(i = 0; i < size; ) 9 | { 10 | printk("%lx:\t", (unsigned long)p); 11 | 12 | for(j = 0; j < 8; j++) 13 | { 14 | if(i + j >= size) 15 | break; 16 | 17 | if(*(p+j) <= 0xf) 18 | printk("0%x ", *(p+j)); 19 | else 20 | printk("%x ", *(p+j)); 21 | } 22 | 23 | printk("\n"); 24 | 25 | i = i + 8; 26 | p = p + 8; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /code/2/2.11/PrintingDriver/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include "ToolFunctions.h" 2 | 3 | void MEM_PRINT(unsigned long addr, unsigned long size) 4 | { 5 | unsigned long i, j; 6 | unsigned char *p = (unsigned char *)addr; 7 | 8 | for(i = 0; i < size; ) 9 | { 10 | printk("%lx:\t", (unsigned long)p); 11 | 12 | for(j = 0; j < 8; j++) 13 | { 14 | if(i + j >= size) 15 | break; 16 | 17 | if(*(p+j) <= 0xf) 18 | printk("0%x ", *(p+j)); 19 | else 20 | printk("%x ", *(p+j)); 21 | } 22 | 23 | printk("\n"); 24 | 25 | i = i + 8; 26 | p = p + 8; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /code/3/3.1/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define DEVICE_NAME "msg_printer" 14 | 15 | struct SLDriverParameters 16 | { 17 | struct class *pslDriverClass; 18 | dev_t uiDeviceNumber; 19 | struct cdev slCharDevice; 20 | }; 21 | 22 | extern struct SLDriverParameters gslDriverParameters; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /code/3/3.10/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /code/3/3.11/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /code/3/3.2/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /code/3/3.3/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /code/3/3.4/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /code/3/3.5/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /code/3/3.6/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /code/3/3.7/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /code/3/3.8/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /code/3/3.9/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | }; 22 | 23 | extern struct SLDriverParameters gslDriverParameters; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /symbol_export/src/dmesg.log: -------------------------------------------------------------------------------- 1 | [13682.341888] symbol_export: loading out-of-tree module taints kernel. 2 | [13682.342070] symbol_export: module verification failed: signature and/or required key missing - tainting kernel 3 | [13682.343033] symbol_export module loaded 4 | [13682.343035] This is func_t 5 | [13682.343038] var_D = 42 6 | [13682.343040] var_d = 24 7 | [13682.343041] var_R = 100 8 | [13682.343042] var_r = 200 9 | [13682.343044] var_A = 1234 10 | [13682.343045] var_a = 4321 11 | [13682.343046] var_B = 0 12 | [13682.343048] var_b = 0 13 | [13682.343049] var_G = 10 14 | [13682.343050] var_C = 20 15 | [13682.343051] var_W = 30 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # linux kernel driver 2 | 3 | ``` 4 | Something I hope you know before go into the coding~ 5 | First, please watch or star this repo, I'll be more happy if you follow me. 6 | Bug report, questions and discussion are welcome, you can post an issue or pull a request. 7 | ``` 8 | 9 | 10 | # 目录 11 | 12 | * [001-helloworld](001-helloworld/README.md) 13 | * [002-read_zero-page](002-read_zero-page/README.md) 14 | * [003-read_gdtldt](003-read_gdtldt/README.md) 15 | * [004-read_pfn-page](004-read_pfn-page/README.md) 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | --- 35 | -------------------------------------------------------------------------------- /code/1/1.1/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /code/2/2.11/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /code/2/2.2/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /code/2/2.3/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /code/2/2.4/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /code/3/3.12/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /code/5/5.10/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /code/5/5.13/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /code/5/5.14/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /driver_template/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | int fd = 0; 15 | int ret; 16 | 17 | string toSend = "hello driver"; 18 | 19 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 20 | { 21 | cerr << strerror(errno) << endl; 22 | return -1; 23 | } 24 | 25 | ret = write(fd, toSend.c_str(), toSend.size()); 26 | if(ret < 0) 27 | { 28 | cerr << strerror(errno) << endl; 29 | close(fd); 30 | return -1; 31 | } 32 | 33 | close(fd); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /code/1/1.2/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/1/1.3/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.10/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.6/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.7/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.9/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.1/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.10/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.11/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.2/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.3/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.4/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.5/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.6/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.7/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.8/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.9/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/5/5.1/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/3/3.1/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.10/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.11/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.12/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.13/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.14/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.2/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.3/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.4/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.5/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.6/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.7/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.8/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.9/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.10/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.11/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.12/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.18/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.19/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.2/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.20/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.25/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.3/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.4/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.5/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.6/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.7/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/4/4.8/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.10/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.11/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.12/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.13/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.14/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.15/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.16/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.18/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.19/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.2/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.3/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.5/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.6/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/5/5.7/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/1/1.1/PrintingDriver/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.1/PrintingDriver/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.1/PrintingDriver/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define DEVICE_NAME "msg_printer" 14 | 15 | struct SLDriverParameters 16 | { 17 | struct class *pslDriverClass; 18 | dev_t uiDeviceNumber; 19 | struct cdev slCharDevice; 20 | 21 | unsigned long ulNVMStartPhyAddr; 22 | unsigned long ulNVMSize; 23 | unsigned long ulNVMKernelVirtualAddr; 24 | }; 25 | 26 | extern struct SLDriverParameters gslDriverParameters; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /code/2/2.11/PrintingDriver/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.2/PrintingDriver/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.3/PrintingDriver/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.4/PrintingDriver/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /code/2/2.5/PrintingDriver/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 5 | 6 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 9 | 10 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 13 | 14 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /driver_template/ToolFunctions.h: -------------------------------------------------------------------------------- 1 | #ifndef ToolFunctions_H 2 | #define ToolFunctions_H 3 | 4 | #include 5 | 6 | #ifdef TEST_DEBUG 7 | #define DEBUG_PRINT_LINE(...) do{printk(KERN_ALERT "ErrLine : %s::%d\nErrorInfo : ", __FILE__, __LINE__); printk(KERN_ALERT __VA_ARGS__);}while(0) 8 | #define DEBUG_PRINT(...) printk(KERN_ALERT __VA_ARGS__) 9 | #else 10 | #define DEBUG_PRINT_LINE(...) 11 | #define DEBUG_PRINT(...) 12 | #endif 13 | 14 | #ifdef TEST_DEBUG 15 | void MEM_PRINT(unsigned long addr, unsigned long size); 16 | void SetPageReadAndWriteAttribute(unsigned long ulAddress); 17 | #else 18 | #define MEM_PRINT(x, y) 19 | #define SetPageReadAndWriteAttribute(x) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /code/3/3.12/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/3/3.13/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/3/3.14/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.10/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.11/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.12/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.18/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.19/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.2/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.20/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.25/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.3/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.4/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.5/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.6/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.7/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/4/4.8/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.1/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define DEVICE_NAME "msg_printer" 15 | 16 | struct SLDriverParameters 17 | { 18 | struct class *pslDriverClass; 19 | dev_t uiDeviceNumber; 20 | struct cdev slCharDevice; 21 | 22 | unsigned long ulNVMStartPhyAddr; 23 | unsigned long ulNVMSize; 24 | unsigned long ulNVMKernelVirtualAddr; 25 | }; 26 | 27 | extern struct SLDriverParameters gslDriverParameters; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /code/5/5.10/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.11/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.12/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.13/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.14/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.15/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.16/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.18/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.19/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.2/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.3/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.5/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.6/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/5/5.7/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /bus_device_driver/src/xxx_chip_drv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "simple_bus.h" 7 | 8 | 9 | extern int register_sb_driver(struct sb_driver *sdrv); 10 | extern void unregister_sb_driver(struct sb_driver *sdrv); 11 | 12 | static struct sb_driver sculld_driver = { 13 | .driver = { 14 | .name = "chip", 15 | }, 16 | }; 17 | 18 | int xxx_chipdrv_init(void) 19 | { 20 | return register_sb_driver(&sculld_driver); 21 | } 22 | 23 | void xxx_chipdrv_cleanup(void) 24 | { 25 | unregister_sb_driver(&sculld_driver); 26 | } 27 | 28 | module_init(xxx_chipdrv_init); 29 | module_exit(xxx_chipdrv_cleanup); 30 | MODULE_LICENSE("GPL"); 31 | -------------------------------------------------------------------------------- /driver_template/DriverFileOperations.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverFileOperations_H 2 | #define DriverFileOperations_H 3 | 4 | #include "DriverMain.h" 5 | 6 | int DriverOpen(struct inode *pslINode, struct file *pslFileStruct); 7 | 8 | int DriverClose(struct inode *pslINode, struct file *pslFileStruct); 9 | 10 | ssize_t DriverRead(struct file *pslFileStruct, char __user *pBuffer, size_t nCount, loff_t *pOffset); 11 | 12 | ssize_t DriverWrite(struct file *pslFileStruct, const char __user *pBuffer, size_t nCount, loff_t *pOffset); 13 | 14 | long DriverIOControl(struct file *pslFileStruct, unsigned int uiCmd, unsigned long ulArg); 15 | 16 | int DriverMMap(struct file *pslFileStruct, struct vm_area_struct *pslVirtualMemoryArea); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /code/3/3.12/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/3/3.13/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/3/3.14/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.10/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.11/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.12/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.18/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.19/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.2/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.20/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.25/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.3/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.4/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.5/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.6/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.7/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/4/4.8/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.10/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.11/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.12/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.13/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.14/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.15/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.16/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.18/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.19/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.2/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.3/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.5/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.6/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/5/5.7/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode* 2 | 3 | 4 | # kernel module 5 | modules.order 6 | Module.symvers 7 | *.cmd 8 | *.swp 9 | 10 | # Prerequisites 11 | *.d 12 | 13 | # Object files 14 | *.o 15 | *.ko 16 | *.obj 17 | *.elf 18 | 19 | # Linker output 20 | *.ilk 21 | *.map 22 | *.exp 23 | 24 | # Precompiled Headers 25 | *.gch 26 | *.pch 27 | 28 | # Libraries 29 | *.lib 30 | *.a 31 | *.la 32 | *.lo 33 | 34 | # Shared objects (inc. Windows DLLs) 35 | *.dll 36 | *.so 37 | *.so.* 38 | *.dylib 39 | 40 | # Executables 41 | *.exe 42 | *.out 43 | *.app 44 | *.i*86 45 | *.x86_64 46 | *.hex 47 | 48 | # Debug files 49 | *.dSYM/ 50 | *.su 51 | *.idb 52 | *.pdb 53 | 54 | # Kernel Module Compile Results 55 | *.mod* 56 | *.cmd 57 | .tmp_versions/ 58 | modules.order 59 | Module.symvers 60 | Mkfile.old 61 | dkms.conf 62 | -------------------------------------------------------------------------------- /driver_template/DriverMain.h: -------------------------------------------------------------------------------- 1 | #ifndef DriverMain_H 2 | #define DriverMain_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define DEVICE_NAME "msg_printer" 20 | 21 | struct SLDriverParameters 22 | { 23 | struct class *pslDriverClass; 24 | dev_t uiDeviceNumber; 25 | struct cdev slCharDevice; 26 | }; 27 | 28 | extern struct SLDriverParameters gslDriverParameters; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /code/2/2.5/UserApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | __thread int x = 5; 13 | 14 | int main() 15 | { 16 | int fd = 0; 17 | int ret; 18 | 19 | x++; 20 | 21 | unsigned long addr = (unsigned long)(&x); 22 | 23 | cout << hex << addr << endl; 24 | 25 | string toSend = "hello driver"; 26 | 27 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 28 | { 29 | cerr << strerror(errno) << endl; 30 | return -1; 31 | } 32 | 33 | ret = write(fd, toSend.c_str(), toSend.size()); 34 | if(ret < 0) 35 | { 36 | cerr << strerror(errno) << endl; 37 | close(fd); 38 | return -1; 39 | } 40 | 41 | close(fd); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /005-read_pfn-page/src/pfn_page.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static int __init pfn_page_init(void) 6 | { 7 | printk(KERN_INFO "--------------------------------------------\n"); 8 | printk(KERN_INFO "Loading pfn_page Module\n"); 9 | printk(KERN_INFO "file:%s func:%s line:%d\n",__FILE__,__func__,__LINE__); 10 | return 0; 11 | } 12 | 13 | static void __exit pfn_page_exit(void) 14 | { 15 | printk(KERN_INFO "--------------------------------------------\n"); 16 | printk(KERN_INFO "Removing pfn_page Module\n"); 17 | printk(KERN_INFO "file:%s func:%s line:%d\n",__FILE__,__func__,__LINE__); 18 | } 19 | 20 | module_init(pfn_page_init); 21 | module_exit(pfn_page_exit); 22 | 23 | MODULE_LICENSE("GPL"); 24 | MODULE_DESCRIPTION("pfn_page Module"); 25 | MODULE_AUTHOR("nicyou"); 26 | -------------------------------------------------------------------------------- /code/4/4.1/size.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Figure out which kmalloc slab an allocation of a certain size 3 | * belongs to. 4 | * 0 = zero alloc 5 | * 1 = 65 .. 96 bytes 6 | * 2 = 120 .. 192 bytes 7 | * n = 2^(n-1) .. 2^n -1 8 | */ 9 | static __always_inline int kmalloc_index(size_t size) 10 | { 11 | if (!size) 12 | return 0; 13 | 14 | if (size > 64 && size <= 96) 15 | return 1; 16 | 17 | if (size > 128 && size <= 192) 18 | return 2; 19 | 20 | if (size <= 8) return 3; 21 | if (size <= 16) return 4; 22 | if (size <= 32) return 5; 23 | if (size <= 64) return 6; 24 | if (size <= 128) return 7; 25 | if (size <= 256) return 8; 26 | if (size <= 512) return 9; 27 | if (size <= 1024) return 10; 28 | if (size <= 2 * 1024) return 11; 29 | if (size <= 4 * 1024) return 12; 30 | if (size <= 8 * 1024) return 13; 31 | 32 | return -1; 33 | } -------------------------------------------------------------------------------- /code/2/2.1/Userapp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "../PrintingDriver/IoCtlSupport.h" 10 | 11 | using namespace std; 12 | 13 | int main() 14 | { 15 | int fd = 0; 16 | int ret; 17 | unsigned short cs, ds, ss; 18 | 19 | string toSend = "hello driver"; 20 | 21 | if((fd = open("/dev/msg_printer", O_RDWR)) < 0) 22 | { 23 | cerr << strerror(errno) << endl; 24 | return -1; 25 | } 26 | 27 | asm volatile ("mov %%cs, %0 \n\t" : "=m"(cs)); 28 | asm volatile ("mov %%ds, %0 \n\t" : "=m"(ds)); 29 | asm volatile ("mov %%ss, %0 \n\t" : "=m"(ss)); 30 | 31 | cout << "cs : " << hex << cs << endl; 32 | cout << "ds : " << hex << ds << endl; 33 | cout << "ss : " << hex << ss << endl; 34 | 35 | ret = write(fd, toSend.c_str(), toSend.size()); 36 | if(ret < 0) 37 | { 38 | cerr << strerror(errno) << endl; 39 | return -1; 40 | } 41 | 42 | close(ret); 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /code/3/3.1/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.10/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.11/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.12/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.13/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.14/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.2/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.3/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.4/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.5/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.6/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /code/3/3.7/ToolFunctions.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ToolFunctions.h" 4 | 5 | #ifdef TEST_DEBUG 6 | 7 | void MEM_PRINT(unsigned long addr, unsigned long size) 8 | { 9 | unsigned long i, j; 10 | unsigned char *p = (unsigned char *)addr; 11 | 12 | for(i = 0; i < size; ) 13 | { 14 | printk("%lx:\t", (unsigned long)p); 15 | 16 | for(j = 0; j < 8; j++) 17 | { 18 | if(i + j >= size) 19 | break; 20 | 21 | if(*(p+j) <= 0xf) 22 | printk("0%x ", *(p+j)); 23 | else 24 | printk("%x ", *(p+j)); 25 | } 26 | 27 | printk("\n"); 28 | 29 | i = i + 8; 30 | p = p + 8; 31 | } 32 | } 33 | 34 | void SetPageReadAndWriteAttribute(unsigned long addr) 35 | { 36 | pgd_t *pgd; 37 | pud_t *pud; 38 | pmd_t *pmd; 39 | pte_t *pte; 40 | 41 | pgd = pgd_offset(current->mm, addr); 42 | 43 | pud = pud_offset(pgd, addr); 44 | 45 | pmd = pmd_offset(pud, addr); 46 | 47 | pte = pte_offset_kernel(pmd, addr); 48 | 49 | pte->pte = pte->pte | 0x2UL; 50 | } 51 | 52 | #endif 53 | --------------------------------------------------------------------------------