diff --git a/docs/flash.md b/docs/flash.md index 632830391..53e5c30d7 100644 --- a/docs/flash.md +++ b/docs/flash.md @@ -35,7 +35,13 @@ of wear leveling, however. + 2000_0000 | Primary FPGA bitstream | + 2021_7287 | 2,192,008 bytes | +-----------+----------------------------------------+ -+ 2021_7288 | Reserved for bitstreams | ++ 2021_7288 | Padding | ++ 2027_7FFF | | ++-----------+----------------------------------------+ ++ 2027_8000 | csr.csv corresponding to bitstream | ++ 2027_FFFF | (32kiB max, see below) | ++-----------+----------------------------------------+ ++ 2028_0000 | Reserved for backup bitstream | + 204F_FFFF | | +-----------+----------------------------------------+ + 2050_0000 | loader.bin - Xous loader | @@ -55,3 +61,21 @@ of wear leveling, however. +-----------+----------------------------------------+ ``` + +The csr.csv block is further structured as follows: + +``` ++-----------+----------------------------------------+ ++ 2027_8000 | Length of csr.csv data | ++ 2027_8003 | 4 bytes, little-endian | ++-----------+----------------------------------------+ ++ 2027_8004 | csr.csv data (variable length) | ++ 2027_8xxx | Typically ~12kiB, byte ordered | ++-----------+----------------------------------------+ ++ 2027_8xxx | padding to 0xFF | ++ 2027_FFBF | padding included in sha512 | ++-----------+----------------------------------------+ ++ 2027_FFC0 | sha512 of 2027_8000:2027_FFBF | ++ 2027_FFFF | 64 bytes, network order | ++-----------+----------------------------------------+ +``` diff --git a/docs/startup.md b/docs/startup.md index f6def1f1d..ad8e84df7 100644 --- a/docs/startup.md +++ b/docs/startup.md @@ -1,12 +1,22 @@ # Xous Startup Sequence +The loader broadly runs in two phases, called phase 1 and phase 2: + +1. Allocate memory and copy stuff into RAM. This is where the tags are copied, and executable data is unpacked into memory. This is almost entirely a copying phase. +2. Allocate and configure pagetables. This more or less does a second pass over the args table (so there's a possible TOCTOU here). + +After this it jumps to PID1. + +------------ +Below is historical notes + This document describes how a running system is established. It is, broadly, divided into four stages: -0: Pre-boot -- setting the machine up to run -1: Initializing the allocator -2: Loading the kernel and PID1 -3: Userspace setup +0. Pre-boot -- setting the machine up to run +1. Initializing the allocator +2. Loading the kernel and PID1 +3. Userspace setup Once userspace is set up, it will continue to spawn additional processes and maintain the system. However, after this point there is no longer a