mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
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) svn path=/trunk/; revision=25445
This commit is contained in:
parent
95c8fa90a8
commit
c96114a82c
5 changed files with 74 additions and 9 deletions
|
@ -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 @@ int main(int argc, char * argv[])
|
|||
|
||||
}
|
||||
|
||||
|
||||
return LoadPFileImage(infile,outfile,BaseAddress,cpuid,type, mode);
|
||||
//return LoadPFileImage("e:\\testms.exe","e:\\cputointel.asm",0,0,0,0);
|
||||
|
||||
|
|
|
@ -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 @@ CPU_INT PPC_Addx( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
|
|||
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,11 +55,24 @@ CPU_INT PPC_Ld( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
|
|||
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");
|
||||
return 4;
|
||||
|
|
24
rosapps/devutils/cputointel/any_op.h
Normal file
24
rosapps/devutils/cputointel/any_op.h
Normal file
|
@ -0,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;
|
||||
|
|
@ -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 @@ CPU_UNINT GetData32Be(CPU_BYTE *cpu_buffer)
|
|||
}
|
||||
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,3 +23,4 @@ CPU_UNINT GetMaskByte32(CPU_BYTE *bit);
|
|||
CPU_UNINT GetData32Le(CPU_BYTE *cpu_buffer);
|
||||
CPU_UNINT GetData32Be(CPU_BYTE *cpu_buffer);
|
||||
|
||||
CPU_INT AllocAny();
|
||||
|
|
Loading…
Reference in a new issue