[LLVMdev] OS Development

Willow Schlanger wrschlanger at gmail.com
Fri Jun 15 19:57:09 PDT 2007


Hi,
I'm interested in developing a 64-bit operating system to run inside a 
version of BOCHS compiled with x86-64 support enabled 
(bochs-2.2.6-x86-64.exe) that I found on the web.

Can I use LLVM as a GCC replacement for OS development? I need to 
generate 64-bit x86-64 assembly language output which I can then 
assemble with the normal 'as' and link via 'ld' commands.

How do I do this? Can I run LLVM inside coLinux under Windows? How do I 
build it from the source and install it and what is the command for a 
GCC replacement (how do I generate x86-64 assembly source from C/C++ files)?

It would be really cool if I could use the LLVM intermediate 
representation in my OS, so all drivers can be supplied in intermediate 
form. The OS will compile the drivers when the driver is first loaded 
and cache the resulting program (after assembling and linking it) to disk.

This way the back-end can optimize drivers globally (inter-procedural 
analysis) and the back-end can generate code optimized for the current 
machine. If you boot up the OS on a 32-bit PC the SAME driver can be 
used, the IR is simply 'recompiled' (code is generated) for a new target.

Obviously there will be some drivers that must be pre-built, such as 
those that run early in system initialization and those that are 
specific to the architecture, e.g. some low-level memory management etc.

Any thoughts?

Thanks,
Willow



More information about the llvm-dev mailing list