#include<iostream>
using namespace std;
typedef struct _Int_info
{
unsigned vector :8;
unsigned int_type :3;
unsigned error_code :1;
unsigned Reserved :19;
unsigned valid :1;
}IntInfo,*pIntInfo;
void ShowStruct(pIntInfo info)
{
cout<<"中断或异常向量为 : "<<info->vector<<endl;
cout<<"中断类型 : "<<info->int_type;
switch (info->int_type)
{
case 0:cout<<" 外部中断;"<<endl;break;
case 1:cout<<" 保留;"<<endl;break;
case 2:cout<<" 非屏蔽中断;"<<endl;break;
case 3:cout<<" 硬件异常;"<<endl;break;
case 4:cout<<" 软件中断;"<<endl;break;
case 5:cout<<" 特权软件异常;"<<endl;break;
case 6:cout<<" 软件异常;"<<endl;break;
case 7:cout<<" 保留;"<<endl;break;
default :cout<<" 错误;"<<endl;
}
cout<<"错误代码 : "<<info->error_code;
if(info->error_code)
{
cout<<" 有错误代码传递,可参考VMCS中的VM Entry exception error code;"<<endl;
}
else
{
cout<<" 无错误代码传递;"<<endl;
}
cout<<"检测合法性 : "<<info->valid;
if(info->valid)
{
cout<<" 合法;"<<endl;
}
else
{
cout<<" 不合法;"<<endl;
}
}
int main()
{
unsigned long info=0x80000E06;
cout<<"-----------------------------------------------------"<<endl;
cout<<"---------VM-Entry Interruption-Information-----------"<<endl;
cout<<"- 0000 0000 0000 0000 0000 0 000 0000 0000 -"<<endl;
cout<<"- _ - ___ _________ -"<<endl;
cout<<"- 31 11 10-8 7-0 -"<<endl;
cout<<"- 位31 : 合法位 -"<<endl;
cout<<"- 位11 : 错误代码传递(0=不传递,1=传递) -"<<endl;
cout<<"- 位10:8 : 中断类型 -"<<endl;
cout<<"- 位7:0 : 中断或异常向量 -"<<endl;
cout<<"-----------------------------------------------------"<<endl;
ShowStruct((pIntInfo)&info);
}