Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Sep 2014 09:51:04 +0000 (UTC)
From:      Juergen Lock <nox@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r368631 - in head/emulators/kqemu-kmod-devel: . files
Message-ID:  <201409200951.s8K9p4Bx000224@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nox
Date: Sat Sep 20 09:51:04 2014
New Revision: 368631
URL: http://svnweb.freebsd.org/changeset/ports/368631
QAT: https://qat.redports.org/buildarchive/r368631/

Log:
  - Finally import syrinx' fix for 10.0+, it seems to work no worse
    than kqemu worked before. [1]
  - Fix build on 10/i386.
  
  PR:		184984 [1]
  Submitted by:	syrinx [1]

Added:
  head/emulators/kqemu-kmod-devel/files/patch-z-common-kernel.c   (contents, props changed)
  head/emulators/kqemu-kmod-devel/files/patch-z-kqemu-freebsd.c   (contents, props changed)
Modified:
  head/emulators/kqemu-kmod-devel/Makefile

Modified: head/emulators/kqemu-kmod-devel/Makefile
==============================================================================
--- head/emulators/kqemu-kmod-devel/Makefile	Sat Sep 20 09:45:04 2014	(r368630)
+++ head/emulators/kqemu-kmod-devel/Makefile	Sat Sep 20 09:51:04 2014	(r368631)
@@ -50,11 +50,6 @@ MAKE_CMD_ARGS+=	ARCH=x86_64
 
 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:
 # Apply extra patches from the qemu-devel list; in the unlikely case that
 # these cause regressions please define WITHOUT_EXTRA_PATCHES and post

Added: head/emulators/kqemu-kmod-devel/files/patch-z-common-kernel.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/kqemu-kmod-devel/files/patch-z-common-kernel.c	Sat Sep 20 09:51:04 2014	(r368631)
@@ -0,0 +1,63 @@
+--- 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) = 

Added: head/emulators/kqemu-kmod-devel/files/patch-z-kqemu-freebsd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/emulators/kqemu-kmod-devel/files/patch-z-kqemu-freebsd.c	Sat Sep 20 09:51:04 2014	(r368631)
@@ -0,0 +1,44 @@
+--- 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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409200951.s8K9p4Bx000224>