Porting guide

This guide is intended for developers porting JNode to different platforms.

Porting JNode to another platform involves the components:

  • The nano-kernel (assembler)
  • The native methods (assembler)
  • The architecture specific classes
  • The native code compilers
  • The build process

Nano-kernel

The nano-kernel is the piece of code that is executed when JNode boots. It is responsible for setting the CPU into the correct mode and initialize the physical memory management structures (like page tables, segments etc).

The nano-kernel is also responsible for caching and dispatching hardware interrupts.

Native methods

The Unsafe class contains some native methods that must be implemented according to the given architecture.

Architecture specific classes

The JNode system requires some specific classes for each architecture. These classes describe the architecture like the size of an object reference and implement architecture specific items like thread states and processor information.

The essential classes needed for every architecture are:

  • A class derived from VmArchitecture
  • A class derived from VmProcessor
  • A class derived from VmThread

Native code compilers

At least 1 native code compiler must be written for an architecture. This compiler generates native code for java methods.

It is possible to implement multiple native code compilers for a specific architecture. Every compiler has a specific optimization level.

Part of the native code compiler infrastructure is usually an assembler. This assembler is a java class that writes/encodes native code instructions. The assembler is used by the native code compilers and usually the build process.

Build process

A final but important part of a port to a specific architecture is the build process. The standard JNode build files will compile all java code, prepare plugins and initial jar files, but will not build any architecture dependent structures.

The build process contains an architecture specific ant-file which will call a task used to create the JNode kernel. This task is derived from AbstractBootImageBuilder.