diff --git a/Doxyfile b/Doxyfile index b9126c9c..6ea4977f 100644 --- a/Doxyfile +++ b/Doxyfile @@ -536,7 +536,7 @@ FILE_VERSION_FILTER = # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. -LAYOUT_FILE = +LAYOUT_FILE = documentation/tmpl/layout.xml #--------------------------------------------------------------------------- # configuration options related to warning and progress messages @@ -606,7 +606,7 @@ INPUT = ./fs \ ./libkern \ ./mm \ ./tools \ - ./documentation/text/mainpage.dox + ./documentation/text # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/documentation/img/reset.png b/documentation/img/reset.png new file mode 100644 index 00000000..caab6a7f Binary files /dev/null and b/documentation/img/reset.png differ diff --git a/documentation/img/sccGui.png b/documentation/img/sccGui.png new file mode 100644 index 00000000..8335e70b Binary files /dev/null and b/documentation/img/sccGui.png differ diff --git a/documentation/img/uart.png b/documentation/img/uart.png new file mode 100644 index 00000000..a183d9a2 Binary files /dev/null and b/documentation/img/uart.png differ diff --git a/documentation/text/.gitignore b/documentation/text/.gitignore new file mode 100644 index 00000000..424c745c --- /dev/null +++ b/documentation/text/.gitignore @@ -0,0 +1 @@ +*.h diff --git a/documentation/text/compilation.dox b/documentation/text/compilation.dox index 833cbf20..1222228f 100644 --- a/documentation/text/compilation.dox +++ b/documentation/text/compilation.dox @@ -1,12 +1,141 @@ /** - * @file manual.dox - * @page manual Manual Contents + * @file compilation.dox + * @page compilation Compiling and Running MetalSVM * - * @section Readme + * @section toc Table of Contents + * - @ref checkout + * - @ref compiling + * - @ref runqemu + * - @ref runscc + * - @ref runsccmc + * - @ref msvmuart * - * This document contains some explanations about stuff. + * @section checkout Checking out MetalSVM online + * + * The MetalSVM project is hosted in a Git repository. To check it out, just type: * - * @subsection Compiling + * \verbatim$ git clone gitosis@git.lfbs.rwth-aachen.de:metalsvm.git \endverbatim + * + * If you are asked for a password you are not authorized to clone the repository. In this case you will need to get your public SSH key authorized. + * + * @section compiling Compiling MetalSVM + * + * To compile MetalSVM, you will need a proper Makefile and configuration. To use the example files, just do the following: + * + * \verbatim +$ cd MetalSVM +$ cp Makefile.example Makefile +$ cp include/metalsvm/config.h.example include/metalsvm/config.h \endverbatim + * + * The standard configuration works on usual PC hardware configurations as well as in emulators. + * + * Compiler settings can be edited in the Makefile, while the kernel configuration can be found in the just copied configuration file. + * + * @section runqemu Running MetalSVM in Qemu + * + * There is a Make-target for running MetalSVM in Qemu: + * \verbatim$ make qemu \endverbatim + * + * The emulator is then started with the following parameters: + * \verbatim$ qemu -monitor stdio -smp 2 -net nic,model=rtl8139 -net user,hostfwd=tcp::12345-:7 -net dump -kernel metalsvm.elf -initrd tools/initrd.img \endverbatim + * + * Please note that qemu versions 0.13 and 0.14 have a bug which keeps MetalSVM from booting properly. Used qemu-0.12.5 instead. + * + * @section runscc Running MetalSVM on the Intel SCC + * + * -# Intel recommends to use their cross-compiler for generating code which is guaranteed to be SCC-compatible. Just set the environment variables with the following command: + * \verbatim$ . /opt/compilerSetupFiles/crosscompile.sh \endverbatim + * -# The Makefile needs to be adapted to actually use the cross compiler: + * \verbatim +CC_FOR_TARGET=i386-unknown-linux-gnu-gcc +CXX_FOR_TARGET=i386-unknown-linux-gnu-g++ +GCC_FOR_TARGET=i386-unknown-linux-gnu-gcc +AR_FOR_TARGET=i386-unknown-linux-gnu-ar +AS_FOR_TARGET=i386-unknown-linux-gnu-as +LD_FOR_TARGET=i386-unknown-linux-gnu-ld +NM_FOR_TARGET=i386-unknown-linux-gnu-nm +OBJDUMP_FOR_TARGET=i386-unknown-linux-gnu-objdump +OBJCOPY_FOR_TARGET=i386-unknown-linux-gnu-objcopy +RANLIB_FOR_TARGET=i386-unknown-linux-gnu-ranlib +STRIP_FOR_TARGET=i386-unknown-linux-gnu-strip +READELF_FOR_TARGET=i386-unknown-linux-gnu-readelf \endverbatim + * -# Another important change in the Makefile is disabling the "-fno-stack-protector" option. It occurs several times. + * -# The SCC requires a special configuration for the MetalSVM kernel: + * \verbatim +//#define CONFIG_PCI +//#define CONFIG_VGA +//#define CONFIG_UART +//#define CONFIG_KEYBOARD +//#define CONFIG_MULTIBOOT +#define CONFIG_ROCKCREEK +// RCCE specific flags +#define SCC +#define COPPERRIDGE +#define MS_BAREMETAL +//#define GORY +#define SHMADD +#define SHMDBG +//#define SHMADD_CACHEABLE \endverbatim + * -# There is only one core per tile, so it is adequate to reduce overhead by disabling SMP in MetalSVM: + * \verbatim#define MAX_CORES 1 \endverbatim + * -# Cache-line size is 32 byte: + * \verbatim#define CACHE_LINE 32 \endverbatim + * -# MetalSVM can now be built using \c make. + * -# Build the SCC tools: + * \verbatim +$ cd tools +$ make SCC \endverbatim + * -# The \c obj directory was just created, containing the MetalSVM kernel image. It can be loaded into the SCC's memory using \verbatim$ sccBoot -g obj \endverbatim + * -# The default configuration lets MetalSVM run only on core 0. Its reset pin needs to be released: + * \verbatim$ sccReset -r 0x00 \endverbatim + * -# Although the display driver was deactivated, MetalSVM's kprintf-output is written into the memory, where you can read it with the following command: + * \verbatim$ sccDump -d 0x00 0x100000 0x10000 | less \endverbatim + * + * + * @section runsccmc Running MetalSVM on multiple SCC cores + * + * -# Build the kernel like described above (items 1-7) and change to the \c tools directory. + * -# The \c scc_bootinfo.asm file contains boot-information relevant to the SCC-cores. + * It is generated automatically by the \c bootinfo.sh script.\n + * \n + * The following example generates the \c scc_bootinfo.asm file needed for use of the cores 0 and 1: + * \verbatim$ ./bootinfo.sh 0x01000000 initrd.img 2 533 0 1 > scc_bootinfo.asm \endverbatim + * Parameters describe the following: + * -# First parameter describes the address at which the initrd shall be located at later + * -# Second is path to the initrd image file + * -# The other parameters are analogous to RCCE-App-parameters. This example starts MetalSVM on cores 0 and 1, clocked with 533MHz. + * -# Now the file \c metalsvm.mt has to be edited. It defines the layout of the memory image (Where the kernels will be located in the memory later). For the example from above it looks like the following: + * \verbatim# pid mch-route mch-dest-id mch-offset-base testcase + 0x00 0x00 6 0x00 metalsvm.obj + 0x01 0x00 6 0x01 metalsvm.obj \endverbatim + * This locates two instances of MetalSVM on core 0 and 1, supplied with memory from memory controller 0. See \c sccMerge \c -h for more information. + * -# The final image must be generated then with \code$ make SCC\endcode + * -# A directory \c obj was created, containing the final MetalSVM Image. This image can now be loaded with the following command: \code$ sccBoot -g obj\endcode + * -# Everything has been placed in the cores' memory. To release the reset pins of the corresponding cores, type \code$ sccReset -r 0x00 0x01\endcode + * + * @section msvmuart Enabling UART support + * + * MetalSVM is able to reroute terminal output to port \c 0x2F8. This way it can be displayed in \c sccGui. Too much output stresses the network load, therefore it should be used for debugging purposes only. + * + * How to enable: + * -# Enable UART-support in the kernel's config file \c include/metalsvm/config.h: + * \code#define CONFIG_UART\endcode + * -# Rebuild the kernel. Do not launch it with \c sccBoot - In the following \c sccGui will be used. + * -# Launch \c sccGui. + * -# Enable UART in the gui by klicking Enable software RAM and UART in the Menu Settings/Debug Settings. + * -# Issue a software interrupt by clicking on the wiper symbol. + * -# Choose the memory image called \c mch_0_0.32.obj from the \c obj folder with Preload object file. + * -# Initialize the LUT with Preload LUT file. It is called \c lut_init.dat and is located in the same directory. + * -# Both L2 cache and MPB can be reset now, if needed. + * -# Activate the corresponding cores with Change selected reset(s). This opens the following window: + * @image html reset.png + * -# A box being checked means that the reset pin is pulled and the core is \e inactive. The example from the picture will boot MetalSVM only on cores 0 and 1. + * + * After following these steps successfully, a similar image to the following should appear on the gui: + * @image html sccGui.png + * + * Another window will be opened automatically as soon as UART output arrives in the gui. This will be similar to the following: + * @image html uart.png * * */ diff --git a/documentation/text/config.dox b/documentation/text/config.dox new file mode 100644 index 00000000..e4e80343 --- /dev/null +++ b/documentation/text/config.dox @@ -0,0 +1,18 @@ +/** + * @file config.dox + * @page config The MetalSVM feature configuration file + * + * @section conf MetalSVM's configuration file + * + * MetalSVM's configuration parameters and some features can be configured/activated in the central configuration file located at \c include/metalsvm/config.h. + * + * The \c config.h is a usual C-header file and the configuration items are usual C preprocessor-definitions like the following: + * \code +#define CONFIGURATION_PARAMETER 123value /* A parameter with a value */ +#define FEATURE_A /* An activated feature */ +//#define FEATURE_B /* A deactivated feature */\endcode + * + * Just like the example suggests, features are deactivated by commenting them out. + * + * + */ diff --git a/documentation/text/documenting.dox b/documentation/text/documenting.dox new file mode 100644 index 00000000..5a77f053 --- /dev/null +++ b/documentation/text/documenting.dox @@ -0,0 +1,112 @@ +/** + * @file documenting.dox + * @page documenting Documenting MetalSVM with Doxygen + * + * The doxygen project has a nice manual at http://www.stack.nl/~dimitri/doxygen/manual.html \n + * All content on this page is extracted from there. + * + * Please check if the \c doxygen command throws errors on your documented code. + * + * @section inline Documenting code inline + * + * To document your code correctly, you will have to follow some (simple) rules: + * + * Place a comment block like this at the beginning of your source code files you intend to document: + * + * @verbatim + /** + * @author John Doe + * @file path/to/your/file.h + * @brief A brief explanation about what this code does or is supposed to do. + */@endverbatim + * + * Functions/procedures are commented in the header file just above the + * function/procedure definition: + * + * @verbatim + /** @brief Blocking wait for semaphore [short explanation] + * + * [space for more detailed explanations] + * + * [describing parameters] + * @param s Address of the according sem_t structure + * @param ms Timeout in milliseconds + * + * [describing possible return values in a list] + * @return + * - 0 on success + * - -EINVAL on invalid argument + * - -ETIME on timer expired + */ + inline static int sem_wait(sem_t* s, uint32_t ms); @endverbatim + * + * Documenting structures and their members looks like the following: + * @verbatim + /** @brief The task_t structure */ + typedef struct task { + /// Task id = position in the task table + tid_t id; + /// Task status (INVALID, READY, RUNNING, ...) + uint32_t status; + ... @endverbatim + * + * @section formatting Formatting text + * + * Although you could use HTML brackets to format your text, + * Doxygen provides special commands. Please use those, since it is possible + * that someone may want to generate CHM, Latex or other formatted output + * from this documentation. + * + * To \e emphasize, \b highlight or \c typewrite text, use the following commands: + * \verbatim To \e emphasize, \b highlight or \c typewrite text... \endverbatim + * + * \verbatim + Preserving the format + of text like + this can be done with \verbatim end \ endverbatim \endverbatim + * + * Code will be color-highlighted with \\code and \\endcode: + * \code + int i; + for (i=0; i < 123; i++) + printf("%d\n", i); + \endcode + * + * It is also easily possible to make listings: + * - item a + * - item b + * - item c + * + * And also enumerated listings: + * -# item a + * -# item b + * -# item c + * + * \verbatim +It is also easily possible to make listings: + - item a + - item b + - item c + +And also enumerated listings: + -# item a + -# item b + -# item c \endverbatim + * + * @section docs Writing documents like this one + * + * To write a stand-alone manual like this one, just create + * a file \c your_manual.dox in \c $MSVM/documentation/text/. + * + * This file's content should look like this: + * + * \verbatim + /** + * @file your_manual.dox + * @page your_manual This is your manual's title. It will be displayed in the "Manuals" section. + * + * @section your_section This starts a section with a title + * + * content, content, content! + */ \endverbatim + */ diff --git a/documentation/text/kernelspace.dox b/documentation/text/kernelspace.dox new file mode 100644 index 00000000..95e014d4 --- /dev/null +++ b/documentation/text/kernelspace.dox @@ -0,0 +1,7 @@ +/** + * @file kernelspace.dox + * @page kernelspace Development in kernel space + * + * @section kernelthreads Starting kernel threads + * + */ diff --git a/documentation/text/userspace.dox b/documentation/text/userspace.dox new file mode 100644 index 00000000..9489f4d2 --- /dev/null +++ b/documentation/text/userspace.dox @@ -0,0 +1,7 @@ +/** + * @file userspace.dox + * @page userspace Development in user space + * + * @section ownapps Installing and launching your own applications + * + */ diff --git a/documentation/tmpl/layout.xml b/documentation/tmpl/layout.xml new file mode 100644 index 00000000..6794c866 --- /dev/null +++ b/documentation/tmpl/layout.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/documentation/tmpl/stylesheet.css b/documentation/tmpl/stylesheet.css index d27dd30b..9564fb02 100644 --- a/documentation/tmpl/stylesheet.css +++ b/documentation/tmpl/stylesheet.css @@ -849,6 +849,6 @@ dl.bug .textblock { - width: 950px; + width: 800px; textalign: justify; } diff --git a/fs/fs.c b/fs/fs.c index c6c16440..f539e576 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -79,7 +79,7 @@ int open_fs(fildes_t* file, const char* name) if (name[0] == '/') file_node = fs_root; - while((name[j] != '\0') && (file_node != NULL)) { + while((name[j] != '\0') || ((file_node != NULL) && (file_node->type == FS_DIRECTORY))) { i = 0; while((name[j] != '/') && (name[j] != '\0')) { fname[i] = name[j]; diff --git a/include/metalsvm/tasks_types.h b/include/metalsvm/tasks_types.h index 857e9d52..759bbeea 100644 --- a/include/metalsvm/tasks_types.h +++ b/include/metalsvm/tasks_types.h @@ -64,7 +64,7 @@ typedef int (*entry_point_t)(void*); typedef int (STDCALL *internal_entry_point_t)(void*); struct page_dir; -/* @brief The task_t structure */ +/** @brief The task_t structure */ typedef struct task { /// Task id = position in the task table tid_t id;