资源描述:
《汇编全局描述符表实验》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、全局描述符表试验.MODELTINY.386.STACK100.DATAGDTDB1000HDUP(0);存放读取的全局描述符表bPAEDB0;操作系统是WinxpSP2或更新COUNTDW0COUNT1DW0bufferDB80DUP(0)sCodeDB4,'Code'sDataDB4,'Data'sTSS32DB6,'TSS32's32DB2,'32's16DB2,'16'sDPLDB4,'DPL:'.CODESTART:MOVAH,00HMOVAL,03HINT10H;清屏LEAEDI,GDTMOVAH,0FEHMOVAL,00HINT2
2、1H;读GDTSGDT[EDI]LEAEBX,GDTMOVCX,[EBX]INCCX;CX:全局描述符表长度MOVCOUNT,CXMOVEBX,[EBX+2];EBX:全局描述符表在系统中的地址(逻辑地址)LEAEDI,GDT;EDI:存放读取的全局描述符表首地址MOVAH,0FEHMOVAL,01HINT21H;读取数据MOVCX,COUNTSHRCX,3LEAESI,GDTSTART1:MOVEAX,[ESI]OREAX,[ESI+4]JNZSTART3ADDESI,8START2:INCCOUNT1LOOPSTART1START17:CA
3、LLIfExitJZSTART17JMPEXITSTART3:LEAEDI,BUFFERMOVAX,COUNT1CALLDisplayWordMOVAL,':'STOSBMOVAL,''STOSBPUSHECXMOVECX,8START4:LODSBCALLDisplayByteMOVAL,''STOSBLOOPSTART4MOVAL,':'STOSBMOVAL,''STOSBPUSHESIMOVDL,[ESI-3]MOVDH,[ESI-2]TESTDL,10HJZSTART7LEASI,sCode;代码段TESTDL,08HJNZSTART5
4、LEASI,sData;数据段或堆栈段START5:CALLCopyStrLEASI,s32TESTDH,40HJNZSTART6LEASI,s16JMPSTART6START7:LEASI,sTSS32;系统段START6:CALLCopyStrMOVAL,''STOSBPOPESIMOVAL,[ESI-1];显示段基地址CALLDisplayByteMOVAL,[ESI-4]CALLDisplayByteMOVAL,[ESI-5]CALLDisplayByteMOVAL,[ESI-6]CALLDisplayByteMOVAL,''STOSB
5、TESTDH,80H;显示结束地址JZSTART8MOVAL,DHANDAL,0FHCALLToASCIISTOSBMOVAX,[ESI-8]CALLDisplayWordMOVAL,'F'STOSBSTOSBSTOSBJMPSTART9START8:MOVAL,'0'STOSBSTOSBSTOSBMOVAL,DHANDAL,0FHCALLToASCIISTOSBMOVAX,[ESI-8]CALLDisplayWordSTART9:MOVAL,''STOSBPUSHESILEASI,sDPL;显示DPLCALLCopyStrPOPESIMOVA
6、L,60HANDAL,DLRORAL,5ORAL,'0'STOSBMOVAL,''STOSBTESTDL,80HJZSTART10MOVAL,'P'STOSBMOVAL,''STOSBJMPSTART11START10:MOVAL,'N'STOSBMOVAL,'P'STOSBSTART11:MOVAL,''STOSBTESTDL,10HJZSTART16TESTDL,08HJZSTART14;代码段TESTDL,04HJZSTART12MOVAL,'C'STOSBSTART12:TESTDL,02HJZSTART13MOVAL,'R'STOSB
7、JMPSTART13;数据段或堆栈段START14:TESTDL,04HJZSTART15MOVAL,'E'STOSBSTART15:MOVAL,'R'STOSBTESTDL,02HJZSTART13MOVAL,'W'STOSBJMPSTART13START16:;系统段MOVAL,''STOSBMOVAL,0FHANDAL,DLCALLToASCIISTOSBSTART13:MOVAL,0DHSTOSBMOVAL,0AHSTOSBMOVAL,'$'STOSBLEADX,bufferMOVAH,09HINT21HPOPECXJMPSTART2T
8、oASCIIPROCNEARORAL,30HCMPAL,3AHJBToASCII1ADDAL,07HToASCII1:RETToASCIIENDPDi