diff -uNr src.org/dis.c src/dis.c
--- src.org/dis.c	2002-10-30 20:42:54.000000000 +0900
+++ src/dis.c	2005-01-10 02:34:36.000000000 +0900
@@ -91,6 +91,8 @@
 char    *ptyp[]=
 {"byte ptr ","word ptr ","dword ptr ","qword ptr ","tbyte ptr ","fword ptr ","",""};
 
+char    **exregname[] = {regname, eregname};
+
 
 char    *op;    /* Œ»�Ý‚Ì‰ð�ÍˆÊ’u‚ðŽw‚µ‚Ä‚¢‚éƒ|ƒCƒ“ƒ^ */
 char    *op0;   /* –½—ß‚Ì�æ“ª”Ô’n‚ðŽw‚µ‚Ä‚¢‚éƒ|ƒCƒ“ƒ^ */
@@ -110,12 +112,13 @@
 int	win_printrel( int off,char *buf);
 
 /* ƒIƒyƒ‰ƒ“ƒh‚ªƒ|ƒCƒ“ƒ^‚Å‚ ‚é�ê�‡�A‚»‚ÌƒTƒCƒY‚ðŽ¦‚·ƒqƒ“ƒg */
-#define NONTYPE   0		/* byte ptr 	*/
-#define PTRTYPE   1		/* word ptr 	*/
+#define NONTYPE   0		/* none	*/
+#define PTRTYPE   1		/* byte/word/dword ptr 	*/
 #define DWORDTYPE 2		/* dword ptr	*/
 #define QWORDTYPE 3		/* qword ptr	*/
 #define TBYTETYPE 4		/* tbyte ptr	*/
 #define FWORDTYPE 5		/* fword ptr	*/
+#define WORDTYPE  6		/* word ptr 	*/
 
 /* –½—ßƒoƒbƒtƒ@‚ðŽw‚·ƒ|ƒCƒ“ƒ^‚©‚ç‚h‚o‚ð“¾‚é. */
 #define	IP(ptr)  (startadrs+((ptr)-instbuf)) /* 80x86 Instruction Pointer (offset part)*/
@@ -301,7 +304,7 @@
                            ,"%-27s %-7s %s"		/*1 operand 32bit seg*/
                            ,"%-27s %-7s %s,%s"	/*2 operand 32bit seg*/
         };
-	int f;
+        int f;
 
         hexp=hexbuf;*hexp=0;
         mnep=mnebuf;*mnep=0;
@@ -313,7 +316,7 @@
                 set_eop();
                 *hexp=0;
                 *mnep=0;
-	f=0;
+        f=0;
         if(op2buf[0])  f|=1;
         if(adsize32def)f|=2;
         
@@ -473,9 +476,9 @@
         break;
         
  case 0x6c:mne("insb")  ;break;
- case 0x6d:mne("insw")  ;break;
+ case 0x6d:mnes(opsize32,"insw","insd");break;
  case 0x6e:mne("outsb") ;break;
- case 0x6f:mne("outsw") ;break;
+ case 0x6f:mnes(opsize32,"outsw","outsd");break;
 /*****************************************************************/
  case 0x70: case 0x71: case 0x72: case 0x73:
  case 0x74: case 0x75: case 0x76: case 0x77:
@@ -548,14 +551,8 @@
         break;
  
 /*****************************************************************/
- case 0x98:mne("cbw");break;
- case 0x99:
- 	//mne("cwd");break;
-      if (opsize32)
-        mne("cdq");
-      else
-        mne("cwd");
-      break;
+ case 0x98:mnes(opsize32,"cbw","cwde");break;
+ case 0x99:mnes(opsize32,"cwd","cdq") ;break;
 
  case 0x9a:mne("call");farptr();break;
  case 0x9b:mne("wait");break;
@@ -651,7 +648,7 @@
 		}
 	 	break;
  case 0xce:mne("into");break;
- case 0xcf:mne("iret");break;
+ case 0xcf:mnes(opsize32,"iret","iretd");break;
 /*****************************************************************/
  case 0xc0:             /* SHIFT rmb,immb  */
  case 0xc1:             /* SHIFT rmb,immb  */
@@ -704,28 +701,28 @@
         inst_FPU(opc);break;
 /*****************************************************************/
  case 0xe0: case 0xe1: case 0xe2: case 0xe3:
-        mnes(opc-0xe0,"loopnz","loopz","loop","jcxz");
+        mnes(opc-0xe0,"loopnz","loopz","loop", (adsize32) ? "jecxz" : "jcxz");
         relb();
         break;
 /*****************************************************************/
