From b200372c08a04c0b2e131c705b6e7439b3f675f4 Mon Sep 17 00:00:00 2001 From: rafael2k Date: Tue, 29 Apr 2008 04:27:46 +0000 Subject: kqemu patch git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@1849 370017ae-e619-0410-ac65-c121f96126d4 --- app/emulation/kqemu/kqemu-1.3.0.diff | 56 ++++++++++++++++++++++++++++++++++++ app/emulation/kqemu/kqemu.SlackBuild | 6 ++++ 2 files changed, 62 insertions(+) create mode 100644 app/emulation/kqemu/kqemu-1.3.0.diff (limited to 'app/emulation') diff --git a/app/emulation/kqemu/kqemu-1.3.0.diff b/app/emulation/kqemu/kqemu-1.3.0.diff new file mode 100644 index 00000000..dcf343a7 --- /dev/null +++ b/app/emulation/kqemu/kqemu-1.3.0.diff @@ -0,0 +1,56 @@ +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 + +--- xx/kqemu-1.3.0pre11/common/monitor.c Tue Feb 6 23:02:00 2007 ++++ kqemu-1.3.0pre11/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; + } diff --git a/app/emulation/kqemu/kqemu.SlackBuild b/app/emulation/kqemu/kqemu.SlackBuild index d86ab889..5fbec183 100755 --- a/app/emulation/kqemu/kqemu.SlackBuild +++ b/app/emulation/kqemu/kqemu.SlackBuild @@ -107,6 +107,12 @@ tar xvf $SOURCE -C $PKG_SRC || exit $ERROR_TAR PKG_DIR="$PKG_SRC/$( ls $PKG_SRC/ )" cd $PKG_DIR +# aplicando o patch para o kqemu +if [ -f "$CWD/kqemu-$VERSION.diff" ]; then + patch -p1 < $CWD/kqemu-$VERSION.diff || exit $ERROR_PATCH +fi + + # -------------- Configura programa --------------------- # Configura programa CFLAGS="$SLKCFLAGS" ./configure --prefix=$PREFIX --libdir=$LIBDIR $OPTCONF || exit $ERROR_CONF -- cgit v1.2.3