Build is only tested on a Linux system, but should be possible on any system using the GNU toolchain and the ELF file format. The tools required are:
An intermediate bootloader may pass a boot command line to Memtest86+. The
command line may contain one or more options, separated by spaces. Each
option consists of an option name, optionally followed by an =
sign and
one or more parameters, separated by commas. The following options are
recognised:
0x
prefix (eg: 0xFEDC9000)Memtest86+ v6.0 was based on PCMemTest, developed by Martin Whitaker, which was based on Memtest86+ v5.01, developed by Samuel Demeulemeester, which in turn was based on Memtest86, developed by Chris Brady with the resources and assistance listed below:
The initial versions of the source files bootsect.S, setup.S, head.S and build.c are from the Linux 1.2.1 kernel and have been heavily modified.
Doug Sisk provided code to support a console connected via a serial port. (not currently used)
Code to create BadRAM patterns was provided by Rick van Rein.
The block move test is based on Robert Redelmeier's burnBX test.
Screen buffer code was provided by Jani Averbach. (not used by Memtest86+ v6.0)
Eric Biederman provided all of the feature content for version 3.0 plus many bugfixes and significant code cleanup.
Major enhancements to hardware detection and reporting in version 3.2, 3.3 and 3.4 provided by Samuel Demeulemeester (from Memtest86+ v1.11, v1.60 and v1.70).
In addition, several bug fixes for Memtest86+ were imported from anphsw/memtest86.
This is the developer's guide to the Memtest86+ source code. The user's guide can be found in the README.md file in the top level directory.
The source code is divided into the following categories, each contained in a subdirectory of the same name:
app
The main application and framework for running the memory tests.
boot
The code that runs from the BIOS or bootloader entry point to the start of the main application.
lib
The subset of the C standard library that is used by Memtest86+ plus other hardware-independent low-level support functions.
system
Low-level support functions that interface to the hardware.
tests
The individual memory tests.
The boot code is mostly written in AT&T syntax x86 assembly language. The remaining code is written in C with a smattering of inline assembly code.
Each category is further subdivided into multiple source files, splitting the
code into small units of closely related functionality. For the C code, the
API for each unit is defined in a header (.h
) file and the implementation
(if required) is found in the correspondingly named source (.c
) file.
Doxygen can be used to automatically generate HTML documentation for the API
for each code unit from the comments in the C header files. To regenerate the
documentation, change directory into the doc
subdirectory and run doxygen
.
Macro names and enumeration values are written in upper case separated by underscores. All other identifiers are written in lower case separated by underscores. Both excessive length and excessive abbreviation are avoided.
Line length is normally limited to 120 characters.
Indentation is 4 spaces. No hard tab characters are used.
Opening braces for function bodies are put on a new line. Other opening braces are put on the same line as the construct that introduces them.
The C11 dialect is used. In particular, variable declarations and statements
are interspersed and loop variables are declared within the for
loop
construct.
Labels are written in lower case separated by underscores. Op-codes and register names are written in lower case.
Line length is normally limited to 120 characters.
Indentation is 8 spaces using hard tab characters.
The C preprocessor is used for defining constant values and expressions. Macro names are written in upper case separated by underscores.