From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FfF68-0000UD-2I for qemu-devel@nongnu.org; Sun, 14 May 2006 07:49:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FfF66-0000Tp-I2 for qemu-devel@nongnu.org; Sun, 14 May 2006 07:49:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FfF66-0000Tm-FC for qemu-devel@nongnu.org; Sun, 14 May 2006 07:49:18 -0400 Received: from [84.96.92.55] (helo=smtP.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FfF8H-0001do-5z for qemu-devel@nongnu.org; Sun, 14 May 2006 07:51:33 -0400 Received: from [84.102.211.51] by sp604004mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0IZ900C317H3A090@sp604004mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Sun, 14 May 2006 13:48:40 +0200 (CEST) Date: Sun, 14 May 2006 13:48:04 +0200 From: Fabrice Bellard Subject: Re: [Qemu-devel][PATCH]Get machine name from name of executable In-reply-to: <44670987.1030203@mail.berlios.de> Message-id: <446718F4.9080400@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <44670987.1030203@mail.berlios.de> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: weil@mail.berlios.de Cc: qemu-devel@nongnu.org Hi, The long term plan for qemu is to have a single executable for all machines. If you make a single executable for mips and mipsel, it is better to select the endianness in the code of the machine itself when initializing the CPU. Regards, Fabrice. Stefan Weil wrote: > Today, QEMU allows machine selection using command line option -M. > Without this option, it will always take the first machine > for the given target architecture. > > With my patch, QEMU first parses the name of the executable. > The string after the last '-' is interpreted as machine name. > If this machine does not exist, the first machine is taken, > so the new QEMU remains compatible with the old behaviour. > > With this patch, an installation might link e.g. qemu-system-arm > to qemu-system-arm-integratorcp926, and running > qemu-system-arm-integratorcp926 > will automatically select machine integratorcp926. > > My goal is a MIPS emulation which supports big and little endian mode > in the same executable (like the real hardware). qemu-system-mipsel > would be a symbolic link to qemu-system-mips and enable little endian mode. > > I propose another code modification: instead of registration of all > machines > in vl.c, vl.c might call a target procedure which does this registration. > So if MIPS, ARM or other targets add machines, vl.c would not change. > Example: vl.c calls qemu_register_mips_machines() which calls > qemu_register_machine(&mips_machine). > > Regards, > Stefan > > > --- vl.c 3 May 2006 22:02:44 -0000 1.185 > +++ vl.c 12 May 2006 20:19:15 -0000 > @@ -4252,7 +4254,7 @@ > return 0; > } > > -QEMUMachine *find_machine(const char *name) > +static QEMUMachine *find_machine(const char *name) > { > QEMUMachine *m; > > @@ -5075,7 +5077,14 @@ > mallopt(M_MMAP_THRESHOLD, 4096 * 1024); > #endif > register_machines(); > + machine = 0; > + optarg = strrchr(argv[0], '-'); > + if (optarg != 0) { > + machine = find_machine(optarg + 1); > + } > + if (!machine) { > machine = first_machine; > + } > initrd_filename = NULL; > for(i = 0; i < MAX_FD; i++) > fd_filename[i] = NULL; > > > > _______________________________________________ > Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel > >