wok-current rev 25512
memtest: 386/1M support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Feb 14 07:20:48 2023 +0000 (22 months ago) |
parents | be6d30fe521d |
children | 2956e54cc56a |
files | memtest/receipt memtest/stuff/memtest86+-6-386.patch |
line diff
1.1 --- a/memtest/receipt Mon Feb 13 17:17:56 2023 +0000 1.2 +++ b/memtest/receipt Tue Feb 14 07:20:48 2023 +0000 1.3 @@ -75,7 +75,7 @@ 1.4 objdump -t boot/startup.o | \ 1.5 awk '/patch/ { print "sed -i \"s|" $5 "|0x" $1 "|\" ../boot/setup.S" }' | sh 1.6 make memtest.bin 1.7 - tune_lzma memtest.bin 161,mf=bt2 LC 3 PB 2 1.8 + tune_lzma memtest.bin 208,mf=bt2 LC 3 PB 2 1.9 } 1.10 1.11
2.1 --- a/memtest/stuff/memtest86+-6-386.patch Mon Feb 13 17:17:56 2023 +0000 2.2 +++ b/memtest/stuff/memtest86+-6-386.patch Tue Feb 14 07:20:48 2023 +0000 2.3 @@ -83,8 +83,8 @@ 2.4 + xorb %dl, %al 2.5 + and $0x20, %al 2.6 + jz 1f 2.7 -+ movw $0x1000, %ax 2.8 -+ movw %ax, %ds 2.9 ++ pushw $0x1000 2.10 ++ popw %ds 2.11 + movb $0xa8, %al # testb $imm %al opcode 2.12 + movw %ax, patch1 2.13 + movw %ax, patch2 2.14 @@ -147,3 +147,56 @@ 2.15 __asm__ __volatile__ ("\t" 2.16 "wbinvd\n" 2.17 : /* no outputs */ 2.18 +--- app/main.c 2.19 ++++ app/main.c 2.20 +@@ -75,6 +75,7 @@ 2.21 + 2.22 + static volatile int init_state = 0; 2.23 + 2.24 ++static uintptr_t low_load_limit = LOW_LOAD_LIMIT; 2.25 + static uintptr_t low_load_addr; 2.26 + static uintptr_t high_load_addr; 2.27 + 2.28 +@@ -205,6 +206,9 @@ 2.29 + 2.30 + cpuid_init(); 2.31 + 2.32 ++ if (cpuid_info.version.family <= 4) // down to 1MB memory size support 2.33 ++ low_load_limit = SIZE_C(256,KB); // must be a multiple of the page size 2.34 ++ 2.35 + // Nothing before this should access the boot parameters, in case they are located above 4GB. 2.36 + // This is the first region we map, so it is guaranteed not to fail. 2.37 + boot_params_addr = map_region(boot_params_addr, sizeof(boot_params_t), true); 2.38 +@@ -282,8 +286,8 @@ 2.39 + 2.40 + size_t program_size = (_stacks - _start) + BSP_STACK_SIZE + (num_enabled_cpus - 1) * AP_STACK_SIZE; 2.41 + 2.42 +- bool load_addr_ok = set_load_addr(& low_load_addr, program_size, 0x1000, LOW_LOAD_LIMIT) 2.43 +- && set_load_addr(&high_load_addr, program_size, LOW_LOAD_LIMIT, HIGH_LOAD_LIMIT); 2.44 ++ bool load_addr_ok = set_load_addr(& low_load_addr, program_size, 0x1000, low_load_limit) 2.45 ++ && set_load_addr(&high_load_addr, program_size, low_load_limit, HIGH_LOAD_LIMIT); 2.46 + 2.47 + trace(0, "program size %ikB", (int)(program_size / 1024)); 2.48 + trace(0, " low_load_addr %0*x", 2*sizeof(uintptr_t), low_load_addr); 2.49 +@@ -420,7 +424,7 @@ 2.50 + // Relocation may disrupt the test. 2.51 + window_num = 1; 2.52 + } 2.53 +- if (window_num == 0 && pm_limit_lower >= LOW_LOAD_LIMIT) { 2.54 ++ if (window_num == 0 && pm_limit_lower >= low_load_limit) { 2.55 + // Avoid unnecessary relocation. 2.56 + window_num = 1; 2.57 + } 2.58 +@@ -443,10 +447,10 @@ 2.59 + switch (window_num) { 2.60 + case 0: 2.61 + window_start = 0; 2.62 +- window_end = (LOW_LOAD_LIMIT >> PAGE_SHIFT); 2.63 ++ window_end = (low_load_limit >> PAGE_SHIFT); 2.64 + break; 2.65 + case 1: 2.66 +- window_start = (LOW_LOAD_LIMIT >> PAGE_SHIFT); 2.67 ++ window_start = (low_load_limit >> PAGE_SHIFT); 2.68 + window_end = VM_WINDOW_SIZE; 2.69 + break; 2.70 + default: