summaryrefslogtreecommitdiffstats
path: root/memtestEDK
diff options
context:
space:
mode:
Diffstat (limited to 'memtestEDK')
-rw-r--r--memtestEDK/Memtest/Test1/doTest1.c25
-rw-r--r--memtestEDK/Memtest/Test1/memoryMap.h22
-rw-r--r--memtestEDK/Memtest/Test1/test.c2
3 files changed, 42 insertions, 7 deletions
diff --git a/memtestEDK/Memtest/Test1/doTest1.c b/memtestEDK/Memtest/Test1/doTest1.c
index e6883ff..8b555db 100644
--- a/memtestEDK/Memtest/Test1/doTest1.c
+++ b/memtestEDK/Memtest/Test1/doTest1.c
@@ -7,6 +7,28 @@
#include "test.h"
+static inline void cache_off(void)
+{
+ asm(
+ "push %rax\n\t"
+ "movq %cr0,%eax\n\t"
+ "orl $0x40000000,%eax\n\t" /* Set CD */
+ "movq %eax,%cr0\n\t"
+ "wbinvd\n\t"
+ "pop %rax\n\t");
+}
+
+static inline void cache_on(void)
+{
+ asm(
+ "push %rax\n\t"
+ "movq %cr0,%eax\n\t"
+ "andl $0x9fffffff,%eax\n\t" /* Clear CD and NW */
+ "movq %eax,%cr0\n\t"
+ "pop %rax\n\t");
+}
+
+
EFI_STATUS
EFIAPI
UefiMain (
@@ -14,6 +36,9 @@ UefiMain (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
+ cache_off();
+ addr_tst1(0);
+ cache_on();
return EFI_SUCCESS;
diff --git a/memtestEDK/Memtest/Test1/memoryMap.h b/memtestEDK/Memtest/Test1/memoryMap.h
index e887a4a..23ff7e7 100644
--- a/memtestEDK/Memtest/Test1/memoryMap.h
+++ b/memtestEDK/Memtest/Test1/memoryMap.h
@@ -1,6 +1,12 @@
+typedef unsigned long ulong;
-struct vars variables = {};
-struct vars * const vv = &variables;
+#define MAX_MEM_SEGMENTS 127
+
+struct mmap {
+ ulong pbase_addr;
+ ulong *start; // VA of segment start
+ ulong *end; // VA of the last dword within the segment.
+};
/* Define common variables across relocations of memtest86 */
struct vars {
@@ -15,9 +21,9 @@ struct vars {
int total_ticks;
int pptr;
int tptr;
- struct err_info erri;
+ // struct err_info erri;
// PA ranges from e820 table:
- struct pmap pmap[MAX_MEM_SEGMENTS];
+ //struct pmap pmap[MAX_MEM_SEGMENTS];
// VA mappings:
volatile struct mmap map[MAX_MEM_SEGMENTS];
ulong plim_lower; // phys page number
@@ -29,7 +35,7 @@ struct vars {
ulong snapl;
int printmode;
int numpatn;
- struct pair patn [BADRAM_MAXPATNS];
+ // struct pair patn [BADRAM_MAXPATNS];
ulong test_pages;
ulong selected_pages;
ulong reserved_pages;
@@ -38,4 +44,8 @@ struct vars {
int each_sec;
int beepmode;
int debugging; // Set in selftest only
-}; \ No newline at end of file
+};
+
+struct vars variables = {};
+struct vars * const vv = &variables;
+
diff --git a/memtestEDK/Memtest/Test1/test.c b/memtestEDK/Memtest/Test1/test.c
index c9bc36b..6b0403c 100644
--- a/memtestEDK/Memtest/Test1/test.c
+++ b/memtestEDK/Memtest/Test1/test.c
@@ -64,7 +64,7 @@ void foreach_segment
int done = 0;
do {
- do_tick(me);
+ // do_tick(me);
{ BAILR }
// ensure no overflow