diff options
author | nox <nox@FreeBSD.org> | 2008-05-11 18:59:20 +0800 |
---|---|---|
committer | nox <nox@FreeBSD.org> | 2008-05-11 18:59:20 +0800 |
commit | 4a97f6f1d2e7d00dbfe9d50e3e8b8ef3fd35e617 (patch) | |
tree | d06c5a5d65794e72d0a0cd9bc80590bd8d3d4ad2 /emulators/kqemu-kmod-devel | |
parent | 0cd3953fb25a43176b50cf87d5dd4958efcfb860 (diff) | |
download | freebsd-ports-gnome-4a97f6f1d2e7d00dbfe9d50e3e8b8ef3fd35e617.tar.gz freebsd-ports-gnome-4a97f6f1d2e7d00dbfe9d50e3e8b8ef3fd35e617.tar.zst freebsd-ports-gnome-4a97f6f1d2e7d00dbfe9d50e3e8b8ef3fd35e617.zip |
- Get rid of the infamous "fpudna in kernel mode" messages on amd64 by
calling fpudna()/npxdna() directly instead of programmatically invoking
int 7 (should also speed up the i386 case a tiny little bit that didn't
print a message) [1]
- Rename kqemu_tss_workaround to kqemu_tss_fixup [2]
- Bump PORTREVISION
Looked over by: bde [1]
Prodded by: jhb [2]
Diffstat (limited to 'emulators/kqemu-kmod-devel')
-rw-r--r-- | emulators/kqemu-kmod-devel/Makefile | 2 | ||||
-rw-r--r-- | emulators/kqemu-kmod-devel/files/patch-fpucontext | 78 | ||||
-rw-r--r-- | emulators/kqemu-kmod-devel/files/patch-tssworkaround | 16 |
3 files changed, 87 insertions, 9 deletions
diff --git a/emulators/kqemu-kmod-devel/Makefile b/emulators/kqemu-kmod-devel/Makefile index 872b199a6eff..955ea30159b1 100644 --- a/emulators/kqemu-kmod-devel/Makefile +++ b/emulators/kqemu-kmod-devel/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-devel/files/patch-fpucontext b/emulators/kqemu-kmod-devel/files/patch-fpucontext new file mode 100644 index 000000000000..186d131da2b2 --- /dev/null +++ b/emulators/kqemu-kmod-devel/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-devel/files/patch-tssworkaround b/emulators/kqemu-kmod-devel/files/patch-tssworkaround index 07185972a889..00638fdd671f 100644 --- a/emulators/kqemu-kmod-devel/files/patch-tssworkaround +++ b/emulators/kqemu-kmod-devel/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 + |