随笔分类 - Linux misc
摘要:migration/* kernel thread用途 console:/proc/13 # ps -Af |grep migration root 13 2 0 02:29:43 ? 00:00:00 [migration/0] root 16 2 0 02:29:43 ? 00:00:00 [m
阅读全文
摘要:kernel BUG_ON macro的实现以及brk指令触发异常后的异常处理callstack kernel里的两个macro BUG_ON(condition),如果condition条件满足,判断为真,则会造成一个debug exception; BUG(),这个没有条件判断,调用它则会直接造
阅读全文
摘要:ARM C函数调用堆栈入栈顺序 堆栈指针是在函数一开头就确认了的,比如如下的xxx_func.cfi函数,它在函数的开头就将sp自减了0x170,这个0x170是xxx_fun.cfi函数局部变量total size + 需要入栈的reg total size 然后会设置x29(fp,栈底指针),这
阅读全文
摘要:elf文件结构解析 elf文件格式,许多文件类型都是elf格式,比如.ko、.so、.o,vmlinux也是这种格式 如下图是elf文件结构: 查看是否为elf文件,使用file cmd file slub_debug_test_module.ko slub_debug_test_module.ko
阅读全文
摘要:kill一个pthread_test.bin测试程序主线程、子线程退出kernel flow 以下blog基于andorid Q,kernel 4.19 pthread_test.bi是执行pthread_test.bin的主线程,在这个主线程里会创建pthread_test_name线程 执行ki
阅读全文
摘要:signal bit operation include/linux/signal.h #define _SIG_SET_BINOP(name, op) \ static inline void name(sigset_t *r, const sigset_t *a, const sigset_t
阅读全文
摘要:pthread PTHREAD_CREATE_DETACHED pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); 在任何一个时间点上,线程是可结合的(joinable),或者是分离的(detached)。一个可结合的线程能够被其
阅读全文
摘要:信号发送处理流程: https://www.cnblogs.com/sunsky303/p/10838610.html
阅读全文
摘要:print address/symbol(%p*) in kernel /* * Show a '%p' thing. A kernel extension is that the '%p' is followed * by an extra set of alphanumeric characte
阅读全文
摘要:以下内存布局信息在引导时由Linux内核在我的SoC平台上打印(带有4核Cortex-A53处理器和2.75GiB DRAM) [ 0.000000] Memory: 2736316K/2883584K available (4796K kernel code, 488K rwdata, 1360K
阅读全文
摘要:linux汇编(ARM64) quad arm64汇编代码里(.S)的.quad,表示4个word,即8个字节 memset/__memset函数实现 这两个函数都是汇编函数,在如下路径里的.S文件里实现: 4.19\arch\arm64\lib\memset.S misc 一. 带点的(一般都是A
阅读全文
摘要:current() macro current在内核中通常以宏的形式存在,其实现方式依赖于具体的架构和内核版本,有些实现是从堆栈中获取当前运行任务的task_struct结构指针,有些则从寄存器中获取。 current的实现 拿 arm64架构 + linux-5.4版本 为背景举例, curren
阅读全文
摘要:ftrace code ftrace event kmem:rss_stat trace event definition include/trace/events/kmem.h TRACE_EVENT(rss_stat, TP_PROTO(struct mm_struct *mm, int mem
阅读全文
摘要:linux kernel input event处理流程 input驱动会调用input_register_device()来注册device到input framework; input设备驱动接收到时间输入事件时(接收的方式一般是硬件interrupt),会call input_event()上
阅读全文
摘要:linux kernel boot sequence early_param回调执行时间 [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.116+ #7[ 0.000000] Hardware name: machine_name(D
阅读全文
摘要:linux驱动入口函数module_init何时被调用 被上面的宏处理过后,变成__initcall_func6 __used加入到内核映像的".initcall"区。内核的加载的时候,会搜索".initcall"中的所有条目,并按优先级加载它们,普通驱动程序的优先级是6。其它模块优先级列出如下:值
阅读全文
摘要:1、Standard commands (标准命令)2、System calls (系统调用)3、Library functions (库函数)4、Special devices (设备说明)5、File formats (文件格式)6、Games and toys (游戏和娱乐)7、Miscell
阅读全文
摘要:selinux misc . selinux语法 Section 5.2. Types, Attributes, and Aliases https://flylib.com/books/en/2.803.1.40/1/ type type_name [ alias alias_set ] [, a
阅读全文
摘要:tune2fs tune2fs允許系統管理員在Linux ext2、ext3或ext4檔案系統上調整各種可調的檔案系統引數。這些選項的當前值可以使用-l選項顯示,也可以通過使用dumpe2fs (8)程式顯示。 此命令的適用範圍:RedHat、RHEL、Ubuntu、CentOS、SUSE、open
阅读全文