FreeBSD Bugzilla – Attachment 182690 Details for
Bug 211204
loading sysutils/memtest86+ reboots the system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
attempt to fix loading via freebsd boot chain
memtest5-update.diff (text/plain), 10.36 KB, created by
Andriy Gapon
on 2017-05-18 11:48:50 UTC
(
hide
)
Description:
attempt to fix loading via freebsd boot chain
Filename:
MIME Type:
Creator:
Andriy Gapon
Created:
2017-05-18 11:48:50 UTC
Size:
10.36 KB
patch
obsolete
>diff --git a/sysutils/memtest86+/Makefile b/sysutils/memtest86+/Makefile >index abad2803efd7d..036f8681da1dd 100644 >--- a/sysutils/memtest86+/Makefile >+++ b/sysutils/memtest86+/Makefile >@@ -3,6 +3,7 @@ > > PORTNAME= memtest86+ > PORTVERSION= 5.01 >+PORTREVISION= 1 > CATEGORIES= sysutils > MASTER_SITES= http://www.memtest.org/download/${PORTVERSION}/ > >@@ -41,17 +42,16 @@ BOOT_SUB_LIST+= BOOT_DIR=${BOOT_DIR} > > pre-fetch: > .if !defined(PACKAGE_BUILDING) >- @${ECHO} "If you only need bootable ISO image of memtest86+, you can" >- @${ECHO} "simply download it from http://www.memtest.org/. Use this" >- @${ECHO} "port if you need ELF image of memtest86+ that can be loaded" >- @${ECHO} "by boot2 or loader(8), or if you want to use this port to" >- @${ECHO} "build ISO image with custom tweaks in memtest86+ code." >+ @${ECHO_CMD} "If you only need bootable ISO image of memtest86+, you can" >+ @${ECHO_CMD} "simply download it from http://www.memtest.org/. Use this" >+ @${ECHO_CMD} "port if you need ELF image of memtest86+ that can be loaded" >+ @${ECHO_CMD} "by boot2 or loader(8), or if you want to use this port to" >+ @${ECHO_CMD} "build ISO image with custom tweaks in memtest86+ code." > .endif > > .include <bsd.port.options.mk> > > post-patch: >- ${REINPLACE_CMD} -e 's|gcc|${CC}|' ${WRKSRC}/Makefile > .if ${PORT_OPTIONS:MSERIAL} > ${REINPLACE_CMD} -e 's|SERIAL_CONSOLE_DEFAULT 0|SERIAL_CONSOLE_DEFAULT 1|' ${WRKSRC}/config.h > . if ${PORT_OPTIONS:MHISPEED} >diff --git a/sysutils/memtest86+/files/patch-Makefile b/sysutils/memtest86+/files/patch-Makefile >index 41f5504d24bde..59f3d4bc8414e 100644 >--- a/sysutils/memtest86+/files/patch-Makefile >+++ b/sysutils/memtest86+/files/patch-Makefile >@@ -1,6 +1,16 @@ >---- Makefile.orig 2013-08-10 02:01:58 UTC >-+++ Makefile >-@@ -21,21 +21,20 @@ OBJS= head.o reloc.o main.o test.o init. >+--- Makefile.orig 2013-08-10 05:01:58.000000000 +0300 >++++ Makefile 2017-05-11 13:40:06.753439265 +0300 >+@@ -9,8 +9,7 @@ >+ # >+ FDISK=/dev/fd0 >+ >+-AS=as -32 >+-CC=gcc >++ASFLAGS=-32 >+ >+ CFLAGS= -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin \ >+ -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector >+@@ -21,21 +20,20 @@ OBJS= head.o reloc.o main.o test.o init. > > > all: clean memtest.bin memtest >@@ -25,16 +35,7 @@ > > head.s: head.S config.h defs.h test.h > $(CC) -E -traditional $< -o $@ >-@@ -47,7 +46,7 @@ setup.s: setup.S config.h defs.h >- $(CC) -E -traditional $< -o $@ >- >- memtest.bin: memtest_shared.bin bootsect.o setup.o memtest.bin.lds >-- $(LD) -T memtest.bin.lds bootsect.o setup.o -b binary \ >-+ $(LD) --oformat elf32-i386-freebsd -T memtest.bin.lds bootsect.o setup.o -b binary \ >- memtest_shared.bin -o memtest.bin >- >- reloc.o: reloc.c >-@@ -67,8 +66,7 @@ clean: >+@@ -67,8 +65,7 @@ clean: > rm -f *.o *.s *.iso memtest.bin memtest memtest_shared \ > memtest_shared.bin memtest.iso > >diff --git a/sysutils/memtest86+/files/patch-io.h b/sysutils/memtest86+/files/patch-io.h >index e69de29bb2d1d..e3ec303efa0d3 100644 >--- a/sysutils/memtest86+/files/patch-io.h >+++ b/sysutils/memtest86+/files/patch-io.h >@@ -0,0 +1,46 @@ >+--- io.h.orig 2013-08-10 05:01:58.000000000 +0300 >++++ io.h 2017-05-11 13:56:41.349526741 +0300 >+@@ -31,7 +31,7 @@ >+ */ >+ >+ #define __OUT1(s,x) \ >+-extern inline void __out##s(unsigned x value, unsigned short port) { >++static inline void __out##s(unsigned x value, unsigned short port) { >+ >+ #define __OUT2(s,s1,s2) \ >+ __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" >+@@ -43,7 +43,7 @@ __OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" >+ __OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; } >+ >+ #define __IN1(s) \ >+-extern inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v; >++static inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v; >+ >+ #define __IN2(s,s1,s2) \ >+ __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" >+@@ -55,7 +55,7 @@ __IN1(s##_p) __IN2(s,s1,"w") : "=a" (_v) >+ __IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; } >+ >+ #define __OUTS(s) \ >+-extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ >++static inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ >+ { __asm__ __volatile__ ("cld ; rep ; outs" #s \ >+ : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } >+ >+@@ -94,6 +94,16 @@ __OUTS(l) >+ __inbc(port) : \ >+ __inb(port)) >+ >++#define outb_p(val,port) \ >++((__builtin_constant_p((port)) && (port) < 256) ? \ >++ __outbc_p((val),(port)) : \ >++ __outb_p((val),(port))) >++ >++#define inb_p(port) \ >++((__builtin_constant_p((port)) && (port) < 256) ? \ >++ __inbc_p(port) : \ >++ __inb_p(port)) >++ >+ >+ #define outw(val,port) \ >+ ((__builtin_constant_p((port)) && (port) < 256) ? \ >diff --git a/sysutils/memtest86+/files/patch-lib.c b/sysutils/memtest86+/files/patch-lib.c >index e69de29bb2d1d..93ddafecc43e7 100644 >--- a/sysutils/memtest86+/files/patch-lib.c >+++ b/sysutils/memtest86+/files/patch-lib.c >@@ -0,0 +1,18 @@ >+--- lib.c.orig 2017-05-11 13:44:30.061388920 +0300 >++++ lib.c 2017-05-11 13:45:14.901431848 +0300 >+@@ -33,7 +33,7 @@ struct ascii_map_str { >+ int keycode; >+ }; >+ >+-inline void reboot(void) >++void reboot(void) >+ { >+ >+ /* tell the BIOS to do a cold start */ >+@@ -1196,4 +1196,4 @@ void get_list(int x, int y, int len, cha >+ return; >+ } >+ } >+-} >+\ No newline at end of file >++} >diff --git a/sysutils/memtest86+/files/patch-main.c b/sysutils/memtest86+/files/patch-main.c >index e69de29bb2d1d..35921c4649d69 100644 >--- a/sysutils/memtest86+/files/patch-main.c >+++ b/sysutils/memtest86+/files/patch-main.c >@@ -0,0 +1,16 @@ >+--- main.c.orig 2013-08-10 05:01:58.000000000 +0300 >++++ main.c 2017-05-11 13:40:06.783440452 +0300 >+@@ -400,6 +400,13 @@ void test_start(void) >+ /* First thing, switch to main stack */ >+ switch_to_main_stack(my_cpu_num); >+ >++ if (start_seq == 0) { >++ if ((ulong)&_start != LOW_TEST_ADR) >++ run_at(LOW_TEST_ADR, 0); >++ else >++ spin_unlock(&barr->mutex); >++ } >++ >+ /* First time (for this CPU) initialization */ >+ if (start_seq < 2) { >+ >diff --git a/sysutils/memtest86+/files/patch-memtest.lds b/sysutils/memtest86+/files/patch-memtest.lds >index 759738effa3d3..8ee49f4c6673f 100644 >--- a/sysutils/memtest86+/files/patch-memtest.lds >+++ b/sysutils/memtest86+/files/patch-memtest.lds >@@ -1,11 +1,11 @@ >---- memtest.lds.orig 2013-08-10 02:01:58 UTC >-+++ memtest.lds >+--- memtest.lds.orig 2013-08-10 05:01:58.000000000 +0300 >++++ memtest.lds 2017-05-11 13:40:06.795436922 +0300 > @@ -3,7 +3,7 @@ OUTPUT_ARCH(i386); > > ENTRY(_start); > SECTIONS { > - . = 0x10000; >-+ . = 0xc0120000; >++ . = 0xc0210000; > _start = . ; > .data : { > *(.data) >diff --git a/sysutils/memtest86+/files/patch-setup.S b/sysutils/memtest86+/files/patch-setup.S >index 5479c76606019..82d02ff3fdece 100644 >--- a/sysutils/memtest86+/files/patch-setup.S >+++ b/sysutils/memtest86+/files/patch-setup.S >@@ -1,5 +1,5 @@ >---- setup.S.orig 2013-08-10 02:01:58 UTC >-+++ setup.S >+--- setup.S.orig 2013-08-10 05:01:58.000000000 +0300 >++++ setup.S 2017-05-11 13:40:06.808467223 +0300 > @@ -50,7 +50,7 @@ reload: > jz alt_a20_done > >diff --git a/sysutils/memtest86+/files/patch-smp.c b/sysutils/memtest86+/files/patch-smp.c >index e69de29bb2d1d..66192d7a96371 100644 >--- a/sysutils/memtest86+/files/patch-smp.c >+++ b/sysutils/memtest86+/files/patch-smp.c >@@ -0,0 +1,28 @@ >+--- smp.c.orig 2013-08-10 05:01:58.000000000 +0300 >++++ smp.c 2017-05-11 15:38:39.000978352 +0300 >+@@ -428,13 +428,14 @@ rsdp_t *scan_for_rsdp(uintptr_t addr, ui >+ uintptr_t end = addr + length; >+ >+ >+- while ((uintptr_t)addr < end) { >++ while (addr < end) { >+ rp = (rsdp_t*)addr; >+- if (*(unsigned int *)addr == RSDPSignature && >+- checksum((unsigned char*)addr, rp->length) == 0) { >++ if (*(unsigned int *)addr == RSDPSignature && >++ ((rp->revision == 0 && checksum((unsigned char*)addr, 20) == 0) || >++ (rp->revision > 0 && checksum((unsigned char*)addr, rp->length) == 0))) { >+ return rp; >+ } >+- addr += 4; >++ addr += 16; >+ } >+ return NULL; >+ } >+@@ -689,4 +690,4 @@ int smp_ord_to_cpu(int me) >+ if (num_to_ord[i] == me) return i; >+ } >+ return -1; >+-} >+\ No newline at end of file >++} >diff --git a/sysutils/memtest86+/files/patch-test.c b/sysutils/memtest86+/files/patch-test.c >index ce6f9dd219c48..1e8f9df22a698 100644 >--- a/sysutils/memtest86+/files/patch-test.c >+++ b/sysutils/memtest86+/files/patch-test.c >@@ -1,53 +1,11 @@ >---- test.c.orig 2013-08-10 02:29:44 UTC >-+++ test.c >-@@ -14,7 +14,6 @@ >+--- test.c.orig 2013-08-10 05:29:44.000000000 +0300 >++++ test.c 2017-05-11 11:31:24.549949900 +0300 >+@@ -14,7 +14,7 @@ > #include "stdint.h" > #include "cpuid.h" > #include "smp.h" > -#include <sys/io.h> >++#include "io.h" > > extern struct cpu_ident cpu_id; > extern volatile int mstr_cpu; >-@@ -1543,6 +1542,19 @@ void sleep(long n, int flag, int me, int >- } >- } >- >-+static inline unsigned char inb(unsigned int port) >-+{ >-+ unsigned char data; >-+ >-+ asm __volatile__("inb %1,%0" : "=a" (data) : "id" ((unsigned short)(port))); >-+ return (data); >-+} >-+ >-+static inline void outb(unsigned int port, unsigned char data) >-+{ >-+ asm __volatile__("outb %0,%1" : : "a" (data), "id" ((unsigned short)(port))); >-+} >-+ >- /* Beep function */ >- >- void beep(unsigned int frequency) >-@@ -1551,18 +1563,18 @@ void beep(unsigned int frequency) >- unsigned int count = 1193180 / frequency; >- >- // Switch on the speaker >-- outb_p(inb_p(0x61)|3, 0x61); >-+ outb(inb(0x61)|3, 0x61); >- >- // Set command for counter 2, 2 byte write >-- outb_p(0xB6, 0x43); >-+ outb(0xB6, 0x43); >- >- // Select desired Hz >-- outb_p(count & 0xff, 0x42); >-+ outb(count & 0xff, 0x42); >- outb((count >> 8) & 0xff, 0x42); >- >- // Block for 100 microseconds >- sleep(100, 0, 0, 1); >- >- // Switch off the speaker >-- outb(inb_p(0x61)&0xFC, 0x61); >-+ outb(inb(0x61)&0xFC, 0x61); >- } >diff --git a/sysutils/memtest86+/files/patch-test.h b/sysutils/memtest86+/files/patch-test.h >index e69de29bb2d1d..ff7b74683b0bb 100644 >--- a/sysutils/memtest86+/files/patch-test.h >+++ b/sysutils/memtest86+/files/patch-test.h >@@ -0,0 +1,11 @@ >+--- test.h.orig 2013-08-10 05:01:58.000000000 +0300 >++++ test.h 2017-05-11 13:40:06.834437333 +0300 >+@@ -36,7 +36,7 @@ struct mem_info_t { >+ }; >+ >+ typedef unsigned long ulong; >+-#define STACKSIZE (8*1024) >++#define STACKSIZE (16*1024) >+ #define MAX_MEM 0x7FF00000 /* 8 TB */ >+ #define WIN_SZ 0x80000 /* 2 GB */ >+ #define UNMAP_SZ (0x100000-WIN_SZ) /* Size of umappped first segment */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 211204
: 182690