diff options
author | Regina König | 2020-08-07 14:30:29 +0200 |
---|---|---|
committer | Regina König | 2020-08-07 14:30:29 +0200 |
commit | abd5686cbe9d0c87518a16f073d3d4a6153afef6 (patch) | |
tree | 31f5564e995d1dd72fffd1878a321ee646fe37c8 /memtestEDK/Memtest | |
parent | some restructuring of edk/Memtest directory (diff) | |
download | memtest86-abd5686cbe9d0c87518a16f073d3d4a6153afef6.tar.gz memtest86-abd5686cbe9d0c87518a16f073d3d4a6153afef6.tar.xz memtest86-abd5686cbe9d0c87518a16f073d3d4a6153afef6.zip |
added new application to test the first test
Diffstat (limited to 'memtestEDK/Memtest')
-rw-r--r-- | memtestEDK/Memtest/Test1/doTest1.c | 20 | ||||
-rw-r--r-- | memtestEDK/Memtest/Test1/doTest1.inf | 33 | ||||
-rw-r--r-- | memtestEDK/Memtest/Test1/test.c | 85 | ||||
-rw-r--r-- | memtestEDK/Memtest/Test1/test.h | 1 | ||||
-rw-r--r-- | memtestEDK/Memtest/Test2/Template.c | 18 | ||||
-rw-r--r-- | memtestEDK/Memtest/Test2/Template.inf | 32 |
6 files changed, 189 insertions, 0 deletions
diff --git a/memtestEDK/Memtest/Test1/doTest1.c b/memtestEDK/Memtest/Test1/doTest1.c new file mode 100644 index 0000000..11babee --- /dev/null +++ b/memtestEDK/Memtest/Test1/doTest1.c @@ -0,0 +1,20 @@ +#include <stdio.h> + +#include <stdint.h> +#include <Uefi.h> +#include <Library/UefiLib.h> +#include <Library/UefiApplicationEntryPoint.h> + +#include "test.h" + +EFI_STATUS +EFIAPI +UefiMain ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + + return EFI_SUCCESS; + +}
\ No newline at end of file diff --git a/memtestEDK/Memtest/Test1/doTest1.inf b/memtestEDK/Memtest/Test1/doTest1.inf new file mode 100644 index 0000000..5a15050 --- /dev/null +++ b/memtestEDK/Memtest/Test1/doTest1.inf @@ -0,0 +1,33 @@ +[Defines] + INF_VERSION = 1.25 + BASE_NAME = doTest1 + FILE_GUID = 6e6463a5-8e95-4959-97ea-7db3c845f8d5 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = UefiMain +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC Etc... +# + +[Sources] + doTest1.c + test.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + UefiApplicationEntryPoint + UefiLib + +[Guids] + +[Ppis] + +[Protocols] + +[FeaturePcd] + +[Pcd] diff --git a/memtestEDK/Memtest/Test1/test.c b/memtestEDK/Memtest/Test1/test.c new file mode 100644 index 0000000..818a193 --- /dev/null +++ b/memtestEDK/Memtest/Test1/test.c @@ -0,0 +1,85 @@ +typedef void(*segment_fn)(ulong* start, // start address + ulong len_dw, // length of segment in dwords + const void* ctx); // any context data needed + +static const void* const nullptr = 0x0; + int me = 0; // my_cpu_num in main.c + +/* + * Memory address test, walking ones + */ +void addr_tst1(int me) // TODO TEST STARTS HERE +{ + unsliced_foreach_segment(nullptr, me, addr_tst1_seg); +} + + +/* Calls segment_fn() for each segment in vv->map. + * + * Does not slice by CPU number, so it covers the entire memory. + * Contrast to sliced_foreach_segment(). + */ +STATIC void unsliced_foreach_segment +(const void* ctx, int me, segment_fn func) { + int j; + for (j=0; j<segs; j++) { + foreach_segment(vv->map[j].start, + vv->map[j].end, + me, ctx, func); + } +} + +/* Call segment_fn() for each up-to-SPINSZ segment between + * 'start' and 'end'. + */ +void foreach_segment +(ulong* start, ulong* end, + int me, const void* ctx, segment_fn func) { + + ASSERT(start < end); + + // Confirm 'start' points to an even dword, and 'end' + // should point to an odd dword + ASSERT(0 == (((ulong)start) & 0x7)); + ASSERT(0x4 == (((ulong)end) & 0x7)); + + // 'end' may be exactly 0xfffffffc, right at the 4GB boundary. + // + // To avoid overflow in our loop tests and length calculations, + // use dword indices (the '_dw' vars) to avoid overflows. + ulong start_dw = ((ulong)start) >> 2; + ulong end_dw = ((ulong) end) >> 2; + + // end is always xxxxxffc, but increment end_dw to an + // address beyond the segment for easier boundary calculations. + ++end_dw; + + ulong seg_dw = start_dw; + ulong seg_end_dw = start_dw; + + int done = 0; + do { + do_tick(me); + { BAILR } + + // ensure no overflow + ASSERT((seg_end_dw + SPINSZ_DWORDS) > seg_end_dw); + seg_end_dw += SPINSZ_DWORDS; + + if (seg_end_dw >= end_dw) { + seg_end_dw = end_dw; + done++; + } + if (seg_dw == seg_end_dw) { + break; + } + + ASSERT(((ulong)seg_end_dw) <= 0x40000000); + ASSERT(seg_end_dw > seg_dw); + ulong seg_len_dw = seg_end_dw - seg_dw; + + func((ulong*)(seg_dw << 2), seg_len_dw, ctx); + + seg_dw = seg_end_dw; + } while (!done); +}
\ No newline at end of file diff --git a/memtestEDK/Memtest/Test1/test.h b/memtestEDK/Memtest/Test1/test.h new file mode 100644 index 0000000..d741056 --- /dev/null +++ b/memtestEDK/Memtest/Test1/test.h @@ -0,0 +1 @@ +void addr_tst1(int me);
\ No newline at end of file diff --git a/memtestEDK/Memtest/Test2/Template.c b/memtestEDK/Memtest/Test2/Template.c new file mode 100644 index 0000000..723d7d9 --- /dev/null +++ b/memtestEDK/Memtest/Test2/Template.c @@ -0,0 +1,18 @@ +#include <stdio.h> + +#include <stdint.h> +#include <Uefi.h> +#include <Library/UefiLib.h> +#include <Library/UefiApplicationEntryPoint.h> + +EFI_STATUS +EFIAPI +UefiMain ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + + return EFI_SUCCESS; + +}
\ No newline at end of file diff --git a/memtestEDK/Memtest/Test2/Template.inf b/memtestEDK/Memtest/Test2/Template.inf new file mode 100644 index 0000000..0d31854 --- /dev/null +++ b/memtestEDK/Memtest/Test2/Template.inf @@ -0,0 +1,32 @@ +[Defines] + INF_VERSION = 1.25 + BASE_NAME = Template + FILE_GUID = https://www.guidgenerator.com/online-guid-generator.aspx + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = UefiMain +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC Etc... +# + +[Sources] + Template.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + UefiApplicationEntryPoint + UefiLib + +[Guids] + +[Ppis] + +[Protocols] + +[FeaturePcd] + +[Pcd] |