一些基础知识
1
typedef int (*fn_ptr)(); (无内容)
typedef int (*funcptr)(); // funcptr is synonym for "pointer
// to function returning int"
funcptr table[10]; // Equivalent to "int (*table[10])();"
table[]函数指针数组,每个元素都保存一个函数的入口
比如
int fun();
table[1] = fun;
int i = table[1]( );
即调用了一个函数fun,并将返回值赋予i。
2
ret 和iret的区别
ret 用于子程序调用
iret用于中断返回
Stack is an area of memory for keeping temporary data. Stack is used byCALL instruction to keep return address for procedure, RET instruction gets this value
from the stack and returns to that offset. Quite the same thing happens when INT instruction calls an interrupt, it stores in stack flag register, code segment and
offset. IRET instruction is used to return from interrupt call.