qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC, PATCH] Support for loading 32 bit ELF files for 64 bi


From: Blue Swirl
Subject: [Qemu-devel] [RFC, PATCH] Support for loading 32 bit ELF files for 64 bit linux-user
Date: Sun, 7 Oct 2007 15:45:59 +0300

Hi,

This patch adds support for loading a 32 bit ELF file in the 64 bit
user mode emulator. This means that qemu-sparc64 can be used to
execute 32 bit ELF files containing V9 instructions (SPARC32PLUS).
This format is used by Solaris/Sparc and maybe by Debian in the
future.

Other targets shouldn't be affected, but I have done only compile
testing. Any comments?

$ cat helloworld.c
#define __KERNEL__
#include <asm/unistd.h>
static int errno;
static __inline__ _syscall1(void,exit,int,exitval)
static inline _syscall3(int,write,int,fd,const char *,buf,long,count)

int _start()
{
  write(2, "Hello World!\n", sizeof("Hello World!\n"));
  exit(0);
}
$ gcc -o helloworld.sparc32plus helloworld.c -g -Wa,-xarch=v9b -Wa,-32
-m32 -mcpu=ultrasparc -static -nostdlib
$ file helloworld.sparc32plus
helloworld.sparc32plus: ELF 32-bit MSB executable, SPARC32PLUS, V8+
Required, version 1 (SYSV), statically linked, not stripped
$ ./qemu-sparc64 ./helloworld.sparc32plus
Hello World!

Attachment: elfload_32_and_64.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]