Ram initialization and small c.

Steve Gehlbach steve at kesa.com
Thu Mar 13 22:49:30 CET 2003

Eric W. Biederman wrote:

> Short term I suspect there would be a lot of distraction with just
> the mechanics of gcc.  If someone knows gcc better than me feel free.
> Eric

I think you have to cramp your C coding style anyway, to stay within 
registers.  The extra scratch area does not help much, with chips such 
as the SiS630, only has three gp regs, little help.  You can't go around 
declaring variables willy nilly, you run out of space (registers) no 
matter what compiler.

I also have been experimenting with inline gcc, and I think it works 
pretty well and once you get the hang of it, and it _is_ easier than 
assy.  I have re-coded the console routines, and ram setup, and spd 
timing setup on the sis630 for C.  It is still a wip but I have tested 
the spd setup by wrapping a real main on a live machine.

So far it is about 400 lines of C, should I attach it?  It compiles 
without using the stack (except for a %ebp push/pop which can be deleted).

I can't see how a special compiler gets you enough more than gcc to be 
worth the downside of effort and debugging.  Scratch regs vary from chip 
to chip, and use 1.5 regs to access (pci).  You could use the %ebp and 
%esp which is a gain of two (and maybe %es %fs etc), but I think using 
gcc will get us there anyway.

Just another opinion to put in the hat.


More information about the coreboot mailing list