diff options
Diffstat (limited to 'memtestEDK/Memtest/Test1/doTest1.c')
-rw-r--r-- | memtestEDK/Memtest/Test1/doTest1.c | 25 |
1 files changed, 25 insertions, 0 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; |