From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkBq9-0003al-VX for qemu-devel@nongnu.org; Mon, 20 Apr 2015 09:34:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkBq4-0002JX-Cw for qemu-devel@nongnu.org; Mon, 20 Apr 2015 09:34:21 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:18142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkBq4-0002J3-7v for qemu-devel@nongnu.org; Mon, 20 Apr 2015 09:34:16 -0400 Message-ID: <55350055.1070305@imgtec.com> Date: Mon, 20 Apr 2015 14:34:13 +0100 From: Yongbok Kim MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] running 64 bit user mode program on 32 bit host machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org" Cc: Riku Voipio , Leon Alrae , Richard Henderson Hi All, I have faced a problem to run a simple 64 bit Linux user mode=20 application on 32 bit Linux host machines. I did some investigation and found out that the TARGET_ELF_PAGESTART=20 macro in the linux-user/elfload.c is causing the problem. However I am not sure if this is the right solution as I am not familiar=20 with the area. Perhaps the macro should take care of target=E2=80=99s bits width rather = than=20 just use unsigned long. Would you please confirm the change or suggest better solution? Regards, Yongbok $ ../masterbin/mips64-linux-user/qemu-mips64 -cpu MIPS64R6-generic=20 ./hello_linux.elf qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (core dumped) $ git diff diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 399c021..d99a43b 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1227,7 +1227,7 @@ struct exec /* Necessary parameters */ #define TARGET_ELF_EXEC_PAGESIZE TARGET_PAGE_SIZE -#define TARGET_ELF_PAGESTART(_v) ((_v) & ~(unsigned=20 long)(TARGET_ELF_EXEC_PAGESIZE-1)) +#define TARGET_ELF_PAGESTART(_v) ((_v) &=20 ~(abi_ulong)(TARGET_ELF_EXEC_PAGESIZE-1)) #define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1)) #define DLINFO_ITEMS 14 (END) WITH the change: $ ../masterbin/mips64-linux-user/qemu-mips64 -cpu MIPS64R6-generic=20 ./hello_linux.elf Hello World!