- case 0xe4:     mne("in")  ;op1("al");immb();break;
- case 0xe5:     mne("in")  ;op1("ax");immb();break;
- case 0xe6:     mne("out") ;immb();op2("al");break;
- case 0xe7:     mne("out") ;immb();op2("ax");break;
+ case 0xe4:     mne("in")  ;op1("al")      ;immb();break;
+ case 0xe5:     mne("in")  ;put_axreg(op1p);immb();break;
+ case 0xe6:     mne("out") ;immb()      ;op2("al");break;
+ case 0xe7:     mne("out") ;immb();put_axreg(op2p);break;
 /*****************************************************************/
  case 0xe8:
  case 0xe9:
         mnes(opc-0xe8,"call","jmp") ;
-	rel_dw();
+        rel_dw();
         break;
  case 0xea:     mne("jmp") ;farptr();break;
  case 0xeb:     mne("jmp") ;
         PR1(op1p,"short %04x",IP(op0)+2+dbr());
         break;
- case 0xec:     mne("in") ;op1("al");op2("dx");break;
- case 0xed:     mne("in") ;op1("ax");op2("dx");break;
- case 0xee:     mne("out");op1("dx");op2("al");break;
- case 0xef:     mne("out");op1("dx");op2("ax");break;
+ case 0xec:     mne("in") ;op1("al")      ;op2("dx");break;
+ case 0xed:     mne("in") ;put_axreg(op1p);op2("dx");break;
+ case 0xee:     mne("out");op1("dx")      ;op2("al");break;
+ case 0xef:     mne("out");op1("dx");put_axreg(op2p);break;
 /*****************************************************************/
  case 0xf0:     mne("lock");break;
  case 0xf1:     mne("icebp");rem("(386+) int 1h  (AMD386SXLV) SMI");break;
@@ -837,9 +834,13 @@
          case 1:
         mnes(reg,"inc","dec");modrm(op1p,opc,mod_rm,PTRTYPE);break;
          case 2:mne("call");modrm(op1p,opc,mod_rm,PTRTYPE)  ;break;
-         case 3:mne("call");modrm(op1p,opc,mod_rm,DWORDTYPE);break;
+         case 3:mne("call");
+        		modrm(op1p,opc,mod_rm, (opsize32) ? FWORDTYPE : DWORDTYPE);
+        		break;
          case 4:mne("jmp") ;modrm(op1p,opc,mod_rm,PTRTYPE)  ;break;
-         case 5:mne("jmp") ;modrm(op1p,opc,mod_rm,DWORDTYPE);break;
+         case 5:mne("jmp");
+        		modrm(op1p,opc,mod_rm, (opsize32) ? FWORDTYPE : DWORDTYPE);
+        		break;
          case 6:mne("push");modrm(op1p,opc,mod_rm,PTRTYPE)  ;break;
          case 7:undef();break;
         }
@@ -926,20 +927,35 @@
 void	farptr()
 {
         int seg,off;
+        long off32;
         
         if(win_printrel(IP(op),symbol)) {
-        	op+=4;op1(symbol);return;
+        	op += (opsize32) ? 6 : 4;
+        	op1(symbol);return;
         }
 
-        off=dw();
+        if(opsize32){
+        	off32=dd();
+        }else{
+        	off=dw();
+        }
         if(win_printrel(IP(op),symbol)) {
-        	PR1(op1p,"%s:%04x",symbol,off);
-        	op+=2;
+        	if(opsize32){
+        		PR1(op1p,"%s:%08lx",symbol,off32);
+        		op+=4;
+        	}else{
+        		PR1(op1p,"%s:%04x",symbol,off);
+        		op+=2;
+        	}
         	return;
         }
 
         seg=dw();
-        PR1(op1p,"%04x:%04x",seg,off);
+        if(opsize32){
+        	PR1(op1p,"%04x:%08lx",seg,off32);
+        }else{
+        	PR1(op1p,"%04x:%04x",seg,off);
+        }
 }
 
 /**********************************************************************
@@ -986,9 +1002,10 @@
  */
 void	farind()
 {
-        int seg,off,off32;
+        int seg,off;
+        long off32;
 
-	if(adsize32) {
+        if(adsize32) {
 	        off32=dd();
 	        seg=dw();
 	        PR1(op1p,"[%04x:%08lx]",seg,off32);
@@ -1014,7 +1031,7 @@
         		PR1(op1p,"%s",symbol);
         		op+=2;
 	        	return;
-		}
+	        }
         }
 
         if(op1buf[0]) {
@@ -1120,10 +1137,7 @@
                 s[0] = 'x';
                 strcpy(s+1,mregname[reg]);	// xmm0�`7;
         } else if(w&1) {
-            if(opsize32)
-                strcpy(s,eregname[reg]);
-            else
-                strcpy(s, regname[reg]);
+                strcpy(s,exregname[opsize32][reg]);
         }
         else    strcpy(s,hregname[reg]);
 }
