From 69988f94dd97f481a87831400cdebf746ce6d1ed Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 17 Jan 2020 18:59:45 +0100 Subject: start explaining ramfs --- Ramfs-explained.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Ramfs-explained.txt diff --git a/Ramfs-explained.txt b/Ramfs-explained.txt new file mode 100644 index 0000000..c778d9d --- /dev/null +++ b/Ramfs-explained.txt @@ -0,0 +1,17 @@ +A simple ram file system has been introduced to avoid having to embed too many files in the kernel in the future. + +The ram filesystem is created on the development machine and then embedded into the kernel. Kernel can then parse the ramfs and access files, that have been put in it. + +Ramfs contains a mapping from file's name to it's size and contents. Directories, file permissions, etc. as well as writing to filesystem are not supported. + +Currently this is used to access the code of PL0 test program by the kernel, which it then copies to the appropriate memory location. In case more user mode programs are later written, they can all be added to ramfs to enable the kernel to access them easily. + +Specification +When ramfs is accessed in memory, it MUST be aligned to a multiple of 4. +The filesystem itself consists of blocks of data, each containing one file. Blocks of data in the ramfs come one after another, with the requirement, that each block starts at a 4-aligned offset/address. If a block doesn't end at a 4-aligned address, there shall be up to 3 null-bytes of padding after it, so that the next block is properly aligned. +Each block start with a C (null-terminated) string with the name of the file it contains. At the first 4-aligned offset after the string, file size is stored on 4 bytes in little endian. Null-bytes are used for padding between file name and file size if necessary. Immediately after the file size reside file contents, that take exactly the amount of bytes specified in file size. + +As obvious from the specification, files bigger than 4GB are not supported, which is not a problem in the case of this project. + +Implementation +... -- cgit v1.2.3