标签:desc current linu 用例 模块 efault obj 自己的 代码
实现目的: 通过实验了解虚拟内存
实验内容:在proc 文件系统下,我们建立一个文件,每次向这个文件写人字符时,调用相应的虚拟内存处理函数
下面为Makefile
下面为测试用例
[root@HBIDS proc]# echo "listvma" > mtest
[root@HBIDS proc]# echo "listvma" > mtest
[root@HBIDS proc]# echo "findvma0xb7f2b001" > mtest
[root@HBIDS proc]# echo "findpage0xb7f2b001" > mtest
[root@HBIDS proc]# echo "writeval0xb7f2b001 123456" > mtest
打印结果为
The current process is bash
mtest_dump_vma_list
VMA 0x8048000-0x80dc000 READ EXEC
VMA 0x80dc000-0x80e2000 WRITE READ EXEC
VMA 0x80e2000-0x811e000 WRITE READ EXEC
VMA 0x42000000-0x4212e000 READ EXEC
VMA 0x4212e000-0x42131000 WRITE READ EXEC
VMA 0x42131000-0x42133000 WRITE READ EXEC
VMA 0xb7d00000-0xb7f00000 READ EXEC
VMA 0xb7f00000-0xb7f0b000 READ EXEC
VMA 0xb7f0b000-0xb7f0c000 WRITE READ EXEC
VMA 0xb7f0c000-0xb7f0d000 WRITE READ EXEC
VMA 0xb7f0d000-0xb7f0f000 READ EXEC
VMA 0xb7f0f000-0xb7f10000 WRITE READ EXEC
VMA 0xb7f10000-0xb7f13000 READ EXEC
VMA 0xb7f13000-0xb7f14000 WRITE READ EXEC
VMA 0xb7f2b000-0xb7f31000 READ EXEC
VMA 0xb7f31000-0xb7f32000 WRITE READ EXEC
VMA 0xb7f32000-0xb7f47000 READ EXEC
VMA 0xb7f47000-0xb7f48000 WRITE READ EXEC
VMA 0xbfd31000-0xbfd47000 WRITE READ EXEC
mtest_write ...........
mtest_find_vma
found vma 0xb7f47000-0xb7f48000 flag 100877 for addr 0xb7f47001
mtest_write ...........
mtest_write_val
page found for 0xb7f47001
find 0xb7f47001 to kernel address 0xc8c4e001
mtest_write ...........
mtest_write_val
write 0x1234 to address 0xc8c4e001
标签:desc current linu 用例 模块 efault obj 自己的 代码
原文地址:https://www.cnblogs.com/lucelujiaming/p/9467889.html