From patchwork Sun Oct 11 16:57:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksej Saushev X-Patchwork-Id: 35711 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 220BCB7088 for ; Mon, 12 Oct 2009 03:58:51 +1100 (EST) Received: from localhost ([127.0.0.1]:48360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mx1kt-0001tb-VB for incoming@patchwork.ozlabs.org; Sun, 11 Oct 2009 12:58:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mx1jZ-0001Rz-Sm for qemu-devel@nongnu.org; Sun, 11 Oct 2009 12:57:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mx1jX-0001QN-T8 for qemu-devel@nongnu.org; Sun, 11 Oct 2009 12:57:25 -0400 Received: from [199.232.76.173] (port=55481 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mx1jX-0001QG-Kv for qemu-devel@nongnu.org; Sun, 11 Oct 2009 12:57:23 -0400 Received: from mx30.mail.ru ([94.100.176.44]:64379) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mx1jW-0000Kk-On for qemu-devel@nongnu.org; Sun, 11 Oct 2009 12:57:23 -0400 Received: from [83.237.166.229] (port=47807 helo=asau.local) by mx30.mail.ru with asmtp id 1Mx1jR-0008QJ-00 for qemu-devel@nongnu.org; Sun, 11 Oct 2009 20:57:17 +0400 From: Aleksej Saushev To: qemu-devel@nongnu.org Date: Sun, 11 Oct 2009 20:57:14 +0400 Message-ID: <87iqelzx5h.fsf@inbox.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (berkeley-unix) MIME-Version: 1.0 X-Spam: Not detected X-Mras: Ok X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [diff] BSD support (NetBSD, FreeBSD, Dragonfly) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hello! qemu 0.11.0 doesn't build on NetBSD out of the box, it doesn't on FreeBSD and Dragonfly either. --- exec.c.orig 2009-09-23 23:01:32.000000000 +0400 +++ exec.c 2009-09-30 14:03:55.000000000 +0400 @@ -464,7 +464,7 @@ exit(1); } } -#elif defined(__FreeBSD__) || defined(__DragonFly__) +#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) { int flags; void *addr = NULL; --- osdep.c.orig 2009-09-23 23:01:32.000000000 +0400 +++ osdep.c 2009-09-30 14:05:39.000000000 +0400 @@ -110,7 +110,7 @@ void *ptr; /* no need (?) for a dummy file on OpenBSD/FreeBSD */ -#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) int map_anon = MAP_ANON; #else int map_anon = 0; @@ -181,7 +181,7 @@ } size = (size + 4095) & ~4095; ftruncate(phys_ram_fd, phys_ram_size + size); -#endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__) */ +#endif /* !(__OpenBSD__ || __FreeBSD__ || __DragonFly__ || __NetBSD__) */ ptr = mmap(NULL, size, PROT_WRITE | PROT_READ, map_anon | MAP_SHARED, --- vl.c.orig 2009-09-23 23:01:32.000000000 +0400 +++ vl.c 2009-09-30 14:10:21.000000000 +0400 @@ -567,7 +567,7 @@ { use_rt_clock = 0; #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \ - || defined(__DragonFly__) + || defined(__DragonFly__) || defined(__NetBSD__) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { @@ -580,7 +580,7 @@ static int64_t get_clock(void) { #if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \ - || defined(__DragonFly__) + || defined(__DragonFly__) || defined(__NetBSD__) if (use_rt_clock) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); --- cpu-exec.c.orig 2009-09-23 23:01:32.000000000 +0400 +++ cpu-exec.c 2009-09-30 14:18:16.000000000 +0400 @@ -1247,6 +1247,20 @@ # define TRAP_sig(context) ((context)->uc_mcontext->es.trapno) # define ERROR_sig(context) ((context)->uc_mcontext->es.err) # define MASK_sig(context) ((context)->uc_sigmask) +#elif defined (__NetBSD__) +# include + +# define EIP_sig(context) ((context)->uc_mcontext.__gregs[_REG_EIP]) +# define TRAP_sig(context) ((context)->uc_mcontext.__gregs[_REG_TRAPNO]) +# define ERROR_sig(context) ((context)->uc_mcontext.__gregs[_REG_ERR]) +# define MASK_sig(context) ((context)->uc_sigmask) +#elif defined (__FreeBSD__) || defined(__DragonFly__) +# include + +# define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext.mc_eip)) +# define TRAP_sig(context) ((context)->uc_mcontext.mc_trapno) +# define ERROR_sig(context) ((context)->uc_mcontext.mc_err) +# define MASK_sig(context) ((context)->uc_sigmask) #elif defined(__OpenBSD__) # define EIP_sig(context) ((context)->sc_eip) # define TRAP_sig(context) ((context)->sc_trapno) @@ -1263,7 +1277,9 @@ void *puc) { siginfo_t *info = pinfo; -#if defined(__OpenBSD__) +#if defined(__NetBSD__) || defined (__FreeBSD__) || defined(__DragonFly__) + ucontext_t *uc = puc; +#elif defined(__OpenBSD__) struct sigcontext *uc = puc; #else struct ucontext *uc = puc;