fixing count how many reg we are using. so we can setup a frame pointer

svn path=/trunk/; revision=25499
This commit is contained in:
Magnus Olsen 2007-01-17 18:47:08 +00:00
parent d1aa0d32ae
commit 3f44d73a4b
3 changed files with 48 additions and 12 deletions

View file

@ -130,7 +130,11 @@ CPU_INT ConvertToIA32Process( FILE *outfp, CPU_INT eax, CPU_INT ebp,
}
fprintf(outfp,"ret\n");
}
if (pMystart == pMyend)
pMystart=NULL;
else
pMystart = (PMYBrainAnalys) pMystart->ptr_next;
}
return 0;
}

View file

@ -19,11 +19,16 @@ CPU_INT ConvertProcess(FILE *outfp, CPU_INT FromCpuid, CPU_INT ToCpuid)
CPU_INT esp =-1;
CPU_INT regbits=-1;
CPU_INT HowManyRegInUse = 0;
CPU_INT RegTableCount[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
CPU_INT t;
PMYBrainAnalys pMystart = pStartMyBrainAnalys;
PMYBrainAnalys pMyend = pMyBrainAnalys;
if (FromCpuid == IMAGE_FILE_MACHINE_POWERPC)
PMYBrainAnalys ptmpMystart = pStartMyBrainAnalys;
PMYBrainAnalys ptmpMyend = pMyBrainAnalys;
if ( (FromCpuid == IMAGE_FILE_MACHINE_POWERPC) ||
(FromCpuid == IMAGE_FILE_MACHINE_I386))
{
regbits = 32 / 8;
esp = 1;
@ -32,21 +37,35 @@ CPU_INT ConvertProcess(FILE *outfp, CPU_INT FromCpuid, CPU_INT ToCpuid)
ebp = 31;
}
/* FIXME calc where todo first split */
/* FIXME calc who many register are in use */
/* count how many register we got */
ptmpMystart = pMystart;
ptmpMyend = pMyend;
while (ptmpMystart!=NULL)
{
if ((ptmpMystart->type & 2) == 2)
RegTableCount[ptmpMystart->src]++;
//ret = ConvertToIntelProcess(FILE *outfp,
// CPU_INT eax,
// CPU_INT edx,
// CPU_INT edx,
// CPU_INT esp,
// PMYBrainAnalys start,
// PMYBrainAnalys end);
if ((ptmpMystart->type & 8) == 8)
RegTableCount[ptmpMystart->dst]++;
if (ptmpMystart == ptmpMyend)
ptmpMystart=NULL;
else
ptmpMystart = (PMYBrainAnalys) ptmpMystart->ptr_next;
}
for (t=0;t<31;t++)
{
if (RegTableCount[t]!=0)
{
HowManyRegInUse++;
}
}
/* switch to the acual converting now */
switch (ToCpuid)
{
case IMAGE_FILE_MACHINE_I386:

View file

@ -10,6 +10,19 @@
* edx = register 4
* esp = register 1
* ebp = register 31
* ecx = 5
* ebx = 6
* esi = 7
* edi = 8
* mmx/sse/fpu 0 = 10
* mmx/sse/fpu 1 = 12
* mmx/sse/fpu 2 = 14
* mmx/sse/fpu 3 = 16
* mmx/sse/fpu 4 = 18
* mmx/sse/fpu 5 = 20
* mmx/sse/fpu 6 = 22
* mmx/sse/fpu 7 = 24
*/
typedef struct _BrainAnalys