中断门结构如下
中断门
四个字节表示偏移量,Selector是段选择子,一般来说,lowOffset的下一个字节的值为0x8e或0xee。
中断门
可以看到除了8e外,还有85的存在,这是任务门的存在。因为系统支持的中断向量是256个,所以在offset为0x100的地方可以供用户来编程
中断门

#include <stdio.h>

//定义几个全局变量,用以输出addr为0x8003f400

unsigned int g_addr = 0x8003f400;
unsigned int flag_after;
unsigned int flag_before;


_declspec(naked)
void InterruptionJump()
{
	_asm {
		pushad
		pushfd
		mov eax,g_addr
		mov ebx, [eax] //取出高2g的值
		mov g_addr,ebx
		pushfd
		pop eax
		mov flag_after,eax
		popfd
		popad
		iretd
	}
}




int main()//我们把中断布置在0x20的地方,这里正好是用户可操作的地方
{
	
	_asm {
		push eax
		pushfd
		pop eax
		mov flag_before,eax
		pop eax
		int 0x20 //调用我们自己的中断函数
	}

	//安装自己的中断描述符 eq 8003f500 0041ee00`0008113b 
	printf("flags_before : %8X\n",flag_before);
	printf("flags_after : %8X\n",flag_after);
	printf("value of 0x8003f400 is : %8x\n", g_addr);
	

	return 0;
}

中断门

然后运行我们的程序
中断门
成功读到了高2g的内存可以看到之前我们的eflag是202,进入之后变成了2,所以它的IF变为0,这是为了屏蔽外部的可屏蔽中断。

相关文章:

  • 2021-10-21
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2022-12-23
猜你喜欢
  • 2021-04-15
  • 2021-08-30
  • 2021-05-23
  • 2021-08-10
  • 2021-07-14
  • 2022-02-28
相关资源
相似解决方案