Linux kernel
RichardYSteven
这个作者很懒,什么都没留下…
展开
-
linux kernel是如何做到释放仅在启动时使用的内存的?
linux内核释放启动内存原创 2016-08-21 10:41:25 · 1581 阅读 · 1 评论 -
The Linux Bootdisk HOWTO
http://oss.org.cn/man/linux/how/Bootdisk-HOWTO.html#toc4http://oss.org.cn/man/linux/how/Bootdisk-HOWTO.html#toc4dd if=/dev/zer转载 2011-09-11 23:27:17 · 698 阅读 · 0 评论 -
kernel中 resource结构的操作
/* * ===================================================================================== * * Filename: resource.c * *原创 2011-09-14 17:16:30 · 2266 阅读 · 0 评论 -
用dump_stack 和 show_regs来阅读代码
这招貌似有点偏。主要是kernel的代码实在有点难看。原创 2011-09-08 14:56:40 · 2257 阅读 · 0 评论 -
gcc 嵌入式汇编的语法
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html原创 2011-08-05 13:12:16 · 1023 阅读 · 0 评论 -
block设备 发送一个bio的过程 2.6.36
<br />sync_request 这个是不一定的,可以call别的函数<br /> submit_bio<br /> <br />//这个的bio 和 bio_vec是local变量<br />static int sync_request(struct page *page, struct block_device *bdev, int rw)<br />{<br /> struct bio bio;<br /> struct bio_vec bio_vec;<br原创 2011-01-02 21:39:00 · 2279 阅读 · 0 评论 -
在非process context中,不能做什么
<br /> When you are outside of process context (i.e., in interrupt context), you must observe the<br />following rules:<br /> • No access to user space is allowed. Because there is no process context, there is<br /> no path to the user space ass原创 2010-11-30 21:49:00 · 1117 阅读 · 0 评论 -
Slab Cache
http://www.ibm.com/developerworks/linux/library/l-linux-slab-allocator/?ca=dgr-lnxw16LinuxSlabAllo 这个文章不错。 经过这两天的学习,了解到,在kernel中分配内存 至少有两种方式:1. kmalloc2. kmem_cache 其实都是用了kmem_cach转载 2010-04-21 15:25:00 · 1627 阅读 · 0 评论 -
如何生成core file 及使用
程序发生crash时,linux会产生core dump。但是这个是需要配置的。 1. configure kernelmake menuconfigenter General setup & select Enable ELF core dumps 3. configure the core file limit and原创 2010-01-14 18:49:00 · 1313 阅读 · 0 评论 -
Concurrency and Race Condition
产生竞争的原因: 对资源的共享访问,包括硬件资源(设备)和软件资源(内存空间) 原则: 尽量减少共享资源的使用,如全局变量等 解决的方法: 通过建立critical section是操作成为原子操作,使同一时间内,只有一个线程操作该段代码。 kernel对不同的情况提供了不同的方法,注意的是,有的方法可以 Go to slee原创 2009-10-14 21:37:00 · 938 阅读 · 0 评论 -
在 kernel中如何定时, 变量 HZ 和 jiffies
HZ 定义了时钟中断的频率,即每秒钟时钟中断的次数jiffies 记录了自启动后,时钟中断发生的次数 例如:unsigned long timeout = jiffies + (3*HZ); while (hwgroup->busy) { /* ... */ if (time_after(jiffies, timeo原创 2009-09-17 11:08:00 · 1812 阅读 · 0 评论 -
pgp key
生成keygpg --gen-key查看key在哪里gpg --list-secret-key上传keygpg --keyserver --send-key use pgp.mit.edu as the keyserver显示自己的key,并把该信息给别人让别人来signgpg --fingerprint 签署原创 2011-10-21 16:55:39 · 3293 阅读 · 0 评论 -
使用spinlock需要注意的事项
Concurrency IV -- Spinlock, may be used in code that can't sleepPinciples for using spinlock1. CANNOT sleep when holding a spinlock2. disable preemption before holding a apinlock this is don转载 2011-11-19 22:52:08 · 1240 阅读 · 0 评论 -
混沌初开--内核启动笔记
先隆重介绍这个网站 https://www.gitbook.com/book/0xax/linux-insides/details实在太好了,膜拜,膜拜,膜拜。bootloader加载内核到内存bootloader之前的我就不关心了,主要关心加载到内存以及之后的事情。从这篇文章中才知道原来内核加载是有自己的协议的,我也是醉了阿。这个可以从 boot protocol 看到原文,有兴趣的同学可以参考。原创 2016-09-23 00:02:49 · 4330 阅读 · 0 评论 -
Intel IOMMU
Intel IOMMUAgenda Why Hardware Perspective Software PerspectiveWhy According to the Intel VT-d SPEC, Section 2.5, IOMMU provides several advantages: 1. Device protection and isolation 2. DMA remap原创 2016-08-07 21:33:54 · 2804 阅读 · 0 评论 -
How debugger works
http://www.alexonlinux.com/how-debugger-works先藏着,以后学习。转载 2013-07-21 11:50:50 · 1404 阅读 · 0 评论 -
一个有意思的讲pci中断的文章
http://blog.csdn.net/lightseed/article/details/4233739转载 2013-07-13 22:21:46 · 1297 阅读 · 0 评论 -
one artical on pci hotplug framework
http://linux.chinaunix.net/techdoc/system/2007/10/22/970458.shtml转载 2013-01-30 15:25:17 · 891 阅读 · 0 评论 -
linux pci 初始化
1。 函数调用的顺序(gdb) bt#0 pci_arch_init () at arch/x86/pci/init.c:13#1 0xc1001255 in do_one_initcall (fn=0xc17a3afa ) at init/main.c:758#2 0xc176c963 in do_initcalls (unused=) at init/main.c:7原创 2012-03-17 20:43:33 · 1251 阅读 · 0 评论 -
pcie
http://blog.sina.com.cn/s/articlelist_1685243084_3_1.html别人的blog转载 2012-03-06 14:18:44 · 590 阅读 · 0 评论 -
Add a system call on x86_32 arch
diff --git a/Makefile b/Makefileindex a43733d..9e3bfef 100644--- a/Makefile+++ b/Makefile@@ -708,7 +708,7 @@ export mod_strip_cmd ifeq ($(KBUILD_EXTMOD),)-core-y += kernel/ mm原创 2011-12-20 10:32:18 · 908 阅读 · 0 评论 -
kernel的链表api
/* * ===================================================================================== * * Filename: list.c * * Description: * * Version: 1.0 * Created:原创 2010-12-13 14:47:00 · 937 阅读 · 0 评论 -
贡献者
http://www.remword.com/kps_result/all_whole.html原创 2011-12-01 17:47:48 · 605 阅读 · 0 评论 -
How to: Compile Linux kernel 2.6
http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html Step # 1 Get Latest Linux kernel code $ cd /tmp$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2原创 2009-07-05 16:21:00 · 953 阅读 · 0 评论 -
Create file under /proc -- Manage it with standard file system
/* * procfs3.c - create a "file" in /proc, use the file_operation way * to manage the file. */#include /* Were doing kernel work */#include /* Specifically原创 2009-09-03 16:56:00 · 819 阅读 · 0 评论 -
Intel x86 下 gcc汇编结果
GCC的汇编语言用的是AT&T的语法。 源文件:test.c#include #include int swap(int *a, int *b){ int c ; c = *a; *a = *b; *b = c; return c;}int main(int argc, char *argv[]){ int a, b, c; a = 16; b = 32; c = swap(原创 2009-05-17 15:37:00 · 1619 阅读 · 0 评论 -
嵌入汇编的用法
语法 asm( "汇编语句" :输出寄存器 :输入寄存器 :会被修改的寄存器) 如果输入寄存器的代码是 0 或者为空,则说明使用与相应输出一样的寄存器。原创 2009-05-14 14:25:00 · 791 阅读 · 0 评论 -
bootsect.S 所做的工作
1. 将自己(512B)移动到0x90000 并新的地方继续执行 2. 从磁盘第二个扇区开始的四个扇区的setup模块拷贝到0x90200, 即bootsect后面 3. 保存每磁道最大扇区数到 变量sectors, 用init 0x13, 用于判断跟文件系统,in step5 4. 加载system模块到0x10000处, 5. 确定根文件系统设备号,并保存到ro原创 2009-05-07 14:23:00 · 739 阅读 · 0 评论 -
Where to download old version linux
http://ftp.ntu.edu.tw/linux/kernel/Historic/old-versions/ http://www.oldlinux.org/Linux.old/原创 2009-04-23 10:10:00 · 884 阅读 · 0 评论 -
启动进程所需要的基本条件
进程是现代计算机系统运行的最小单位,所以没有进程也不能称之为操作系统。 当系统启动后,设置了GDT, IDT进入了保护模式后,需要哪些东西才能让进程跑起来呢?其实简单说来进程产生的目的并不是要让程序跑起来,而是要让一个系统上有多个进程一起跑。因为如果一个系统上只有一个所谓的“进程”在跑,那就没有必要保存再恢复进程的运行环境了。 好,来看看都要加哪些东西才原创 2008-12-25 20:37:00 · 2742 阅读 · 0 评论 -
IA32保护模式所包含的内容
进入保护模式是现代操作系统的基础,那保护模式都包含哪些内容呢?在这里列举一些,虽然不全面,但也基本够用了。 1. GDT 因为进入保护模式后传统的寻址方式发生了变化,所以使用GDT是CPU进入保护模式运行的最小条件。2. LDT 3. 页式存储4. 中断和异常5. 特权级变换 最简单来说,只要cr0寄存器的0位置1,CPU就进入了保护模式。但是此时的CPU的功能还是原创 2008-12-25 08:37:00 · 1341 阅读 · 0 评论 -
Installing GRUB on a Hard Disk Image File
quoted from http://www.omninerd.com/articles/Installing_GRUB_on_a_Hard_Disk_Image_File IntroductionGRUB is the GRand Unified Bootloader. For those unfamiliar, a bootloader is a critical piece转载 2009-02-15 21:12:00 · 1254 阅读 · 0 评论 -
直接写入硬盘的第一扇区
本来以为很难,没发现这么简单 唉 dd if=bin/stage1 of=/dev/fd0 bs=512 count=1原创 2009-02-15 21:08:00 · 1312 阅读 · 0 评论 -
Linux Boot Process
copy from:http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch07_:_The_Linux_Boot_Process IntroductionLearning how Linux boots up is critical. When you have this information转载 2009-01-22 10:46:00 · 3696 阅读 · 0 评论 -
中断处理的几个条件
中断处理之所以这么重要是因为当中断发生时,所有运行的进程都将被打断。 这就需要在中断过程中保护进程的运行环境,从用户态切换到内核态,执行内核程序,最后恢复进程运行状态,跳转到用户态运行进程。必要的时候还需要进行进程切换。 这样的话就基本知道中断处理要做哪些事情了。1. 保护进程运行环境 和 恢复进程运行环境 这是由一系列的push和pop完成的。2. 赋值原创 2009-01-07 21:28:00 · 2672 阅读 · 0 评论 -
Kernel Terminology
SMP symmetric multiprocessing 多处理器原创 2009-08-04 14:02:00 · 623 阅读 · 0 评论 -
linux 0.12: 内核支持最多进程个数
对于linux 0.12内核设置全局描述符表GDT中的段描述符项最大为256,其中2项为空、2项为系统使用(数据段 和 代码段),每个进程用两项(LDT 和 TSS)。因此系统最多可以容纳 (256 - 4)/2 = 126 个任务。 不过linux 0.12内核中定义最大的任务数为 NR_TASK = 64原创 2009-06-06 20:03:00 · 1203 阅读 · 0 评论 -
Char Device Driver Example for Kernel 2.6
现在还有疑问,1.怎么知道注册了device后,在/dev目录下显示的是哪个文件名?在class_device_create中生成该文件。 仍有待研究。 注册字符设备的过程1. alloc_chrdev_region 动态分配设备号2. cdev_init 初始化cdev,将fops注册3. cdev_add 将这个字符设备注册到kernel这样c原创 2009-08-31 13:39:00 · 1485 阅读 · 0 评论 -
Major and Minor Numbers 及 注册和撤销
Char devices are accessedthrough names in the filesystem. Those names arecalled special files or device files or simply nodes of thefilesystem tree; they are conventionally l原创 2009-08-31 11:30:00 · 1526 阅读 · 0 评论 -
三种 bottom half的实现方式 softirqs, tasklets, work queue 及之间的比较
The following mechanisms are available in the kernel to defer work to a bottom half: softirqs, tasklets, and work queues. Softirqs are the basic bottom half mechanism and have strong lock原创 2009-08-29 15:40:00 · 2155 阅读 · 0 评论