Author: greatlrd
Date: Sun Jan 14 15:10:53 2007
New Revision: 25448
URL:
http://svn.reactos.org/svn/reactos?rev=25448&view=rev
Log:
adding blr opcode (can not found it in the ibm or motorala doc, the primary opcode refens
to addi).
now we can disambler two opcode the li and blr, add blr to my own asm langues.
Modified:
trunk/rosapps/devutils/cputointel/From/PPC/PPC.h
trunk/rosapps/devutils/cputointel/From/PPC/PPCBrain.c
trunk/rosapps/devutils/cputointel/From/PPC/PPCBrain.h
trunk/rosapps/devutils/cputointel/From/PPC/PPCopcode.c
trunk/rosapps/devutils/cputointel/any_op.h
trunk/rosapps/devutils/cputointel/misc.c
Modified: trunk/rosapps/devutils/cputointel/From/PPC/PPC.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/From/P…
==============================================================================
--- trunk/rosapps/devutils/cputointel/From/PPC/PPC.h (original)
+++ trunk/rosapps/devutils/cputointel/From/PPC/PPC.h Sun Jan 14 15:10:53 2007
@@ -12,11 +12,8 @@
/* here we put the prototype for the opcode api that brain need we show a example for it
*/
CPU_INT PPC_Addx(FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size,
CPU_UNINT BaseAddress, CPU_UNINT cpuarch, CPU_INT mode);
-
-
-CPU_INT PPC_Ld( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
- CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch,
- CPU_INT mode);
+CPU_INT PPC_Blr( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size,
CPU_UNINT BaseAddress, CPU_UNINT cpuarch, CPU_INT mode);
+CPU_INT PPC_Ld( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos, CPU_UNINT cpu_size,
CPU_UNINT BaseAddress, CPU_UNINT cpuarch, CPU_INT mode);
/* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu
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 Sun Jan 14 15:10:53 2007
@@ -53,6 +53,19 @@
CPU_INT retsize;
+ /* 0x12 = 0001 0010,
+ 0x10 = 0001 0000
+ 0x13 = 0001 0011
+
+ 0x20 = 0010 0000 0 0000 0010 2
+ 0x80 = 1000 0000 0 0000 1000 8
+ 0x4e = 0010 1110 E 1110 0010 2
+
+ 0x20 00 80 4e
+ 0010 0000 0000 0000 1000 0000 0100 1110
+
+ */
+
/* now we start the process */
while (cpu_pos<cpu_size)
{
@@ -60,10 +73,21 @@
cpuint = GetData32Le(&cpu_buffer[cpu_pos]);
- /* Add */
- if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_Addx))) ==
ConvertBitToByte32(cpuPPCInit_Addx))
+ ///* Add */
+ //if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_Addx))) ==
ConvertBitToByte32(cpuPPCInit_Addx))
+ //{
+ // retsize = PPC_Addx( outfp, cpu_buffer, cpu_pos, cpu_size,
+ // BaseAddress, cpuarch, mode);
+ // if (retsize<0)
+ // retcode = 1;
+ // else
+ // cpu_pos += retsize;
+ //}
+
+ /* 0x38 Ld aslo known as Li */
+ if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_Ld))) ==
ConvertBitToByte32(cpuPPCInit_Ld))
{
- retsize = PPC_Addx( outfp, cpu_buffer, cpu_pos, cpu_size,
+ retsize = PPC_Ld( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch, mode);
if (retsize<0)
retcode = 1;
@@ -71,10 +95,10 @@
cpu_pos += retsize;
}
- /* Ld aslo known as Li */
- if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_Ld))) ==
ConvertBitToByte32(cpuPPCInit_Ld))
+ /* hard code the op blr */
+ if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_Blr))) ==
ConvertBitToByte32(cpuPPCInit_Blr))
{
- retsize = PPC_Ld( outfp, cpu_buffer, cpu_pos, cpu_size,
+ retsize = PPC_Blr( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch, mode);
if (retsize<0)
retcode = 1;
@@ -106,5 +130,5 @@
break;
}
}
- return retcode;
+ return retcode;
}
Modified: trunk/rosapps/devutils/cputointel/From/PPC/PPCBrain.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/From/P…
==============================================================================
--- trunk/rosapps/devutils/cputointel/From/PPC/PPCBrain.h (original)
+++ trunk/rosapps/devutils/cputointel/From/PPC/PPCBrain.h Sun Jan 14 15:10:53 2007
@@ -9,6 +9,7 @@
* same. thuse bit are always 0 or 1
*/
CPU_BYTE cpuPPCInit_Addx[32] =
{2,0,1,0,1,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,0};
+CPU_BYTE cpuPPCInit_Blr[32] =
{0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0};
CPU_BYTE cpuPPCInit_Ld[32] =
{0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,1,1,1,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 15:10:53 2007
@@ -44,6 +44,31 @@
return -1;
}
+CPU_INT PPC_Blr( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
+ CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch,
+ CPU_INT mode)
+{
+
+ BaseAddress +=cpu_pos;
+ if (mode==0)
+ {
+ fprintf(out,"Line_0x%08x:\n",BaseAddress);
+ fprintf(out,"blr\n");
+ }
+ else if (mode>0)
+ {
+ /* own translatons langues */
+ if (AllocAny()!=0) /* alloc memory for pMyBrainAnalys */
+ {
+ return -1;
+ }
+ pMyBrainAnalys->op = OP_ANY_ret;
+ pMyBrainAnalys->memAdr=BaseAddress;
+ }
+
+ return 4;
+}
+
CPU_INT PPC_Ld( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch,
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 Sun Jan 14 15:10:53 2007
@@ -1,7 +1,7 @@
#define OP_ANY_mov 0x00000000
-
+#define OP_ANY_ret 0x00000001
typedef struct _BrainAnalys
{
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 15:10:53 2007
@@ -161,7 +161,13 @@
CPU_INT FreeAny()
{
- PMYBrainAnalys tmp;
+ PMYBrainAnalys tmp = NULL;
+
+ if (pMyBrainAnalys == NULL)
+ {
+ return -1;
+ }
+
tmp = (PMYBrainAnalys)pMyBrainAnalys->ptr_prev;
while (pMyBrainAnalys != NULL)