3
Linuxのデバイスドライバをデバッグする方法を学びますが、問題があります。私はここにLinuxカーネルモジュールの逆アセンブリコード
#include <linux/module.h>
#include <linux/init.h>
static int __init my_init(void){
int *i;
i = NULL;
printk(KERN_INFO "Hello: init_module loaded at address 0x%p\n",init_module);
printk(KERN_INFO "i = %d\n", *i);
return 0;
}
static void __exit my_exit(void){
printk(KERN_INFO "Hello: cleanup_module moaded at address 0x%p\n",cleanup_module);
}
module_init(my_init);
module_exit(my_exit);
MODULE_LICENSE("GPL v2");
(crashit.ko C言語で書く)このモジュールのアセンブリコードを理解していない は crashit.ko上記モジュールの分解である:ファイル形式ELF32-i386の
Disassembly of section .exit.text:
00000000 <cleanup_module>:
0: 68 00 00 00 00 push $0x0
5: 68 00 00 00 00 push $0x0
a: e8 fc ff ff ff call b <cleanup_module+0xb>
f: 58 pop %eax
10: 5a pop %edx
11: c3 ret
Disassembly of section .init.text:
00000000 <init_module>:
0: 68 00 00 00 00 push $0x0
5: 68 31 00 00 00 push $0x31
a: e8 fc ff ff ff call b <init_module+0xb>
f: ff 35 00 00 00 00 pushl 0x0
15: 68 5f 00 00 00 push $0x5f
1a: e8 fc ff ff ff call 1b <init_module+0x1b>
1f: 31 c0 xor %eax,%eax
21: 83 c4 10 add $0x10,%esp
24: c3 ret
私は、逆アセンブリコードには、call b、call b、call 1bという3つの命令があることに気がつきました。私はそれらが何をしているのかわからず、実装されている場所がわかりません。さらに "call b" call b命令が表示されますが、これは表示されません。 私にいくつかの説明を教えてください。