1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-19 19:59:43 +00:00

Remove kqemu-kmod{,-devel}

The are broken on recent FreeBSD, they are not supported by any qemu version,
they do not build with recent binutils (2.27)
This commit is contained in:
Baptiste Daroussin 2016-08-26 12:21:39 +00:00
parent 173dbe03ec
commit 5cc0ee357b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=420913
35 changed files with 2 additions and 1410 deletions

2
MOVED
View File

@ -8619,3 +8619,5 @@ www/pecl-APC||2016-08-15|No longer maintained upstream, and not working with PHP
textproc/libtext-wrapi18n-perl|textproc/p5-Text-WrapI18N|2016-08-15|Duplicate
textproc/libtext-charwidth-perl|textproc/p5-Text-CharWidth|2016-08-15|Duplicate
net-mgmt/netams||2016-08-18|Has expired: unmaintained, broken on most FreeBSD platforms
emulators/kqemu-kmod||2016-08-26|Not supported in any qemu version anymore
emulators/kqemu-kmod-devel||2016-08-26|Not supported in any qemu version anymore

View File

@ -64,8 +64,6 @@
SUBDIR += jzintv
SUBDIR += kcemu
SUBDIR += klh10
SUBDIR += kqemu-kmod
SUBDIR += kqemu-kmod-devel
SUBDIR += lib765
SUBDIR += libdsk
SUBDIR += libspectrum

View File

