Philipp Eppelt's Blog
The goal of the project was to design and implement an abstraction layer, to ease virtualization of RTEMS across different hypervisors. As a proof-of-concept POK was chosen as a host OS.
The virtualization layer is a set of functions a virtualized system cannot execute on its own and therefore needs support by the host OS. This is for example interrupt handling or hardware interaction. As POK is not a hypervisor, it does not provide abstractions common hypervisors have, like a vbus or a vCPU.
The design phase showed the necessity to split up the i386 CPU model, as virtualization sensitive instructions need to be replaced by virt.layer calls. The split introduced two new CPU models in libcpu, native and virtual. The native model is the one for real hardware and the virtual one is for the use with the virt.layer. The CPU model is chosen by the BSP. So we get a new BSP called virtualpok. As a starting point for the BSP I used last years results.
The POK world was not this simple, as I had no experience with POK and the code generation process makes it difficult to find the right point to interfere with the system.
The goal was to get RTEMS sample suite running. Starting off with hello world.
The implementation of the layer in POK was straightforward, the only addition was in a Makefile to build a library consisting of the layer implementation and all partition functionality. The linking process of RTEMS requires this library to solve the undefined references to the layer functions.
The hello world binary is then copied to POK, the kernel including the partitions must be rebuild and then “Hello World” showed up on the screen.
In the second part of the project I worked mainly on POK to change the interrupt handling, so it can forward interrupts to partitions. The partition aka RTEMS has to register a handler for the interrupt and after it finished processing it, it needs to acknowledge it at the host. The still unsolved problem is the switch from kernel to user space, when an interrupt occurs.
RTEMS’s virtualpok BSP implements a clock driver, interrupt handling and console functionality. But I could not reliably test it, due to the host OS problems. In the future this problem must be solved and virtualpok needs to be tested on other (real) hypervisors.