aboutsummaryrefslogtreecommitdiff
path: root/emulators/kqemu-kmod
diff options
context:
space:
mode:
authorJuergen Lock <nox@FreeBSD.org>2008-05-11 10:59:20 +0000
committerJuergen Lock <nox@FreeBSD.org>2008-05-11 10:59:20 +0000
commit35eb12366196ffbd302709b022b4674775009e56 (patch)
treec4b3092b64cfd537d9d0f86a92b51d9b91bc3f7b /emulators/kqemu-kmod
parent2155118957467430e7b0de6300bc17564b3a39c3 (diff)
downloadports-35eb12366196ffbd302709b022b4674775009e56.tar.gz
ports-35eb12366196ffbd302709b022b4674775009e56.zip
Notes
Diffstat (limited to 'emulators/kqemu-kmod')
-rw-r--r--emulators/kqemu-kmod/Makefile2
-rw-r--r--emulators/kqemu-kmod/files/patch-fpucontext78
-rw-r--r--emulators/kqemu-kmod/files/patch-tssworkaround16
3 files changed, 87 insertions, 9 deletions
diff --git a/emulators/kqemu-kmod/Makefile b/emulators/kqemu-kmod/Makefile
index 872b199a6eff..955ea30159b1 100644
--- a/emulators/kqemu-kmod/Makefile
+++ b/emulators/kqemu-kmod/Makefile
@@ -7,7 +7,7 @@
PORTNAME= kqemu
PORTVERSION= 1.3.0.p11
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= emulators kld
MASTER_SITES= http://fabrice.bellard.free.fr/qemu/ \
http://qemu.org/ \
diff --git a/emulators/kqemu-kmod/files/patch-fpucontext b/emulators/kqemu-kmod/files/patch-fpucontext
new file mode 100644
index 000000000000..186d131da2b2
--- /dev/null
+++ b/emulators/kqemu-kmod/files/patch-fpucontext
@@ -0,0 +1,78 @@
+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, ...);
diff --git a/emulators/kqemu-kmod/files/patch-tssworkaround b/emulators/kqemu-kmod/files/patch-tssworkaround
index 07185972a889..00638fdd671f 100644
--- a/emulators/kqemu-kmod/files/patch-tssworkaround
+++ b/emulators/kqemu-kmod/files/patch-tssworkaround
@@ -1,8 +1,8 @@
Index: kqemu-freebsd.c
-@@ -33,6 +33,11 @@
-
- #include <machine/vmparam.h>
- #include <machine/stdarg.h>
+@@ -38,6 +38,11 @@
+ #else
+ #include <machine/npx.h>
+ #endif
+#ifdef __x86_64__
+#include <sys/pcpu.h>
+#include <machine/segments.h>
@@ -11,13 +11,13 @@ Index: kqemu-freebsd.c
#include "kqemu-kernel.h"
-@@ -234,6 +239,19 @@
+@@ -248,6 +253,19 @@
va_end(ap);
}
+#ifdef __x86_64__
+/* called with interrupts disabled */
-+void CDECL kqemu_tss_workaround(void)
++void CDECL kqemu_tss_fixup(void)
+{
+ int gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
+
@@ -49,7 +49,7 @@ Index: common/kernel.c
+#ifdef __FreeBSD__
+#ifdef __x86_64__
+ spin_lock(&g->lock);
-+ kqemu_tss_workaround();
++ kqemu_tss_fixup();
+ spin_unlock(&g->lock);
+#endif
+#endif
@@ -63,7 +63,7 @@ Index: kqemu-kernel.h
+#ifdef __FreeBSD__
+#ifdef __x86_64__
-+void CDECL kqemu_tss_workaround(void);
++void CDECL kqemu_tss_fixup(void);
+#endif
+#endif
+