From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K1QU0-0008S4-FN for qemu-devel@nongnu.org; Wed, 28 May 2008 14:34:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K1QTz-0008Rs-0e for qemu-devel@nongnu.org; Wed, 28 May 2008 14:34:43 -0400 Received: from [199.232.76.173] (port=34128 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K1QTy-0008Rp-RE for qemu-devel@nongnu.org; Wed, 28 May 2008 14:34:42 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:42067) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K1QTy-0006QO-AY for qemu-devel@nongnu.org; Wed, 28 May 2008 14:34:42 -0400 Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate03.web.de (Postfix) with ESMTP id 07276DD16B85 for ; Wed, 28 May 2008 20:34:41 +0200 (CEST) Received: from [88.64.30.248] (helo=[192.168.1.198]) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1K1QTt-0005ud-00 for qemu-devel@nongnu.org; Wed, 28 May 2008 20:34:37 +0200 Message-ID: <483DA5B9.4010002@web.de> Date: Wed, 28 May 2008 20:34:33 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <483C3D55.2000508@siemens.com> <483C8705.307@bellard.org> <483D81FA.5070202@siemens.com> <483D8A2E.5070907@bellard.org> <483D8E9A.40509@siemens.com> In-Reply-To: <483D8E9A.40509@siemens.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9E5A97448C0AD4001B5FB404" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: KQEMU code organization Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9E5A97448C0AD4001B5FB404 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Jan Kiszka wrote: > Fabrice Bellard wrote: >> Jan Kiszka wrote: >>> Fabrice Bellard wrote: >>>> Jan Kiszka wrote: >>>>> Hi, >>>>> >>>>> is there a technical reason why the kqemu kernel module is built ou= t of >>>>> a binary blob (monitor-image.bin->monitor-image.h)? Does this simpl= y >>>>> date back to the time when wrapper and core were distributed under >>>>> different licenses? >>>> This is a technical reason: the "blob" is run in an address space >>>> different from the host kernel. >>> Well, easy to claim, I know, but I don't think this is a hard reason.= >>> However, as overcoming genmon and genoffset may require quite some >>> refactoring, I'm not sure if it's worth it. >> I may change the monitor blob format to ELF to allow relocation, but t= he >> idea stays the same, and I don't think you can do it another way... >=20 > I agree (from my current knowledge of the problem) that the monitor > remains "foreign" code to the kernel module. But at least the > repackaging into a c-structure should be unnecessary. >=20 > The offset generation can be skipped if the assembly files are converte= d > into inline assembly. Might be tricky in some cases, but I see no > show-stopper yet. >=20 > The give it a tiny start, I will look if I can unify the build process > for all "true" kernel components. That is what currently breaks the > debugability of the driver frame (up to kernel2monitor), and which also= > causes a kbuild warning. Likely harmless ATM, but it is fragile on > long-term. Here we go. Still not nice (I would put all monitor code in its own directory, moving those few host kernel bits into the top-level dir), but at least much cleaner from kbuild's POV. Signed-off-by: Jan Kiszka --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) Index: b/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ ifdef CONFIG_KBUILD26 all: kqemu.ko =20 kqemu.ko: - make -C common all + make -C common monitor-image.h make -C $(KERNEL_PATH) M=3D`pwd` modules =20 else @@ -38,7 +38,8 @@ endif # !CONFIG_WIN32 =20 clean: $(MAKE) -C common clean - rm -f kqemu.ko *.o *~ + rm -rf kqemu.ko *.o *~ .kqemu* Module.* modules.order kqemu.mod.c .tmp_= versions \ + common/.kernel* common/*/.kernel* =20 FILES=3Dconfigure Makefile README Changelog LICENSE COPYING \ install.sh kqemu-linux.c kqemu.h \ @@ -89,10 +90,10 @@ kqemu.o: $(kqemu-objs) else # called from 2.6 kernel kbuild =20 -obj-m:=3D kqemu.o -kqemu-objs:=3D kqemu-linux.o kqemu-mod.o +EXTRA_AFLAGS=3D-I $(PWD)/common +EXTRA_CFLAGS=3D-I $(PWD) =20 -$(obj)/kqemu-mod.o: $(src)/kqemu-mod-$(ARCH).o - cp $< $@ +obj-m:=3D kqemu.o +kqemu-objs:=3D kqemu-linux.o common/kernel.o common/$(ARCH)/kernel_asm.o= endif endif # PATCHLEVEL BTW, there is more trouble ahead for kqemu. This is what I get booting a = x86-64 OpenSuse 10.3 image on a 64-bit platform: RAX=3Dffff810001008220 RBX=3Dffff81002f88a160 RCX=3D0000000000000036 RDX=3D= 0000000000000000 RSI=3Dffffe20000065aa0 RDI=3Dffff81002f88a164 RBP=3Dffff81002df99e68 RSP=3D= ffff81002df99e68 R8 =3D0000000000000000 R9 =3D0000000000000000 R10=3Dffff81002df99db8 R11=3D= 0000000000010246 R12=3Dffff81002f88a164 R13=3D0000000000000004 R14=3Dffff81002f4a6b10 R15=3D= ffff81002df99f58 RIP=3Dffffffff80447515 RFL=3D00010246 [---Z-P-] CPL=3D0 II=3D0 A20=3D1 SM= M=3D0 HLT=3D0 ES =3D0000 0000000000000000 00000000 00000000 CS =3D0010 0000000000000000 ffffffff 00a09b00 SS =3D0000 0000000000000000 ffffffff 00c09300 DS =3D0000 0000000000000000 00000000 00000000 FS =3D0000 0000000000000000 00000000 00000000 GS =3D0000 ffffffff8059b000 00000000 00000000 LDT=3D0000 0000000000000000 00000000 00008000 TR =3D0040 ffff81000101c280 00002087 00008900 GDT=3D ffffffff8061e000 00000080 IDT=3D ffffffff8067f000 00000fff CR0=3D8005003b CR2=3D00007fff4183bf70 CR3=3D000000002e8a7000 CR4=3D000006= a0 Unsupported return value: 0xffffffff Kernel log says kqemu: aborting: Unexpected exception 0x0d in monitor space err=3D0000 CS:EIP=3Df180:00000000f0001f6f SS:SP=3D0000:00000000f00c6e20= with the official kqemu and, interestingly, kqemu: aborting: mon_get_ptel_l3() failed with Ben's repos. Jan --------------enig9E5A97448C0AD4001B5FB404 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFIPaW8niDOoMHTA+kRArIxAJ0TvA+gq+MNkT95aLzTwhfT1yWU8wCeKPHb fWr6eg5o9/lnHGw6b41Pxlw= =15yd -----END PGP SIGNATURE----- --------------enig9E5A97448C0AD4001B5FB404--