From c15d38f2cd1ad1d995ed9270df10c5bb84301f7d Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 17 Apr 2021 02:00:40 +0800 Subject: [PATCH 1/6] Update startup.md --- docs/startup.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/startup.md b/docs/startup.md index f6def1f1d..b33832894 100644 --- a/docs/startup.md +++ b/docs/startup.md @@ -3,10 +3,10 @@ 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 From 83292bfda2256f326a506bc61752cb2b857be2e1 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 17 Apr 2021 15:03:18 +0800 Subject: [PATCH 2/6] Update startup.md --- docs/startup.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/startup.md b/docs/startup.md index b33832894..ad8e84df7 100644 --- a/docs/startup.md +++ b/docs/startup.md @@ -1,5 +1,15 @@ # 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: From 7124c9dbefbff0c5457b9fd335ea60718353ae72 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 20 Apr 2021 16:15:02 +0800 Subject: [PATCH 3/6] Update flash.md --- docs/flash.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/flash.md b/docs/flash.md index 632830391..a94c58b42 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) | ++-----------+----------------------------------------+ ++ 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 | ++-----------+----------------------------------------+ ++ 2027_8004 | csr.csv data (variable length) | ++ 2027_8xxx | Typically ~12kiB | ++-----------+----------------------------------------+ ++ 2027_8xxx | padding to 0xFF | ++ 2027_FFDF | padding included in sha512 | ++-----------+----------------------------------------+ ++ 2027_FFE0 | sha512 of 2027_8000:2027_FFDF | ++ 2027_FFFF | truncated to 32 bytes | ++-----------+----------------------------------------+ +``` From aaf5ec30c3009c93d35f159e7a6b861b073ca534 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 20 Apr 2021 16:15:36 +0800 Subject: [PATCH 4/6] Update flash.md --- docs/flash.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/flash.md b/docs/flash.md index a94c58b42..259909985 100644 --- a/docs/flash.md +++ b/docs/flash.md @@ -39,7 +39,7 @@ of wear leveling, however. + 2027_7FFF | | +-----------+----------------------------------------+ + 2027_8000 | csr.csv corresponding to bitstream | -+ 2027_FFFF | (32kiB max) | ++ 2027_FFFF | (32kiB max, see below) | +-----------+----------------------------------------+ + 2028_0000 | Reserved for backup bitstream | + 204F_FFFF | | From b907a90b6444ee253a564106d54aef6ede80586d Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 20 Apr 2021 16:16:33 +0800 Subject: [PATCH 5/6] Update flash.md --- docs/flash.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/flash.md b/docs/flash.md index 259909985..9e8da7bb7 100644 --- a/docs/flash.md +++ b/docs/flash.md @@ -67,15 +67,15 @@ The csr.csv block is further structured as follows: ``` +-----------+----------------------------------------+ + 2027_8000 | Length of csr.csv data | -+ 2027_8003 | 4 bytes | ++ 2027_8003 | 4 bytes, little-endian | +-----------+----------------------------------------+ + 2027_8004 | csr.csv data (variable length) | -+ 2027_8xxx | Typically ~12kiB | ++ 2027_8xxx | Typically ~12kiB, byte ordered | +-----------+----------------------------------------+ + 2027_8xxx | padding to 0xFF | + 2027_FFDF | padding included in sha512 | +-----------+----------------------------------------+ + 2027_FFE0 | sha512 of 2027_8000:2027_FFDF | -+ 2027_FFFF | truncated to 32 bytes | ++ 2027_FFFF | truncated to 32 bytes, network order | +-----------+----------------------------------------+ ``` From 1f84796e344cd88374c83a61ae35fe7b34fce1c0 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 20 Apr 2021 16:59:34 +0800 Subject: [PATCH 6/6] Update flash.md --- docs/flash.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/flash.md b/docs/flash.md index 9e8da7bb7..53e5c30d7 100644 --- a/docs/flash.md +++ b/docs/flash.md @@ -73,9 +73,9 @@ The csr.csv block is further structured as follows: + 2027_8xxx | Typically ~12kiB, byte ordered | +-----------+----------------------------------------+ + 2027_8xxx | padding to 0xFF | -+ 2027_FFDF | padding included in sha512 | ++ 2027_FFBF | padding included in sha512 | +-----------+----------------------------------------+ -+ 2027_FFE0 | sha512 of 2027_8000:2027_FFDF | -+ 2027_FFFF | truncated to 32 bytes, network order | ++ 2027_FFC0 | sha512 of 2027_8000:2027_FFBF | ++ 2027_FFFF | 64 bytes, network order | +-----------+----------------------------------------+ ```