#define _set_gate(gate_addr,type,dpl,addr,seg) \
do { \
int __d0, __d1; \
__asm__ __volatile__ ("movw %%dx,%%ax\n\t" \
"movw %4,%%dx\n\t" \
"movl %%eax,%0\n\t" \
"movl %%edx,%1" \
:"=m" (*((long *) (gate_addr))), \
"=m" (*(1+(long *) (gate_addr))), "=&a" (__d0), "=&d" (__d1) \
:"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \ "3" ((char *) (addr)),"2" ((seg) << 16)); \ } while (0)
Before study “_set_gate”, we must know:
%0=(*((long *) (gate_addr))),
%1=(*(1+(long *) (gate_addr))),
%2=(__d0)=%eax=((seg) << 16)),
%3= (__d1)=%edx=((char *) (addr)),
%4=((short) (0x8000+(dpl<<13)+(type<<8)))
沒有留言:
張貼留言