@@ -1190,11 +1204,13 @@
         rm    = mod_rm & 7;
         rmstr = rm00[rm];
 
-        if(opsize32) ptrtype=DWORDTYPE;
+        if(opsize32 && ptrtype == PTRTYPE) ptrtype=DWORDTYPE;
 
         if(!mmx)
         if( (ptrtype!=NONTYPE)&&(mod!=3) ){
-                if(ptrtype>=DWORDTYPE) {
+                if(ptrtype==WORDTYPE) {
+                        s += sprintf(s,"%s",ptyp[1]);
+                }else if(ptrtype>=DWORDTYPE) {
                         s += sprintf(s,"%s",ptyp[ptrtype]);/* 2:DWORD 3:... */
                 }else{
                         s += sprintf(s,"%s",ptyp[w]);      /* 0:BYTE 1:WORD */
@@ -1249,12 +1265,17 @@
         rm    = mod_rm & 7;
         rmstr = rm32_00[rm];
 
-        if( w && opsize32) ptrtype=DWORDTYPE;
+//      if( w && opsize32) ptrtype=DWORDTYPE;
+        if( w && opsize32 && ptrtype == PTRTYPE)
+        	ptrtype = DWORDTYPE;
 
         if(!mmx)
         if( (ptrtype!=NONTYPE)&&(mod!=3) ){
-                if(ptrtype==DWORDTYPE) {
-                        s += sprintf(s,"%s",ptyp[2]);
+                if(ptrtype==WORDTYPE){
+                        s += sprintf(s,"%s",ptyp[1]);
+                }else if(ptrtype>=DWORDTYPE) {
+//                        s += sprintf(s,"%s",ptyp[2]);
+                        s += sprintf(s,"%s",ptyp[ptrtype]);
                 }else{
                         s += sprintf(s,"%s",ptyp[w]);
                 }
@@ -1353,14 +1374,14 @@
                         *s++ = '*';
                         *s++ = scalestr[scale];
                 }
-	}
+        }
 
 
         switch(mod) {
          case 0: /* [ no basereg , always add 32bit base address] */
-		if(nobase) {
-	                sprintf(s,"+%08lx]",dd());
-	        }else{
+                if(nobase) {
+                        sprintf(s,"+%08lx]",dd());
+                }else{
                         sprintf(s,"]");
                 }
                 break;
@@ -1435,6 +1456,7 @@
 
         opc=(*op++) & 0xff;
         mod_rm=(*op)& 0xff;
+        mod   =(mod_rm>>6)&3;
         reg   =(mod_rm>>3)&7;
         rm    =(mod_rm   )&7;
 
@@ -1444,21 +1466,30 @@
   {static char *n[]={"sldt","str","lldt","ltr","verr","verw",UNDEF,UNDEF};
         op++;
         mne(n[reg]);
-        modrm(op1buf,1,mod_rm,PTRTYPE);
+        modrm(op1buf,1,mod_rm,WORDTYPE);
   }
         break;
  case 0x01:
   {static char *n[]={"sgdt","sidt","lgdt","lidt","smsw",UNDEF,"lmsw","invlpg"};
         op++;
+        if(reg==1 && mod==3){
+        	static char *n2[]=
+        			{"monitor","mwait",UNDEF,UNDEF,UNDEF,UNDEF,UNDEF,UNDEF};
+        	mne(n2[rm]);
+        	break;
+        }
         mne(n[reg]);
         switch(reg) {
         case 0x00:	/* "sgdt" */
-        case 0x01:	/* "lgdt" */
+        case 0x01:	/* "sidt" */
+        case 0x02:	/* "lgdt" */
+        case 0x03:	/* "lidt" */
                 modrm(op1buf,opc,mod_rm,FWORDTYPE);break;
         case 0x07:	/* "invlpg" */
-                PR1(op1p,"%02x",rm);break;
+                //PR1(op1p,"%02x",rm);break;
+                modrm(op1buf,opc,mod_rm,NONTYPE);break;
         default:
-                modrm(op1buf,opc,mod_rm,PTRTYPE);break;
+                modrm(op1buf,opc,mod_rm,WORDTYPE);break;
         }
   }
         break;
@@ -1504,11 +1535,11 @@
  case 0x24: /* MOV     rd,tr     */
         op++;
         mne("mov");
-        op1(eregname[reg]);
+        op1(eregname[rm]);
 		switch(opc) {
-	 	 case 0x20:	PR2(op2p,"cr%d",rm);break;
-	 	 case 0x21:	PR2(op2p,"dr%d",rm);break;
-	 	 case 0x24:	PR2(op2p,"tr%d",rm);break;
+		 case 0x20:	PR2(op2p,"cr%d",reg);break;
+		 case 0x21:	PR2(op2p,"dr%d",reg);break;
+		 case 0x24:	PR2(op2p,"tr%d",reg);break;
 		}
         break;
  case 0x22: /* MOV     cr,rd     */
@@ -1517,11 +1548,11 @@
         op++;
         mne("mov");
 		switch(opc) {
-	 	 case 0x22:	PR1(op1p,"cr%d",rm);break;
-	 	 case 0x23:	PR1(op1p,"dr%d",rm);break;
-	 	 case 0x26:	PR1(op1p,"tr%d",rm);break;
+		 case 0x22:	PR1(op1p,"cr%d",reg);break;
+		 case 0x23:	PR1(op1p,"dr%d",reg);break;
+		 case 0x26:	PR1(op1p,"tr%d",reg);break;
 		}
-        op2(eregname[reg]);
+        op2(eregname[rm]);
         break;
 /*****************************************************************/
  case 0x30: /* WRMSR             */
@@ -1533,6 +1564,40 @@
  case 0x32: /* RDMSR             */
         mne("rdmsr");rem("read model specific register");
         break;
+ case 0x33: /* RDPMC             */
+        mne("rdpmc");
+        break;
+ case 0x34: /* SYSENTER          */
+        mne("sysenter");
+        break;
+ case 0x35: /* SYSEXIT           */
+        mne("sysexit");
+        break;
+/*****************************************************************/
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ case 0x4A:
+ case 0x4B:
+ case 0x4C:
+ case 0x4D:
+ case 0x4E:
+ case 0x4F:
+  {static char *n[]={
+		"cmovo","cmovno","cmovb","cmovnb","cmovz","cmovnz","cmovna","cmova",
+		"cmovs","cmovns","cmovp","cmovnp","cmovl","cmovnl","cmovng","cmovg"};
+		
+		mne( n[ opc & 0x0f ] );
+		modrmov(op1buf,op2buf,1);
+  }
+ 		break;
 /*****************************************************************/
  case 0x80: /* JO      ll        */
  case 0x81: /* JNO     ll        */
@@ -1615,7 +1680,7 @@
         mne("cmpxchg");
 		op++;
         modrm(op1buf,opc,mod_rm,PTRTYPE);
-        op2(regname[reg]);
+        op2(exregname[opsize32][reg]);
         break;
 
  case 0xA8: push("gs");break;/* PUSH    GS        */
@@ -1651,7 +1716,7 @@
         mne("cmpxchg");
 		op++;
         modrm(op1buf,opc,mod_rm,PTRTYPE);
-        op2(regname[reg]);
+        op2(exregname[opsize32][reg]);
         break;
 #if	!KNI
  case 0xAE: /* IMUL    rb,rmb    */
@@ -1692,9 +1757,11 @@
  case 0xB7: /* MOVZX   rd,rmw    */
         op++;
         mne("movzx");
-        if(opc==0xb6)   strcpy(op1p, regname[reg]);
-        else            strcpy(op1p,eregname[reg]);
-        modrm(op2p,opc,mod_rm,PTRTYPE); /*‘æ‚QƒIƒyƒ‰ƒ“ƒh‚Ír/m */
+        strcpy(op1p,exregname[opsize32][reg]);
+        if(opc==0xb6)
+        	modrm(op2p,opc,mod_rm,PTRTYPE); /*‘æ‚QƒIƒyƒ‰ƒ“ƒh‚Ír/m */
+        else
+        	modrm(op2p,opc,mod_rm,WORDTYPE); /*‘æ‚QƒIƒyƒ‰ƒ“ƒh‚Ír/m */
         break;
 #endif
 
@@ -1737,9 +1804,11 @@
  case 0xBF: /* MOVSX   rd,rmw    */
         op++;
         mne("movsx");
-        if(opc==0xbe)   strcpy(op1p, regname[reg]);
-        else            strcpy(op1p,eregname[reg]);
-        modrm(op2p,opc,mod_rm,PTRTYPE); /*‘æ‚QƒIƒyƒ‰ƒ“ƒh‚Ír/m */
+        strcpy(op1p,exregname[opsize32][reg]);
+        if(opc==0xbe)
+        	modrm(op2p,opc,mod_rm,PTRTYPE); /*‘æ‚QƒIƒyƒ‰ƒ“ƒh‚Ír/m */
+        else
+        	modrm(op2p,opc,mod_rm,WORDTYPE); /*‘æ‚QƒIƒyƒ‰ƒ“ƒh‚Ír/m */
         break;
 
  case 0xC0: /* XADD    rmb,rb    */
@@ -1747,13 +1816,16 @@
 		op++;
         mne("xadd");
         modrm(op1buf,opc,mod_rm,PTRTYPE);
-        op2(hregname[reg]);
+        if(opc==0xC0)
+        	op2(hregname[reg]);
+        else
+        	op2(exregname[opsize32][reg]);
         break;
- case 0xC7: /* CMPXCHG8B rmq,rd  */
+ case 0xC7: /* CMPXCHG8B rmq  */
         mne("cmpxchg8b");
 		op++;
-        modrm(op1buf,opc,mod_rm,PTRTYPE);
-        op2(regname[reg]);
+        modrm(op1buf,opc,mod_rm,QWORDTYPE);
+        //op2(regname[reg]);
         break;
 /*****************************************************************/
  case 0xC8: /* BSWAP   eax       */
@@ -1950,27 +2022,31 @@
 	{"faddp","fmulp","fcomp" ,UNDEF,"fsubrp","fsubp","fdivrp","fdivp"};
 static	char *fpu_da_c1[]=
 	{"fadd" ,"fmul" ,UNDEF, "fcompp","fsubr" ,"fsubp","fdivrp","fdivp"};
+static	char *fpu_da_fcmov[]=
+	{"fcmovb","fcmove","fcmovbe","fcmovu"};
 
 /*****************************************************************/
 static	char *fpu_db[]=
-	{"fild",UNDEF,"fist","fistp",UNDEF,"fld",UNDEF,"fstp"};
+	{"fild","fisttp","fist","fistp",UNDEF,"fld",UNDEF,"fstp"};
 static	char *fpu_db_c0[]=
-	{"fneni","fndisi","fnclex","fninit","fsetpm"};
+	{"fneni","fndisi","fnclex","fninit","fsetpm",UNDEF,UNDEF,UNDEF};
+static	char *fpu_db_fcmov[]=
+	{"fcmovnb","fcmovne","fcmovnbe","fcmovnu",UNDEF,"fucomi","fcomi",UNDEF};
 
 /*****************************************************************/
 static	char *fpu_dc_c0[]=
 	{"fadd","fmul","fcom","fcomp","fsubr","fsub","fdivr","fdiv"};
 /*****************************************************************/
 static	char *fpu_dd[]=
-	{"fld",UNDEF,"fst","fst","frstor",UNDEF,"fnsave","fnstsw"};
+	{"fld","fisttp","fst","fstp","frstor",UNDEF,"fnsave","fnstsw"};
 static	char *fpu_dd_c0[]=
 	{"ffree","fxch","fst","fstp","fucom","fucomp",UNDEF,UNDEF};
 
 /*****************************************************************/
 static	char *fpu_df[]=
-	{"fild",UNDEF,"fist","fistp","fbld","fild","fbstp","fistp"};
+	{"fild","fisttp","fist","fistp","fbld","fild","fbstp","fistp"};
 static	char *fpu_df_c0[]=
-	{"ffree","fxch","fst","fstp","fnstsw",UNDEF,UNDEF,UNDEF};
+	{"ffree","fxch","fst","fstp","fnstsw","fucomip","fcomi",UNDEF};
 
 /*****************************************************************/
 
@@ -2006,10 +2082,10 @@
 			modrm(op1p,1,mod_rm,DWORDTYPE);break;
 		case 0x04:
 		case 0x06:
-			modrm(op1p,1,mod_rm, PTRTYPE);break;
+			modrm(op1p,1,mod_rm, NONTYPE);break;
 		case 0x05:
 		case 0x07:
-			modrm(op1p,1,mod_rm, PTRTYPE);break;
+			modrm(op1p,1,mod_rm,WORDTYPE);break;
 		}
 	}else{
 	 switch(mod_rm) {
@@ -2046,9 +2122,13 @@
 	
  case 0xda: 
 	if(mod!=3) {
-		mne(fpu_da[reg]);modrm(op1p,1,mod_rm,PTRTYPE);
+		mne(fpu_da[reg]);modrm(op1p,1,mod_rm,DWORDTYPE);
 	}else{
-		if(mod_rm==0xe9)
+		if(mod_rm<0xe0) {
+			mne(fpu_da_fcmov[reg]);
+			op1("st");
+			PR2(op2p,"st(%d)",rm);
+		}else if(mod_rm==0xe9)
 			mne("fucompp");
 		else
 			undef();
@@ -2063,18 +2143,21 @@
 			modrm(op1p,1,mod_rm,TBYTETYPE);
 		}
 	}else{
-	  	if(mod_rm <0xe0) undef(); else
-	  	if(mod_rm <0xe5) {
-	  		mne(fpu_db_c0[mod_rm - 0xe0]);
-	  	}else
-	  			undef();
-	  	break;
+		if(reg==4) {
+			mne(fpu_db_c0[mod_rm - 0xe0]);
+		}else if(reg<7) {
+			mne(fpu_db_fcmov[reg]);
+			op1("st");
+			PR2(op2p,"st(%d)",rm);
+		}else
+				undef();
+		break;
 	}
 	break;
 	
  case 0xdc: 
 	if(mod!=3) {
-		mne(fpu_d8[reg]);modrm(op1p,1,mod_rm,DWORDTYPE);
+		mne(fpu_d8[reg]);modrm(op1p,1,mod_rm,QWORDTYPE);
 	}else{
 		mne(fpu_dc_c0[reg]);
 		PR1(op1p,"st(%d)",rm);
@@ -2094,10 +2177,10 @@
 			modrm(op1p,1,mod_rm,QWORDTYPE);break;
 		case 0x04:
 		case 0x06:
-			modrm(op1p,1,mod_rm, PTRTYPE);break;
+			modrm(op1p,1,mod_rm, NONTYPE);break;
 		case 0x05:
 		case 0x07:
-			modrm(op1p,1,mod_rm, PTRTYPE);break;
+			modrm(op1p,1,mod_rm,WORDTYPE);break;
 		}
 	}else{
 		mne(fpu_dd_c0[reg]);
@@ -2108,7 +2191,7 @@
 	break;
  case 0xde: 
 	if(mod!=3) {
-		mne(fpu_da[reg]);modrm(op1p,1,mod_rm,PTRTYPE);
+		mne(fpu_da[reg]);modrm(op1p,1,mod_rm,WORDTYPE);
 	}else{
 		if(rm!=1) {
 			mne(fpu_da_c0[reg]);
@@ -2121,9 +2204,30 @@
 	break;
  case 0xdf: 
 	if(mod!=3) {
-		mne(fpu_df[reg]);modrm(op1p,1,mod_rm,PTRTYPE);
+		mne(fpu_df[reg]);//modrm(op1p,1,mod_rm,PTRTYPE);
+		switch(reg) {
+		case 0x00:
+		case 0x01:
+		case 0x02:
+		case 0x03:
+			modrm(op1p,1,mod_rm,WORDTYPE);break;
+		case 0x04:
+		case 0x06:
+			modrm(op1p,1,mod_rm,TBYTETYPE);break;
+		case 0x05:
+		case 0x07:
+			modrm(op1p,1,mod_rm,QWORDTYPE);break;
+		}
 	}else{
-		if(mod_rm!=0xe0) {
+		if(reg==7) {
+			undef();
+			break;
+		}
+		if(reg>4) {
+			mne(fpu_df_c0[reg]);
+			op1("st");
+			PR2(op2p,"st(%d)",rm);
+		}else if(mod_rm!=0xe0) {
 			mne(fpu_df_c0[reg]);
 			PR1(op1p,"st(%d)",rm);
 		}else{
diff -uNr src.org/kni.c src/kni.c
--- src.org/kni.c	1999-02-11 20:52:00.000000000 +0900
+++ src/kni.c	2005-01-06 18:36:22.000000000 +0900
@@ -38,7 +38,9 @@
 0f ae		fxrstor		
 0f ae		ldmxcsr		
 0f ae		stmxcsr		
+0f ae		lfence		
 0f ae		sfence		
+0f ae		clflush		
 0f c2		cmpltps		
 0f c2		cmpordps	
 0f c2		cmpeqps		
@@ -150,7 +152,10 @@
 {0xae,FXSAVE  ,"ldmxcsr"	,"ldmxcsr"	/*,"LoaD Multimedia eXtended Control/Status Register"*/},
 {0xae,FXSAVE  ,"stmxcsr"	,"stmxcsr"	/*,"STore Multimedia eXtended Control/Status Register"*/},
 {0xae,FXSAVE  ,"fxsave??"	,"fxsave??"	/*,""*/},
+{0xae,FXSAVE  ,"lfence"		,"lfence"	/*,""*/},
+{0xae,FXSAVE  ,"fxsave??"	,"fxsave??"	/*,""*/},
 {0xae,FXSAVE  ,"sfence"		,"sfence"	/*,""*/},
+{0xae,FXSAVE  ,"clflush"	,"clflush"	/*,""*/},
 {0xc2,CMPXX_PS,"cmpeqps"	,"cmpeqss"	/*,"Compare Equal parallel scalar"*/},
 {0xc2,CMPXX_PS,"cmpltps"	,"cmpltss"	/*,"Compare Less Than"*/},
 {0xc2,CMPXX_PS,"cmpleps"	,"cmpless"	/*,"Compare Less than or Equal"*/},
@@ -185,6 +190,7 @@
 	int cmp_xx;
 	int mod_rm;
 	int reg;
+	int mod;
 
 	while( t->code ) {
 		if(t->code == opc) break;
@@ -209,16 +215,21 @@
 	  case PREFETCH:	// === prefetchnta,prefetcht0,prefetcht1,prefetcht2
 	  case FXSAVE:		// === fxsave,fxrstor,ldmxcsr,stmxcsr,sfence
 		mod_rm=(*op++) & 0xff;
-        reg   =( mod_rm >>3) & 7;
+		reg   =( mod_rm >>3) & 7;
+		mod   =( mod_rm >>6) & 3;
 
-		if((reg==7)&&(t->attr==FXSAVE)) {	// === sfence
-			t += 5;		// look ahead
-			mne( t->inst );
-			return;
+		if((reg>=4)&&(t->attr==FXSAVE)) {	// === lfence,sfence,clflush
+			if((reg==7) && (mod!=3)) {		// === clflush
+				t += 8;			// look ahead
+			}else{
+				t += reg;		// look ahead
+				mne( t->inst );
+				return;
+			}
+		} else {
+			if(reg>=4) reg=4;			// REGister field:range error
+			t += reg;	// look ahead!
 		}
-
-		if(reg>=4) reg=4;			// REGister field:range error
-		t += reg;	// look ahead!
 		
 		mne( t->inst );
         modrm(op1buf,1,mod_rm,NONTYPE);   /*‘æ‚QƒIƒyƒ‰ƒ“ƒh‚Ír/m */
diff -uNr src.org/le.c src/le.c
--- src.org/le.c	2002-10-30 20:42:06.000000000 +0900
+++ src/le.c	2005-01-07 17:56:41.343705600 +0900
@@ -114,11 +114,51 @@
 		printf("     virtual size    = 0x%lx\n",objt.virtual_size);
 		printf("     relocation base = 0x%lx\n",objt.rel_base);
 		printf("     file offset     = 0x%lx\n",offset);
+		printf("     flag            = 0x%lx - ",objt.flag);
+		if(objt.flag & 0x0001)
+			printf("Read");
+		if(objt.flag & 0x0002)
+			printf(",Write");
+		if(objt.flag & 0x0004)
+			printf(",Exec");
+		if(objt.flag & 0x0008)
+			printf(",Rsrc");
+		if(objt.flag & 0x0010)
+			printf(",Discard");
+		if(objt.flag & 0x0020)
+			printf(",Share");
+		if(objt.flag & 0x0040)
+			printf(",Preload");
+		if(objt.flag & 0x0080)
+			printf(",Inval");
+		if(objt.flag & 0x0300) {
+			switch(objt.flag & 0x0300){
+			case 0x0100:	printf(",ZeroFill");	break;
+			case 0x0200:	printf(",Resident");	break;
+			case 0x0300:	printf(",Resident/cont");	break;
+			}
+		}
+		if(objt.flag & 0x0400)
+			printf(",Long-loc");
+		//if(objt.flag & 0x0800)
+		if(objt.flag & 0x1000)
+			printf(",16bit");
+		if(objt.flag & 0x2000)
+			printf(",32bit");
+		if(objt.flag & 0x4000)
+			printf(",Conform");
+		if(objt.flag & 0x8000)
+			printf(",I/O");
+		
+		printf("\n");
 
       ifopt('s') {
       	pe.opt.ImageBase           =objt.rel_base;
       	
-	    set_cpumode(1,1);	/* ƒAƒhƒŒƒX�AƒIƒyƒ‰ƒ“ƒhƒTƒCƒY‹¤‚É‚R‚Q‚‚‚‰‚” */
+		if(objt.flag & 0x2000)
+			set_cpumode(1,1);	/* ƒAƒhƒŒƒX�AƒIƒyƒ‰ƒ“ƒhƒTƒCƒY‹¤‚É‚R‚Q‚‚‚‰‚” */
+		else
+			set_cpumode(0,0);	/* ƒAƒhƒŒƒX�AƒIƒyƒ‰ƒ“ƒhƒTƒCƒY‹¤‚É16‚‚‚‰‚” */
 		set_exemode(1);		/* LE MODE */
         code32_dump(i+1,"LE_CODE"       /*ƒZƒNƒVƒ‡ƒ“–¼ */
                    ,offset				/*ƒtƒ@ƒCƒ‹‚Ì�æ“ª‚©‚ç‚ÌƒIƒtƒZƒbƒg*/
@@ -130,4 +170,4 @@
 		le_objt += sizeof(objt);
 	}
 	
-}
\ No newline at end of file
+}
diff -uNr src.org/makefile src/makefile
--- src.org/makefile	2002-10-30 21:36:04.000000000 +0900
+++ src/makefile	2004-05-26 19:23:58.000000000 +0900
@@ -13,11 +13,12 @@
 OPT	= -DMINGW
 EXE	= .exe
 endif
+CC	= gcc
 #
 #  ===== rule =====
 #
 .c.o:
-	gcc ${OPT} -O2 -c $*.c
+	${CC} ${OPT} -O2 -c $*.c
 #
 #  ===== source files =====
 #
@@ -30,10 +31,10 @@
 #  ===== target =====
 #
 diswin${EXE}: $(files) $(mips) $(sh) $(arm)
-	gcc -s -o $@  $(files) $(mips) $(sh) $(arm)
-#
-# w/map
-#	gcc -s -o $@  $(files) $(mips) $(sh) $(arm) -Xlinker -Map=diswin.map
+	${CC} -s -o $@  $(files) $(mips) $(sh) $(arm)
+#
+# w/map
+#	${CC} -s -o $@  $(files) $(mips) $(sh) $(arm) -Xlinker -Map=diswin.map
 #
 #  ===== other stuff =====
 #
diff -uNr src.org/makefile.gcc src/makefile.gcc
--- src.org/makefile.gcc	2002-10-30 21:36:04.000000000 +0900
+++ src/makefile.gcc	2004-05-26 19:23:58.000000000 +0900
@@ -13,11 +13,12 @@
 OPT	= -DMINGW
 EXE	= .exe
 endif
+CC	= gcc
 #
 #  ===== rule =====
 #
 .c.o:
-	gcc ${OPT} -O2 -c $*.c
+	${CC} ${OPT} -O2 -c $*.c
 #
 #  ===== source files =====
 #
@@ -30,10 +31,10 @@
 #  ===== target =====
 #
 diswin${EXE}: $(files) $(mips) $(sh) $(arm)
-	gcc -s -o $@  $(files) $(mips) $(sh) $(arm)
-#
-# w/map
-#	gcc -s -o $@  $(files) $(mips) $(sh) $(arm) -Xlinker -Map=diswin.map
+	${CC} -s -o $@  $(files) $(mips) $(sh) $(arm)
+#
+# w/map
+#	${CC} -s -o $@  $(files) $(mips) $(sh) $(arm) -Xlinker -Map=diswin.map
 #
 #  ===== other stuff =====
 #
diff -uNr src.org/pe.c src/pe.c
--- src.org/pe.c	2002-10-30 21:20:52.000000000 +0900
+++ src/pe.c	2005-01-05 04:41:40.000000000 +0900
@@ -594,26 +594,41 @@
  		p++;
  	}
  }
- 	for (i=0;i<export->NumberOfNames;i++) {
-		labelptr = &loadbuf[*name - impdelta];
+	for (i=0;i<export->NumberOfFunctions;i++) {
+		int j, ordinal, noname = 1;
+		char labelbuf[128];
+		
+		for (j=0;j<export->NumberOfNames;j++) {
+			if (ordinals[j] == i) {
+				labelptr = &loadbuf[name[j] - impdelta];
+				ordinal = ordinals[j] + export->Base;
+				noname = 0;
+				break;
+			}
+		}
+		if (noname) {
+			ordinal = i + export->Base;
+			sprintf(labelbuf, "<Ordinal_%05lu>", ordinal);
+			labelptr = labelbuf;
+		}
 
  if(!IsOpt('x')) {
 		printf("   %08lx  %4lu:%s\n",
 				*functions,
-				*ordinals + export->Base,
+				 ordinal,
 				 labelptr
 			  );
 		insert_hash2(*functions + pe.opt.ImageBase,0,xstrdup(labelptr));
  }else{
 		printf("  %s.%lu	%s\n",
 				 ModuleName,
-				*ordinals + export->Base,
+				 ordinal,
 				 labelptr
 			  );
  }
 
-		name++;
-		ordinals++;
+	//	name++;
+	//	ordinals++;
 		functions++;
 	}
 	return (0);
