From patchwork Tue Apr 25 03:18:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 9697491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 44256603F2 for ; Tue, 25 Apr 2017 03:19:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4063628415 for ; Tue, 25 Apr 2017 03:19:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23DE3284E5; Tue, 25 Apr 2017 03:19:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0187428415 for ; Tue, 25 Apr 2017 03:19:09 +0000 (UTC) Received: from localhost ([::1]:46848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2r0P-0004Kf-13 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Apr 2017 23:19:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2qzo-0004JQ-MH for qemu-devel@nongnu.org; Mon, 24 Apr 2017 23:18:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2qzk-0003RB-In for qemu-devel@nongnu.org; Mon, 24 Apr 2017 23:18:32 -0400 Received: from mail-io0-x242.google.com ([2607:f8b0:4001:c06::242]:35330) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d2qzk-0003Qz-DQ for qemu-devel@nongnu.org; Mon, 24 Apr 2017 23:18:28 -0400 Received: by mail-io0-x242.google.com with SMTP id d203so52470001iof.2 for ; Mon, 24 Apr 2017 20:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:message-id:cc:content-transfer-encoding:from:subject :date:to; bh=STgk3tph5WDxjL3Vmp6FUd9ABRAQIOYC6ZmBUZqMouc=; b=MW3/BEXFXst31ttxfmjHznqp0T4KCmWcgsaGKjfcU0sAp93+r67JaO63KnUS3Z4bgw JSqt6cQCsmn0d7CXaUS3MsYPTwVhpTbr/TY/lypky6dJeDU1s/RFljseIjEcammVvjwb kE5lx2tgMTftSLZ/1+Ec9FVubHseg1FW/MWGZ/iC76xKYCcKycv+ulZdTzDDI/Z/xLMq NWjCNB3H7cedTFbb6qM8EUE8VIhPyUBrACp5fWfQePH8coe6dHgiGmaI6ldz3qwv+Qfr lK5S5SaU8HY82EjgJy4z1u7J7UJ191fAJI7LeIlY77djCtrITe43SOCVoC40lHKqA00M 87Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:message-id:cc :content-transfer-encoding:from:subject:date:to; bh=STgk3tph5WDxjL3Vmp6FUd9ABRAQIOYC6ZmBUZqMouc=; b=E1BaGXNKObP6s7/NZbRHO9/kMqQE7YQDzjCjkT0+SSwQM29R4PA1/2Gr6o1KzXtl77 PFp0wY1fMux7CORpNQcSG+KqSM117Hjckle5yc+UfBFWBaaDJYSGDU2wzBcbG6+qDKxF mqJ/P1d6/Kmsi6pasGHntkum9hYJOZSztfAIZTE5ULdDHWgjoCk4QVHjSZyuFUtZjwfe +UsMEp8HWlN62RLDibJqWkROx2e5BnWR0Uw/BsrZ+ILmbIxEhT3fbcVan02NsM888j6B 6zLBTpY36jLV7ajyge9tzGFA42X7Q73jrj9DJrOjHuM4r5TJnjD9yQntYUTKjC1ywfQl sjfg== X-Gm-Message-State: AN3rC/44Q2y5NzEhgz1+vf/TK+/32T+BbV5xmLbeaD4ZoN/x02gkeyw5 AR/7UWNenrfhUA== X-Received: by 10.107.138.7 with SMTP id m7mr11046263iod.133.1493090307804; Mon, 24 Apr 2017 20:18:27 -0700 (PDT) Received: from [192.168.0.4] (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id m83sm8978586ioi.32.2017.04.24.20.18.26 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 24 Apr 2017 20:18:27 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v753.1) Message-Id: <8366F7D4-6288-406E-8C64-2FE3777FC0C3@gmail.com> From: G 3 Date: Mon, 24 Apr 2017 23:18:25 -0400 To: Peter Maydell X-Mailer: Apple Mail (2.753.1) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::242 Subject: [Qemu-devel] [PATCH 2/9] Add risu_ppc.c file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org qemu-devel" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add the risu_ppc.c file. It defines several functions used by risu. Signed-off-by: John Arbuckle --- risu_ppc.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 risu_ppc.c diff --git a/risu_ppc.c b/risu_ppc.c new file mode 100644 index 0000000..70a1cf7 --- /dev/null +++ b/risu_ppc.c @@ -0,0 +1,41 @@ +/***************************************************************** + * File: risu_ppc.c + * Date: 3-27-2017 + * Description: Implement advance_pc(), set_ucontext_paramreg(), + * get_reginfo_paramreg(), get_risuop() + *****************************************************************/ + +#include "risu.h" + +/* Advances the program counter register to the next instruction */ +void advance_pc(void *vuc) +{ + ucontext_t *uc = (ucontext_t*)vuc; + uc->uc_mcontext->ss.srr0 += 4; +} + +/* Sets register r0 to the address of a memory block. */ +void set_ucontext_paramreg(void *vuc, uint64_t value) +{ + ucontext_t *uc = vuc; + uc->uc_mcontext->ss.r0 = value; +} + +/* + * Returns the register that keeps track of a memory block address. + * Used for the load and store to memory instructions like LFD. + * Returns general purpose register r0. + */ +uint64_t get_reginfo_paramreg(struct reginfo *ri) +{ + return ri->gpr[0]; +} + +int get_risuop(struct reginfo *ri) +{ + uint32_t insn = ri->faulting_insn; + uint32_t op = insn & 0xf; + uint32_t key = insn & ~0xf; + uint32_t risukey = 0x00005af0; + return (key != risukey) ? -1 : op; +}