summaryrefslogtreecommitdiffstats
path: root/efi_memtest
diff options
context:
space:
mode:
authorRegia König2021-06-15 10:49:57 +0200
committerRegia König2021-06-15 10:49:57 +0200
commite8e3208bee35b25562feeb13a5953f7653d91b5c (patch)
tree0f7bce8794e9bcc690122357d2a2b8755d5de39f /efi_memtest
parentResolve some compilation errors (diff)
downloadmemtest86-e8e3208bee35b25562feeb13a5953f7653d91b5c.tar.gz
memtest86-e8e3208bee35b25562feeb13a5953f7653d91b5c.tar.xz
memtest86-e8e3208bee35b25562feeb13a5953f7653d91b5c.zip
Add EFI_LOADED_IMAGE_PROTOCOL_GUID
Diffstat (limited to 'efi_memtest')
-rw-r--r--efi_memtest/MemtestEfi.c13
-rw-r--r--efi_memtest/logger_config.h5
-rw-r--r--efi_memtest/memtest86+/config.c13
-rw-r--r--efi_memtest/memtest86+/efi/Include/Efi_Defs.c1
-rw-r--r--efi_memtest/memtest86+/efi/Include/Efi_Defs_GUID.h2
-rw-r--r--efi_memtest/memtest86+/efi/Include/Protocol/LoadedImage.h7
-rw-r--r--efi_memtest/memtest86+/efi/test.c75
-rw-r--r--efi_memtest/memtest86+/error.c11
8 files changed, 87 insertions, 40 deletions
diff --git a/efi_memtest/MemtestEfi.c b/efi_memtest/MemtestEfi.c
index a464cba..3f14289 100644
--- a/efi_memtest/MemtestEfi.c
+++ b/efi_memtest/MemtestEfi.c
@@ -35,6 +35,19 @@ UefiMain (
print_log(msg, sizeof(msg) - 1);
}
+ {
+ char log[43] = "Address of UefiMain: ";
+ int length = 23;
+ int_to_charr((unsigned long)UefiMain, log, &length);
+ print_log(log, length);
+ }
+
+ {
+ char log[43] = "Address of test_start: ";
+ int length = 23;
+ int_to_charr((unsigned long)test_start, log, &length);
+ print_log(log, length);
+ }
test_start();
diff --git a/efi_memtest/logger_config.h b/efi_memtest/logger_config.h
index 6d9fc9e..26143b0 100644
--- a/efi_memtest/logger_config.h
+++ b/efi_memtest/logger_config.h
@@ -15,4 +15,7 @@ short log_pmap = 1;
// Hardware Information
short log_mem_ctrl = 0;
short log_pci_conf = 0;
-short log_dmi = 0; \ No newline at end of file
+short log_dmi = 0;
+
+// Tests
+short log_tst2 = 1; \ No newline at end of file
diff --git a/efi_memtest/memtest86+/config.c b/efi_memtest/memtest86+/config.c
index d3411a6..cade5e1 100644
--- a/efi_memtest/memtest86+/config.c
+++ b/efi_memtest/memtest86+/config.c
@@ -462,12 +462,13 @@ void pop2clear()
void adj_mem(void)
{
- if(logflag && log_pmap) {
- char log[23] = "vvaaddr = ";
- int length = 10;
- int_to_charr((ulong)vv, log, &length);
- print_log(log, length);
- }
+ if(logflag && log_pmap) {
+ char log[23] = "vvaaddr = ";
+ int length = 10;
+ int_to_charr((ulong)vv, log, &length);
+ print_log(log, length);
+ }
+
int i;
vv->selected_pages = 0;
diff --git a/efi_memtest/memtest86+/efi/Include/Efi_Defs.c b/efi_memtest/memtest86+/efi/Include/Efi_Defs.c
index acaebcc..6b3bda2 100644
--- a/efi_memtest/memtest86+/efi/Include/Efi_Defs.c
+++ b/efi_memtest/memtest86+/efi/Include/Efi_Defs.c
@@ -29,6 +29,7 @@ EFI_GUID gEfiSmbios3Guid = SMBIOS3_TABLE_GUID;
// Protocols
EFI_GUID gEfiSimpleFileSystemProtocolGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
EFI_GUID gEfiFileSystemInfoGuid = EFI_FILE_SYSTEM_INFO_ID;
+EFI_GUID gEfiLoadedImageProtocolGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
// Guids
//GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiMdePkgTokenSpaceGuid = { 0x914AEBE7, 0x4635, 0x459b, { 0xAA, 0x1C, 0x11, 0xE2, 0x19, 0xB0, 0x3A, 0x10 }};
diff --git a/efi_memtest/memtest86+/efi/Include/Efi_Defs_GUID.h b/efi_memtest/memtest86+/efi/Include/Efi_Defs_GUID.h
index 4fbc049..f468b54 100644
--- a/efi_memtest/memtest86+/efi/Include/Efi_Defs_GUID.h
+++ b/efi_memtest/memtest86+/efi/Include/Efi_Defs_GUID.h
@@ -61,6 +61,8 @@ extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;
#define EFI_FILE_SYSTEM_INFO_ID { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }}
extern EFI_GUID gEfiFileSystemInfoGuid;
+#define EFI_LOADED_IMAGE_PROTOCOL_GUID {0x5B1B31A1,0x9562,0x11d2,{0x8E,0x3F,0x00,0xA0,0xC9,0x69,0x72,0x3B}}
+extern EFI_GUID gEfiLoadedImageProtocolGuid;
#endif
diff --git a/efi_memtest/memtest86+/efi/Include/Protocol/LoadedImage.h b/efi_memtest/memtest86+/efi/Include/Protocol/LoadedImage.h
index d6e05a9..9195785 100644
--- a/efi_memtest/memtest86+/efi/Include/Protocol/LoadedImage.h
+++ b/efi_memtest/memtest86+/efi/Include/Protocol/LoadedImage.h
@@ -9,14 +9,11 @@
**/
+#include "Efi_Defs_GUID.h"
+
#ifndef __LOADED_IMAGE_PROTOCOL_H__
#define __LOADED_IMAGE_PROTOCOL_H__
-#define EFI_LOADED_IMAGE_PROTOCOL_GUID \
- { \
- 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \
- }
-
#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \
{ \
0xbc62157e, 0x3e33, 0x4fec, {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf } \
diff --git a/efi_memtest/memtest86+/efi/test.c b/efi_memtest/memtest86+/efi/test.c
index 1ab87bf..7b7d3ec 100644
--- a/efi_memtest/memtest86+/efi/test.c
+++ b/efi_memtest/memtest86+/efi/test.c
@@ -19,6 +19,11 @@
extern short logflag;
extern short log_fine;
+extern short log_tst2;
+
+// TODO REMOVE
+int addr_written = 0;
+ulong bad_addr = 103456768;
extern struct cpu_ident cpu_id;
extern volatile int mstr_cpu;
@@ -280,55 +285,44 @@ STATIC void addr_tst2_init_segment(ulong* p,
ulong len_dw, const void* unused) {
ulong* pe = p + ((len_dw - 1) >> 1);
- if (logflag) {
+ if (logflag && log_tst2) {
char log[27] = "Number of pages: ";
int length = 17;
int_to_charr((ulong)(pe - p)>>9, log, &length);
print_log(log, length);
}
- if (logflag) {
+ if (logflag && log_tst2) {
char log[13] = "p: ";
int length = 3;
int_to_charr((ulong)p, log, &length);
print_log(log, length);
}
- if (logflag) {
+ if (logflag && log_tst2) {
char log[14] = "pe: ";
int length = 4;
int_to_charr((ulong)pe, log, &length);
print_log(log, length);
}
- if (logflag) {
+ if (logflag && log_tst2) {
char log[128] = "pe - p: ";
int length = 8;
int_to_charr((ulong)(pe - p)<<3, log, &length);
print_log(log, length);
}
- /*if (status != EFI_SUCCESS) {
- char log[19] = "status = ";
- int length = 9;
- int_to_charr(status, log, &length);
- print_log(log, length);
-
- } else {
- print_log(">>>>>>>>>>SUCCESS!!", 19);
- }*/
-
//Original C code replaced with hand tuned assembly code
for (; p <= pe; p++) {
*p = (ulong)p;
- /* if ((ulong)p == 103514112) {
- if (logflag) {
+ if ((ulong)p == bad_addr) {
+ addr_written = 1;
char log[35] = "content of p = ";
int length = 15;
int_to_charr(*p, log, &length);
print_log(log, length);
}
- }*/
}
/*asm __volatile__ (
@@ -342,6 +336,14 @@ STATIC void addr_tst2_init_segment(ulong* p,
"jb L90\n\t"
: : "D" (p), "d" (pe)
);*/
+
+ if (addr_written) {
+ ulong *px = (ulong *)bad_addr;
+ char log[35] = "content of p = ";
+ int length = 15;
+ int_to_charr(*px, log, &length);
+ print_log(log, length);
+ }
}
int print_check_counter = 0;
@@ -378,7 +380,21 @@ STATIC void addr_tst2_check_segment(ulong* p,
}*/
//Original C code replaced with hand tuned assembly code
+
+ if (logflag && log_tst2 && addr_written) {
+ ulong *px = (ulong*)bad_addr;
+ char log[35] = "content of p = ";
+ int length = 15;
+ int_to_charr(*px, log, &length);
+ print_log(log, length);
+ }
+
+
for (; p <= pe; p++) {
+
+
+
+
if((bad = *p) != (ulong)p) {
ad_err2((ulong *)p, bad);
}
@@ -445,11 +461,6 @@ STATIC void addr_tst2_check_segment(ulong* p,
: "ecx"
);
*/
- /* EFI_STATUS status = gST->BootServices->FreePages((EFI_PHYSICAL_ADDRESS) p, (UINTN) (pe - p) >> 12);
-
- if (status != EFI_SUCCESS) {
- print_log("no success", 10);
- }*/
}
@@ -460,7 +471,7 @@ void addr_tst2(int me)
{
cprint(LINE_PAT, COL_PAT, "address ");
- if (logflag) {
+ if (logflag && log_tst2) {
print_log("addr_tst2(): starting addr_tst2_init_segment", 44);
}
@@ -468,10 +479,26 @@ void addr_tst2(int me)
unsliced_foreach_segment(nullptr, me, addr_tst2_init_segment);
{ BAILR }
- if (logflag) {
+ ulong *p = (ulong * )bad_addr;
+ if (logflag && log_tst2 && addr_written) {
+ char log[35] = "content of p = ";
+ int length = 15;
+ int_to_charr(*p, log, &length);
+ print_log(log, length);
+ }
+
+
+ if (logflag && log_tst2) {
print_log("addr_tst2(): starting addr_tst2_check_segment", 45);
}
+ if (logflag && log_tst2 && addr_written) {
+ char log[35] = "content of p = ";
+ int length = 15;
+ int_to_charr(*p, log, &length);
+ print_log(log, length);
+ }
+
/* Each address should have its own address */
unsliced_foreach_segment(nullptr, me, addr_tst2_check_segment);
diff --git a/efi_memtest/memtest86+/error.c b/efi_memtest/memtest86+/error.c
index 03c567e..f256e5d 100644
--- a/efi_memtest/memtest86+/error.c
+++ b/efi_memtest/memtest86+/error.c
@@ -16,6 +16,7 @@
#include "display.h"
extern short logflag;
+extern short log_tst2;
extern int dmi_err_cnts[MAX_DMI_MEMDEVS];
extern int beepmode;
@@ -110,21 +111,23 @@ void ad_err1(ulong *adr1, ulong *mask, ulong bad, ulong good)
void ad_err2(ulong *adr, ulong bad)
{
- /*if (logflag) {
+ if (logflag) {
print_log("ad_err2(): FOUND ERROR IN MEMORY TEST # 2", 41);
}
- if (logflag) {
+ if (logflag && log_tst2) {
char log[28] = "ad_err2(): *adr = ";
int length = 18;
int_to_charr((ulong)adr, log, &length);
print_log(log, length);
}
- if (logflag) {
+ if (logflag && log_tst2) {
char log[27] = "ad_err2(): bad = ";
int length = 17;
int_to_charr(bad, log, &length);
print_log(log, length);
- }*/
+ }
+
+ while(1);
//query_memory_table(); // TODO remove
//print_pmap(); // TODO remove