Author: greatlrd
Date: Wed Jan 17 19:23:39 2007
New Revision: 25497
URL: http://svn.reactos.org/svn/reactos?rev=25497&view=rev
Log:
fixing a bug did write end code for frame pointer that we do not have
tempary fix, we can not optimize code so good yet. so if it more that 4 register same time we are using own frame, ebx is working as our ebp for we already resvert the ebp
Modified:
trunk/rosapps/devutils/cputointel/ConvertToIA32Process.c
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 19:23:39 2007
@@ -19,16 +19,13 @@
CPU_UNINT tmp;
CPU_INT setup_ebp = 0 ; /* 0 = no, 1 = yes */
- if (HowManyRegInUse > 8)
+ /* Fixme at moment we can not optimze code */
+ //if (HowManyRegInUse > 9)
+ if (HowManyRegInUse > 4)
{
setup_ebp =1; /* we will use ebx as ebp */
stack = HowManyRegInUse * regbits;
}
-
-
-
-
-
fprintf(outfp,"BITS 32\n");
fprintf(outfp,"GLOBAL _main\n");
@@ -44,6 +41,19 @@
fprintf(outfp,"push ebx\n");
fprintf(outfp,"mov ebx,esp\n");
fprintf(outfp,"sub esp, %d ; Alloc %d bytes for reg\n\n",stack,stack);
+ }
+ else
+ {
+ /*
+ 0 EAX
+ 1 ECX
+ 2 EDX
+ 5 EBX
+ 6 ESP
+ 7 EBP
+ 8 ESI
+ 9 EDI
+ */
}
fprintf(outfp,"; Start the program \n");
@@ -95,7 +105,12 @@
}
else
{
- fprintf(outfp,"mov dword [ebx - %d], %llu\n", tmp, pMystart->src);
+ if (setup_ebp == 1)
+ fprintf(outfp,"mov dword [ebx - %d], %llu\n", tmp, pMystart->src);
+ else
+ {
+ fprintf(outfp,"unsuported optimze should not happen it happen :(\n", tmp, pMystart->src);
+ }
}
}
} /* end pMyBrainAnalys->type & 8 */
@@ -106,9 +121,12 @@
{
if (pMyBrainAnalys->ptr_next == NULL)
{
- fprintf(outfp,"\n; clean up after the frame \n");
- fprintf(outfp,"mov esp, ebx\n");
- fprintf(outfp,"pop ebx\n");
+ if (setup_ebp == 1)
+ {
+ fprintf(outfp,"\n; clean up after the frame \n");
+ fprintf(outfp,"mov esp, ebx\n");
+ fprintf(outfp,"pop ebx\n");
+ }
}
fprintf(outfp,"ret\n");
}