摘要:摘要:linux设备驱动程序第三版第三章笔记1.scull:simple character utility for loading localities.2.scull0-scull3: 4个global and persistent设备,映射到的物理内存区是不会消失的。 scullpipe0-scullpipe3:4个FIFO设备,一个进程读一个进程写。3.主次编号: 3.1 major number标志了设备相联系的driver。 minor number用来决定引用了哪个设备。 3.2 设备编号内部表示: dev_t类型<linux/types.h>中含有设备编号 获得d.
阅读全文
摘要:1.MIPS (Microprocessor without Interlocked Pipeline Stages):(1) Define a control register set as well as the instruction set.(2) RISC(3) Features about assembly language: a) Integer: there are 32 integer registers b) Floating point : has 32 floating-point, two registers paired for double precision..
阅读全文
摘要:1.按F6打开键映射(在~/.vim/macros/gdb_mapping.vim中修改)2.空格打开command_line窗口 输入:cd ** file nachos回车,就可以看到调试窗口了3.ctrl+B设置断点 ctrl+N //next R //run S //step C //continue4.跟踪变量: :bel 20vsplit gdb-variables //分割出gdb-variables窗口 然后用”v“命令选中变量i,按”CTRL-P“命令,把变量i加入到监视窗口 输入下面的命令,把变量*r输入到变量窗口: c...
阅读全文
摘要:1.内核导出符号用EXPORT_SYMBOL()或者EXPORT_SYMBOL_GPL()导出。2.系统内核符号导出记录在/proc/kallsyms文件中,我们可以使用cat /proc/kallsyms查看当前环境下的导出内核符号。3.示例:(1)导出符号的内核模块(2)导入符号的内核模块
阅读全文
摘要:1.一个简单的例子:TOPDIR = ../include $(TOPDIR)Rule.makEXTRA_LIB +=EXEC = $(INSTALL_DIR)/helloOBJS = hello.oall:$(EXEC)$(EXEC):$(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS)install: $(EXP_INSTALL) $(EXEC) $(INSTALL_DIR)clean: -rm -f $(EXEC) *.elf *.gdb *.o好了,其中:CC 指明编译器的宏EXEC表明生成的执行文件名称的宏OBJS 目标文件列...
阅读全文
摘要:1.编写模块代码: 简单例子:#include<linux/kernel.h>#include<linux/module.h>#Inlcude<linux/init.h>static int __init hello_init(void){ printk(KERN_INFO "Hello world\n"); return 0;}static void __exit hello_exit(void);{ printk(KERN_INFO "Goodbye world\n");}module_init(hello_ini
阅读全文