mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Qemu support for PPC
@ 2003-04-07  2:40 Rusty Russell
  2003-04-07  2:29 ` Paul Mackerras
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Rusty Russell @ 2003-04-07  2:40 UTC (permalink / raw)
  To: Fabrice Bellard; +Cc: linux-kernel, paulus, Marcelo Tosatti

Paul, is this OK?

I'd like it in 2.4.21 if possible.

Thanks,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: Qemu Kernel Patch for PPC
Author: Rusty Russell
Status: Tested on 2.4.21-pre6

D: Allow (0.1.5 or above) qemu to set the personality for emulation,
D: so files in /usr/gnemul/x86-linux get looked up before normal files
D: (this is the standard way of hooking in emulation libraries, etc).

diff -urpN --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.4.21-pre6/Documentation/Configure.help working-2.4.21-pre6-wagner/Documentation/Configure.help
--- linux-2.4.21-pre6/Documentation/Configure.help	2003-03-27 12:10:45.000000000 +1100
+++ working-2.4.21-pre6-wagner/Documentation/Configure.help	2003-04-04 17:15:21.000000000 +1000
@@ -4123,6 +4123,19 @@ CONFIG_BINFMT_JAVA
   binaries directly.  Note: this option is obsolete and scheduled for
   removal, use CONFIG_BINFMT_MISC instead.
 
+Kernel support for Linux/Intel ELF binaries
+CONFIG_X86_EMU
+  Say Y here if you want to be able to execute Linux/Intel ELF
+  binaries just like native binaries on your PPC machine. For
+  this to work, you need to have /usr/gnemul/x86-linux populated
+  with Intel libraries. etc.
+
+  You may answer M to compile the emulation support as a module and
+  later load the module when you want to use a Linux/Intel binary. The
+  module will be called x86emu.o.  If unsure, say Y.
+
 Solaris binary emulation
 CONFIG_SOLARIS_EMUL
   This is experimental code which will enable you to run (many)
diff -urpN --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.4.21-pre6/arch/ppc/config.in working-2.4.21-pre6-wagner/arch/ppc/config.in
--- linux-2.4.21-pre6/arch/ppc/config.in	2003-03-27 12:10:49.000000000 +1100
+++ working-2.4.21-pre6-wagner/arch/ppc/config.in	2003-04-04 17:11:48.000000000 +1000
@@ -183,6 +183,7 @@ fi
 define_bool CONFIG_BINFMT_ELF y
 define_bool CONFIG_KERNEL_ELF y
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
+dep_tristate 'Kernel support for Linux/Intel ELF binaries' CONFIG_X86_EMU
 
 source drivers/pci/Config.in
 
diff -urpN --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.4.21-pre6/arch/ppc/kernel/Makefile working-2.4.21-pre6-wagner/arch/ppc/kernel/Makefile
--- linux-2.4.21-pre6/arch/ppc/kernel/Makefile	2003-03-27 12:10:49.000000000 +1100
+++ working-2.4.21-pre6-wagner/arch/ppc/kernel/Makefile	2003-04-04 17:11:16.000000000 +1000
@@ -66,6 +66,7 @@ obj-$(CONFIG_PAL4)		+= indirect_pci.o pc
 obj-$(CONFIG_SPRUCE)		+= indirect_pci.o pci_auto.o todc_time.o
 obj-$(CONFIG_8260)		+= m8260_setup.o ppc8260_pic.o
 obj-$(CONFIG_BOOTX_TEXT)	+= btext.o
+obj-$(CONFIG_X86_EMU)		+= x86emu.o
 
 include $(TOPDIR)/Rules.make
 
diff -urpN --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.4.21-pre6/arch/ppc/kernel/x86emu.c working-2.4.21-pre6-wagner/arch/ppc/kernel/x86emu.c
--- linux-2.4.21-pre6/arch/ppc/kernel/x86emu.c	1970-01-01 10:00:00.000000000 +1000
+++ working-2.4.21-pre6-wagner/arch/ppc/kernel/x86emu.c	2003-04-07 11:44:44.000000000 +1000
@@ -0,0 +1,29 @@
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/personality.h>
+#include <linux/binfmts.h>
+
+struct exec_domain x86_linux_exec_domain = {
+	.name		="X86LINUX",
+	.pers_low	= PER_X86_LINUX & PER_MASK,
+	.pers_high	= PER_X86_LINUX & PER_MASK,
+	.module		= THIS_MODULE
+};
+
+static int init(void)
+{
+	return register_exec_domain(&x86_linux_exec_domain);
+}
+
+static void fini(void)
+{
+	unregister_exec_domain(&x86_linux_exec_domain);
+}
+
+module_init(init);
+module_exit(fini);
+
+MODULE_DESCRIPTION("x86 Linux execution domain");
+MODULE_LICENSE("GPL");
diff -urpN --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.4.21-pre6/include/asm-ppc/namei.h working-2.4.21-pre6-wagner/include/asm-ppc/namei.h
--- linux-2.4.21-pre6/include/asm-ppc/namei.h	2003-03-27 12:11:03.000000000 +1100
+++ working-2.4.21-pre6-wagner/include/asm-ppc/namei.h	2003-04-04 15:15:12.000000000 +1000
@@ -8,12 +8,15 @@
 #ifndef __PPC_NAMEI_H
 #define __PPC_NAMEI_H
 
-/* This dummy routine maybe changed to something useful
- * for /usr/gnemul/ emulation stuff.
- * Look at asm-sparc/namei.h for details.
- */
-
-#define __emul_prefix() NULL
+static inline char *__emul_prefix(void)
+{
+	switch (current->personality) {
+	case (PER_X86_LINUX & PER_MASK):
+		return "usr/gnemul/x86-linux/";
+	default:
+		return NULL;
+	}
+}
 
 #endif /* __PPC_NAMEI_H */
 #endif /* __KERNEL__ */
diff -urpN --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.4.21-pre6/include/linux/personality.h working-2.4.21-pre6-wagner/include/linux/personality.h
--- linux-2.4.21-pre6/include/linux/personality.h	2003-03-18 04:59:22.000000000 +1100
+++ working-2.4.21-pre6-wagner/include/linux/personality.h	2003-04-04 12:14:09.000000000 +1000
@@ -64,6 +64,7 @@ enum {
 	PER_UW7 =		0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
 	PER_HPUX =		0x000f,
 	PER_OSF4 =		0x0010,			 /* OSF/1 v4 */
+	PER_X86_LINUX =		0x0011 | ADDR_LIMIT_32BIT,/* QEMU */
 	PER_MASK =		0x00ff,
 };
 

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [PATCH] Qemu support for PPC
@ 2003-04-07  6:45 Rusty Russell
  2003-04-07  6:56 ` Christoph Hellwig
  2003-04-07 11:21 ` Alan Cox
  0 siblings, 2 replies; 15+ messages in thread
From: Rusty Russell @ 2003-04-07  6:45 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Paul Mackerras, Fabrice Bellard, linux-kernel, Marcelo Tosatti

In <20030407072144.A28096@infradead.org> you wrote:
> On Mon, Apr 07, 2003 at 03:09:37PM +1000, Paul Mackerras wrote:
> > Anyway, it's not your call.
> 
> if you look at MAINTAINERS I'm responsible for personality handling, so
> maybe it actually _is_ my call?

Which simply shows that an entry in the MAINTAINERS file does not a
maintainer make, since your first post showed such misundestanding of
what personalities do, and you've let the 2.4 and 2.5 personality
lists get out of sync.

Qemu could hack it into all the stat, stat64, open, chmod, chown,
link, rename etc. calls in the emulator, yes, but the in-kernel
solution already exists and is far simpler.

> Because stuff should go into 2.5 first.

I happens, though, whatever you may think.  It was done as a 2.4 patch
because there's a tighter time constraint on entry into 2.4.

> And even if it looks trivial there's an important policy decision
> here: do we want to clutter up our personality system for userspace
> emulators?  If you look at the current list of personalities they
> all have kernel implementations

This is not qemu specific, of course.  If you say it's not going in,
then I'll accept that and do the work inside qemu.  It'll be damn
slow, of course.

Thanks,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2003-04-09  2:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-07  2:40 [PATCH] Qemu support for PPC Rusty Russell
2003-04-07  2:29 ` Paul Mackerras
2003-04-07  5:58 ` Christoph Hellwig
2003-04-07  5:09   ` Paul Mackerras
2003-04-07  6:21     ` Christoph Hellwig
2003-04-07  6:05       ` Paul Mackerras
2003-04-07 11:24         ` Alan Cox
2003-04-07 20:41 ` Tom Rini
2003-04-07  6:45 Rusty Russell
2003-04-07  6:56 ` Christoph Hellwig
2003-04-07  8:34   ` Rusty Russell
2003-04-07 12:49     ` Christoph Hellwig
2003-04-08  1:52       ` Rusty Russell
2003-04-07 11:21 ` Alan Cox
2003-04-09  2:07   ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®