diff -burN 855resolution.orig/855resolution.c 855resolution/855resolution.c --- 855resolution.orig/855resolution.c 2005-05-08 21:46:02.000000000 +0200 +++ 855resolution/855resolution.c 2005-06-21 21:39:20.000000000 +0200 @@ -15,7 +15,13 @@ #include #include #include +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) +#include +#include +#define iopl(x) i386_iopl(x) +#else #include +#endif /* OpenBSD, NetBSD, FreeBSD */ #include "vbios.h" #include "plugin.h" diff -burN 855resolution.orig/Makefile 855resolution/Makefile --- 855resolution.orig/Makefile 2005-05-08 17:27:59.000000000 +0200 +++ 855resolution/Makefile 2005-06-21 23:58:38.000000000 +0200 @@ -7,12 +7,24 @@ SRCS=855resolution.c vbios.c plugin.c ${PLUGINS_SRCS} OBJS=${SRCS:.c=.o} -PLUGINS_LIST:=${shell cd plugins;ls -x *.c | sed -e 's/.c//g' -e 's/ */,/g' } -PLUGINS_ADDR:=${shell echo ${PLUGINS_LIST} | sed -e 's/^/\&/g' -e 's/,/,\&/g' } +PLUGINS_LIST:=${shell cd plugins;ls -x *.c | sed -e 's/.c//g' -e 's/ *$$//g' -e 's/ */,/g' } +PLUGINS_ADDR:=${shell echo ${PLUGINS_LIST} | sed -e 's/^/\&/g' -e 's/ *$$//g' -e 's/,/,\&/g' } VERSION:=${shell cat VERSION.txt} +OS:=${shell uname -s} +OS_V:=${shell uname -r | sed -e 's/.[^.].*$$//g'} LDLIBS:=-lm +ifeq (${OS},NetBSD) + LDLIBS:=$(LDLIBS) -li386 + ifeq (${OS_V},2) + SRCS:=$(SRCS) memmem.c + else + ifeq (${OS_V},1) + SRCS:=$(SRCS) memmem.c + endif + endif +endif -CFLAGS:=-Wall -I`pwd` -DVERSION='"${VERSION}"' -DPLUGINS='${PLUGINS_LIST}' -DREF_PLUGINS='${PLUGINS_ADDR}' ${VBIOS_FILE} +CFLAGS:=-Wall -I`pwd` -DVERSION='"${VERSION}"' -DPLUGINS='${PLUGINS_LIST}' -DREF_PLUGINS='${PLUGINS_ADDR}' -D__${OS}__ ${VBIOS_FILE} LDFLAGS:=-s all: ${PRG} diff -burN 855resolution.orig/memmem.c 855resolution/memmem.c --- 855resolution.orig/memmem.c 1970-01-01 01:00:00.000000000 +0100 +++ 855resolution/memmem.c 2005-06-22 00:04:10.000000000 +0200 @@ -0,0 +1,87 @@ +/* $NetBSD: memmem.c,v 1.1 2005/03/13 14:47:02 perry Exp $ */ + +/*- + * Copyright (c) 2005 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Perry E. Metzger of Metzger, Dowdeswell & Co. LLC. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: memmem.c,v 1.1 2005/03/13 14:47:02 perry Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#if !defined(_KERNEL) && !defined(_STANDALONE) +#include +#include +#else +#include +#define _DIAGASSERT(x) (void)0 +#define NULL ((void *)0) +#endif + +void * +memmem(const void *block, size_t blen, const void *pat, size_t plen) +{ + const unsigned char *bp, *pp, *endp; + + _DIAGASSERT(block != NULL); + _DIAGASSERT(pat != NULL); + + /* + * Following the precedent in ststr(3) and glibc, a zero + * length pattern matches the start of block. + */ + if (plen == 0) + return (void *)block; + + if (blen < plen) + return NULL; + + bp = block; + pp = pat; + endp = bp + (blen - plen) + 1; + + /* + * As a cheezy optimization, check that the first chars are + * the same before calling memcmp. Really we should use bm(3) + * to speed this up if blen is large enough. + */ + while (bp < endp) { + if ((*bp == *pp) && (memcmp(bp, pp, plen) == 0)) + return (void *)bp; + bp++; + } + + return NULL; +} diff -burN 855resolution.orig/plugins/plugin1.c 855resolution/plugins/plugin1.c --- 855resolution.orig/plugins/plugin1.c 2005-05-08 21:56:35.000000000 +0200 +++ 855resolution/plugins/plugin1.c 2005-06-21 21:34:57.000000000 +0200 @@ -12,7 +12,12 @@ */ #include +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) +/* NOT USED */ +// #include +#else #include +#endif /* OpenBSD, NetBSD, FreeBSD */ #include "../plugin.h" diff -burN 855resolution.orig/plugins/plugin2.c 855resolution/plugins/plugin2.c --- 855resolution.orig/plugins/plugin2.c 2005-05-08 21:55:57.000000000 +0200 +++ 855resolution/plugins/plugin2.c 2005-06-21 21:35:04.000000000 +0200 @@ -14,7 +14,12 @@ /* VBIOS as found on the Dell 510m */ #include +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) +/* NOT USED */ +// #include +#else #include +#endif /* OpenBSD, NetBSD, FreeBSD */ #include "../plugin.h" diff -burN 855resolution.orig/plugins/plugin3.c 855resolution/plugins/plugin3.c --- 855resolution.orig/plugins/plugin3.c 2005-05-08 21:55:55.000000000 +0200 +++ 855resolution/plugins/plugin3.c 2005-06-21 21:35:09.000000000 +0200 @@ -12,7 +12,12 @@ */ #include +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) +/* NOT USED */ +// #include +#else #include +#endif /* OpenBSD, NetBSD, FreeBSD */ #include "../plugin.h" diff -burN 855resolution.orig/vbios.c 855resolution/vbios.c --- 855resolution.orig/vbios.c 2005-05-08 21:47:08.000000000 +0200 +++ 855resolution/vbios.c 2005-06-21 21:29:43.000000000 +0200 @@ -18,7 +18,15 @@ #include #include #include +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) +#include +#define WRITE_OUTL(data, port) outl(port, data) +#define WRITE_OUTB(data, port) outb(port, data) +#else #include +#define WRITE_OUTL(data, port) outl(data, port) +#define WRITE_OUTB(data, port) outb(data, port) +#endif /* OpenBSD, NetBSD, FreeBSD */ #include "vbios.h" @@ -40,7 +48,7 @@ static unsigned char b1, b2; static unsigned int get_chipset(void) { - outl(0x80000000, 0xcf8); + WRITE_OUTL(0x80000000, 0xcf8); return inl(0xcfc); } @@ -75,35 +83,35 @@ void unlock_bios(void) { if(get_chipset() == CHIPSET_855) { - outl(0x8000005a, 0xcf8); + WRITE_OUTL(0x8000005a, 0xcf8); b1 = inb(0xcfe); - outl(0x8000005a, 0xcf8); - outb(0x33, 0xcfe); + WRITE_OUTL(0x8000005a, 0xcf8); + WRITE_OUTB(0x33, 0xcfe); } else { - outl(0x80000090, 0xcf8); + WRITE_OUTL(0x80000090, 0xcf8); b1 = inb(0xcfd); b2 = inb(0xcfe); - outl(0x80000090, 0xcf8); - outb(0x33, 0xcfd); - outb(0x33, 0xcfe); + WRITE_OUTL(0x80000090, 0xcf8); + WRITE_OUTB(0x33, 0xcfd); + WRITE_OUTB(0x33, 0xcfe); } } void relock_bios(void) { if(get_chipset() == CHIPSET_855) { - outl(0x8000005a, 0xcf8); - outb(b1, 0xcfe); + WRITE_OUTL(0x8000005a, 0xcf8); + WRITE_OUTB(b1, 0xcfe); } else { - outl(0x80000090, 0xcf8); - outb(b1, 0xcfd); - outb(b2, 0xcfe); + WRITE_OUTL(0x80000090, 0xcf8); + WRITE_OUTB(b1, 0xcfd); + WRITE_OUTB(b2, 0xcfe); } }