mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 10:45:24 +00:00
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. svn path=/trunk/; revision=25448
This commit is contained in:
parent
0764ca19ac
commit
7c96cb069a
|
@ -12,11 +12,8 @@ CPU_INT PPCBrain( CPU_BYTE *cpu_buffer,
|
|||
|
||||
/* 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
|
||||
|
|
|
@ -53,6 +53,19 @@ CPU_INT PPCBrain( CPU_BYTE *cpu_buffer,
|
|||
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 @@ CPU_INT PPCBrain( CPU_BYTE *cpu_buffer,
|
|||
|
||||
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_INT PPCBrain( CPU_BYTE *cpu_buffer,
|
|||
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 @@ CPU_INT PPCBrain( CPU_BYTE *cpu_buffer,
|
|||
break;
|
||||
}
|
||||
}
|
||||
return retcode;
|
||||
return retcode;
|
||||
}
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -44,6 +44,31 @@ CPU_INT PPC_Addx( FILE *out, CPU_BYTE * cpu_buffer, CPU_UNINT cpu_pos,
|
|||
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,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
|
||||
#define OP_ANY_mov 0x00000000
|
||||
|
||||
#define OP_ANY_ret 0x00000001
|
||||
|
||||
typedef struct _BrainAnalys
|
||||
{
|
||||
|
|
|
@ -161,7 +161,13 @@ return 0;
|
|||
|
||||
CPU_INT FreeAny()
|
||||
{
|
||||
PMYBrainAnalys tmp;
|
||||
PMYBrainAnalys tmp = NULL;
|
||||
|
||||
if (pMyBrainAnalys == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp = (PMYBrainAnalys)pMyBrainAnalys->ptr_prev;
|
||||
|
||||
while (pMyBrainAnalys != NULL)
|
||||
|
|
Loading…
Reference in a new issue