Author: greatlrd
Date: Wed Jan 17 21:47:08 2007
New Revision: 25499
URL:
http://svn.reactos.org/svn/reactos?rev=25499&view=rev
Log:
fixing count how many reg we are using. so we can setup a frame pointer
Modified:
trunk/rosapps/devutils/cputointel/ConvertToIA32Process.c
trunk/rosapps/devutils/cputointel/ConvertingProcess.c
trunk/rosapps/devutils/cputointel/any_op.h
Modified: trunk/rosapps/devutils/cputointel/ConvertToIA32Process.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/Conver…
==============================================================================
--- trunk/rosapps/devutils/cputointel/ConvertToIA32Process.c (original)
+++ trunk/rosapps/devutils/cputointel/ConvertToIA32Process.c Wed Jan 17 21:47:08 2007
@@ -130,7 +130,11 @@
}
fprintf(outfp,"ret\n");
}
- pMystart = (PMYBrainAnalys) pMystart->ptr_next;
+ if (pMystart == pMyend)
+ pMystart=NULL;
+ else
+ pMystart = (PMYBrainAnalys) pMystart->ptr_next;
+
}
return 0;
}
Modified: trunk/rosapps/devutils/cputointel/ConvertingProcess.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/devutils/cputointel/Conver…
==============================================================================
--- trunk/rosapps/devutils/cputointel/ConvertingProcess.c (original)
+++ trunk/rosapps/devutils/cputointel/ConvertingProcess.c Wed Jan 17 21:47:08 2007
@@ -19,11 +19,16 @@
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 @@
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:
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 Wed Jan 17 21:47:08 2007
@@ -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