Fix build on DragonFly and FreeBSD, by Alexander Polakov in PR 43487.

Enable on FreeBSD-*-i386 FreeBSD-*-x86_64 DragonFly-*-i386.
This commit is contained in:
wiz 2010-06-20 11:06:03 +00:00
parent ef3ef15dc8
commit 1c50480398
3 changed files with 20 additions and 7 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.4 2009/08/19 08:41:45 ghen Exp $
# $NetBSD: Makefile,v 1.5 2010/06/20 11:06:03 wiz Exp $
#
DISTNAME= 915resolution-0.5.3
@ -12,6 +12,7 @@ COMMENT= BIOS VESA resolution utility for 8XX/9XX Intel chips
PKG_DESTDIR_SUPPORT= user-destdir
ONLY_FOR_PLATFORM= NetBSD-*-i386 NetBSD-*-x86_64 Linux-*-i386
ONLY_FOR_PLATFORM+= FreeBSD-*-i386 FreeBSD-*-x86_64 DragonFly-*-i386
USE_TOOLS+= gmake

View file

@ -1,7 +1,7 @@
$NetBSD: distinfo,v 1.4 2009/08/19 08:41:45 ghen Exp $
$NetBSD: distinfo,v 1.5 2010/06/20 11:06:03 wiz Exp $
SHA1 (915resolution-0.5.3.tar.gz) = 377a32d33f1987adf372341c8c6664d5673da9b8
RMD160 (915resolution-0.5.3.tar.gz) = a406c6810bbfcf94c5352ea1b1e9178af4078589
Size (915resolution-0.5.3.tar.gz) = 22583 bytes
SHA1 (patch-aa) = a37e71ef741cc5c981376db8bcc1eff60c32e2db
SHA1 (patch-aa) = 63c4cb0a697e18c29129fd1fab6cde8844e69108
SHA1 (patch-ab) = 5e6a865e4f0707390bf0c602aed9f7fc3c2284b4

View file

@ -1,6 +1,6 @@
$NetBSD: patch-aa,v 1.3 2008/08/25 15:11:47 joerg Exp $
$NetBSD: patch-aa,v 1.4 2010/06/20 11:06:03 wiz Exp $
--- 915resolution.c.orig 2006-02-02 15:28:34.000000000 +0100
--- 915resolution.c.orig 2007-04-15 10:46:56.000000000 +0000
+++ 915resolution.c
@@ -22,11 +22,57 @@
#include <string.h>
@ -21,7 +21,6 @@ $NetBSD: patch-aa,v 1.3 2008/08/25 15:11:47 joerg Exp $
#include <unistd.h>
#include <assert.h>
-
+static uint8_t
+asm_inb(unsigned port)
+{
@ -43,7 +42,7 @@ $NetBSD: patch-aa,v 1.3 2008/08/25 15:11:47 joerg Exp $
+ __asm volatile("inl %w1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+
+static __inline void
+asm_outl(uint32_t data, unsigned port)
+{
@ -61,3 +60,16 @@ $NetBSD: patch-aa,v 1.3 2008/08/25 15:11:47 joerg Exp $
#define NEW(a) ((a *)(calloc(1, sizeof(a))))
#define FREE(a) (free(a))
@@ -165,7 +211,12 @@ typedef struct {
void initialize_system(char * filename) {
if (!filename) {
+#if !defined(__FreeBSD__) & !defined(__DragonFly__)
if (iopl(3) < 0) {
+#else
+ FILE *iof = fopen("/dev/io", "r");
+ if(iof == NULL) {
+#endif
perror("Unable to obtain the proper IO permissions");
exit(2);
}