C++ · AArch64 · Raspberry Pi 4

πOS / Browser demo

A real AArch64 kernel running in QEMU compiled to WebAssembly.

Checking browser support…
Machine off.

Select Boot OS to watch the kernel start.

Serial console · type a command and press Enter.

Example programs

Small C++ programs built from tasks and messages. These examples are compiled into an OS image; the terminal above runs the built-in ipc, sched, and test demonstrations.

Syscall reference

Each example is a separate source file. With the name, clock, and console services running, launch its entry point at priority 10.

Ping-pong

Eight request/reply exchanges between two tasks. Send waits until the other task replies. This is the byte-buffer form of the exchange demonstrated by the terminal’s ipc command.

Create(10, ping_pong);

#include "kern/syscall.h"

void pong() {
    for (int round = 0; round < 8; ++round) {
        tid_t sender;
        char ping[4];
        Receive(&sender, ping, sizeof(ping));
        Reply(sender, "pong", 4);
    }
    Exit();
}

void ping_pong() {
    tid_t server = Create(9, pong);
    if (server < 0) { Exit(); return; }

    for (int round = 0; round < 8; ++round) {
        char reply[4];
        Send(server, "ping", 4, reply, sizeof(reply));
        // reply contains four bytes: p o n g.
        // The server has replied before this line runs.
    }
    Exit();
}