mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
- Add a workaround for the amd64 SMP shared gdt issue that caused the
host panics - longer explanation in this post: http://docs.freebsd.org/cgi/mid.cgi?20080501101951.GA30274 [1] - Get rid of superfluous "kqemu " in IGNORE message when kernel source is missing - Pass down DEBUG_FLAGS to the build - Bump PORTREVISION PR: ports/113430 [1]
This commit is contained in:
parent
27133d7f58
commit
4fbc32fd37
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=212415
6 changed files with 192 additions and 4 deletions
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= kqemu
|
PORTNAME= kqemu
|
||||||
PORTVERSION= 1.3.0.p11
|
PORTVERSION= 1.3.0.p11
|
||||||
PORTREVISION= 3
|
PORTREVISION= 4
|
||||||
CATEGORIES= emulators kld
|
CATEGORIES= emulators kld
|
||||||
MASTER_SITES= http://fabrice.bellard.free.fr/qemu/ \
|
MASTER_SITES= http://fabrice.bellard.free.fr/qemu/ \
|
||||||
http://qemu.org/ \
|
http://qemu.org/ \
|
||||||
|
@ -48,7 +48,7 @@ KMODDIR= /boot/modules
|
||||||
MAKE_ENV+= KMODDIR="${KMODDIR}"
|
MAKE_ENV+= KMODDIR="${KMODDIR}"
|
||||||
|
|
||||||
.if !exists(${SRC_BASE}/sys/Makefile)
|
.if !exists(${SRC_BASE}/sys/Makefile)
|
||||||
IGNORE= kqemu requires kernel source to be installed
|
IGNORE= requires kernel source to be installed
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
|
.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
|
||||||
|
@ -58,6 +58,8 @@ IGNORE= kqemu requires kernel source to be installed
|
||||||
CFLAGS+= -DKSE
|
CFLAGS+= -DKSE
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
CFLAGS+= ${DEBUG_FLAGS}
|
||||||
|
|
||||||
post-extract:
|
post-extract:
|
||||||
.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
|
.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
|
||||||
@${ECHO_MSG} "Compiling with -DKSE."
|
@${ECHO_MSG} "Compiling with -DKSE."
|
||||||
|
|
22
emulators/kqemu-kmod-devel/files/patch-common-Makefile
Normal file
22
emulators/kqemu-kmod-devel/files/patch-common-Makefile
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
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 \
|
70
emulators/kqemu-kmod-devel/files/patch-tssworkaround
Normal file
70
emulators/kqemu-kmod-devel/files/patch-tssworkaround
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
Index: kqemu-freebsd.c
|
||||||
|
@@ -33,6 +33,11 @@
|
||||||
|
|
||||||
|
#include <machine/vmparam.h>
|
||||||
|
#include <machine/stdarg.h>
|
||||||
|
+#ifdef __x86_64__
|
||||||
|
+#include <sys/pcpu.h>
|
||||||
|
+#include <machine/segments.h>
|
||||||
|
+#include <machine/tss.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "kqemu-kernel.h"
|
||||||
|
|
||||||
|
@@ -234,6 +239,19 @@
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef __x86_64__
|
||||||
|
+/* called with interrupts disabled */
|
||||||
|
+void CDECL kqemu_tss_workaround(void)
|
||||||
|
+{
|
||||||
|
+ int gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
|
||||||
|
+
|
||||||
|
+ gdt_segs[GPROC0_SEL].ssd_base = (long) &common_tss[PCPU_GET(cpuid)];
|
||||||
|
+ ssdtosyssd(&gdt_segs[GPROC0_SEL],
|
||||||
|
+ (struct system_segment_descriptor *)&gdt[GPROC0_SEL]);
|
||||||
|
+ 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
|
||||||
|
@@ -1188,6 +1191,13 @@
|
||||||
|
apic_restore_nmi(s, apic_nmi_mask);
|
||||||
|
}
|
||||||
|
profile_record(s);
|
||||||
|
+#ifdef __FreeBSD__
|
||||||
|
+#ifdef __x86_64__
|
||||||
|
+ spin_lock(&g->lock);
|
||||||
|
+ kqemu_tss_workaround();
|
||||||
|
+ spin_unlock(&g->lock);
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (s->mon_req == MON_REQ_IRQ) {
|
||||||
|
struct kqemu_exception_regs *r;
|
||||||
|
Index: kqemu-kernel.h
|
||||||
|
@@ -44,4 +44,10 @@
|
||||||
|
|
||||||
|
void CDECL kqemu_log(const char *fmt, ...);
|
||||||
|
|
||||||
|
+#ifdef __FreeBSD__
|
||||||
|
+#ifdef __x86_64__
|
||||||
|
+void CDECL kqemu_tss_workaround(void);
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#endif /* KQEMU_KERNEL_H */
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= kqemu
|
PORTNAME= kqemu
|
||||||
PORTVERSION= 1.3.0.p11
|
PORTVERSION= 1.3.0.p11
|
||||||
PORTREVISION= 3
|
PORTREVISION= 4
|
||||||
CATEGORIES= emulators kld
|
CATEGORIES= emulators kld
|
||||||
MASTER_SITES= http://fabrice.bellard.free.fr/qemu/ \
|
MASTER_SITES= http://fabrice.bellard.free.fr/qemu/ \
|
||||||
http://qemu.org/ \
|
http://qemu.org/ \
|
||||||
|
@ -48,7 +48,7 @@ KMODDIR= /boot/modules
|
||||||
MAKE_ENV+= KMODDIR="${KMODDIR}"
|
MAKE_ENV+= KMODDIR="${KMODDIR}"
|
||||||
|
|
||||||
.if !exists(${SRC_BASE}/sys/Makefile)
|
.if !exists(${SRC_BASE}/sys/Makefile)
|
||||||
IGNORE= kqemu requires kernel source to be installed
|
IGNORE= requires kernel source to be installed
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
|
.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
|
||||||
|
@ -58,6 +58,8 @@ IGNORE= kqemu requires kernel source to be installed
|
||||||
CFLAGS+= -DKSE
|
CFLAGS+= -DKSE
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
CFLAGS+= ${DEBUG_FLAGS}
|
||||||
|
|
||||||
post-extract:
|
post-extract:
|
||||||
.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
|
.if ${OSVERSION} >= 700024 && ${OSVERSION} < 700053 && !defined(NOKSE)
|
||||||
@${ECHO_MSG} "Compiling with -DKSE."
|
@${ECHO_MSG} "Compiling with -DKSE."
|
||||||
|
|
22
emulators/kqemu-kmod/files/patch-common-Makefile
Normal file
22
emulators/kqemu-kmod/files/patch-common-Makefile
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
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 \
|
70
emulators/kqemu-kmod/files/patch-tssworkaround
Normal file
70
emulators/kqemu-kmod/files/patch-tssworkaround
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
Index: kqemu-freebsd.c
|
||||||
|
@@ -33,6 +33,11 @@
|
||||||
|
|
||||||
|
#include <machine/vmparam.h>
|
||||||
|
#include <machine/stdarg.h>
|
||||||
|
+#ifdef __x86_64__
|
||||||
|
+#include <sys/pcpu.h>
|
||||||
|
+#include <machine/segments.h>
|
||||||
|
+#include <machine/tss.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "kqemu-kernel.h"
|
||||||
|
|
||||||
|
@@ -234,6 +239,19 @@
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef __x86_64__
|
||||||
|
+/* called with interrupts disabled */
|
||||||
|
+void CDECL kqemu_tss_workaround(void)
|
||||||
|
+{
|
||||||
|
+ int gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
|
||||||
|
+
|
||||||
|
+ gdt_segs[GPROC0_SEL].ssd_base = (long) &common_tss[PCPU_GET(cpuid)];
|
||||||
|
+ ssdtosyssd(&gdt_segs[GPROC0_SEL],
|
||||||
|
+ (struct system_segment_descriptor *)&gdt[GPROC0_SEL]);
|
||||||
|
+ 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
|
||||||
|
@@ -1188,6 +1191,13 @@
|
||||||
|
apic_restore_nmi(s, apic_nmi_mask);
|
||||||
|
}
|
||||||
|
profile_record(s);
|
||||||
|
+#ifdef __FreeBSD__
|
||||||
|
+#ifdef __x86_64__
|
||||||
|
+ spin_lock(&g->lock);
|
||||||
|
+ kqemu_tss_workaround();
|
||||||
|
+ spin_unlock(&g->lock);
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (s->mon_req == MON_REQ_IRQ) {
|
||||||
|
struct kqemu_exception_regs *r;
|
||||||
|
Index: kqemu-kernel.h
|
||||||
|
@@ -44,4 +44,10 @@
|
||||||
|
|
||||||
|
void CDECL kqemu_log(const char *fmt, ...);
|
||||||
|
|
||||||
|
+#ifdef __FreeBSD__
|
||||||
|
+#ifdef __x86_64__
|
||||||
|
+void CDECL kqemu_tss_workaround(void);
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#endif /* KQEMU_KERNEL_H */
|
Loading…
Add table
Reference in a new issue