CS 410/510 Languages and Low-Level Programming
This page last updated: December 2018.
Bare Metal Exercises
Fall 2018

The main goal for this set of exercises is to provide some hands on experience building and running bare metal programs. During the first part of the lab, we will focus on the pragmatics of installing and configuring the virtual machine environment that you'll be using for this, and all of the following labs. But please come back here when you are done with that and are ready to put your shiny new virtual machine to the test!

Some sample programs are provided for you to study in the files hello.tar.gz and baremetal.tar.gz. Download these files and unpack them in your llp directory using commands like the following:

  cd ~/Documents/llp
  tar xvzf ~/Downloads/hello.tar.gz.
  tar xvzf ~/Downloads/baremetal.tar.gz.
Now you can begin to experiment with building, running, and modifying these programs. For example, you might start by moving in to the newly created hello directory and scanning the source files. Find the lines that specify what characters are to be output on the screen, or that set the background color/pattern, and then modify them as you see fit. Then compile and run the resulting program (the easiest way to do this is to use the command `make run`). Congratulations, you have just written and executed a bare metal program!

Here are some additional ideas for further experiments and exercises that you can try:

  • Add a function to the code for "hello" that can be used to output an integer value (hexadecimal notation is probably easiest, and most useful too). Test to make sure it works correctly.

  • Integrate your assembly code for cls into "hello".

  • Adapt the code from "hello" or "bootinfo" to print out a summary of the details that GRUB passes on to the "kernel" via the multiboot information structure. (Start simple, and add more fields as you go.)

  • Experiment with different virtual machine settings to see what impact this has on the information in the multiboot structure.

Please see the slide for the Week 2 lecture for further details, and listen for further instructions and suggestions in the lab session.