diff options
author | maya <maya@pkgsrc.org> | 2018-02-07 00:59:18 +0000 |
---|---|---|
committer | maya <maya@pkgsrc.org> | 2018-02-07 00:59:18 +0000 |
commit | acfb08bba0dfd8ac4fe8967df6dd88634ed746ad (patch) | |
tree | 5d23d6e7d47afdfa7984c15fb0b3852db34f07cc /sysutils | |
parent | dc8321b918de7a2463bad3f3d64a33b77a0ac280 (diff) | |
download | pkgsrc-acfb08bba0dfd8ac4fe8967df6dd88634ed746ad.tar.gz |
memtestplus: replace macro insanity with expanded definitions
...from current linux.
PR pkg/52983: sysutils/memtestplus w/-O0 build fails on netbsd-7
PKGREVISION++
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/memtestplus/Makefile | 7 | ||||
-rw-r--r-- | sysutils/memtestplus/files/io.h | 68 |
2 files changed, 73 insertions, 2 deletions
diff --git a/sysutils/memtestplus/Makefile b/sysutils/memtestplus/Makefile index 0a482b1de42..8bad3a26184 100644 --- a/sysutils/memtestplus/Makefile +++ b/sysutils/memtestplus/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.25 2018/01/29 14:23:26 maya Exp $ +# $NetBSD: Makefile,v 1.26 2018/02/07 00:59:18 maya Exp $ # # Note -- version number also in the do-install rule @@ -7,7 +7,7 @@ MINVER=01 DISTNAME= memtest86+-${MAJVER}.${MINVER} PKGNAME= memtestplus-${MAJVER}.${MINVER} -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= sysutils MASTER_SITES= http://www.memtest.org/download/${MAJVER}.${MINVER}/ @@ -47,6 +47,9 @@ BUILDLINK_TRANSFORM+= rm:-fno-stack-protector BROKEN+= ${PKGNAME} does not produce a working binary with clang .endif +pre-configure: + ${CP} ${FILESDIR}/io.h ${WRKSRC} + do-install: ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/mdec ${INSTALL_DATA} ${WRKSRC}/memtest.bin \ diff --git a/sysutils/memtestplus/files/io.h b/sysutils/memtestplus/files/io.h new file mode 100644 index 00000000000..a99be3e4d78 --- /dev/null +++ b/sysutils/memtestplus/files/io.h @@ -0,0 +1,68 @@ +#ifndef _ASM_X86_IO_H +#define _ASM_X86_IO_H + +#ifdef SLOW_IO_BY_JUMPING +#define native_io_delay() __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:") +#else +#define native_io_delay() __asm__ __volatile__("outb %al,$0x80") +#endif + +static inline void slow_down_io(void) +{ + native_io_delay(); +#ifdef REALLY_SLOW_IO + native_io_delay(); + native_io_delay(); + native_io_delay(); +#endif +} + + +void __outb(char value, int port) { + asm volatile("outb" " %b" "0, %w1" + : : "a"(value), "Nd"(port)); +} + +unsigned char __inb(int port) +{ + unsigned char value; + asm volatile("inb" " %w1, %b" "0" + : "=a"(value) : "Nd"(port)); + return value; +} + +void __outw(short value, int port) { + asm volatile("outw" " %w" "0, %w1" + : : "a"(value), "Nd"(port)); +} + +unsigned short __inw(int port) +{ + unsigned short value; + asm volatile("inw" " %w1, %w" "0" + : "=a"(value) : "Nd"(port)); + return value; +} + +void __outl(int value, int port) { + asm volatile("outl" " %" "0, %w1" + : : "a"(value), "Nd"(port)); +} + +unsigned int __inl(int port) +{ + unsigned int value; + asm volatile("inl" " %w1, %" "0" + : "=a"(value) : "Nd"(port)); + return value; +} + +#define outb __outb +#define outw __outw +#define outl __outl + +#define inb __inb +#define inw __inw +#define inl __inl + +#endif /* _ASM_X86_IO_H */ |