- 论坛徽章:
- 0
|
在内核模块中,获取sys_call_table的地址,函数如下:
unsigned int get_sys_call_table(void)
{
unsigned int sys_call_off;
unsigned int sys_call_table;
char* p;
int i;
asm("sidt %0":"=m"(idtr));
printk("addr of idtr: %x\n", &idtr);
memcpy(&idt, idtr.base+8*0x80, sizeof(idt));
sys_call_off=((idt.off2<<16)|idt.off1);
printk("addr of idt 0x80: %x\n", sys_call_off);
p=sys_call_off;
for (i=0; i<100; i++)
{
if (p=='\xff' && p[i+1]=='\x14' && p[i+2]=='\x85')
{
sys_call_table=*(unsigned int*)(p+i+3);
printk("addr of sys_call_table: %x\n", sys_call_table);
return sys_call_table;
}
}
return 0;
}
这个函数获取的sys_call_table的地址与直接通过查System.map中的地址不同,但是,两个地址都可以工作,请问,这是为什么?
难道是因为这个函数获取的是int 0x80的列表,而现在的系统调用通常都是使用sysenter?
[ 本帖最后由 guotie 于 2009-5-18 11:36 编辑 ] |
|