@ -1,75 +0,0 @@
# Created by: nork@FreeBSD.org
# $FreeBSD$
PORTNAME= kqemu
DISTVERSION= 1.4.0pre1
PORTREVISION= 5
CATEGORIES= emulators
MASTER_SITES= http://bellard.org/qemu/ \
http://qemu.org/ \
LOCAL/nox
PKGNAMESUFFIX= -kmod-devel
DIST_SUBDIR= kqemu
MAINTAINER= ports@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_GCC= any
CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC}
CONFLICTS= kqemu-kmod-[0-9]*
USE_RC_SUBR= kqemu
USES= kmod gmake uidfix
OPTIONS_DEFINE= DOCS
.include <bsd.port.pre.mk>
PORTDOCS= kqemu-doc.html kqemu-tech.html
PLIST_FILES= "include/kqemu/kqemu.h"
PLIST_FILES+= ${KMODDIR}/kqemu.ko
MAKEFILE= Makefile.freebsd
MAKE_ARGS+= LDFLAGS="${LDFLAGS:S/^-Wl,//}"
.if ${ARCH} == "amd64"
MAKE_CMD_ARGS+= ARCH=x86_64
.endif
CFLAGS+= ${DEBUG_FLAGS}
post-patch:
# 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
# - Thanx!
.if !defined(WITHOUT_EXTRA_PATCHES)
for i in ${FILESDIR}/extra-patch-*; do \
${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 machine/../../sys sys)
@(cd ${BUILD_WRKSRC}/common; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_FLAGS} Makefile ${MAKE_CMD_ARGS} ${ALL_TARGET})
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
do-install:
@(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} DESTDIR=${STAGEDIR} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
${MKDIR} ${STAGEDIR}${PREFIX}/include/kqemu
${INSTALL_DATA} ${WRKSRC}/kqemu.h ${STAGEDIR}${PREFIX}/include/kqemu
do-install-DOCS-on:
${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/kqemu-doc.html ${WRKSRC}/kqemu-tech.html \
${STAGEDIR}${DOCSDIR}
.include <bsd.port.post.mk>

View File

@ -1,2 +0,0 @@
SHA256 (kqemu/kqemu-1.4.0pre1.tar.gz) = bac3e84eae1c867b06cd06ed2bcf563ba8304bd4e5a900880c2abe61b9aab491
SIZE (kqemu/kqemu-1.4.0pre1.tar.gz) = 168249

View File

@ -1,70 +0,0 @@
From: 3n4ch3@gmail.com (Enache Adrian)
Subject: [Qemu-devel] [kqemu patch] get Open/NetBSD to work with the kqemu
accelerator
Date: Mon, 5 Nov 2007 22:00:12 +0200
Message-ID: <281a8e2bec2c45bce8b89bf96457995c.fa6dd951@aerenchyma>
To: qemu-devel@nongnu.org
[sorry if this is the wrong list, but I haven't figured out any public
address where I could send kqemu bug reports and patches]
Currently, both NetBSD and OpenBSD are hanging or crashing when running
on qemu with the kqemu accelerator enabled.
This happens because both systems are using a weird scheme where they
are loading the GDT table with LGDT up-front (with the limit set to
the maximum), but are growing the table and actually mapping the memory
behind it only when needed.
(see src/sys/arch/i386/i386/gdt.c in both source trees)
That is causing the kqemu accelerator to generate a page fault in
update_dt_cache() when trying to fill its 'soft' tlb with pages that
are beyond the real end of the GDT table.
With this diff applied, NetBSD and OpenBSD seem to run fine with
kqemu + user-only virtualization (I've tried netbsd-4.0-rc2 and
openbsd 4.2).
Full virtualization (-kernel-kqemu) doesn't work yet for different
reasons (I think).
Regards,
Adi
Index: common/monitor.c
--- common/monitor.c Tue Feb 6 23:02:00 2007
+++ common/monitor.c Mon Nov 5 18:59:58 2007
@@ -990,7 +990,8 @@ static void *map_vaddr(struct kqemu_state *s, unsigned
e = &s->soft_tlb[(addr >> PAGE_SHIFT) & (SOFT_TLB_SIZE - 1)];
redo:
if (e->vaddr[(is_user << 1) + is_write] != (addr & PAGE_MASK)) {
- soft_tlb_fill(s, addr, is_write, is_user);
+ if(cpu_x86_handle_mmu_fault(s, addr, is_write, is_user, 1))
+ return NULL;
goto redo;
} else {
taddr = e->addend + addr;
@@ -1802,6 +1803,11 @@ static void update_dt_cache(struct kqemu_state *s, int
page_end = dt_end;
sel2 = sel + (page_end - dt_ptr);
ptr = map_vaddr(s, dt_ptr, 0, 0);
+ if(!ptr)
+ /* Open/NetBSD have a 'dynamic' GDT, but they load the gdt
+ register with LGDT only once and with a limit far beyond
+ the end of the memory actually mapped for the table */
+ goto skip_the_rest;
ram_addr = ram_ptr_to_ram_addr(s, ptr);
if (dt_changed ||
s->dt_ram_addr[dt_type][pindex] != ram_addr ||
@@ -1818,7 +1824,7 @@ static void update_dt_cache(struct kqemu_state *s, int
sel_end = (s->dt_limit[dt_type] + 1) & ~7;
if (sel < sel_end)
reset_dt_entries(s, dt_type, sel, sel_end);
-
+skip_the_rest:
s->dt_base[dt_type] = base;
s->dt_limit[dt_type] = limit;
}

View File

@ -1,51 +0,0 @@
From: jan.kiszka@siemens.com (Jan Kiszka)
Subject: [Qemu-devel] [PATCH 1/5] kqemu: x86-64: Run 16-bit-stack-return in
ring 0
Date: Fri, 29 May 2009 19:18:31 +0200
Message-ID: <20090529171831.14265.89986.stgit@mchn012c.ww002.siemens.net>
To: qemu-devel@nongnu.org
The fix-up code for returning to 16 bit stack segments is currently
executed in ring 1. This has the side effect that the interrupt flag
remains cleared on return from ring 1 to the guest's ring 3 as its
IOPL is 0 (ie. iret can only modify IF when run in ring 0).
Fix this by moving the 32 bit return trampoline into ring 0.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
common/kernel.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git common/kernel.c common/kernel.c
index 6a88452..1d7a69e 100644
Index: common/kernel.c
--- common/kernel.c
+++ common/kernel.c
@@ -422,8 +422,8 @@ struct kqemu_state *kqemu_init(struct kqemu_init *d,
#ifdef __x86_64__
s->monitor_ds_sel = 0; /* no need for a specific data segment */
/* used for 16 bit esp fix */
- s->monitor_cs32_sel = (s->monitor_selector_base + (7 << 3)) | 1;
- s->monitor_ss16_sel = (s->monitor_selector_base + (6 << 3)) | 1;
+ s->monitor_cs32_sel = s->monitor_selector_base + (7 << 3);
+ s->monitor_ss16_sel = s->monitor_selector_base + (6 << 3);
s->monitor_ss_null_sel = (s->monitor_selector_base + (1 << 3)) | 3;
#else
s->monitor_ds_sel = s->monitor_selector_base + (1 << 3);
@@ -495,9 +495,9 @@ struct kqemu_state *kqemu_init(struct kqemu_init *d,
0, 0xfffff, 0xa09a); /* long mode segment */
set_seg((uint32_t *)(dt_table + (s->monitor_ss16_sel >> 3)),
(s->monitor_data_vaddr + offsetof(struct kqemu_state, stack)) & ~0xffff,
- 0xffff, 0x00b2); /* SS16 segment for 16 bit ESP fix */
+ 0xffff, 0x0092); /* SS16 segment for 16 bit ESP fix */
set_seg((uint32_t *)(dt_table + (s->monitor_cs32_sel >> 3)),
- 0, 0xfffff, 0xc0ba); /* CS32 segment for 16 bit ESP fix */
+ 0, 0xfffff, 0xc09a); /* CS32 segment for 16 bit ESP fix */
set_seg((uint32_t *)(dt_table + (s->monitor_ss_null_sel >> 3)),
0, 0, 0x40f2); /* substitute for null SS segment */
#else

View File

@ -1,102 +0,0 @@
From: jan.kiszka@siemens.com (Jan Kiszka)
Subject: [Qemu-devel] [PATCH 2/5] kqemu: i386: Reorder DS and ES on
exception stack
Date: Fri, 29 May 2009 19:18:31 +0200
Message-ID: <20090529171831.14265.74474.stgit@mchn012c.ww002.siemens.net>
To: qemu-devel@nongnu.org
This is a KQEMU upstream bug: In case the non-trivial paths of
LOAD_SEG_CACHE in exception_return are taken for both DS and ES, the
current code will break as it assumes to read from the monitor's DS in
the restore code for ES. Fix this by swapping both segments on the stack
so that ES is always restored before DS.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
common/i386/monitor_asm.S | 16 ++++++++--------
common/kqemu_int.h | 6 +++---
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git common/i386/monitor_asm.S b/common/i386/monitor_asm.S
index 04f4258..e996553 100644
Index: common/i386/monitor_asm.S
--- common/i386/monitor_asm.S
+++ common/i386/monitor_asm.S
@@ -214,8 +214,8 @@ __monitor_exception:
pushl %edx
pushl %ecx
pushl %eax
- pushl %es
pushl %ds
+ pushl %es
/* compute the address of the monitor context */
call 1f
@@ -260,17 +260,17 @@ exception_return:
cmpb $3, KQEMU_STATE_cpu_state_cpl(%ebx)
je normal_seg_load
popl %eax
- LOAD_SEG_CACHE(%ds, R_DS, (11 * 4))
+ LOAD_SEG_CACHE(%es, R_ES, (11 * 4))
popl %eax
- LOAD_SEG_CACHE(%es, R_ES, (10 * 4))
+ LOAD_SEG_CACHE(%ds, R_DS, (10 * 4))
jmp 2f
normal_seg_load:
#endif
1:
- popl %ds
+ popl %es
SEG_EXCEPTION(1b)
1:
- popl %es
+ popl %ds
SEG_EXCEPTION(1b)
2:
@@ -295,10 +295,10 @@ SEG_EXCEPTION(1b)
exception_return_to_monitor:
1:
- popl %ds
+ popl %es
SEG_EXCEPTION(1b)
1:
- popl %es
+ popl %ds
SEG_EXCEPTION(1b)
popl %eax
popl %ecx
@@ -363,8 +363,8 @@ __monitor_interrupt:
pushl %edx
pushl %ecx
pushl %eax
- pushl %es
pushl %ds
+ pushl %es
/* compute the address of the monitor context */
call 1f
diff --git common/kqemu_int.h common/kqemu_int.h
index f19f7ca..4b59cb3 100644
Index: common/kqemu_int.h
--- common/kqemu_int.h
+++ common/kqemu_int.h
@@ -367,10 +367,10 @@ struct kqemu_exception_regs {
};
#else
struct kqemu_exception_regs {
- uint16_t ds_sel; /* 0 */
- uint16_t ds_sel_h;
- uint16_t es_sel; /* 1 */
+ uint16_t es_sel; /* 0 */
uint16_t es_sel_h;
+ uint16_t ds_sel; /* 1 */
+ uint16_t ds_sel_h;
uint32_t eax; /* 2 */
uint32_t ecx;
uint32_t edx;

View File

@ -1,38 +0,0 @@
From: jan.kiszka@siemens.com (Jan Kiszka)
Subject: [Qemu-devel] [PATCH 3/5] kqemu: Fix forbidden selector range change
Date: Fri, 29 May 2009 19:18:31 +0200
Message-ID: <20090529171831.14265.66049.stgit@mchn012c.ww002.siemens.net>
To: qemu-devel@nongnu.org
Do not bail out on LDT selectors that match the reserved monitor GDT
selector range. At this chance, improve the related panic message.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
common/interp.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git common/interp.c b/common/interp.c
index 088d2b2..4c042e9 100644
Index: common/interp.c
--- common/interp.c
+++ common/interp.c
@@ -775,9 +775,12 @@ static void load_seg_desc(struct kqemu_state *s,
#ifdef DEBUG_SEG
monitor_log(s, "load_seg_desc: reg=%d sel=0x%04x\n", seg_reg, selector);
#endif
- if (selector >= s->monitor_selector_base &&
+ if (!(selector & 0x4) && selector >= s->monitor_selector_base &&
selector <= (s->monitor_selector_base + MONITOR_SEL_RANGE)) {
- monitor_panic(s, "Trying to load a reserved selector\n");
+ monitor_panic(s, "Trying to load a reserved selector "
+ "(reg=%d sel=0x%04x cs:ip=%04x:" FMT_lx ")\n",
+ seg_reg, selector, env->segs[R_CS].selector,
+ (unsigned long)env->eip);
}
if ((selector & 0xfffc) == 0) {

View File

@ -1,108 +0,0 @@
From: jan.kiszka@siemens.com (Jan Kiszka)
Subject: [Qemu-devel] [PATCH 4/5] kqemu: Implement verr/verw in the monitor
code interpreter
Date: Fri, 29 May 2009 19:18:31 +0200
Message-ID: <20090529171831.14265.57241.stgit@mchn012c.ww002.siemens.net>
To: qemu-devel@nongnu.org
This avoids user space for handling verr/verw via TCG.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
common/interp.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 70 insertions(+), 1 deletions(-)
diff --git a/common/interp.c b/common/interp.c
index 4c042e9..4f93bc3 100644
Index: common/interp.c
--- common/interp.c
+++ common/interp.c
@@ -1720,6 +1720,65 @@ void helper_lldt(struct kqemu_state *s, int selector)
env->ldt.selector = selector;
}
+static void helper_verr(struct kqemu_state *s, int selector)
+{
+ uint32_t e1, e2;
+ int rpl, dpl, cpl;
+
+ if ((selector & 0xfffc) == 0)
+ goto fail;
+ if (load_segment(s, &e1, &e2, selector) != 0)
+ goto fail;
+ if (!(e2 & DESC_S_MASK))
+ goto fail;
+ rpl = selector & 3;
+ dpl = (e2 >> DESC_DPL_SHIFT) & 3;
+ cpl = s->cpu_state.cpl;
+ if (e2 & DESC_CS_MASK) {
+ if (!(e2 & DESC_R_MASK))
+ goto fail;
+ if (!(e2 & DESC_C_MASK)) {
+ if (dpl < cpl || dpl < rpl)
+ goto fail;
+ }
+ } else {
+ if (dpl < cpl || dpl < rpl) {
+ fail:
+ set_reset_eflags(s, 0, CC_Z);
+ return;
+ }
+ }
+ set_reset_eflags(s, CC_Z, 0);
+}
+
+static void helper_verw(struct kqemu_state *s, int selector)
+{
+ uint32_t e1, e2;
+ int rpl, dpl, cpl;
+
+ if ((selector & 0xfffc) == 0)
+ goto fail;
+ if (load_segment(s, &e1, &e2, selector) != 0)
+ goto fail;
+ if (!(e2 & DESC_S_MASK))
+ goto fail;
+ rpl = selector & 3;
+ dpl = (e2 >> DESC_DPL_SHIFT) & 3;
+ cpl = s->cpu_state.cpl;
+ if (e2 & DESC_CS_MASK) {
+ goto fail;
+ } else {
+ if (dpl < cpl || dpl < rpl)
+ goto fail;
+ if (!(e2 & DESC_W_MASK)) {
+ fail:
+ set_reset_eflags(s, 0, CC_Z);
+ return;
+ }
+ }
+ set_reset_eflags(s, CC_Z, 0);
+}
+
static void helper_wrmsr(struct kqemu_state *s)
{
#ifdef __x86_64__
@@ -4479,7 +4538,17 @@ QO( case OT_LONG | 8:\
case 5: /* verw */
if (!(s->cpu_state.cr0 & CR0_PE_MASK) || get_eflags_vm(s))
goto illegal_op;
- raise_exception(s, KQEMU_RET_SOFTMMU);
+ if (mod == 3) {
+ rm = (modrm & 7) | REX_B(s);
+ val = get_regS(s, OT_WORD, rm) & 0xffff;
+ } else {
+ addr = get_modrm(s, modrm);
+ val = ldS(s, OT_WORD, addr);
+ }
+ if (op == 4)
+ helper_verr(s, val);
+ else
+ helper_verw(s, val);
break;
default:
goto illegal_op;

View File

@ -1,155 +0,0 @@
From: jan.kiszka@siemens.com (Jan Kiszka)
Subject: [Qemu-devel] [PATCH 5/5] kqemu: Implement lar/lsl in the monitor
code interpreter
Date: Fri, 29 May 2009 19:18:31 +0200
Message-ID: <20090529171831.14265.17606.stgit@mchn012c.ww002.siemens.net>
To: qemu-devel@nongnu.org
This avoids user space for handling lar/lsl via TCG.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
common/interp.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 109 insertions(+), 2 deletions(-)
diff --git common/interp.c b/common/interp.c
index 4f93bc3..577d666 100644
Index: common/interp.c
--- common/interp.c
+++ common/interp.c
@@ -1720,6 +1720,93 @@ void helper_lldt(struct kqemu_state *s, int selector)
env->ldt.selector = selector;
}
+static int helper_lar(struct kqemu_state *s, int selector)
+{
+ uint32_t e1, e2;
+ int rpl, dpl, cpl, type;
+
+ if ((selector & 0xfffc) == 0)
+ goto fail;
+ if (load_segment(s, &e1, &e2, selector) != 0)
+ goto fail;
+ rpl = selector & 3;
+ dpl = (e2 >> DESC_DPL_SHIFT) & 3;
+ cpl = s->cpu_state.cpl;
+ if (e2 & DESC_S_MASK) {
+ if ((e2 & DESC_CS_MASK) && (e2 & DESC_C_MASK)) {
+ /* conforming */
+ } else {
+ if (dpl < cpl || dpl < rpl)
+ goto fail;
+ }
+ } else {
+ type = (e2 >> DESC_TYPE_SHIFT) & 0xf;
+ switch(type) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 9:
+ case 11:
+ case 12:
+ break;
+ default:
+ goto fail;
+ }
+ if (dpl < cpl || dpl < rpl) {
+ fail:
+ set_reset_eflags(s, 0, CC_Z);
+ return 0;
+ }
+ }
+ set_reset_eflags(s, CC_Z, 0);
+ return e2 & 0x00f0ff00;
+}
+
+static int helper_lsl(struct kqemu_state *s, int selector)
+{
+ unsigned int limit;
+ uint32_t e1, e2;
+ int rpl, dpl, cpl, type;
+
+ if ((selector & 0xfffc) == 0)
+ goto fail;
+ if (load_segment(s, &e1, &e2, selector) != 0)
+ goto fail;
+ rpl = selector & 3;
+ dpl = (e2 >> DESC_DPL_SHIFT) & 3;
+ cpl = s->cpu_state.cpl;
+ if (e2 & DESC_S_MASK) {
+ if ((e2 & DESC_CS_MASK) && (e2 & DESC_C_MASK)) {
+ /* conforming */
+ } else {
+ if (dpl < cpl || dpl < rpl)
+ goto fail;
+ }
+ } else {
+ type = (e2 >> DESC_TYPE_SHIFT) & 0xf;
+ switch(type) {
+ case 1:
+ case 2:
+ case 3:
+ case 9:
+ case 11:
+ break;
+ default:
+ goto fail;
+ }
+ if (dpl < cpl || dpl < rpl) {
+ fail:
+ set_reset_eflags(s, 0, CC_Z);
+ return 0;
+ }
+ }
+ limit = get_seg_limit(e1, e2);
+ set_reset_eflags(s, CC_Z, 0);
+ return limit;
+}
+
static void helper_verr(struct kqemu_state *s, int selector)
{
uint32_t e1, e2;
@@ -4616,6 +4703,28 @@ QO( case OT_LONG | 8:\
goto illegal_op;
}
goto insn_next;
+ LABEL(102) /* lar */
+ LABEL(103) /* lsl */
+ if (!(s->cpu_state.cr0 & CR0_PE_MASK) || get_eflags_vm(s))
+ goto illegal_op;
+ ot = s->dflag + OT_WORD;
+ modrm = ldub_code(s);
+ mod = (modrm >> 6);
+ if (mod == 3) {
+ rm = (modrm & 7) | REX_B(s);
+ val = get_regS(s, OT_WORD, rm) & 0xffff;
+ } else {
+ addr = get_modrm(s, modrm);
+ val = ldS(s, OT_WORD, addr);
+ }
+ rm = ((modrm >> 3) & 7) | REX_R(s);
+ if (b == 0x102)
+ val = helper_lar(s, val);
+ else
+ val = helper_lsl(s, val);
+ if (s->regs1.eflags & CC_Z)
+ set_regS(s, ot, rm, val);
+ goto insn_next;
LABEL(108) /* invd */
LABEL(109) /* wbinvd */
if (s->cpu_state.cpl != 0)
@@ -5214,8 +5323,6 @@ QO( case OT_LONG | 8:\
LABEL(10b)
LABEL(10a)
LABEL(104)
- LABEL(103)
- LABEL(102)
LABEL(f1)
LABEL(e2)
LABEL(e1)

View File

@ -1,53 +0,0 @@
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: kqemu
# KEYWORD: nojail
#
# Add the following line to /etc/rc.conf[.local] to enable kqemu
#
# kqemu_enable="YES"
#
. /etc/rc.subr
name="kqemu"
rcvar=kqemu_enable
load_rc_config $name
: ${kqemu_enable="NO"}
start_cmd=kqemu_start
stop_cmd=kqemu_stop
kqemu_start()
{
# load aio if needed
if ! kldstat -qm aio; then
if kldload aio; then
info 'aio module loaded.'
else
warn 'aio module failed to load.'
return 1
fi
fi
if ! kldstat -qm kqemu; then
if kldload kqemu; then
echo 'kqemu module loaded.'
else
warn 'kqemu module failed to load.'
return 1
fi
fi
return 0
}
kqemu_stop()
{
if kldstat -qm kqemu && kldunload kqemu; then
echo 'kqemu module unloaded.'
fi
}
run_rc_command "$1"

View File

@ -1,9 +0,0 @@
--- Makefile.freebsd.orig
+++ Makefile.freebsd
@@ -8,3 +8,6 @@ OBJS= kqemu-mod-x86_64.o
WERROR=
.include <bsd.kmod.mk>
+
+CFLAGS:= ${CFLAGS:N-fformat-extensions}
+CFLAGS:= ${CFLAGS:N-mno-align-long-strings}

View File

@ -1,22 +0,0 @@
Index: common/Makefile
@@ -47,9 +47,9 @@
ifeq ($(ARCH), x86_64)
COMMON_CFLAGS+=-mno-red-zone
endif
-CFLAGS=$(COMMON_CFLAGS)
+CFLAGS=$(COMMON_CFLAGS) ${DEBUG_FLAGS}
MON_CFLAGS=$(COMMON_CFLAGS)
-KERNEL_CFLAGS=$(COMMON_CFLAGS)
+KERNEL_CFLAGS=$(COMMON_CFLAGS) ${DEBUG_FLAGS}
# Disable SSP if GCC supports it
MON_CFLAGS+=$(call cc-option,$(MON_CC),-fno-stack-protector,)
@@ -119,7 +119,7 @@
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -c -o $@ $<
%.o: %.S
- $(CC) $(DEFINES) $(INCLUDES) -D__ASSEMBLY__ -c -o $@ $<
+ $(CC) ${DEBUG_FLAGS} $(DEFINES) $(INCLUDES) -D__ASSEMBLY__ -c -o $@ $<
clean:
rm -f *.o *~ monitor-image.h genoffsets genmon monitor_def.h \

View File

@ -1,15 +0,0 @@
--- common/interp.c.orig
+++ common/interp.c
@@ -1870,11 +1870,11 @@ static void helper_wrmsr(struct kqemu_st
{
#ifdef __x86_64__
struct kqemu_cpu_state *env = &s->cpu_state;
-#endif
uint64_t val;
val = ((uint32_t)s->regs1.eax) |
((uint64_t)((uint32_t)s->regs1.edx) << 32);
+#endif
switch((uint32_t)s->regs1.ecx) {
#ifdef __x86_64__

View File

@ -1,19 +0,0 @@
--- common/kqemu_int.h.orig
+++ common/kqemu_int.h
@@ -17,8 +17,16 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ASSEMBLY__
+#ifdef __FreeBSD__
+#include <sys/stddef.h>
+#include <machine/stdarg.h>
+#include <sys/cdefs.h>
+#include <machine/_types.h>
+typedef __size_t size_t;
+#else
#include <stddef.h>
#include <stdarg.h>
+#endif
#ifndef NO_STD_TYPES

View File

@ -1,78 +0,0 @@
Index: common/kernel.c
@@ -1240,6 +1240,11 @@
case MON_REQ_EXCEPTION:
exec_exception(s->arg0);
break;
+#ifdef __FreeBSD__
+ case MON_REQ_LOADFPUCONTEXT:
+ kqemu_loadfpucontext(s->arg0);
+ break;
+#endif
default:
kqemu_log("invalid mon request: %d\n", s->mon_req);
break;
Index: common/kqemu_int.h
@@ -523,6 +523,7 @@
MON_REQ_LOCK_USER_PAGE,
MON_REQ_UNLOCK_USER_PAGE,
MON_REQ_EXCEPTION,
+ MON_REQ_LOADFPUCONTEXT,
} MonitorRequest;
#define INTERRUPT_ENTRY_SIZE 16
Index: common/monitor.c
@@ -1995,8 +1995,13 @@
raise_exception_err(s, EXCP07_PREX, 0);
} else {
/* the host needs to restore the FPU state for us */
+#ifndef __FreeBSD__
s->mon_req = MON_REQ_EXCEPTION;
s->arg0 = 0x07;
+#else
+ s->mon_req = MON_REQ_LOADFPUCONTEXT;
+ s->arg0 = (unsigned long)s->cpu_state.cpl;
+#endif
monitor2kernel1(s);
}
}
Index: kqemu-freebsd.c
@@ -33,6 +33,11 @@
#include <machine/vmparam.h>
#include <machine/stdarg.h>
+#ifdef __x86_64__
+#include <machine/fpu.h>
+#else
+#include <machine/npx.h>
+#endif
#include "kqemu-kernel.h"
@@ -172,6 +177,15 @@
{
}
+void CDECL kqemu_loadfpucontext(unsigned long cpl)
+{
+#ifdef __x86_64__
+ fpudna();
+#else
+ npxdna();
+#endif
+}
+
#if __FreeBSD_version < 500000
static int
curpriority_cmp(struct proc *p)
Index: kqemu-kernel.h
@@ -40,6 +40,10 @@
void * CDECL kqemu_io_map(unsigned long page_index, unsigned int size);
void CDECL kqemu_io_unmap(void *ptr, unsigned int size);
+#ifdef __FreeBSD__
+void CDECL kqemu_loadfpucontext(unsigned long cpl);
+#endif
+
int CDECL kqemu_schedule(void);
void CDECL kqemu_log(const char *fmt, ...);

View File

@ -1,89 +0,0 @@
Index: kqemu-freebsd.c
@@ -222,9 +222,17 @@
int CDECL kqemu_schedule(void)
{
/* kqemu_log("kqemu_schedule\n"); */
+#if __FreeBSD_version < 700044
mtx_lock_spin(&sched_lock);
mi_switch(SW_VOL, NULL);
mtx_unlock_spin(&sched_lock);
+#else
+ /* -current no longer uses sched_lock */
+ struct thread *td = curthread;
+ thread_lock(td);
+ mi_switch(SW_VOL, NULL);
+ thread_unlock(td);
+#endif
return SIGPENDING(curthread);
}
#endif
@@ -258,6 +266,10 @@
static struct clonedevs *kqemuclones;
static TAILQ_HEAD(,kqemu_instance) kqemuhead = TAILQ_HEAD_INITIALIZER(kqemuhead);
static eventhandler_tag clonetag;
+#ifndef D_NEEDMINOR
+/* see http://svn.freebsd.org/viewvc/base?view=revision&revision=179726 */
+#define D_NEEDMINOR 0
+#endif
#endif
static d_close_t kqemu_close;
@@ -282,7 +294,7 @@
/* bmaj */ -1
#else
.d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
+ .d_flags = D_NEEDGIANT | D_NEEDMINOR,
.d_open = kqemu_open,
.d_ioctl = kqemu_ioctl,
.d_close = kqemu_close,
@@ -334,8 +346,15 @@
#if __FreeBSD_version >= 500000
dev->si_drv1 = NULL;
TAILQ_REMOVE(&kqemuhead, ks, kqemu_ent);
+#if __FreeBSD_version >= 700051
+ destroy_dev_sched(dev);
+#else
+#if __FreeBSD_version >= 700024
+ dev_relthread(dev);
+#endif
destroy_dev(dev);
#endif
+#endif
free(ks, M_KQEMU);
--kqemu_ref_count;
}
@@ -412,6 +431,19 @@
ks->state = s;
break;
}
+ case KQEMU_SET_PHYS_MEM: {
+ struct kqemu_phys_mem kphys_mem;
+ if (!s) {
+ ret = -EIO;
+ break;
+ }
+ kphys_mem = *(struct kqemu_phys_mem *)addr;
+ ret = kqemu_set_phys_mem(s, &kphys_mem);
+ if (ret != 0) {
+ ret = -EINVAL;
+ }
+ break;
+ }
case KQEMU_EXEC: {
struct kqemu_cpu_state *ctx;
if (s == NULL) {
@@ -514,7 +546,13 @@
while ((ks = TAILQ_FIRST(&kqemuhead)) != NULL) {
kqemu_destroy(ks);
}
+#if __FreeBSD_version >= 700051
+ drain_dev_clone_events();
+#endif
clone_cleanup(&kqemuclones);
+#if __FreeBSD_version >= 700051
+ destroy_dev_drain(&kqemu_cdevsw);
+#endif
#endif
kqemu_global_delete(kqemu_gs);
kqemu_gs = NULL;

View File

@ -1,25 +0,0 @@
Index: common/kernel.c
@@ -1079,6 +1079,10 @@ long kqemu_exec(struct kqemu_state *s)
uint16_t saved_ds, saved_es;
unsigned long fs_base, gs_base;
#endif
+#if defined(__FreeBSD__)
+ extern int ticks;
+ int tstart = ticks;
+#endif
#ifdef PROFILE
s->nb_profile_ts = 0;
@@ -1252,7 +1256,11 @@ long kqemu_exec(struct kqemu_state *s)
/* if interrupting user code, we schedule to give time
to the other processes. We can be interrupted by a
signal a that case. */
- if (kqemu_schedule()) {
+ if (kqemu_schedule()
+#if defined(__FreeBSD__)
+ || ticks - tstart > 1
+#endif
+ ) {
restore_cpu_state_from_regs(s, r);
ret = KQEMU_RET_INTR;
break;

View File

@ -1,16 +0,0 @@
--- kqemu-freebsd.c.orig 2009-02-12 03:45:30.607773000 -0600
+++ kqemu-freebsd.c 2009-02-12 03:50:10.019986534 -0600
@@ -381,7 +381,12 @@
r = clone_create(&kqemuclones, &kqemu_cdevsw, &unit, dev, 0);
if (r) {
- *dev = make_dev(&kqemu_cdevsw, unit2minor(unit),
+ *dev = make_dev(&kqemu_cdevsw,
+#if __FreeBSD_version < 800062
+ unit2minor(unit),
+#else /* __FreeBSD_version >= 800062 */
+ unit,
+#endif /* __FreeBSD_version < 800062 */
UID_ROOT, GID_WHEEL, 0660, "kqemu%d", unit);
if (*dev != NULL) {
dev_ref(*dev);

View File

@ -1,63 +0,0 @@
--- common/kernel.c.orig
+++ common/kernel.c
@@ -341,7 +341,7 @@ static void kqemu_del_state(struct kqemu
}
}
-struct kqemu_global_state *kqemu_global_init(int max_locked_pages)
+struct kqemu_global_state * CDECL kqemu_global_init(int max_locked_pages)
{
struct kqemu_global_state *g;
@@ -354,13 +354,13 @@ struct kqemu_global_state *kqemu_global_
return g;
}
-void kqemu_global_delete(struct kqemu_global_state *g)
+void CDECL kqemu_global_delete(struct kqemu_global_state *g)
{
/* XXX: free all existing states ? */
kqemu_vfree(g);
}
-struct kqemu_state *kqemu_init(struct kqemu_init *d,
+struct kqemu_state * CDECL kqemu_init(struct kqemu_init *d,
struct kqemu_global_state *g)
{
struct kqemu_state *s;
@@ -756,7 +756,7 @@ struct kqemu_state *kqemu_init(struct kq
return NULL;
}
-int kqemu_set_phys_mem(struct kqemu_state *s,
+int CDECL kqemu_set_phys_mem(struct kqemu_state *s,
const struct kqemu_phys_mem *kphys_mem)
{
uint64_t start, size, end, addr;
@@ -951,7 +951,7 @@ static void profile_dump(struct kqemu_st
}
#endif
-void kqemu_delete(struct kqemu_state *s)
+void CDECL kqemu_delete(struct kqemu_state *s)
{
uint8_t *s1;
struct kqemu_ram_page *rp;
@@ -990,7 +990,7 @@ void kqemu_delete(struct kqemu_state *s)
kqemu_vfree(s1);
}
-struct kqemu_cpu_state *kqemu_get_cpu_state(struct kqemu_state *s)
+struct kqemu_cpu_state * CDECL kqemu_get_cpu_state(struct kqemu_state *s)
{
return &s->cpu_state;
}
@@ -1063,7 +1063,7 @@ static void apic_restore_nmi(struct kqem
}\
}
-long kqemu_exec(struct kqemu_state *s)
+long CDECL kqemu_exec(struct kqemu_state *s)
{
const struct monitor_code_header *m = (void *)monitor_code;
void (*kernel2monitor)(struct kqemu_state *s) =

View File

@ -1,44 +0,0 @@
--- kqemu-freebsd.c~ 2014-02-07 20:00:33.656255395 +0200
+++ kqemu-freebsd.c 2014-02-08 08:43:19.209100708 +0200
@@ -105,17 +105,29 @@
*/
struct kqemu_page *CDECL kqemu_alloc_zeroed_page(unsigned long *ppage_index)
{
+#if __FreeBSD_version < 1000030
pmap_t pmap;
+#endif
vm_offset_t va;
vm_paddr_t pa;
+#if __FreeBSD_version >= 1000030
+ va = kmem_malloc(kernel_arena, PAGE_SIZE, M_ZERO | M_WAITOK);
+#else
va = kmem_alloc(kernel_map, PAGE_SIZE);
+#endif
+
if (va == 0) {
kqemu_log("kqemu_alloc_zeroed_page: NULL\n");
return NULL;
}
+
+#if __FreeBSD_version >= 1000030
+ pa = vtophys(va);
+#else
pmap = vm_map_pmap(kernel_map);
pa = pmap_extract(pmap, va);
+#endif
/* kqemu_log("kqemu_alloc_zeroed_page: %08x\n", pa); */
*ppage_index = pa >> PAGE_SHIFT;
return (struct kqemu_page *)va;
@@ -125,7 +137,11 @@
{
if (kqemu_debug > 0)
kqemu_log("kqemu_free_page(%p)\n", page);
+#if __FreeBSD_version >= 1000030
+ kmem_free(kernel_arena, (vm_offset_t) page, PAGE_SIZE);
+#else
kmem_free(kernel_map, (vm_offset_t) page, PAGE_SIZE);
+#endif
}
/* return kernel address of the physical page page_index */

View File

@ -1,3 +0,0 @@
KQEMU is a qemu accelerator kernel module on x86/amd64.
WWW: http://fabrice.bellard.free.fr/qemu/

View File

@ -1,7 +0,0 @@
====
Notice:
If you installed this from a package and your kernel configuration
differs from the one on the package build machine (or your kernel source
is newer than the package), then the kld may not work, or even panic.
Consider building it from ports in that case.
====

View File

@ -1,71 +0,0 @@
# Created by: nork@FreeBSD.org
# $FreeBSD$
PORTNAME= kqemu
DISTVERSION= 1.3.0pre11
PORTREVISION= 12
CATEGORIES= emulators
MASTER_SITES= http://bellard.org/qemu/ \
http://qemu.org/ \
LOCAL/nox
PKGNAMESUFFIX= -kmod
DIST_SUBDIR= kqemu
MAINTAINER= ports@FreeBSD.org
COMMENT= Kernel Accelerator for QEMU CPU Emulator
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/COPYING
ONLY_FOR_ARCHS= i386 amd64
HAS_CONFIGURE= yes
USE_GCC= any
CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC}
CONFLICTS= kqemu-kmod-devel-[0-9]*
USE_RC_SUBR= kqemu
USES= kmod gmake uidfix
OPTIONS_DEFINE= DOCS
.include <bsd.port.pre.mk>
PORTDOCS= kqemu-doc.html kqemu-tech.html
PLIST_FILES= include/kqemu/kqemu.h
PLIST_FILES+= ${KMODDIR}/kqemu.ko
MAKEFILE= Makefile.freebsd
MAKE_ARGS+= LDFLAGS="${LDFLAGS:S/^-Wl,//}"
.if ${ARCH} == "amd64"
MAKE_CMD_ARGS+= ARCH=x86_64
.endif
CFLAGS+= ${DEBUG_FLAGS}
# Not sure about the exact OSVERSION:
.if ${OSVERSION} > 1000015
BROKEN= KPI changes in 10 and up, use bhyve or vbox
.endif
post-patch:
@${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} ${MAKE_CMD} ${MAKE_FLAGS} Makefile ${MAKE_CMD_ARGS} ${ALL_TARGET})
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
do-install:
@(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} DESTDIR=${STAGEDIR} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
${MKDIR} ${STAGEDIR}${PREFIX}/include/kqemu
${INSTALL_DATA} ${WRKSRC}/kqemu.h ${STAGEDIR}${PREFIX}/include/kqemu
do-install-DOCS-on:
${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/kqemu-doc.html ${WRKSRC}/kqemu-tech.html \
${STAGEDIR}${DOCSDIR}
.include <bsd.port.post.mk>

View File

@ -1,2 +0,0 @@
SHA256 (kqemu/kqemu-1.3.0pre11.tar.gz) = 541aef5797e5c6c6a76e354c17c6513ca21fe3372ec79493a32f7e51ba785b0f
SIZE (kqemu/kqemu-1.3.0pre11.tar.gz) = 161478

View File

@ -1,53 +0,0 @@
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: kqemu
# KEYWORD: nojail
#
# Add the following line to /etc/rc.conf[.local] to enable kqemu
#
# kqemu_enable="YES"
#
. /etc/rc.subr
name="kqemu"
rcvar=kqemu_enable
load_rc_config $name
: ${kqemu_enable="NO"}
start_cmd=kqemu_start
stop_cmd=kqemu_stop
kqemu_start()
{
# load aio if needed
if ! kldstat -qm aio; then
if kldload aio; then
info 'aio module loaded.'
else
warn 'aio module failed to load.'
return 1
fi
fi
if ! kldstat -qm kqemu; then
if kldload kqemu; then
echo 'kqemu module loaded.'
else
warn 'kqemu module failed to load.'
return 1
fi
fi
return 0
}
kqemu_stop()
{
if kldstat -qm kqemu && kldunload kqemu; then
echo 'kqemu module unloaded.'
fi
}
run_rc_command "$1"

View File

@ -1,9 +0,0 @@
--- Makefile.freebsd.orig
+++ Makefile.freebsd
@@ -8,3 +8,6 @@ OBJS= kqemu-mod-x86_64.o
WERROR=
.include <bsd.kmod.mk>
+
+CFLAGS:= ${CFLAGS:N-fformat-extensions}
+CFLAGS:= ${CFLAGS:N-mno-align-long-strings}

View File

@ -1,22 +0,0 @@
Index: common/Makefile
@@ -47,9 +47,9 @@
ifeq ($(ARCH), x86_64)
COMMON_CFLAGS+=-mno-red-zone
endif
-CFLAGS=$(COMMON_CFLAGS)
+CFLAGS=$(COMMON_CFLAGS) ${DEBUG_FLAGS}
MON_CFLAGS=$(COMMON_CFLAGS)
-KERNEL_CFLAGS=$(COMMON_CFLAGS)
+KERNEL_CFLAGS=$(COMMON_CFLAGS) ${DEBUG_FLAGS}
# Disable SSP if GCC supports it
MON_CFLAGS+=$(call cc-option,$(MON_CC),-fno-stack-protector,)
@@ -119,7 +119,7 @@
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -c -o $@ $<
%.o: %.S
- $(CC) $(DEFINES) $(INCLUDES) -D__ASSEMBLY__ -c -o $@ $<
+ $(CC) ${DEBUG_FLAGS} $(DEFINES) $(INCLUDES) -D__ASSEMBLY__ -c -o $@ $<
clean:
rm -f *.o *~ monitor-image.h genoffsets genmon monitor_def.h \

View File

@ -1,15 +0,0 @@
--- common/interp.c.orig
+++ common/interp.c
@@ -1623,11 +1623,11 @@ static void helper_wrmsr(struct kqemu_st
{
#ifdef __x86_64__
struct kqemu_cpu_state *env = &s->cpu_state;
-#endif
uint64_t val;
val = ((uint32_t)s->regs1.eax) |
((uint64_t)((uint32_t)s->regs1.edx) << 32);
+#endif
switch((uint32_t)s->regs1.ecx) {
#ifdef __x86_64__

View File

@ -1,19 +0,0 @@
--- common/kqemu_int.h.orig
+++ common/kqemu_int.h
@@ -17,8 +17,16 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ASSEMBLY__
+#ifdef __FreeBSD__
+#include <sys/stddef.h>
+#include <machine/stdarg.h>
+#include <sys/cdefs.h>
+#include <machine/_types.h>
+typedef __size_t size_t;
+#else
#include <stddef.h>
#include <stdarg.h>
+#endif
#ifndef NO_STD_TYPES

View File

@ -1,78 +0,0 @@
Index: common/kernel.c
@@ -1240,6 +1240,11 @@
case MON_REQ_EXCEPTION:
exec_exception(s->arg0);
break;
+#ifdef __FreeBSD__
+ case MON_REQ_LOADFPUCONTEXT:
+ kqemu_loadfpucontext(s->arg0);
+ break;
+#endif
default:
kqemu_log("invalid mon request: %d\n", s->mon_req);
break;
Index: common/kqemu_int.h
@@ -523,6 +523,7 @@
MON_REQ_LOCK_USER_PAGE,
MON_REQ_UNLOCK_USER_PAGE,
MON_REQ_EXCEPTION,
+ MON_REQ_LOADFPUCONTEXT,
} MonitorRequest;
#define INTERRUPT_ENTRY_SIZE 16
Index: common/monitor.c
@@ -1995,8 +1995,13 @@
raise_exception_err(s, EXCP07_PREX, 0);
} else {
/* the host needs to restore the FPU state for us */
+#ifndef __FreeBSD__
s->mon_req = MON_REQ_EXCEPTION;
s->arg0 = 0x07;
+#else
+ s->mon_req = MON_REQ_LOADFPUCONTEXT;
+ s->arg0 = (unsigned long)s->cpu_state.cpl;
+#endif
monitor2kernel1(s);
}
}
Index: kqemu-freebsd.c
@@ -33,6 +33,11 @@
#include <machine/vmparam.h>
#include <machine/stdarg.h>
+#ifdef __x86_64__
+#include <machine/fpu.h>
+#else
+#include <machine/npx.h>
+#endif
#include "kqemu-kernel.h"
@@ -172,6 +177,15 @@
{
}
+void CDECL kqemu_loadfpucontext(unsigned long cpl)
+{
+#ifdef __x86_64__
+ fpudna();
+#else
+ npxdna();
+#endif
+}
+
#if __FreeBSD_version < 500000
static int
curpriority_cmp(struct proc *p)
Index: kqemu-kernel.h
@@ -40,6 +40,10 @@
void * CDECL kqemu_io_map(unsigned long page_index, unsigned int size);
void CDECL kqemu_io_unmap(void *ptr, unsigned int size);
+#ifdef __FreeBSD__
+void CDECL kqemu_loadfpucontext(unsigned long cpl);
+#endif
+
int CDECL kqemu_schedule(void);
void CDECL kqemu_log(const char *fmt, ...);

View File

@ -1,69 +0,0 @@
Index: kqemu-freebsd.c
@@ -222,9 +222,17 @@
int CDECL kqemu_schedule(void)
{
/* kqemu_log("kqemu_schedule\n"); */
+#if __FreeBSD_version < 700044
mtx_lock_spin(&sched_lock);
mi_switch(SW_VOL, NULL);
mtx_unlock_spin(&sched_lock);
+#else
+ /* -current no longer uses sched_lock */
+ struct thread *td = curthread;
+ thread_lock(td);
+ mi_switch(SW_VOL, NULL);
+ thread_unlock(td);
+#endif
return SIGPENDING(curthread);
}
#endif
@@ -258,6 +266,10 @@
static struct clonedevs *kqemuclones;
static TAILQ_HEAD(,kqemu_instance) kqemuhead = TAILQ_HEAD_INITIALIZER(kqemuhead);
static eventhandler_tag clonetag;
+#ifndef D_NEEDMINOR
+/* see http://svn.freebsd.org/viewvc/base?view=revision&revision=179726 */
+#define D_NEEDMINOR 0
+#endif
#endif
static d_close_t kqemu_close;
@@ -282,7 +294,7 @@
/* bmaj */ -1
#else
.d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
+ .d_flags = D_NEEDGIANT | D_NEEDMINOR,
.d_open = kqemu_open,
.d_ioctl = kqemu_ioctl,
.d_close = kqemu_close,
@@ -334,8 +346,15 @@
#if __FreeBSD_version >= 500000
dev->si_drv1 = NULL;
TAILQ_REMOVE(&kqemuhead, ks, kqemu_ent);
+#if __FreeBSD_version >= 700051
+ destroy_dev_sched(dev);
+#else
+#if __FreeBSD_version >= 700024
+ dev_relthread(dev);
+#endif
destroy_dev(dev);
#endif
+#endif
free(ks, M_KQEMU);
--kqemu_ref_count;
}
@@ -514,7 +533,13 @@
while ((ks = TAILQ_FIRST(&kqemuhead)) != NULL) {
kqemu_destroy(ks);
}
+#if __FreeBSD_version >= 700051
+ drain_dev_clone_events();
+#endif
clone_cleanup(&kqemuclones);
+#if __FreeBSD_version >= 700051
+ destroy_dev_drain(&kqemu_cdevsw);
+#endif
#endif
kqemu_global_delete(kqemu_gs);
kqemu_gs = NULL;

View File

@ -1,16 +0,0 @@
--- kqemu-freebsd.c.orig 2009-02-12 03:45:30.607773000 -0600
+++ kqemu-freebsd.c 2009-02-12 03:50:10.019986534 -0600
@@ -381,7 +381,12 @@
r = clone_create(&kqemuclones, &kqemu_cdevsw, &unit, dev, 0);
if (r) {
- *dev = make_dev(&kqemu_cdevsw, unit2minor(unit),
+ *dev = make_dev(&kqemu_cdevsw,
+#if __FreeBSD_version < 800062
+ unit2minor(unit),
+#else /* __FreeBSD_version >= 800062 */
+ unit,
+#endif /* __FreeBSD_version < 800062 */
UID_ROOT, GID_WHEEL, 0660, "kqemu%d", unit);
if (*dev != NULL) {
dev_ref(*dev);

View File

@ -1,3 +0,0 @@
KQEMU is a qemu accelerator kernel module on x86/amd64.
WWW: http://fabrice.bellard.free.fr/qemu/

View File

@ -1,7 +0,0 @@
====
Notice:
If you installed this from a package and your kernel configuration
differs from the one on the package build machine (or your kernel source
is newer than the package), then the kld may not work, or even panic.
Consider building it from ports in that case.
====