00058                    :
00059 
00060     This 
functions gains 
control when 
the system has no installed
00061     NPX support, but 
the thread has cleared 
it's EM bit in CR0.
00062 
00063     The purpose of 
this function 
is to 
move the instruction
00064     pointer forward over 
the current NPX instruction.
00065 
00066 Enviroment:
00067 
00068     16:16 mode
00069 
00070 Arguments:
00071 
00072 Return Value:
00073 
00074 --*/
00075 {
00076     BOOLEAN     fPrefix;
00077     UCHAR       ibyte, Mod, rm;
00078     UCHAR       Address32Bits;
00079     ULONG       CallerCs;
00080 
00081     Address32Bits = 0;                          
00082 
00083     
00084     
00085     
00086 
00087     CallerCs = Context->SegCs;
00088     _asm {
00089         mov     eax, CallerCs
00090         lar     eax, eax
00091         test    eax, 400000h
00092         jz      
short IsDefault16Bit
00093 
00094         mov     Address32Bits, 1
00095 
00096 IsDefault16Bit:
00097     }
00098 
00099     
00100     
00101     
00102     
00103     
00104     
00105     
00106 
00107     
00108     
00109     
00110 
00111     fPrefix = 
TRUE;
00112     
while (fPrefix) {
00113         ibyte = 
NpxNpReadCSEip(Context);
00114 
00115         
switch (ibyte) {
00116             
case 0x2e:  
00117             
case 0x36:  
00118             
case 0x3e:  
00119             
case 0x26:  
00120             
case 0x64:  
00121             
case 0x65:  
00122             
case 0x66:  
00123                 
break;
00124 
00125             
case 0x67:
00126                 
00127                 Address32Bits ^= 1;
00128                 
break;
00129 
00130             
default:
00131                 fPrefix = 
FALSE;
00132                 
break;
00133         }
00134     }
00135 
00136     
00137     
00138     
00139 
00140     
if (ibyte == 0x9b) {
00141 
00142         
00143         
00144         
00145 
00146         
return;
00147     }
00148 
00149     
if (ibyte < 0xD8 || ibyte > 0xDF) {
00150 
00151         
00152         
00153         
00154 
00155 
#if DBG
00156 
        DbgPrint (
"P5_FPU_PATCH: 16: Not NPX ESC instruction\n");
00157 
#endif
00158 
        return;
00159     }
00160 
00161     
00162     
00163     
00164 
00165     ibyte = 
NpxNpReadCSEip(Context);
00166 
00167     
if (ibyte > 0xbf) {
00168         
00169         
00170         
00171 
00172         
return;
00173     }
00174 
00175     Mod = ibyte >> 6;
00176     rm  = ibyte & 0x7;
00177     
if (Address32Bits) {
00178         Context->Eip += 
MOD32 [Mod];
00179         
if (Mod == 0  &&  rm == 5) {
00180             
00181             Context->Eip += 4;
00182         }
00183 
00184         
00185         
00186         
00187 
00188         
if (rm == 4) {
00189             ibyte = 
NpxNpReadCSEip(Context);
00190 
00191             
if (Mod == 0  &&  (ibyte & 7) == 5) {
00192                 
00193                 Context->Eip += 4;
00194             }
00195         }
00196 
00197     } 
else {
00198         Context->Eip += 
MOD16 [Mod];
00199         
if (Mod == 0  &&  rm == 6) {
00200             
00201             Context->Eip += 2;
00202         }
00203     }
00204 }
}