idt_table undefined! warning when compiling kernel module

时光总嘲笑我的痴心妄想 提交于 2019-12-04 17:57:43

Theoretically, you could implement a non-init-section set_trap_gate() via:

void set_trap_gate(int n, void *addr)
{
    struct { uint16_t lim; struct desc_struct *idt_table; }
        __attribute__((packed)) idt;
    __asm__ ("sidt %0" : : "m"(idt) : "memory");
    _set_gate(idt.idt_table + n, 15, 0, addr);
}

But that'd be CPU-local, i.e. it's not guaranteed to modify any other IDT but the one of the CPU it's running on. Also, it might fall foul of writeprotected memory.

What exactly is it you're trying to achieve ?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!