Author: greatlrd
Date: Fri Jan 19 00:35:48 2007
New Revision: 25517
URL:
http://svn.reactos.org/svn/reactos?rev=25517&view=rev
Log:
Adding stwu to converting to ia32
fixing some smaller bug when it was disabmler
fixing dymatic translations of abi for ppc and ia32
Modified:
trunk/rosapps/devutils/cputointel/ConvertToIA32Process.c
trunk/rosapps/devutils/cputointel/CpuToIntel.c
trunk/rosapps/devutils/cputointel/From/PPC/PPCBrain.c
trunk/rosapps/devutils/cputointel/From/PPC/PPCopcode.c
trunk/rosapps/devutils/cputointel/any_op.h
Modified: trunk/rosapps/devutils/cputointel/ConvertToIA32Process.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/Conver…
==============================================================================
--- trunk/rosapps/devutils/cputointel/ConvertToIA32Process.c (original)
+++ trunk/rosapps/devutils/cputointel/ConvertToIA32Process.c Fri Jan 19 00:35:48 2007
@@ -28,6 +28,57 @@
* mmx/sse/fpu 7 = 28
*/
+static void standardreg(CPU_INT *RegTableCount, CPU_UNINT reg, CPU_INT setup_ebp, FILE
*outfp)
+{
+ /* eax */
+ if (reg == RegTableCount[3])
+ {
+ fprintf(outfp,"eax");
+ }
+ /* ebp */
+ else if (reg == RegTableCount[31])
+ {
+ fprintf(outfp,"ebp");
+ }
+ /* edx */
+ else if (reg == RegTableCount[4])
+ {
+ fprintf(outfp,"edx");
+ }
+ /* esp */
+ else if (reg == RegTableCount[1])
+ {
+ fprintf(outfp,"esp");
+ }
+ /* ecx */
+ else if (reg == RegTableCount[8])
+ {
+ fprintf(outfp,"ecx");
+ }
+ /* ebx */
+ else if (reg == RegTableCount[9])
+ {
+ fprintf(outfp,"ebx");
+ }
+ /* esi */
+ else if (reg == RegTableCount[10])
+ {
+ fprintf(outfp,"esi");
+ }
+ /* edi */
+ else if (reg == RegTableCount[10])
+ {
+ fprintf(outfp,"edi");
+ }
+ else
+ {
+ if (setup_ebp == 1)
+ fprintf(outfp,"dword [ebx - %d]");
+ else
+ fprintf(outfp,"; unsuported should not happen it happen :(\n");
+ }
+}
+
CPU_INT ConvertToIA32Process( FILE *outfp,
PMYBrainAnalys pMystart,
PMYBrainAnalys pMyend, CPU_INT regbits,
@@ -108,99 +159,52 @@
if ((pMystart->type & 16)== 16)
{
/* source are imm */
-
- /*
- * esi = 10
- * edi = 11 */
-
- /* eax */
- if (pMystart->dst == RegTableCount[3])
+ if ((pMystart->src == 0) &&
+ (setup_ebp == 0))
{
- if (pMystart->src == 0)
- fprintf(outfp,"xor eax,eax\n");
- else
- fprintf(outfp,"mov eax,%llu\n",pMystart->src);
- }
- /* ebp */
- else if (pMystart->dst == RegTableCount[31])
- {
- if (pMystart->src == 0)
- fprintf(outfp,"xor ebp,ebp\n");
- else
- fprintf(outfp,"mov ebp,%llu\n",pMystart->src);
- }
- /* edx */
- else if (pMystart->dst == RegTableCount[4])
- {
- if (pMystart->src == 0)
- fprintf(outfp,"xor edx,edx\n");
- else
- fprintf(outfp,"mov edx,%llu\n",pMystart->src);
- }
- /* esp */
- else if (pMystart->dst == RegTableCount[1])
- {
- if (pMystart->src == 0)
- fprintf(outfp,"xor esp,esp\n");
- else
- fprintf(outfp,"mov esp,%llu\n",pMystart->src);
- }
- /* ecx */
- else if (pMystart->dst == RegTableCount[8])
- {
- if (pMystart->src == 0)
- fprintf(outfp,"xor ecx,ecx\n");
- else
- fprintf(outfp,"mov ecx,%llu\n",pMystart->src);
- }
- /* ebx */
- else if (pMystart->dst == RegTableCount[9])
- {
- if (pMystart->src == 0)
- fprintf(outfp,"xor ebx,ebx\n");
- else
- fprintf(outfp,"mov ebx,%llu\n",pMystart->src);
- }
- /* esi */
- else if (pMystart->dst == RegTableCount[10])
- {
- if (pMystart->src == 0)
- fprintf(outfp,"xor esi,esi\n");
- else
- fprintf(outfp,"mov esi,%llu\n",pMystart->src);
- }
- /* edi */
- else if (pMystart->dst == RegTableCount[10])
- {
- if (pMystart->src == 0)
- fprintf(outfp,"xor edi,edi\n");
- else
- fprintf(outfp,"mov edi,%llu\n",pMystart->src);
+ /* small optimze */
+ fprintf(outfp,"xor ");
+ standardreg( RegTableCount,
+ pMystart->dst,
+ setup_ebp, outfp);
+ fprintf(outfp,",");
+ standardreg( RegTableCount,
+ pMystart->dst,
+ setup_ebp, outfp);
+ fprintf(outfp,"\n");
}
else
{
- if (setup_ebp == 1)
- fprintf(outfp,"mov dword [ebx - %d], %llu\n", tmp,
pMystart->src);
- else
- {
- fprintf(outfp,"unsuported optimze should not happen it
happen :(\n");
- }
+ fprintf(outfp,"mov ");
+ standardreg( RegTableCount,
+ pMystart->dst,
+ setup_ebp, outfp);
+ fprintf(outfp,",%llu\n",pMystart->src);
}
+ } /* end "source are imm" */
+ } /* end pMyBrainAnalys->type & 8 */
+
+ if ((pMystart->type & 64)== 64)
+ {
+ if ((pMystart->type & 2)== 2)
+ {
+ /* dest [eax - 0x20], source reg */
+
+ fprintf(outfp,"mov [");
+ standardreg( RegTableCount,
+ pMystart->dst,
+ setup_ebp, outfp);
+ fprintf(outfp," %d], ",pMystart->dst_extra);
+ standardreg( RegTableCount,
+ pMystart->src,
+ setup_ebp, outfp);
+ fprintf(outfp,"\n");
}
-
- if ((pMystart->type & 32)== 32)
- {
- /* source are [reg - xx] */
- if (setup_ebp == 1)
- fprintf(outfp,"not supporet\n");
- else
- {
- fprintf(outfp,"not supporet\n");
- fprintf(outfp,"mov eax,
word[eax%d]\n",pMystart->src_extra);
- }
-
- }
- } /* end pMyBrainAnalys->type & 8 */
+ }
+
+
+
+
}
/* return */
Modified: trunk/rosapps/devutils/cputointel/CpuToIntel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/CpuToI…
==============================================================================
--- trunk/rosapps/devutils/cputointel/CpuToIntel.c (original)
+++ trunk/rosapps/devutils/cputointel/CpuToIntel.c Fri Jan 19 00:35:48 2007
@@ -95,7 +95,7 @@
//}
//return LoadPFileImage(infile,outfile,BaseAddress,cpuid,type, mode);
- return
LoadPFileImage("e:\\testppc.exe","e:\\cputointel.asm",0,0,0,2); //
disambler
+ return
LoadPFileImage("e:\\testppc.exe","e:\\cputointel.asm",0,0,0,1); //
disambler
// return
LoadPFileImage("e:\\testms.exe","e:\\cputointel.asm",0,0,0,1); //
convert
}
Modified: trunk/rosapps/devutils/cputointel/From/PPC/PPCBrain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/From/P…
==============================================================================
--- trunk/rosapps/devutils/cputointel/From/PPC/PPCBrain.c (original)
+++ trunk/rosapps/devutils/cputointel/From/PPC/PPCBrain.c Fri Jan 19 00:35:48 2007
@@ -116,5 +116,6 @@
}
}
+// return 0; // hack getting dismabler working or converting working
return retcode;
}
Modified: trunk/rosapps/devutils/cputointel/From/PPC/PPCopcode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/From/P…
==============================================================================
--- trunk/rosapps/devutils/cputointel/From/PPC/PPCopcode.c (original)
+++ trunk/rosapps/devutils/cputointel/From/PPC/PPCopcode.c Fri Jan 19 00:35:48 2007
@@ -98,6 +98,8 @@
CPU_INT PPC_Stwu( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch)
{
+ /* r1 store at -0x20(r1) */
+
CPU_UNINT opcode;
CPU_SHORT tmp = 0;
@@ -114,12 +116,12 @@
tmp = _byteswap_ushort( ((CPU_SHORT)((opcode >> 16) & 0xffff)));
pMyBrainAnalys->op = OP_ANY_mov;
- pMyBrainAnalys->type= 2 + 8 + 32; /* 2 src reg 8 dst reg, 32 neg */
- pMyBrainAnalys->src_size = 16;
- pMyBrainAnalys->dst_size = 16;
+ pMyBrainAnalys->type= 2 + 64;
+ pMyBrainAnalys->src_size = 32;
+ pMyBrainAnalys->dst_size = 32;
pMyBrainAnalys->src = PPC_GetBitArrayBto31xx(opcode);
pMyBrainAnalys->dst = PPC_GetBitArrayDstReg(opcode);
- pMyBrainAnalys-> src_extra = tmp;
+ pMyBrainAnalys-> dst_extra = tmp;
pMyBrainAnalys->memAdr=BaseAddress;
return 4;
Modified: trunk/rosapps/devutils/cputointel/any_op.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/any_op…
==============================================================================
--- trunk/rosapps/devutils/cputointel/any_op.h (original)
+++ trunk/rosapps/devutils/cputointel/any_op.h Fri Jan 19 00:35:48 2007
@@ -32,6 +32,7 @@
/* 4 = dest are memmory, 8 dest are register */
/* 16 = source are imm */
/* 32 = soucre -xx(r1) or [eax-xx] */
+ /* 64 = dest -xx(r1) or [eax-xx] */
CPU_INT src_size; /* who many bits are src not vaild for reg*/
CPU_INT dst_size; /* who many bits are dst not vaild for reg*/
@@ -40,6 +41,7 @@
CPU_UNINT64 dst;
CPU_INT src_extra; /* if type == 32 are set */
+ CPU_INT dst_extra; /* if type == 32 are set */
CPU_UNINT memAdr; /* where are we in the current memory pos + baseaddress */