memtest86+: Initial commit of 5.01 codebase

This is the initial commit of memtest86+

The tarball was downloaded from www.memtest.org on Feb 24,2016
and unpacked.  No changes have yet been made.
Version: Memtest86+ V5.01 (27/09/2013)

sha1sum of tarball:
eb4b6d70114db3c9ed320785da44c0ba8349c10c *memtest86+-5.01.tar.gz

Change-Id: I1ed925c85925ff5d98e61a11ad1dc6b3c44f79b7
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/13818
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/random.c b/random.c
new file mode 100644
index 0000000..69dd140
--- /dev/null
+++ b/random.c
@@ -0,0 +1,38 @@
+/******************************************************************/
+/* Random number generator */
+/* concatenation of following two 16-bit multiply with carry generators */
+/* x(n)=a*x(n-1)+carry mod 2^16 and y(n)=b*y(n-1)+carry mod 2^16, */
+/* number and carry packed within the same 32 bit integer.        */
+/******************************************************************/
+#include "stdint.h"
+#include "cpuid.h"
+#include "smp.h"
+
+/* Keep a separate seed for each CPU */
+/* Space the seeds by at least a cache line or performance suffers big time! */
+static unsigned int SEED_X[MAX_CPUS*16];
+static unsigned int SEED_Y[MAX_CPUS*16];
+
+unsigned long rand (int cpu)
+{
+   static unsigned int a = 18000, b = 30903;
+   int me;
+
+   me = cpu*16;
+
+   SEED_X[me] = a*(SEED_X[me]&65535) + (SEED_X[me]>>16);
+   SEED_Y[me] = b*(SEED_Y[me]&65535) + (SEED_Y[me]>>16);
+
+   return ((SEED_X[me]<<16) + (SEED_Y[me]&65535));
+}
+
+
+void rand_seed( unsigned int seed1, unsigned int seed2, int cpu)
+{
+   int me;
+
+   me = cpu*16;
+   SEED_X[me] = seed1;   
+   SEED_Y[me] = seed2;
+}
+