To make trying StahlOS out easier, it can run under unicorn.js in the browser. This is rather slow, but actually works! This is implemented as the
js platform, which this page will describe for reference.
number type not being able to store 64-bit integers, unicorn.js has some strange behavior around large addresses. As a result, things are mapped to an address that's lower than might often be expected.
RAM starts at
0x10000, and is 128MiB (
0x8000000 bytes) long. The devicetree gets stored to
0x10000. The kernel is loaded at
A special region of memory is mapped from
0xffffffff. This is the host interface, and is used to communicate between the browser and the kernel.
The host interface acts as a memory-mapped peripheral.
The main way the kernel communicates with the host interface is by writing a single byte to
0xffff0000. Depending on the value of the byte, this can mean several things:
Writes the UTF-8 string whose address is in
x0 and whose length is in
x1 to the console.
Stops emulation permanently, and puts the UI into "panic mode."
Stops emulation temporarily, restarting it on the next user input.
User input is stored in a circular buffer, between addresses
0xffff1fff (inclusive). The offset from
0xffff1000 where the next byte of input will be stored is in the halfword at