Author: greatlrd
Date: Sun Jan 14 02:26:32 2007
New Revision: 25445
URL:
http://svn.reactos.org/svn/reactos?rev=25445&view=rev
Log:
start on adding the own langues, this version create a memory leak if u try run this tool
in translate mode. but not in
disambler mode. (only true for ppc brain about memory leak)
Added:
trunk/rosapps/devutils/cputointel/any_op.h (with props)
Modified:
trunk/rosapps/devutils/cputointel/CpuToIntel.c
trunk/rosapps/devutils/cputointel/From/PPC/PPCopcode.c
trunk/rosapps/devutils/cputointel/misc.c
trunk/rosapps/devutils/cputointel/misc.h
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 Sun Jan 14 02:26:32 2007
@@ -4,6 +4,10 @@
#include <stdlib.h>
#include <string.h>
#include "misc.h"
+#include "any_op.h"
+
+PMYBrainAnalys pMyBrainAnalys = NULL;
+
int main(int argc, char * argv[])
{
@@ -89,7 +93,6 @@
}
-
return LoadPFileImage(infile,outfile,BaseAddress,cpuid,type, mode);
//return
LoadPFileImage("e:\\testms.exe","e:\\cputointel.asm",0,0,0,0);
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 Sun Jan 14 02:26:32 2007
@@ -3,7 +3,7 @@
#include <stdlib.h>
#include "PPC.h"
#include "../../misc.h"
-
+#include "../../any_op.h"
/* cpuDummyInit_Add
* Input param :
@@ -39,11 +39,6 @@
printf(";Add unimplement\n");
return -1;
}
- // stb
-
- // li %r3, 0 : op 00 00 60 38
- // li = ld
-// 0000 0000 0000 0000 0100 0000 0011 1000
CPU_INT PPC_Ld( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
@@ -60,10 +55,23 @@
formD = (opcode & ConvertBitToByte32(PPC_D)) >> 10;
formDS = (opcode & ConvertBitToByte32(PPC_ds)) >> 15;
+ fprintf(out,"Line_0x%08x:\n",BaseAddress + cpu_pos);
if (mode==0)
{
- fprintf(out,"Line_0x%08x:\n",BaseAddress + cpu_pos);
fprintf(out,"li %%r%d,%d\n",formA, formDS);
+ }
+ if (mode!=0)
+ {
+ /* own translatons langues */
+ if (AllocAny()!=0) /* alloc memory for pMyBrainAnalys */
+ {
+ return -1;
+ }
+ pMyBrainAnalys->op = OP_ANY_mov;
+ pMyBrainAnalys->type= 1 + 8; /* 1 dst reg, 8 imm */
+ pMyBrainAnalys->src_size = 16;
+ pMyBrainAnalys->src = formDS;
+ pMyBrainAnalys->dst = formA;
}
printf(";not full implement \n");
Added: 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 (added)
+++ trunk/rosapps/devutils/cputointel/any_op.h Sun Jan 14 02:26:32 2007
@@ -1,0 +1,24 @@
+
+
+#define OP_ANY_mov 0x00000000
+
+
+typedef struct _BrainAnalys
+{
+ CPU_UNINT op; /* one tranlator for any cpu type set our own opcode */
+ CPU_INT type; /* 0 = source are memmory, 1 source are register */
+ /* 2 = dest are memmory, 4 dest are register */
+ /* 8 = source are imm */
+ 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*/
+
+ CPU_UNINT64 src;
+ CPU_UNINT64 dst;
+
+ /* try translate the Adress to a name */
+ CPU_BYTE* ptr_next; /* hook next one */
+ CPU_BYTE* ptr_prev; /* hook previus one */
+} MYBrainAnalys, *PMYBrainAnalys;
+
+extern PMYBrainAnalys pMyBrainAnalys;
+
Propchange: trunk/rosapps/devutils/cputointel/any_op.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rosapps/devutils/cputointel/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/misc.c…
==============================================================================
--- trunk/rosapps/devutils/cputointel/misc.c (original)
+++ trunk/rosapps/devutils/cputointel/misc.c Sun Jan 14 02:26:32 2007
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include "misc.h"
+#include "any_op.h"
#include "From/ARM/ARM.h"
#include "From/m68k/m68k.h"
#include "From/PPC/PPC.h"
@@ -128,7 +129,35 @@
}
-// add no carry
+CPU_INT AllocAny()
+{
+
+ if (pMyBrainAnalys== NULL)
+ {
+ pMyBrainAnalys = (PMYBrainAnalys) malloc(sizeof(MYBrainAnalys));
+ if (pMyBrainAnalys==NULL)
+ {
+ return -1;
+ }
+ ZeroMemory(pMyBrainAnalys,sizeof(MYBrainAnalys));
+ }
+ else
+ {
+ PMYBrainAnalys tmp;
+ tmp = (PMYBrainAnalys) malloc(sizeof(MYBrainAnalys));
+ if (tmp==NULL)
+ {
+ return -1;
+ }
+ ZeroMemory(pMyBrainAnalys,sizeof(MYBrainAnalys));
+
+ pMyBrainAnalys->ptr_next = (CPU_BYTE*)tmp;
+ tmp->ptr_prev= (CPU_BYTE*)pMyBrainAnalys;
+
+ pMyBrainAnalys = tmp;
+ }
+return 0;
+}
Modified: trunk/rosapps/devutils/cputointel/misc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/misc.h…
==============================================================================
--- trunk/rosapps/devutils/cputointel/misc.h (original)
+++ trunk/rosapps/devutils/cputointel/misc.h Sun Jan 14 02:26:32 2007
@@ -23,3 +23,4 @@
CPU_UNINT GetData32Le(CPU_BYTE *cpu_buffer);
CPU_UNINT GetData32Be(CPU_BYTE *cpu_buffer);
+CPU_INT AllocAny();