wiki:GSoC/2013/ParavirtualizationOfRTEMS

Version 10 (modified by Phipse, on Apr 18, 2013 at 7:50:49 PM) (diff)

/* Introduce new target */

GSOC 2013 - Paravirtualization of RTEMS

The goal is to run RTEMS virtual on POK inside a software partition.

The Proposal will be open for everyone, after the application deadline (May 3, 2013).

Partitioned OS Kernel - POK

AADL

RTEMS

Virtual CPU Issue

libcpu/score split

= Structure =

The CPU dependent code is split up in virtualization sensitive and unsensitive parts. The unsensitive parts go in cpukit/score/cpu/${arch}/ the sensitive parts go into c/src/lib/libcpu/${arch}/${arch}virt/.

The CPU is selected through the BSP, hence additional virtual BSPs of the form ${bsp_name}virt are introduced.

Therefore no changes to the configuration scripts besides the additional BSP names are necessary. The target names stay the same.

In the end there is one virtual CPU model and one BSP per virtualized architecture.

= Configuration =

The only change to the RTEMS configuration scripts, will be additional names for the --enable-rtemsbsp= option.

Collective directory virt

= Structure =

To prevent cluttering the BSP and CPU directories with additional virtual CPU models, a collective directory is added.

  • c/src/lib/libbsp/virt/<arch>/<bsp_name>
  • cpukit/score/cpu/virt/<arch>

The behaviour inside these directories is the same, as without virtualization. The names for CPU and BSP stay the same.

The code necessary for the virtualization is shared among the BSPs and CPUs and goes into:

  • c/src/lib/libbsp/virt/shared
  • cpukit/score/cpu/virt/shared

The Makefiles have to cover these directories.

= Configuration =

To configure RTEMS for virtual execution of the binary, a new flag is introduced.

  • --enable-virt:

It tells autoconf to assume a different directory structure. The other configuration parameter, which are deduce from --target and --enable-rtemsbsp, are not touched.

Introduce new target

I used this approach to bring RTEMS on L4Re. I will explain it with the aid of this implementation. The architecture in use is x86 and I used the i386 CPU and BSP directory as a starting point.

L4RTEMS source code

= Structure =

A new target called l4vcpu was introduced and the corresponding directories:

  • c/src/lib/libbsp/l4vcpu/
  • cpukit/score/cpu/l4vcpu/

were added.

These directories are copies of the i386 directories and only code that produced visible faults was touched and changed. To provide a point where data can be shared a so called sharedVariableStruct was defined, which accommodates e.g. a pointer to the vcpu-structure and a pointer to the l4re_env (L4Re environment). This is passed to RTEMS at startup in a register, e.g. like the multiboot information, and is saved before anything else is executed.

The BSP startup was boiled down, as hardware initialization isn't necessary. Also some privileged instructions are skipped. It's still work in progress.

= Configuration =

Also some configuration files were adapted, see the doc file in the source code.

To configure RTEMS l4vcpu-rtems4.11 must be used as a target and pc386 as BSP.

= Compilation & Start up =

RTEMS compiles and links without errors. The resulting ELF binary, e.g. hello.exe, is passed on to L4Re as a command line argument. It is loaded into the applications address space and the vcpu is supplied with EIP and ESP.

ARINC 653 API - GSOC 2012

Source code: by Wiktor Langowski

The project used syscalls to access POK resources out of RTEMS. To get the code together the RTEMS binary is compiled - what fails. The generated .ralf file is the added to POK by rewriting the partition.bin file and by fixing the size section in the POK binary.

The code uses a hack: By naming a function bsp_start in POK and in RTEMS the function is executed twice. One time in POK-RTEMS and one time in POK. From my point of view that's far away from being a valid approach.