In association with heise online

About ROMCC and V3

AB: What is ROMCC?

EB: It stands for ROM C Compiler. After doing several LinuxBIOS ports it got tedious to write memory initialisation code in assembler. So I started investigating how to write the code in C. The initial method I tried was to implement DCache-As-Ram and I investigated that idea quite a bit. Neither Intel nor AMD had clearly documented how to do it at the time. The idea was just to poke some data in the cache and watch it not fall out.

I ran with an implementation that was doing that for a time, and I almost made it work. This was around the time Intel introduced hyper-threading and it seemed that every new rev of the processor broke DCache as RAM. Ouch!

So since at the time I did not know that the trick was to disable the cache, placing it in 'no fill mode' after initializing it's contents, and I did know how to write a compiler, I decided to try another path. Thus ROMCC was born.

The real accomplishment was to be able to write memory and other early initialization code in C. Which is much easier to write and maintain then assembler. Assembly code is fragile when you change it, especially when you don't have a stack. C is much more robust – the code is easier to change without breaking everything. This makes coreboot easier to work on, to contribute to and to maintain.

AB: Ron, can you give a rough estimate on how this helped to speed up development of the project?

RM: ROMCC, although it is now falling out of use, made the K8 port possible. It would not have been possible for us to have the K8 working had we not had ROMCC. ROMCC was a key piece of technology we used from 2002 to the present. I think students everywhere should study ROMCC, just to see how you can do an ANSI C compiler in one file of 25,000 lines! Of course, they should study Ken Thompson's Plan 9 C compiler as well!

AB: What are the advantages of V3?

SR: In 2006 we had learned a lot about the advantages and disadvantages of our new directions in v2. The concepts were good, but the code has gotten too complicated to understand it easily, so newcomers had a hard time extending the code. When coresystems hosted the LinuxBIOS symposium in Hamburg in late 2006, we decided to start "from scratch" and designed version 3 of LinuxBIOS. Targets of the new version were simplicity, modularity and flexibility. We carefully started bringing only the code over that we really needed, and invented new stuff like a Kconfig based build system and the archive format LAR. We also decided to say bye bye to ROMCC, since it was this well-intended, but unmaintainable piece of 26k lines of code in a single file. Nobody except Eric ever really dared touching it. Version 3 was designed to do Cache-as-RAM for pre-RAM configuration on all platforms, so it became a lot faster and simpler.

Another year later, our development tree "version 3" is about to become our new stable tree. Everyone is excited to finally enjoy the fruits of our efforts. Along with V3, new projects turned up such as bayou and libpayload, which made it much easier to develop software for coreboot.

Next: On becoming coreboot

Print Version | Permalink: http://h-online.com/-746525
  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit
 


  • July's Community Calendar





The H Open

The H Security

The H Developer

The H Internet Toolkit