From patchwork Sun May 10 22:44:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 470564 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4EC1E140187 for ; Mon, 11 May 2015 08:44:57 +1000 (AEST) Received: from localhost ([::1]:34735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrZxv-0003xO-FH for incoming@patchwork.ozlabs.org; Sun, 10 May 2015 18:44:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrZxb-0003Ye-OA for qemu-devel@nongnu.org; Sun, 10 May 2015 18:44:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrZxW-0003us-OB for qemu-devel@nongnu.org; Sun, 10 May 2015 18:44:35 -0400 Received: from blu004-omc1s31.hotmail.com ([65.55.116.42]:60870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrZxW-0003um-Jp for qemu-devel@nongnu.org; Sun, 10 May 2015 18:44:30 -0400 Received: from BLU436-SMTP238 ([65.55.116.7]) by BLU004-OMC1S31.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Sun, 10 May 2015 15:44:30 -0700 X-TMN: [PUzG5sYHCwyNbTfrMWsCuxnnMbV11G5R] X-Originating-Email: [xili_gchen_5257@hotmail.com] Message-ID: Date: Mon, 11 May 2015 06:44:55 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Peter Maydell , =?UTF-8?B?QW5kcmVhcyBGw6RyYg==?= =?UTF-8?B?ZXI=?= , "rth@twiddle.net" , Chris Metcalf References: In-Reply-To: X-OriginalArrivalTime: 10 May 2015 22:44:29.0033 (UTC) FILETIME=[DFC24D90:01D08B72] X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 65.55.116.42 Cc: "walt@tilera.com" , Riku Voipio , qemu-devel Subject: [Qemu-devel] [PATCH 08/10 v10] target-tilegx: Add helper features for linux-user X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add several helpers for translation. Signed-off-by: Chen Gang --- target-tilegx/helper.c | 41 +++++++++++++++++++++++++++++++++++++++++ target-tilegx/helper.h | 3 +++ 2 files changed, 44 insertions(+) create mode 100644 target-tilegx/helper.c create mode 100644 target-tilegx/helper.h diff --git a/target-tilegx/helper.c b/target-tilegx/helper.c new file mode 100644 index 0000000..5fc53a8 --- /dev/null +++ b/target-tilegx/helper.c @@ -0,0 +1,41 @@ +/* + * QEMU TILE-Gx helpers + * + * Copyright (c) 2015 Chen Gang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see + * + */ + +#include "cpu.h" +#include "qemu-common.h" +#include "exec/helper-proto.h" + +void helper_exception(CPUTLGState *env, uint32_t excp) +{ + CPUState *cs = CPU(tilegx_env_get_cpu(env)); + + cs->exception_index = excp; + cpu_loop_exit(cs); +} + +uint64_t helper_cntlz(uint64_t arg) +{ + return clz64(arg); +} + +uint64_t helper_cnttz(uint64_t arg) +{ + return ctz64(arg); +} diff --git a/target-tilegx/helper.h b/target-tilegx/helper.h new file mode 100644 index 0000000..15f841f --- /dev/null +++ b/target-tilegx/helper.h @@ -0,0 +1,3 @@ +DEF_HELPER_2(exception, noreturn, env, i32) +DEF_HELPER_FLAGS_1(cntlz, TCG_CALL_NO_RWG_SE, i64, i64) +DEF_HELPER_FLAGS_1(cnttz, TCG_CALL_NO_RWG_SE, i64, i64)