有问题先看Documentation/
下的文档
set_all_modules_text_rw
, set_kernel_text_rw
, set_memory_rw
等函数设置页表权限。
lookup_address
查找页表入口。
offsetof
获得结构体成员偏移。
//CC=gcc | |
//CFLAGS=-O3 -S | |
// | |
//pa.s: pa.c | |
// $(CC) -DRAW_PA $(CFLAGS) -o $@ $^ | |
// | |
//my_pa.s: pa.c | |
// $(CC) $(CFLAGS) -o $@ $^ | |
// | |
//all: pa.s my_pa.s |
#include <stdio.h> | |
int main() | |
{ | |
unsigned long n; | |
asm("rdrand %%rax":"=a"(n)); | |
printf("%lx\n", n); | |
return 0; | |
} |
#!/bin/sh | |
find . -name "*.[chS]"|xargs grep -Ev "^\s*((//|\*|/\*).*)?$"|wc -l |
find . -not \( -path "./asm" -prune \) -name "*.h" | |
#不直接使用-prune,因为在加上-o -name过后会输出排除的目录 |
#include <iostream> | |
#include <typeinfo> | |
#include <type_traits> | |
class A { | |
}; | |
class C { | |
public: | |
~C(){} |
# change this according to build kernel source path | |
add-auto-load-safe-path /home/wambers/code/build-4.2.5-debug/src/linux-4.2.5 | |
define dm | |
source ~/code/modules/add-module-symbol-file.py | |
source ~/code/modules/debug-module.gdb | |
connect-qemu | |
debug-module | |
end |
git log --grep=[KEY_WORDS]
找到相应的提交的hashfind . | cpio --quiet -R 0:0 -o -H newc) | gzip >initrd.gz |