aboutsummaryrefslogtreecommitdiffstats
path: root/emulators
diff options
context:
space:
mode:
authornox <nox@FreeBSD.org>2013-06-26 04:32:57 +0800
committernox <nox@FreeBSD.org>2013-06-26 04:32:57 +0800
commitcfd93aeb869403bcb3b6922034175cbf201975b7 (patch)
treed236aa3a51fbf07d4ae9b7e84e9c16847d3f2a20 /emulators
parent0f03788ae548b497c22eaa363f284b7bb9eea851 (diff)
downloadfreebsd-ports-gnome-cfd93aeb869403bcb3b6922034175cbf201975b7.tar.gz
freebsd-ports-gnome-cfd93aeb869403bcb3b6922034175cbf201975b7.tar.zst
freebsd-ports-gnome-cfd93aeb869403bcb3b6922034175cbf201975b7.zip
- Switch to new header style. [1]
- Add LICENSE. [1] - Remove 7.x bug workarounds, FreeBSD 7 is no more supported. [1] - Respect ${CC} instead of using 'gcc'. [1] - Switch to optionsng. [1] - Fix build with gcc46 (it doesn't like -fformat-extensions in CWARNFLAGS.) - Sync kqemu-kmod with these -devel updates. PR: ports/179952 [1] Submitted by: r4721@tormail.org
Diffstat (limited to 'emulators')
-rw-r--r--emulators/kqemu-kmod-devel/Makefile36
-rw-r--r--emulators/kqemu-kmod-devel/files/patch-tssworkaround112
-rw-r--r--emulators/kqemu-kmod/Makefile41
-rw-r--r--emulators/kqemu-kmod/files/patch-tssworkaround112
4 files changed, 22 insertions, 279 deletions
diff --git a/emulators/kqemu-kmod-devel/Makefile b/emulators/kqemu-kmod-devel/Makefile
index 0e06283b79f6..359b1508c590 100644
--- a/emulators/kqemu-kmod-devel/Makefile
+++ b/emulators/kqemu-kmod-devel/Makefile
@@ -1,9 +1,5 @@
-# New ports collection makefile for: kqemu-kmod
-# Date created: 2005/10/25
-# Whom: nork@FreeBSD.org
-#
+# Created by: nork@FreeBSD.org
# $FreeBSD$
-#
PORTNAME= kqemu
PORTVERSION= 1.4.0.p1
@@ -20,6 +16,9 @@ DIST_SUBDIR= kqemu
MAINTAINER= nox@FreeBSD.org
COMMENT= Kernel Accelerator for QEMU CPU Emulator (development version)
+LICENSE= GPLv2
+LICENSE_FILE= ${WRKSRC}/COPYING
+
ONLY_FOR_ARCHS= i386 amd64
HAS_CONFIGURE= yes
USE_GMAKE= yes
@@ -37,6 +36,7 @@ PLIST_FILES+= "@dirrm include/kqemu"
PLIST_FILES+= "@cwd /"
PLIST_FILES+= ${KMODDIR:C,^/,,}/kqemu.ko
PLIST_FILES+= "@unexec kldxref ${KMODDIR}"
+PLIST_FILES+= "@cwd"
MAKEFILE= Makefile.freebsd
@@ -56,28 +56,9 @@ MAKE_ENV+= SYSDIR="${SYSDIR}"
IGNORE= requires kernel source to be installed
.endif
-.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
-# XXX this is wrong if you have `nooption KSE' in your kernel config,
-# please define NOKSE in that case (no longer a problem after attilio's
-# Sun Jul 22 21:35:44 2007 UTC commit removing the KSE ABI incompatiblity)
-CFLAGS+= -DKSE
-.endif
-
-CFLAGS+= ${DEBUG_FLAGS}
+CFLAGS+= ${DEBUG_FLAGS}
-post-extract:
-.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
- @${ECHO_MSG} "Compiling with -DKSE."
- @${ECHO_MSG} "If this is wrong (i.e. you have \`nooption KSE' in your kernel config),"
- @${ECHO_MSG} "then please define NOKSE."
-.endif
-
-# 7.1 and head have seperate gdts also on amd64 now so the tss fixup code
-# is no longer needed there
post-patch:
-.if ${OSVERSION} >= 701100 && (${OSVERSION} < 800000 || ${OSVERSION} >= 800046)
- @cd ${WRKSRC} && ${PATCH} -R --quiet < ${FILESDIR}/patch-tssworkaround
-.endif
# Apply extra patches from the qemu-devel list; in the unlikely case that
# these cause regressions please define WITHOUT_EXTRA_PATCHES and post
# details about your host _and_ guest on freebsd-emulation@freebsd.org
@@ -87,17 +68,18 @@ post-patch:
${PATCH} -d ${WRKSRC} --quiet <$$i;\
done
.endif
+ @${REINPLACE_CMD} -e '/CC=/s,gcc,${CC},' ${WRKSRC}/common/Makefile
do-build:
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} beforedepend && ${LN} -sfh @/sys sys)
@(cd ${BUILD_WRKSRC}/common; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} Makefile ${MAKE_ARGS} ${ALL_TARGET})
- @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
+ @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} CWARNFLAGS=-Wall ${ALL_TARGET})
do-install:
@(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
${MKDIR} ${PREFIX}/include/kqemu
${INSTALL_DATA} ${WRKSRC}/kqemu.h ${PREFIX}/include/kqemu
-.if !defined(NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/kqemu-doc.html ${WRKSRC}/kqemu-tech.html \
${DOCSDIR}
diff --git a/emulators/kqemu-kmod-devel/files/patch-tssworkaround b/emulators/kqemu-kmod-devel/files/patch-tssworkaround
deleted file mode 100644
index 922342bb7781..000000000000
--- a/emulators/kqemu-kmod-devel/files/patch-tssworkaround
+++ /dev/null
@@ -1,112 +0,0 @@
-Index: kqemu-freebsd.c
-@@ -38,6 +38,14 @@
- #else
- #include <machine/npx.h>
- #endif
-+#ifdef __x86_64__
-+#include <sys/smp.h>
-+#include <sys/pcpu.h>
-+#include <machine/pcb.h>
-+#include <machine/specialreg.h>
-+#include <machine/segments.h>
-+#include <machine/tss.h>
-+#endif
-
- #include "kqemu-kernel.h"
-
-@@ -248,6 +256,57 @@
- va_end(ap);
- }
-
-+#ifdef __x86_64__
-+int kqemu_cpu0gdtfixed;
-+int kqemu_gdts_used;
-+struct user_segment_descriptor *kqemu_gdts;
-+struct region_descriptor kqemu_r_newgdt;
-+extern struct pcpu __pcpu[];
-+
-+/* called with interrupts disabled */
-+void CDECL kqemu_tss_fixup(unsigned long kerngdtbase)
-+{
-+ int gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
-+ unsigned cpuid = PCPU_GET(cpuid);
-+ struct user_segment_descriptor *newgdt = gdt;
-+
-+ if (mp_ncpus <= 1 || kerngdtbase != (unsigned long)gdt)
-+ /* UP host or gdt already moved, nothing to do */
-+ return;
-+ if (cpuid) {
-+ /* move gdts of all but first cpu */
-+ if (!kqemu_gdts)
-+ /*
-+ * XXX gdt is allocated as
-+ * struct user_segment_descriptor gdt[NGDT * MAXCPU];
-+ * so it has room for the moved copies; need to allocate at
-+ * kldload (and only free if kqemu_gdts_used is zero) should this
-+ * change in the future
-+ */
-+ kqemu_gdts = &gdt[NGDT];
-+ ++kqemu_gdts_used;
-+ newgdt = &kqemu_gdts[NGDT * (cpuid - 1)];
-+ bcopy(gdt, newgdt, NGDT * sizeof(gdt[0]));
-+ kqemu_r_newgdt.rd_limit = NGDT * sizeof(gdt[0]) - 1;
-+ kqemu_r_newgdt.rd_base = (long) newgdt;
-+ } else {
-+ if (kqemu_cpu0gdtfixed)
-+ return;
-+ ++kqemu_cpu0gdtfixed;
-+ }
-+ gdt_segs[GPROC0_SEL].ssd_base = (long) &common_tss[cpuid];
-+ ssdtosyssd(&gdt_segs[GPROC0_SEL],
-+ (struct system_segment_descriptor *)&newgdt[GPROC0_SEL]);
-+ if (cpuid) {
-+ lgdt(&kqemu_r_newgdt);
-+ wrmsr(MSR_GSBASE, (u_int64_t)&__pcpu[cpuid]);
-+ wrmsr(MSR_KGSBASE, curthread->td_pcb->pcb_gsbase);
-+ wrmsr(MSR_FSBASE, curthread->td_pcb->pcb_fsbase);
-+ }
-+ ltr(gsel_tss);
-+}
-+#endif
-+
- struct kqemu_instance {
- #if __FreeBSD_version >= 500000
- TAILQ_ENTRY(kqemu_instance) kqemu_ent;
-Index: common/kernel.c
-@@ -1025,6 +1025,9 @@
- #ifdef __x86_64__
- uint16_t saved_ds, saved_es;
- unsigned long fs_base, gs_base;
-+#ifdef __FreeBSD__
-+ struct kqemu_global_state *g = s->global_state;
-+#endif
- #endif
-
- #ifdef PROFILE
-@@ -1096,6 +1099,14 @@
- apic_nmi_mask = apic_save_and_disable_nmi(s);
- }
-
-+#ifdef __FreeBSD__
-+#ifdef __x86_64__
-+ spin_lock(&g->lock);
-+ asm volatile ("sgdt %0" : : "m" (s->kernel_gdt));
-+ kqemu_tss_fixup(s->kernel_gdt.base);
-+ spin_unlock(&g->lock);
-+#endif
-+#endif
- /* load breakpoint registers and avoid setting them if in the
- monitor address space. We suppose that no breakpoints are
- set by the host OS for this process */
-Index: kqemu-kernel.h
-@@ -48,4 +48,10 @@
-
- void CDECL kqemu_log(const char *fmt, ...);
-
-+#ifdef __FreeBSD__
-+#ifdef __x86_64__
-+void CDECL kqemu_tss_fixup(unsigned long kerngdtbase);
-+#endif
-+#endif
-+
- #endif /* KQEMU_KERNEL_H */
diff --git a/emulators/kqemu-kmod/Makefile b/emulators/kqemu-kmod/Makefile
index 18379c7ee16a..48929f93ccdf 100644
--- a/emulators/kqemu-kmod/Makefile
+++ b/emulators/kqemu-kmod/Makefile
@@ -1,9 +1,5 @@
-# New ports collection makefile for: kqemu-kmod
-# Date created: 2005/10/25
-# Whom: nork@FreeBSD.org
-#
+# Created by: nork@FreeBSD.org
# $FreeBSD$
-#
PORTNAME= kqemu
PORTVERSION= 1.3.0.p11
@@ -20,6 +16,9 @@ DIST_SUBDIR= kqemu
MAINTAINER= nox@FreeBSD.org
COMMENT= Kernel Accelerator for QEMU CPU Emulator
+LICENSE= GPLv2
+LICENSE_FILE= ${WRKSRC}/COPYING
+
ONLY_FOR_ARCHS= i386 amd64
HAS_CONFIGURE= yes
USE_GMAKE= yes
@@ -37,6 +36,7 @@ PLIST_FILES+= "@dirrm include/kqemu"
PLIST_FILES+= "@cwd /"
PLIST_FILES+= ${KMODDIR:C,^/,,}/kqemu.ko
PLIST_FILES+= "@unexec kldxref ${KMODDIR}"
+PLIST_FILES+= "@cwd"
MAKEFILE= Makefile.freebsd
@@ -49,43 +49,28 @@ KMODDIR= /boot/modules
MAKE_ENV+= KMODDIR="${KMODDIR}"
-.if !exists(${SRC_BASE}/sys/Makefile)
-IGNORE= requires kernel source to be installed
-.endif
+SYSDIR?= ${SRC_BASE}/sys
+MAKE_ENV+= SYSDIR="${SYSDIR}"
-.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
-# XXX this is wrong if you have `nooption KSE' in your kernel config,
-# please define NOKSE in that case (no longer a problem after attilio's
-# Sun Jul 22 21:35:44 2007 UTC commit removing the KSE ABI incompatiblity)
-CFLAGS+= -DKSE
+.if !exists(${SYSDIR}/Makefile)
+IGNORE= requires kernel source to be installed
.endif
-CFLAGS+= ${DEBUG_FLAGS}
+CFLAGS+= ${DEBUG_FLAGS}
-post-extract:
-.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
- @${ECHO_MSG} "Compiling with -DKSE."
- @${ECHO_MSG} "If this is wrong (i.e. you have \`nooption KSE' in your kernel config),"
- @${ECHO_MSG} "then please define NOKSE."
-.endif
-
-# 7.1 and head have seperate gdts also on amd64 now so the tss fixup code
-# is no longer needed there
post-patch:
-.if ${OSVERSION} >= 701100 && (${OSVERSION} < 800000 || ${OSVERSION} >= 800046)
- @cd ${WRKSRC} && ${PATCH} -R --quiet < ${FILESDIR}/patch-tssworkaround
-.endif
+ @${REINPLACE_CMD} -e '/CC=/s,gcc,${CC},' ${WRKSRC}/common/Makefile
do-build:
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} beforedepend && ${LN} -sfh @/sys sys)
@(cd ${BUILD_WRKSRC}/common; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} Makefile ${MAKE_ARGS} ${ALL_TARGET})
- @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
+ @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} CWARNFLAGS=-Wall ${ALL_TARGET})
do-install:
@(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
${MKDIR} ${PREFIX}/include/kqemu
${INSTALL_DATA} ${WRKSRC}/kqemu.h ${PREFIX}/include/kqemu
-.if !defined(NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/kqemu-doc.html ${WRKSRC}/kqemu-tech.html \
${DOCSDIR}
diff --git a/emulators/kqemu-kmod/files/patch-tssworkaround b/emulators/kqemu-kmod/files/patch-tssworkaround
deleted file mode 100644
index 922342bb7781..000000000000
--- a/emulators/kqemu-kmod/files/patch-tssworkaround
+++ /dev/null
@@ -1,112 +0,0 @@
-Index: kqemu-freebsd.c
-@@ -38,6 +38,14 @@
- #else
- #include <machine/npx.h>
- #endif
-+#ifdef __x86_64__
-+#include <sys/smp.h>
-+#include <sys/pcpu.h>
-+#include <machine/pcb.h>
-+#include <machine/specialreg.h>
-+#include <machine/segments.h>
-+#include <machine/tss.h>
-+#endif
-
- #include "kqemu-kernel.h"
-
-@@ -248,6 +256,57 @@
- va_end(ap);
- }
-
-+#ifdef __x86_64__
-+int kqemu_cpu0gdtfixed;
-+int kqemu_gdts_used;
-+struct user_segment_descriptor *kqemu_gdts;
-+struct region_descriptor kqemu_r_newgdt;
-+extern struct pcpu __pcpu[];
-+
-+/* called with interrupts disabled */
-+void CDECL kqemu_tss_fixup(unsigned long kerngdtbase)
-+{
-+ int gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
-+ unsigned cpuid = PCPU_GET(cpuid);
-+ struct user_segment_descriptor *newgdt = gdt;
-+
-+ if (mp_ncpus <= 1 || kerngdtbase != (unsigned long)gdt)
-+ /* UP host or gdt already moved, nothing to do */
-+ return;
-+ if (cpuid) {
-+ /* move gdts of all but first cpu */
-+ if (!kqemu_gdts)
-+ /*
-+ * XXX gdt is allocated as
-+ * struct user_segment_descriptor gdt[NGDT * MAXCPU];
-+ * so it has room for the moved copies; need to allocate at
-+ * kldload (and only free if kqemu_gdts_used is zero) should this
-+ * change in the future
-+ */
-+ kqemu_gdts = &gdt[NGDT];
-+ ++kqemu_gdts_used;
-+ newgdt = &kqemu_gdts[NGDT * (cpuid - 1)];
-+ bcopy(gdt, newgdt, NGDT * sizeof(gdt[0]));
-+ kqemu_r_newgdt.rd_limit = NGDT * sizeof(gdt[0]) - 1;
-+ kqemu_r_newgdt.rd_base = (long) newgdt;
-+ } else {
-+ if (kqemu_cpu0gdtfixed)
-+ return;
-+ ++kqemu_cpu0gdtfixed;
-+ }
-+ gdt_segs[GPROC0_SEL].ssd_base = (long) &common_tss[cpuid];
-+ ssdtosyssd(&gdt_segs[GPROC0_SEL],
-+ (struct system_segment_descriptor *)&newgdt[GPROC0_SEL]);
-+ if (cpuid) {
-+ lgdt(&kqemu_r_newgdt);
-+ wrmsr(MSR_GSBASE, (u_int64_t)&__pcpu[cpuid]);
-+ wrmsr(MSR_KGSBASE, curthread->td_pcb->pcb_gsbase);
-+ wrmsr(MSR_FSBASE, curthread->td_pcb->pcb_fsbase);
-+ }
-+ ltr(gsel_tss);
-+}
-+#endif
-+
- struct kqemu_instance {
- #if __FreeBSD_version >= 500000
- TAILQ_ENTRY(kqemu_instance) kqemu_ent;
-Index: common/kernel.c
-@@ -1025,6 +1025,9 @@
- #ifdef __x86_64__
- uint16_t saved_ds, saved_es;
- unsigned long fs_base, gs_base;
-+#ifdef __FreeBSD__
-+ struct kqemu_global_state *g = s->global_state;
-+#endif
- #endif
-
- #ifdef PROFILE
-@@ -1096,6 +1099,14 @@
- apic_nmi_mask = apic_save_and_disable_nmi(s);
- }
-
-+#ifdef __FreeBSD__
-+#ifdef __x86_64__
-+ spin_lock(&g->lock);
-+ asm volatile ("sgdt %0" : : "m" (s->kernel_gdt));
-+ kqemu_tss_fixup(s->kernel_gdt.base);
-+ spin_unlock(&g->lock);
-+#endif
-+#endif
- /* load breakpoint registers and avoid setting them if in the
- monitor address space. We suppose that no breakpoints are
- set by the host OS for this process */
-Index: kqemu-kernel.h
-@@ -48,4 +48,10 @@
-
- void CDECL kqemu_log(const char *fmt, ...);
-
-+#ifdef __FreeBSD__
-+#ifdef __x86_64__
-+void CDECL kqemu_tss_fixup(unsigned long kerngdtbase);
-+#endif
-+#endif
-+
- #endif /* KQEMU_KERNEL_H */