Author: greatlrd
Date: Sat Jan 13 20:27:14 2007
New Revision: 25440
URL:
http://svn.reactos.org/svn/reactos?rev=25440&view=rev
Log:
adding GetData32Be, GetData32Le for getting 4bytes from big or lite endian
start implment Ld for ppc.
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/From/dummycpu/DummyBrain.c
trunk/rosapps/devutils/cputointel/misc.c
trunk/rosapps/devutils/cputointel/misc.h
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 Sat Jan 13 20:27:14 2007
@@ -14,6 +14,14 @@
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);
+
/* Export comment thing see m68k for example
* in dummy we do not show it, for it is diffent for each cpu
*/
+
+extern CPU_BYTE PPC_D[32];
+extern CPU_BYTE PPC_A[32];
+extern CPU_BYTE PPC_ds[32];
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 Sat Jan 13 20:27:14 2007
@@ -58,12 +58,23 @@
{
cpu_oldpos = cpu_pos;
- cpuint = cpu_buffer[cpu_pos];
-
+ cpuint = GetData32Le(&cpu_buffer[cpu_pos]);
+
/* 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;
+ }
+
+ /* Ld aslo known as Li */
+ if ((cpuint - (cpuint & GetMaskByte32(cpuPPCInit_Ld))) ==
ConvertBitToByte32(cpuPPCInit_Ld))
+ {
+ retsize = PPC_Ld( outfp, cpu_buffer, cpu_pos, cpu_size,
BaseAddress, cpuarch, mode);
if (retsize<0)
retcode = 1;
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 Sat Jan 13 20:27:14 2007
@@ -10,3 +10,18 @@
*/
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_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};
+CPU_BYTE cpuPPCInit_Ldu[32] =
{1,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};
+
+
+/* mask */
+CPU_BYTE PPC_D[32] =
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0};
+CPU_BYTE PPC_A[32] =
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0};
+CPU_BYTE PPC_ds[32] =
{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+/* bit index
+ 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0
0
+ 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1
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 Sat Jan 13 20:27:14 2007
@@ -39,3 +39,31 @@
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,
+ CPU_UNINT cpu_size, CPU_UNINT BaseAddress, CPU_UNINT cpuarch,
+ CPU_INT mode)
+{
+ CPU_UNINT formA;
+ CPU_UNINT formD;
+ CPU_UNINT formDS;
+ CPU_UNINT opcode;
+
+ opcode = GetData32Le(cpu_buffer);
+ formA = (opcode & ConvertBitToByte(PPC_A)) >> 5;
+ formD = (opcode & ConvertBitToByte(PPC_D)) >> 10;
+ formDS = (opcode & ConvertBitToByte(PPC_ds)) >> 15;
+
+ if (mode==0)
+ {
+ fprintf(out,"Line_0x%8x :\n",BaseAddress + cpu_pos);
+ }
+
+ printf(";not full implement \n");
+ return 4;
+}
+
Modified: trunk/rosapps/devutils/cputointel/From/dummycpu/DummyBrain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/From/d…
==============================================================================
--- trunk/rosapps/devutils/cputointel/From/dummycpu/DummyBrain.c (original)
+++ trunk/rosapps/devutils/cputointel/From/dummycpu/DummyBrain.c Sat Jan 13 20:27:14 2007
@@ -59,7 +59,13 @@
{
cpu_oldpos = cpu_pos;
- cpuint = cpu_buffer[cpu_pos];
+ /* use the GetData32Be or GetData32Le
+ to read from the memory the
+ Le is for small endian and the
+ Be is for big endian
+ the 32 is how many bits we should read
+ */
+ cpuint = GetData32Be(&cpu_buffer[cpu_pos]);
/* Add */
if ((cpuint - (cpuint & GetMaskByte(cpuDummyInit_Add))) ==
ConvertBitToByte(cpuDummyInit_Add))
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 Sat Jan 13 20:27:14 2007
@@ -97,6 +97,37 @@
+CPU_UNINT GetData32Le(CPU_BYTE *cpu_buffer)
+{
+ CPU_UNINT cpuint;
+ CPU_UNINT split1;
+ CPU_UNINT split2;
+ CPU_UNINT split3;
+ CPU_UNINT split4;
+
+ cpuint = *((CPU_UNINT*) &cpu_buffer[0]);
+
+ split1 = cpu_buffer[0];
+ split2 = cpu_buffer[1];
+ split3 = cpu_buffer[2];
+ split4 = cpu_buffer[3];
+
+
+ cpuint = split4+(split3 <<8 )+(split2 <<16 )+(split1 <<24 );
+
+ return cpuint;
+}
+
+CPU_UNINT GetData32Be(CPU_BYTE *cpu_buffer)
+{
+ CPU_UNINT cpuint;
+
+ cpuint = *((CPU_UNINT*) &cpu_buffer[0]);
+
+ return cpuint;
+}
+
+
// add no carry
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 Sat Jan 13 20:27:14 2007
@@ -20,3 +20,6 @@
CPU_UNINT ConvertBitToByte32(CPU_BYTE *bit);
CPU_UNINT GetMaskByte32(CPU_BYTE *bit);
+CPU_UNINT GetData32Le(CPU_BYTE *cpu_buffer);
+CPU_UNINT GetData32Be(CPU_BYTE *cpu_buffer);
+