本系列文章主要写我在阅读Linux内核过程中,关注的比较难以理解但又设计巧妙的代码片段(不关注OS的各个模块的设计思想,此部分我准备写在“深入理解Linux Kernel” 系列文章中),一来通过内核代码复习一下C语言及汇编语言的语法,二来学习内核开发大牛们书写代码的风格及思路. 在内核文件 include/linux/bug.h中,有下面两行的宏定义: 1 2 3 4 5 6 /* Force a compilation error if condition is true, but al…
Because there are numerous revisions and releases of the Linux kernel and new ones are developed at frequent intervals, it is important to have a system for clearly identifying them. A kernel is a program that constitutes the central core of a comput…
原文地址:http://blog.csdn.net/penngrove/article/details/44175387 最近看到Linux Kernel cmpxchg的代码,对实现很不理解.上网查了内嵌汇编以及Intel开发文档,才慢慢理解了,记录下来以享和我一样困惑的开发者.其实cmpxchg实现的原子操作原理早已被熟知: cmpxchg(void* ptr, int old, int new),如果ptr和old的值一样,则把new写到ptr内存,否则返回ptr的值,整个操作是原子的.在…
Linux kernel support pass param to kernel, this params can be assigned at load time by insmod or modprobe. or later read from /etc/modprobe.conf file. There are two macro : module_param and module_param_array, To declare an param or array param ,use…