From nobody Fri May 3 14:08:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561566207; cv=none; d=zoho.com; s=zohoarc; b=QXoMs3TOTu+4XpMRkB8s3xO1GmWVmgnf3li0u5HrfE4THrOZBgUn4HhifmltbMfxIc8DYkZR+zyUPzWsX3YP0vU+1+1WciIeyRRJfzLQegWQS0eBO2DhEFYClxbaBCiIYuNnGrJbRrI7xrhEXsfmYFca5GomKYEYPF6n4YLBLf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561566207; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hKB1hSG3v06DCw2EBob7juLfgig4/TmPqzvhVa+woGc=; b=hMS8BgPd2ihRaQn8C3tqe3vwgrGWtmJ5+yWzVhLzeCpZ4PCEQFEx4vSuUSwXNmzw1mzlNpB7RnxvfW+5M8JVJ9fckOHblIfIu0kmh4VuDWLxfM6IxR2du0ehz0Au33aAWowPymauKYHWk6MDAn8Q4cVGXT0bnB87Zufs9oEKB00= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561566207132973.3279551211781; Wed, 26 Jun 2019 09:23:27 -0700 (PDT) Received: from localhost ([::1]:41778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgAhg-0006eO-8C for importer@patchew.org; Wed, 26 Jun 2019 12:23:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55808) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgAfs-0005ad-4P for qemu-devel@nongnu.org; Wed, 26 Jun 2019 12:21:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgAfq-0006nb-2I for qemu-devel@nongnu.org; Wed, 26 Jun 2019 12:21:32 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:48575) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hgAfp-0006gG-Ok for qemu-devel@nongnu.org; Wed, 26 Jun 2019 12:21:29 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MG9c2-1hnspF0n1w-00GYQ5; Wed, 26 Jun 2019 18:21:09 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 26 Jun 2019 18:20:58 +0200 Message-Id: <20190626162100.24774-2-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190626162100.24774-1-laurent@vivier.eu> References: <20190626162100.24774-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:tHpE2TGhZyegXH1arIg25W/5J/pvplOjvArWH8Il02t/6e6EnoG KMEA7Ny6UhXiBvHUBs1q9x5ourmI2abrTdoDUcpZAtBoNQKMJktPc2wZ956iHC7YKwHHCuZ neaXDayAlF18bDTwYejzqi4Ki/ZziWL2EixCNA5/FLYU6EBod1AapSvYL5gqMKaHd+7C8YP 53V3DFN/CZZYMpuBV2S0g== X-UI-Out-Filterresults: notjunk:1;V03:K0:pPNZbaz7G7E=:nxDDdc5PnLO5TLaNQPatFT z105sJ1lVbg2tz6vLBTl5CAUccn/YVHnNbLv9B/ZuA136pcbYSbSbxJlIbeqx27HXP7V4md5S E2HC6Ar+FKnxAKMyqW0mtGesNNxsPHk0wanLMJC8lmAhYRRQZWICgQ2LrTD4UdQiHFHGqwiPw EPyx3eTwtAPmBIZfXkU/uwGCzzhgIfkcZ83XRFVOOuwdD/HMlV4mO2fxDKsRB1VibrTUcSlSN DiD6WizC49d1yTq9UncRhRK4Mq3AE3UiJg7FBJ5Quy1wFVCDzDDRGWcR13+lAIi+wnhCuFmQB yAM+bNxaaUTeMM4Ug7Krk2PzJzti1SsR6yEQzqAR5YRLw/43M5+5auIOTxiDKgCW4DWeHmwt8 FdaVTYXBEqPdghpqogIlJDne8BhXYfdN+3QAFr9jLuU9Zy4LtFDI1zn74Xuz3hmAVeHfcWIFC uDoiUbnbG20uvT6c/oPHRsLpIrgApECGn+IKHNyDJvNcYoc3mBnE+1XFYYZnW/dSfHl5fiFeZ anaYUUyinUaEO/nQfajkHCr2uxANOwnauoJGhNukIuZUOmLMBXGNy2JAKxI8hljKl0ZS9IPs/ EomYJynvqoj5pfmlnJL1eRHoExcMIov5besvIIcdPjAWPLsZnwHQCuQMb5NLNYBuCoaqPwIJ0 nbtjmyZuhcsgXQLVWFS814iFdFdboQ7jEBS6DNNEzbjjJgH5TNzxoV6XQ/LMe9Ijs4s+X2pOh QuTduK0V3WNOCyvsnbKI7mwOkaaLDnKpDAOLFg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.10 Subject: [Qemu-devel] [PULL 1/3] The m68k gdbstub SR reg request doesnt include Condition-Codes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , Lucien Murray-Pitts Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Lucien Murray-Pitts The register request via gdbstub would return the SR part which contains the Trace/Master/IRQ state flags, but would be missing the CR (Condition Register) state bits. This fix adds this support by merging them in the m68k specific gdbstub handler m68k_cpu_gdb_read_register for SR register. Signed-off-by: Lucien Murray-Pitts Reviewed-by: Laurent Vivier Message-Id: <20190609105154.GA16755@localhost.localdomain> Signed-off-by: Laurent Vivier --- target/m68k/gdbstub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/m68k/gdbstub.c b/target/m68k/gdbstub.c index e6baf0601e..5cad2b658f 100644 --- a/target/m68k/gdbstub.c +++ b/target/m68k/gdbstub.c @@ -35,7 +35,8 @@ int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *mem= _buf, int n) } else { switch (n) { case 16: - return gdb_get_reg32(mem_buf, env->sr); + /* SR is made of SR+CCR, CCR is many 1bit flags so uses helper= */ + return gdb_get_reg32(mem_buf, env->sr | cpu_m68k_get_ccr(env)); case 17: return gdb_get_reg32(mem_buf, env->pc); } --=20 2.21.0 From nobody Fri May 3 14:08:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561566223; cv=none; d=zoho.com; s=zohoarc; b=kwCZ/fIoA8bVUaGRcywrbDqQZC3e6fIyiCQSaHRF660TDinUMJSei9iM/7ButeeR5XnHcPM/juF+uSUMDM+3wJHRKi3XRx8s3slxV36oFh3bb2X1VGnALNA7vZpop4Qn0JfR2D4sU0i5e3X/Gk49YewmaaQcwMYsGJ8+S3XTW2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561566223; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=9R9tniOgMSBIbFj93A+BPfB8Q/1vqOFF1RuocJ1+6bA=; b=n0563FpEcLy3XaSFAhFFyyis0DEBpgq5HxS5172oNT4gf3yE6FEP4JR567WzAhKPz2Q49Yzrc13k9PIeS1/enWh8NsZGQuy+vHWRe+DNWBMkhpMfJNW/W0pZNhyX/PT0aST7xaFA+k3GycI4efCq37bJT2Td4ZKJEWcvmLU08VM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561566223475725.4815876565582; Wed, 26 Jun 2019 09:23:43 -0700 (PDT) Received: from localhost ([::1]:41782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgAhv-00079G-G2 for importer@patchew.org; Wed, 26 Jun 2019 12:23:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55846) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgAfw-0005h0-NZ for qemu-devel@nongnu.org; Wed, 26 Jun 2019 12:21:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgAfp-0006nK-VL for qemu-devel@nongnu.org; Wed, 26 Jun 2019 12:21:36 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:50201) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hgAfn-0006gE-Vx for qemu-devel@nongnu.org; Wed, 26 Jun 2019 12:21:29 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MxmBc-1iVE3H2try-00zH9n; Wed, 26 Jun 2019 18:21:10 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 26 Jun 2019 18:20:59 +0200 Message-Id: <20190626162100.24774-3-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190626162100.24774-1-laurent@vivier.eu> References: <20190626162100.24774-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:HkT2c8+68ggExJ3KAUw6upqQzv45D6qgw2IlFL7QaUdAWyOTaK0 AtqoEOauVnxTaSEWWYNiFpwFvs/yIvyJUcM/9aYL235VwqX3M/jzbE/g/31tfLxHgoseAbb oxX+pM0SqpD8oeQiMyrADjIaXL26QWcoUz96aiwZTs6hruAM34rjKtPBg8kDomG3/IgubzX U2NLVeqqm30Fb30/30bLA== X-UI-Out-Filterresults: notjunk:1;V03:K0:F/Jx8s1RcwY=:wQXpOLFX8gCLG+Jboa91la wIzO4NOEtiOjswkXG4/FlvKSjsFhpBSUgRRg/dB6QPrNPntBfy2gdrnWVxLbROBlcRTzyXqyG WJfuaNyLvoaUlKjND9l4t1upMlVMMgfl2+OPnwFZndwIWg/DdsaCRbedIg0BR5rCsY5czJTwU oAFFXT0VTkAAnQKF8/5UqWpsA+UELNS822Yd/e9BP4mHo7lVMbU6ewNm7IRHWEcb33PCxooxU VRifm1y0xoGPkuGHLaVHhYjayNwOdNk2KQOz3u6SDKUXgv8h9RtVcuqutM3a3M7FzecEzLOYF QCC2pYtDyz5qvHZO1I2zkhp9NWeZwZc84MQIY+9yz226xgRhbPEl08boUOgqdSSg4Nl4EeYQT f9sH/TWPB9RDbwL8B1yoOvw9eoSmaALl3p8HKxLmeInq+Zk/BiOVaWbj3e0wlhzogPPdV032c Izb02/71Ap9ckqxzjiEJDT1H5qmGulhaVRaGOEk2CcmdRtVX/lhtJkoePCDfGOzz/skKBXeIA aoVFqlQjxmHrxTxAY3YOBHjgESzL1+R6ZWPIRMa7/Y1PhuNK936k7kX0j9uyEQ9b/bvJX5BIG yOIHuXkW3bFjRMD2oxkE2AKRXTxw4pV3opgnfKy+/OkTJOxc6Oa7WXPzSZJ6L3uS+6NDC1EnE RM1DFqZWThALhHfXULq2DaolUVpn1zZgsP9UplEw0k3QRlL8HdDTLTkWwK+NenlLOZ3GHtMLe a41JIWqmW5slP78GUdmZagh5p1MyX/ZDRNQYWA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.24 Subject: [Qemu-devel] [PULL 2/3] m68k comments break patch submission due to being incorrectly formatted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier , Lucien Murray-Pitts Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Lucien Murray-Pitts Altering all comments in target/m68k to match Qemu coding styles so that fu= ture patches wont fail due to style breaches. Signed-off-by: Lucien Murray-Pitts Reviewed-by: Laurent Vivier Message-Id: <20190606234125.GA4830@localhost.localdomain> Signed-off-by: Laurent Vivier --- target/m68k/cpu-qom.h | 2 +- target/m68k/cpu.c | 6 +- target/m68k/cpu.h | 29 ++-- target/m68k/fpu_helper.c | 6 +- target/m68k/gdbstub.c | 6 +- target/m68k/helper.c | 16 +- target/m68k/m68k-semi.c | 24 ++- target/m68k/op_helper.c | 58 ++++--- target/m68k/softfloat.c | 181 ++++++++++---------- target/m68k/softfloat.h | 3 +- target/m68k/softfloat_fpsp_tables.h | 3 +- target/m68k/translate.c | 246 ++++++++++++++++++---------- 12 files changed, 353 insertions(+), 227 deletions(-) diff --git a/target/m68k/cpu-qom.h b/target/m68k/cpu-qom.h index 9885bba317..0c157251a2 100644 --- a/target/m68k/cpu-qom.h +++ b/target/m68k/cpu-qom.h @@ -31,7 +31,7 @@ #define M68K_CPU_GET_CLASS(obj) \ OBJECT_GET_CLASS(M68kCPUClass, (obj), TYPE_M68K_CPU) =20 -/** +/* * M68kCPUClass: * @parent_realize: The parent class' realize handler. * @parent_reset: The parent class' reset handler. diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 3d0971d4a2..e6596de29c 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -203,8 +203,10 @@ static void any_cpu_initfn(Object *obj) m68k_set_feature(env, M68K_FEATURE_CF_ISA_APLUSC); m68k_set_feature(env, M68K_FEATURE_BRAL); m68k_set_feature(env, M68K_FEATURE_CF_FPU); - /* MAC and EMAC are mututally exclusive, so pick EMAC. - It's mostly backwards compatible. */ + /* + * MAC and EMAC are mututally exclusive, so pick EMAC. + * It's mostly backwards compatible. + */ m68k_set_feature(env, M68K_FEATURE_CF_EMAC); m68k_set_feature(env, M68K_FEATURE_CF_EMAC_B); m68k_set_feature(env, M68K_FEATURE_USP); diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 5ef200a9fb..20de3c379a 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -106,9 +106,11 @@ typedef struct CPUM68KState { float_status fp_status; =20 uint64_t mactmp; - /* EMAC Hardware deals with 48-bit values composed of one 32-bit and - two 8-bit parts. We store a single 64-bit value and - rearrange/extend this when changing modes. */ + /* + * EMAC Hardware deals with 48-bit values composed of one 32-bit and + * two 8-bit parts. We store a single 64-bit value and + * rearrange/extend this when changing modes. + */ uint64_t macc[4]; uint32_t macsr; uint32_t mac_mask; @@ -146,7 +148,7 @@ typedef struct CPUM68KState { uint32_t features; } CPUM68KState; =20 -/** +/* * M68kCPU: * @env: #CPUM68KState * @@ -171,9 +173,11 @@ int m68k_cpu_gdb_write_register(CPUState *cpu, uint8_t= *buf, int reg); =20 void m68k_tcg_init(void); void m68k_cpu_init_gdb(M68kCPU *cpu); -/* you can call this signal handler from your SIGBUS and SIGSEGV - signal handlers to inform the virtual CPU of exceptions. non zero - is returned if the signal was handled by the virtual CPU. */ +/* + * you can call this signal handler from your SIGBUS and SIGSEGV + * signal handlers to inform the virtual CPU of exceptions. non zero + * is returned if the signal was handled by the virtual CPU. + */ int cpu_m68k_signal_handler(int host_signum, void *pinfo, void *puc); uint32_t cpu_m68k_get_ccr(CPUM68KState *env); @@ -182,7 +186,8 @@ void cpu_m68k_set_sr(CPUM68KState *env, uint32_t); void cpu_m68k_set_fpcr(CPUM68KState *env, uint32_t val); =20 =20 -/* Instead of computing the condition codes after each m68k instruction, +/* + * Instead of computing the condition codes after each m68k instruction, * QEMU just stores one operand (called CC_SRC), the result * (called CC_DEST) and the type of operation (called CC_OP). When the * condition codes are needed, the condition codes can be calculated @@ -447,9 +452,11 @@ void m68k_switch_sp(CPUM68KState *env); =20 void do_m68k_semihosting(CPUM68KState *env, int nr); =20 -/* There are 4 ColdFire core ISA revisions: A, A+, B and C. - Each feature covers the subset of instructions common to the - ISA revisions mentioned. */ +/* + * There are 4 ColdFire core ISA revisions: A, A+, B and C. + * Each feature covers the subset of instructions common to the + * ISA revisions mentioned. + */ =20 enum m68k_features { M68K_FEATURE_M68000, diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index b35489ba4e..9b039c856d 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -25,7 +25,8 @@ #include "exec/cpu_ldst.h" #include "softfloat.h" =20 -/* Undefined offsets may be different on various FPU. +/* + * Undefined offsets may be different on various FPU. * On 68040 they return 0.0 (floatx80_zero) */ =20 @@ -611,7 +612,8 @@ void HELPER(fcos)(CPUM68KState *env, FPReg *res, FPReg = *val) void HELPER(fsincos)(CPUM68KState *env, FPReg *res0, FPReg *res1, FPReg *v= al) { floatx80 a =3D val->d; - /* If res0 and res1 specify the same floating-point data register, + /* + * If res0 and res1 specify the same floating-point data register, * the sine result is stored in the register, and the cosine * result is discarded. */ diff --git a/target/m68k/gdbstub.c b/target/m68k/gdbstub.c index 5cad2b658f..fdc96f57ff 100644 --- a/target/m68k/gdbstub.c +++ b/target/m68k/gdbstub.c @@ -41,8 +41,10 @@ int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *me= m_buf, int n) return gdb_get_reg32(mem_buf, env->pc); } } - /* FP registers not included here because they vary between - ColdFire and m68k. Use XML bits for these. */ + /* + * FP registers not included here because they vary between + * ColdFire and m68k. Use XML bits for these. + */ return 0; } =20 diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 31aacb51c6..ae766a6cb0 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -965,9 +965,11 @@ void HELPER(set_sr)(CPUM68KState *env, uint32_t val) } =20 /* MAC unit. */ -/* FIXME: The MAC unit implementation is a bit of a mess. Some helpers - take values, others take register numbers and manipulate the contents - in-place. */ +/* + * FIXME: The MAC unit implementation is a bit of a mess. Some helpers + * take values, others take register numbers and manipulate the contents + * in-place. + */ void HELPER(mac_move)(CPUM68KState *env, uint32_t dest, uint32_t src) { uint32_t mask; @@ -1047,9 +1049,11 @@ void HELPER(macsats)(CPUM68KState *env, uint32_t acc) if (env->macsr & MACSR_V) { env->macsr |=3D MACSR_PAV0 << acc; if (env->macsr & MACSR_OMC) { - /* The result is saturated to 32 bits, despite overflow occurr= ing - at 48 bits. Seems weird, but that's what the hardware docs - say. */ + /* + * The result is saturated to 32 bits, despite overflow occurr= ing + * at 48 bits. Seems weird, but that's what the hardware docs + * say. + */ result =3D (result >> 63) ^ 0x7fffffff; } } diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c index f97580af83..01627b42c9 100644 --- a/target/m68k/m68k-semi.c +++ b/target/m68k/m68k-semi.c @@ -130,7 +130,8 @@ static void m68k_semi_return_u32(CPUM68KState *env, uin= t32_t ret, uint32_t err) target_ulong args =3D env->dregs[1]; if (put_user_u32(ret, args) || put_user_u32(err, args + 4)) { - /* The m68k semihosting ABI does not provide any way to report this + /* + * The m68k semihosting ABI does not provide any way to report this * error to the guest, so the best we can do is log it in qemu. * It is always a guest error not to pass us a valid argument bloc= k. */ @@ -159,8 +160,10 @@ static void m68k_semi_cb(CPUState *cs, target_ulong re= t, target_ulong err) CPUM68KState *env =3D &cpu->env; =20 if (m68k_semi_is_fseek) { - /* FIXME: We've already lost the high bits of the fseek - return value. */ + /* + * FIXME: We've already lost the high bits of the fseek + * return value. + */ m68k_semi_return_u64(env, ret, err); m68k_semi_is_fseek =3D 0; } else { @@ -168,7 +171,8 @@ static void m68k_semi_cb(CPUState *cs, target_ulong ret= , target_ulong err) } } =20 -/* Read the input value from the argument block; fail the semihosting +/* + * Read the input value from the argument block; fail the semihosting * call if the memory read fails. */ #define GET_ARG(n) do { \ @@ -440,14 +444,18 @@ void do_m68k_semihosting(CPUM68KState *env, int nr) } ts->heap_limit =3D base + size; } - /* This call may happen before we have writable memory, so return - values directly in registers. */ + /* + * This call may happen before we have writable memory, so return + * values directly in registers. + */ env->dregs[1] =3D ts->heap_limit; env->aregs[7] =3D ts->stack_base; } #else - /* FIXME: This is wrong for boards where RAM does not start at - address zero. */ + /* + * FIXME: This is wrong for boards where RAM does not start at + * address zero. + */ env->dregs[1] =3D ram_size; env->aregs[7] =3D ram_size; #endif diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index ebcfe3dfdd..bc4f845e3f 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -494,10 +494,12 @@ bool m68k_cpu_exec_interrupt(CPUState *cs, int interr= upt_request) =20 if (interrupt_request & CPU_INTERRUPT_HARD && ((env->sr & SR_I) >> SR_I_SHIFT) < env->pending_level) { - /* Real hardware gets the interrupt vector via an IACK cycle - at this point. Current emulated hardware doesn't rely on - this, so we provide/save the vector when the interrupt is - first signalled. */ + /* + * Real hardware gets the interrupt vector via an IACK cycle + * at this point. Current emulated hardware doesn't rely on + * this, so we provide/save the vector when the interrupt is + * first signalled. + */ cs->exception_index =3D env->pending_vector; do_interrupt_m68k_hardirq(env); return true; @@ -537,7 +539,8 @@ void HELPER(divuw)(CPUM68KState *env, int destr, uint32= _t den) env->cc_c =3D 0; /* always cleared, even if overflow */ if (quot > 0xffff) { env->cc_v =3D -1; - /* real 68040 keeps N and unset Z on overflow, + /* + * real 68040 keeps N and unset Z on overflow, * whereas documentation says "undefined" */ env->cc_z =3D 1; @@ -564,7 +567,8 @@ void HELPER(divsw)(CPUM68KState *env, int destr, int32_= t den) if (quot !=3D (int16_t)quot) { env->cc_v =3D -1; /* nothing else is modified */ - /* real 68040 keeps N and unset Z on overflow, + /* + * real 68040 keeps N and unset Z on overflow, * whereas documentation says "undefined" */ env->cc_z =3D 1; @@ -647,7 +651,8 @@ void HELPER(divull)(CPUM68KState *env, int numr, int re= gr, uint32_t den) env->cc_c =3D 0; /* always cleared, even if overflow */ if (quot > 0xffffffffULL) { env->cc_v =3D -1; - /* real 68040 keeps N and unset Z on overflow, + /* + * real 68040 keeps N and unset Z on overflow, * whereas documentation says "undefined" */ env->cc_z =3D 1; @@ -681,7 +686,8 @@ void HELPER(divsll)(CPUM68KState *env, int numr, int re= gr, int32_t den) env->cc_c =3D 0; /* always cleared, even if overflow */ if (quot !=3D (int32_t)quot) { env->cc_v =3D -1; - /* real 68040 keeps N and unset Z on overflow, + /* + * real 68040 keeps N and unset Z on overflow, * whereas documentation says "undefined" */ env->cc_z =3D 1; @@ -838,14 +844,18 @@ static struct bf_data bf_prep(uint32_t addr, int32_t = ofs, uint32_t len) addr -=3D 1; } =20 - /* Compute the number of bytes required (minus one) to - satisfy the bitfield. */ + /* + * Compute the number of bytes required (minus one) to + * satisfy the bitfield. + */ blen =3D (bofs + len - 1) / 8; =20 - /* Canonicalize the bit offset for data loaded into a 64-bit big-endian - word. For the cases where BLEN is not a power of 2, adjust ADDR so - that we can use the next power of two sized load without crossing a - page boundary, unless the field itself crosses the boundary. */ + /* + * Canonicalize the bit offset for data loaded into a 64-bit big-endian + * word. For the cases where BLEN is not a power of 2, adjust ADDR so + * that we can use the next power of two sized load without crossing a + * page boundary, unless the field itself crosses the boundary. + */ switch (blen) { case 0: bofs +=3D 56; @@ -937,8 +947,10 @@ uint64_t HELPER(bfextu_mem)(CPUM68KState *env, uint32_= t addr, struct bf_data d =3D bf_prep(addr, ofs, len); uint64_t data =3D bf_load(env, d.addr, d.blen, ra); =20 - /* Put CC_N at the top of the high word; put the zero-extended value - at the bottom of the low word. */ + /* + * Put CC_N at the top of the high word; put the zero-extended value + * at the bottom of the low word. + */ data <<=3D d.bofs; data >>=3D 64 - d.len; data |=3D data << (64 - d.len); @@ -1016,15 +1028,18 @@ uint64_t HELPER(bfffo_mem)(CPUM68KState *env, uint3= 2_t addr, uint64_t n =3D (data & mask) << d.bofs; uint32_t ffo =3D helper_bfffo_reg(n >> 32, ofs, d.len); =20 - /* Return FFO in the low word and N in the high word. - Note that because of MASK and the shift, the low word - is already zero. */ + /* + * Return FFO in the low word and N in the high word. + * Note that because of MASK and the shift, the low word + * is already zero. + */ return n | ffo; } =20 void HELPER(chk)(CPUM68KState *env, int32_t val, int32_t ub) { - /* From the specs: + /* + * From the specs: * X: Not affected, C,V,Z: Undefined, * N: Set if val < 0; cleared if val > ub, undefined otherwise * We implement here values found from a real MC68040: @@ -1054,7 +1069,8 @@ void HELPER(chk)(CPUM68KState *env, int32_t val, int3= 2_t ub) =20 void HELPER(chk2)(CPUM68KState *env, int32_t val, int32_t lb, int32_t ub) { - /* From the specs: + /* + * From the specs: * X: Not affected, N,V: Undefined, * Z: Set if val is equal to lb or ub * C: Set if val < lb or val > ub, cleared otherwise diff --git a/target/m68k/softfloat.c b/target/m68k/softfloat.c index b45a5e8690..591a6f1dce 100644 --- a/target/m68k/softfloat.c +++ b/target/m68k/softfloat.c @@ -14,7 +14,8 @@ * the Softfloat-2a license unless specifically indicated otherwise. */ =20 -/* Portions of this work are licensed under the terms of the GNU GPL, +/* + * Portions of this work are licensed under the terms of the GNU GPL, * version 2 or later. See the COPYING file in the top-level directory. */ =20 @@ -41,10 +42,10 @@ static floatx80 propagateFloatx80NaNOneArg(floatx80 a, = float_status *status) return a; } =20 -/*------------------------------------------------------------------------= ---- - | Returns the modulo remainder of the extended double-precision floating-= point - | value `a' with respect to the corresponding value `b'. - *------------------------------------------------------------------------= ----*/ +/* + * Returns the modulo remainder of the extended double-precision floating-= point + * value `a' with respect to the corresponding value `b'. + */ =20 floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status) { @@ -124,10 +125,10 @@ floatx80 floatx80_mod(floatx80 a, floatx80 b, float_s= tatus *status) 80, zSign, bExp + expDiff, aSig0, aSig1, status); } =20 -/*------------------------------------------------------------------------= ---- - | Returns the mantissa of the extended double-precision floating-point - | value `a'. - *------------------------------------------------------------------------= ----*/ +/* + * Returns the mantissa of the extended double-precision floating-point + * value `a'. + */ =20 floatx80 floatx80_getman(floatx80 a, float_status *status) { @@ -158,10 +159,10 @@ floatx80 floatx80_getman(floatx80 a, float_status *st= atus) 0x3FFF, aSig, 0, status); } =20 -/*------------------------------------------------------------------------= ---- - | Returns the exponent of the extended double-precision floating-point - | value `a' as an extended double-precision value. - *------------------------------------------------------------------------= ----*/ +/* + * Returns the exponent of the extended double-precision floating-point + * value `a' as an extended double-precision value. + */ =20 floatx80 floatx80_getexp(floatx80 a, float_status *status) { @@ -191,13 +192,13 @@ floatx80 floatx80_getexp(floatx80 a, float_status *st= atus) return int32_to_floatx80(aExp - 0x3FFF, status); } =20 -/*------------------------------------------------------------------------= ---- - | Scales extended double-precision floating-point value in operand `a' by - | value `b'. The function truncates the value in the second operand 'b' to - | an integral value and adds that value to the exponent of the operand 'a= '. - | The operation performed according to the IEC/IEEE Standard for Binary - | Floating-Point Arithmetic. - *------------------------------------------------------------------------= ----*/ +/* + * Scales extended double-precision floating-point value in operand `a' by + * value `b'. The function truncates the value in the second operand 'b' to + * an integral value and adds that value to the exponent of the operand 'a= '. + * The operation performed according to the IEC/IEEE Standard for Binary + * Floating-Point Arithmetic. + */ =20 floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status *status) { @@ -282,26 +283,26 @@ floatx80 floatx80_move(floatx80 a, float_status *stat= us) aExp, aSig, 0, status); } =20 -/*------------------------------------------------------------------------= ---- -| Algorithms for transcendental functions supported by MC68881 and MC68882 -| mathematical coprocessors. The functions are derived from FPSP library. -*-------------------------------------------------------------------------= ---*/ +/* + * Algorithms for transcendental functions supported by MC68881 and MC68882 + * mathematical coprocessors. The functions are derived from FPSP library. + */ =20 #define one_exp 0x3FFF #define one_sig LIT64(0x8000000000000000) =20 -/*------------------------------------------------------------------------= ---- - | Function for compactifying extended double-precision floating point val= ues. - *------------------------------------------------------------------------= ----*/ +/* + * Function for compactifying extended double-precision floating point val= ues. + */ =20 static int32_t floatx80_make_compact(int32_t aExp, uint64_t aSig) { return (aExp << 16) | (aSig >> 48); } =20 -/*------------------------------------------------------------------------= ---- - | Log base e of x plus 1 - *------------------------------------------------------------------------= ----*/ +/* + * Log base e of x plus 1 + */ =20 floatx80 floatx80_lognp1(floatx80 a, float_status *status) { @@ -498,9 +499,9 @@ floatx80 floatx80_lognp1(floatx80 a, float_status *stat= us) } } =20 -/*------------------------------------------------------------------------= ---- - | Log base e - *------------------------------------------------------------------------= ----*/ +/* + * Log base e + */ =20 floatx80 floatx80_logn(floatx80 a, float_status *status) { @@ -666,9 +667,9 @@ floatx80 floatx80_logn(floatx80 a, float_status *status) } } =20 -/*------------------------------------------------------------------------= ---- - | Log base 10 - *------------------------------------------------------------------------= ----*/ +/* + * Log base 10 + */ =20 floatx80 floatx80_log10(floatx80 a, float_status *status) { @@ -723,9 +724,9 @@ floatx80 floatx80_log10(floatx80 a, float_status *statu= s) return a; } =20 -/*------------------------------------------------------------------------= ---- - | Log base 2 - *------------------------------------------------------------------------= ----*/ +/* + * Log base 2 + */ =20 floatx80 floatx80_log2(floatx80 a, float_status *status) { @@ -790,9 +791,9 @@ floatx80 floatx80_log2(floatx80 a, float_status *status) return a; } =20 -/*------------------------------------------------------------------------= ---- - | e to x - *------------------------------------------------------------------------= ----*/ +/* + * e to x + */ =20 floatx80 floatx80_etox(floatx80 a, float_status *status) { @@ -848,7 +849,8 @@ floatx80 floatx80_etox(floatx80 a, float_status *status) j =3D n & 0x3F; /* J =3D N mod 64 */ m =3D n / 64; /* NOTE: this is really arithmetic right shift b= y 6 */ if (n < 0 && j) { - /* arithmetic right shift is division and + /* + * arithmetic right shift is division and * round towards minus infinity */ m--; @@ -973,9 +975,9 @@ floatx80 floatx80_etox(floatx80 a, float_status *status) } } =20 -/*------------------------------------------------------------------------= ---- - | 2 to x - *------------------------------------------------------------------------= ----*/ +/* + * 2 to x + */ =20 floatx80 floatx80_twotox(floatx80 a, float_status *status) { @@ -1051,14 +1053,16 @@ floatx80 floatx80_twotox(floatx80 a, float_status *= status) j =3D n & 0x3F; l =3D n / 64; /* NOTE: this is really arithmetic right shift by 6 = */ if (n < 0 && j) { - /* arithmetic right shift is division and + /* + * arithmetic right shift is division and * round towards minus infinity */ l--; } m =3D l / 2; /* NOTE: this is really arithmetic right shift by 1 */ if (l < 0 && (l & 1)) { - /* arithmetic right shift is division and + /* + * arithmetic right shift is division and * round towards minus infinity */ m--; @@ -1121,9 +1125,9 @@ floatx80 floatx80_twotox(floatx80 a, float_status *st= atus) } } =20 -/*------------------------------------------------------------------------= ---- - | 10 to x - *------------------------------------------------------------------------= ----*/ +/* + * 10 to x + */ =20 floatx80 floatx80_tentox(floatx80 a, float_status *status) { @@ -1200,14 +1204,16 @@ floatx80 floatx80_tentox(floatx80 a, float_status *= status) j =3D n & 0x3F; l =3D n / 64; /* NOTE: this is really arithmetic right shift by 6 = */ if (n < 0 && j) { - /* arithmetic right shift is division and + /* + * arithmetic right shift is division and * round towards minus infinity */ l--; } m =3D l / 2; /* NOTE: this is really arithmetic right shift by 1 */ if (l < 0 && (l & 1)) { - /* arithmetic right shift is division and + /* + * arithmetic right shift is division and * round towards minus infinity */ m--; @@ -1274,9 +1280,9 @@ floatx80 floatx80_tentox(floatx80 a, float_status *st= atus) } } =20 -/*------------------------------------------------------------------------= ---- - | Tangent - *------------------------------------------------------------------------= ----*/ +/* + * Tangent + */ =20 floatx80 floatx80_tan(floatx80 a, float_status *status) { @@ -1484,9 +1490,9 @@ floatx80 floatx80_tan(floatx80 a, float_status *statu= s) } } =20 -/*------------------------------------------------------------------------= ---- - | Sine - *------------------------------------------------------------------------= ----*/ +/* + * Sine + */ =20 floatx80 floatx80_sin(floatx80 a, float_status *status) { @@ -1723,9 +1729,9 @@ floatx80 floatx80_sin(floatx80 a, float_status *statu= s) } } =20 -/*------------------------------------------------------------------------= ---- - | Cosine - *------------------------------------------------------------------------= ----*/ +/* + * Cosine + */ =20 floatx80 floatx80_cos(floatx80 a, float_status *status) { @@ -1960,9 +1966,9 @@ floatx80 floatx80_cos(floatx80 a, float_status *statu= s) } } =20 -/*------------------------------------------------------------------------= ---- - | Arc tangent - *------------------------------------------------------------------------= ----*/ +/* + * Arc tangent + */ =20 floatx80 floatx80_atan(floatx80 a, float_status *status) { @@ -2157,9 +2163,9 @@ floatx80 floatx80_atan(floatx80 a, float_status *stat= us) } } =20 -/*------------------------------------------------------------------------= ---- - | Arc sine - *------------------------------------------------------------------------= ----*/ +/* + * Arc sine + */ =20 floatx80 floatx80_asin(floatx80 a, float_status *status) { @@ -2222,9 +2228,9 @@ floatx80 floatx80_asin(floatx80 a, float_status *stat= us) return a; } =20 -/*------------------------------------------------------------------------= ---- - | Arc cosine - *------------------------------------------------------------------------= ----*/ +/* + * Arc cosine + */ =20 floatx80 floatx80_acos(floatx80 a, float_status *status) { @@ -2291,9 +2297,9 @@ floatx80 floatx80_acos(floatx80 a, float_status *stat= us) return a; } =20 -/*------------------------------------------------------------------------= ---- - | Hyperbolic arc tangent - *------------------------------------------------------------------------= ----*/ +/* + * Hyperbolic arc tangent + */ =20 floatx80 floatx80_atanh(floatx80 a, float_status *status) { @@ -2356,9 +2362,9 @@ floatx80 floatx80_atanh(floatx80 a, float_status *sta= tus) return a; } =20 -/*------------------------------------------------------------------------= ---- - | e to x minus 1 - *------------------------------------------------------------------------= ----*/ +/* + * e to x minus 1 + */ =20 floatx80 floatx80_etoxm1(floatx80 a, float_status *status) { @@ -2410,7 +2416,8 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *st= atus) j =3D n & 0x3F; /* J =3D N mod 64 */ m =3D n / 64; /* NOTE: this is really arithmetic right shift b= y 6 */ if (n < 0 && j) { - /* arithmetic right shift is division and + /* + * arithmetic right shift is division and * round towards minus infinity */ m--; @@ -2607,9 +2614,9 @@ floatx80 floatx80_etoxm1(floatx80 a, float_status *st= atus) } } =20 -/*------------------------------------------------------------------------= ---- - | Hyperbolic tangent - *------------------------------------------------------------------------= ----*/ +/* + * Hyperbolic tangent + */ =20 floatx80 floatx80_tanh(floatx80 a, float_status *status) { @@ -2722,9 +2729,9 @@ floatx80 floatx80_tanh(floatx80 a, float_status *stat= us) } } =20 -/*------------------------------------------------------------------------= ---- - | Hyperbolic sine - *------------------------------------------------------------------------= ----*/ +/* + * Hyperbolic sine + */ =20 floatx80 floatx80_sinh(floatx80 a, float_status *status) { @@ -2811,9 +2818,9 @@ floatx80 floatx80_sinh(floatx80 a, float_status *stat= us) } } =20 -/*------------------------------------------------------------------------= ---- - | Hyperbolic cosine - *------------------------------------------------------------------------= ----*/ +/* + * Hyperbolic cosine + */ =20 floatx80 floatx80_cosh(floatx80 a, float_status *status) { diff --git a/target/m68k/softfloat.h b/target/m68k/softfloat.h index 602661d5a8..365ef6ac7a 100644 --- a/target/m68k/softfloat.h +++ b/target/m68k/softfloat.h @@ -14,7 +14,8 @@ * the Softfloat-2a license unless specifically indicated otherwise. */ =20 -/* Portions of this work are licensed under the terms of the GNU GPL, +/* + * Portions of this work are licensed under the terms of the GNU GPL, * version 2 or later. See the COPYING file in the top-level directory. */ =20 diff --git a/target/m68k/softfloat_fpsp_tables.h b/target/m68k/softfloat_fp= sp_tables.h index 3f1419ee6e..2ccd9e8bc3 100644 --- a/target/m68k/softfloat_fpsp_tables.h +++ b/target/m68k/softfloat_fpsp_tables.h @@ -14,7 +14,8 @@ * the Softfloat-2a license unless specifically indicated otherwise. */ =20 -/* Portions of this work are licensed under the terms of the GNU GPL, +/* + * Portions of this work are licensed under the terms of the GNU GPL, * version 2 or later. See the COPYING file in the top-level directory. */ =20 diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 2ae537461f..60bcfb7bd0 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -248,8 +248,10 @@ static void set_cc_op(DisasContext *s, CCOp op) s->cc_op =3D op; s->cc_op_synced =3D 0; =20 - /* Discard CC computation that will no longer be used. - Note that X and N are never dead. */ + /* + * Discard CC computation that will no longer be used. + * Note that X and N are never dead. + */ dead =3D cc_op_live[old_op] & ~cc_op_live[op]; if (dead & CCF_C) { tcg_gen_discard_i32(QREG_CC_C); @@ -306,8 +308,10 @@ static inline void gen_addr_fault(DisasContext *s) gen_exception(s, s->base.pc_next, EXCP_ADDRESS); } =20 -/* Generate a load from the specified address. Narrow values are - sign extended to full register width. */ +/* + * Generate a load from the specified address. Narrow values are + * sign extended to full register width. + */ static inline TCGv gen_load(DisasContext *s, int opsize, TCGv addr, int sign, int index) { @@ -360,8 +364,10 @@ typedef enum { EA_LOADS } ea_what; =20 -/* Generate an unsigned load if VAL is 0 a signed load if val is -1, - otherwise generate a store. */ +/* + * Generate an unsigned load if VAL is 0 a signed load if val is -1, + * otherwise generate a store. + */ static TCGv gen_ldst(DisasContext *s, int opsize, TCGv addr, TCGv val, ea_what what, int index) { @@ -426,8 +432,10 @@ static TCGv gen_addr_index(DisasContext *s, uint16_t e= xt, TCGv tmp) return add; } =20 -/* Handle a base + index + displacement effective addresss. - A NULL_QREG base means pc-relative. */ +/* + * Handle a base + index + displacement effective addresss. + * A NULL_QREG base means pc-relative. + */ static TCGv gen_lea_indexed(CPUM68KState *env, DisasContext *s, TCGv base) { uint32_t offset; @@ -714,8 +722,10 @@ static inline int ext_opsize(int ext, int pos) } } =20 -/* Assign value to a register. If the width is less than the register wid= th - only the low part of the register is set. */ +/* + * Assign value to a register. If the width is less than the register wid= th + * only the low part of the register is set. + */ static void gen_partset_reg(int opsize, TCGv reg, TCGv val) { TCGv tmp; @@ -743,8 +753,10 @@ static void gen_partset_reg(int opsize, TCGv reg, TCGv= val) } } =20 -/* Generate code for an "effective address". Does not adjust the base - register for autoincrement addressing modes. */ +/* + * Generate code for an "effective address". Does not adjust the base + * register for autoincrement addressing modes. + */ static TCGv gen_lea_mode(CPUM68KState *env, DisasContext *s, int mode, int reg0, int opsize) { @@ -817,9 +829,11 @@ static TCGv gen_lea(CPUM68KState *env, DisasContext *s= , uint16_t insn, return gen_lea_mode(env, s, mode, reg0, opsize); } =20 -/* Generate code to load/store a value from/into an EA. If WHAT > 0 this = is - a write otherwise it is a read (0 =3D=3D sign extend, -1 =3D=3D zero ex= tend). - ADDRP is non-null for readwrite operands. */ +/* + * Generate code to load/store a value from/into an EA. If WHAT > 0 this = is + * a write otherwise it is a read (0 =3D=3D sign extend, -1 =3D=3D zero ex= tend). + * ADDRP is non-null for readwrite operands. + */ static TCGv gen_ea_mode(CPUM68KState *env, DisasContext *s, int mode, int = reg0, int opsize, TCGv val, TCGv *addrp, ea_what what, int index) @@ -1012,7 +1026,8 @@ static void gen_load_fp(DisasContext *s, int opsize, = TCGv addr, TCGv_ptr fp, tcg_gen_st_i64(t64, fp, offsetof(FPReg, l.lower)); break; case OS_PACKED: - /* unimplemented data type on 68040/ColdFire + /* + * unimplemented data type on 68040/ColdFire * FIXME if needed for another FPU */ gen_exception(s, s->base.pc_next, EXCP_FP_UNIMP); @@ -1066,7 +1081,8 @@ static void gen_store_fp(DisasContext *s, int opsize,= TCGv addr, TCGv_ptr fp, tcg_gen_qemu_st64(t64, tmp, index); break; case OS_PACKED: - /* unimplemented data type on 68040/ColdFire + /* + * unimplemented data type on 68040/ColdFire * FIXME if needed for another FPU */ gen_exception(s, s->base.pc_next, EXCP_FP_UNIMP); @@ -1212,7 +1228,8 @@ static int gen_ea_mode_fp(CPUM68KState *env, DisasCon= text *s, int mode, tcg_temp_free_i64(t64); break; case OS_PACKED: - /* unimplemented data type on 68040/ColdFire + /* + * unimplemented data type on 68040/ColdFire * FIXME if needed for another FPU */ gen_exception(s, s->base.pc_next, EXCP_FP_UNIMP); @@ -1299,9 +1316,11 @@ static void gen_cc_cond(DisasCompare *c, DisasContex= t *s, int cond) goto done; case 14: /* GT (!(Z || (N ^ V))) */ case 15: /* LE (Z || (N ^ V)) */ - /* Logic operations clear V, which simplifies LE to (Z || N), - and since Z and N are co-located, this becomes a normal - comparison vs N. */ + /* + * Logic operations clear V, which simplifies LE to (Z || N), + * and since Z and N are co-located, this becomes a normal + * comparison vs N. + */ if (op =3D=3D CC_OP_LOGIC) { c->v1 =3D QREG_CC_N; tcond =3D TCG_COND_LE; @@ -1549,9 +1568,11 @@ DISAS_INSN(undef_fpu) =20 DISAS_INSN(undef) { - /* ??? This is both instructions that are as yet unimplemented - for the 680x0 series, as well as those that are implemented - but actually illegal for CPU32 or pre-68020. */ + /* + * ??? This is both instructions that are as yet unimplemented + * for the 680x0 series, as well as those that are implemented + * but actually illegal for CPU32 or pre-68020. + */ qemu_log_mask(LOG_UNIMP, "Illegal instruction: %04x @ %08x\n", insn, s->base.pc_next); gen_exception(s, s->base.pc_next, EXCP_ILLEGAL); @@ -1655,7 +1676,8 @@ static void bcd_add(TCGv dest, TCGv src) { TCGv t0, t1; =20 - /* dest10 =3D dest10 + src10 + X + /* + * dest10 =3D dest10 + src10 + X * * t1 =3D src * t2 =3D t1 + 0x066 @@ -1667,7 +1689,8 @@ static void bcd_add(TCGv dest, TCGv src) * return t3 - t7 */ =20 - /* t1 =3D (src + 0x066) + dest + X + /* + * t1 =3D (src + 0x066) + dest + X * =3D result with some possible exceding 0x6 */ =20 @@ -1680,20 +1703,23 @@ static void bcd_add(TCGv dest, TCGv src) =20 /* we will remove exceding 0x6 where there is no carry */ =20 - /* t0 =3D (src + 0x0066) ^ dest + /* + * t0 =3D (src + 0x0066) ^ dest * =3D t1 without carries */ =20 tcg_gen_xor_i32(t0, t0, dest); =20 - /* extract the carries + /* + * extract the carries * t0 =3D t0 ^ t1 * =3D only the carries */ =20 tcg_gen_xor_i32(t0, t0, t1); =20 - /* generate 0x1 where there is no carry + /* + * generate 0x1 where there is no carry * and for each 0x10, generate a 0x6 */ =20 @@ -1704,7 +1730,8 @@ static void bcd_add(TCGv dest, TCGv src) tcg_gen_add_i32(dest, dest, t0); tcg_temp_free(t0); =20 - /* remove the exceding 0x6 + /* + * remove the exceding 0x6 * for digits that have not generated a carry */ =20 @@ -1716,7 +1743,8 @@ static void bcd_sub(TCGv dest, TCGv src) { TCGv t0, t1, t2; =20 - /* dest10 =3D dest10 - src10 - X + /* + * dest10 =3D dest10 - src10 - X * =3D bcd_add(dest + 1 - X, 0x199 - src) */ =20 @@ -1741,7 +1769,8 @@ static void bcd_sub(TCGv dest, TCGv src) =20 tcg_gen_xor_i32(t0, t1, t2); =20 - /* t2 =3D ~t0 & 0x110 + /* + * t2 =3D ~t0 & 0x110 * t0 =3D (t2 >> 2) | (t2 >> 3) * * to fit on 8bit operands, changed in: @@ -2029,8 +2058,10 @@ DISAS_INSN(movem) /* pre-decrement is not allowed */ goto do_addr_fault; } - /* We want a bare copy of the address reg, without any pre-decreme= nt - adjustment, as gen_lea would provide. */ + /* + * We want a bare copy of the address reg, without any pre-decreme= nt + * adjustment, as gen_lea would provide. + */ break; =20 default: @@ -2072,7 +2103,8 @@ DISAS_INSN(movem) tcg_gen_sub_i32(addr, addr, incr); if (reg0 + 8 =3D=3D i && m68k_feature(s->env, M68K_FEATURE_EXT_FULL)) { - /* M68020+: if the addressing register is the + /* + * M68020+: if the addressing register is the * register moved to memory, the value written * is the initial value decremented by the size of * the operation, regardless of how many actual @@ -2413,7 +2445,8 @@ DISAS_INSN(cas) =20 cmp =3D gen_extend(s, DREG(ext, 0), opsize, 1); =20 - /* if =3D=3D Dc then + /* + * if =3D=3D Dc then * =3D Du * Dc =3D (because =3D=3D Dc) * else @@ -2466,7 +2499,8 @@ DISAS_INSN(cas2w) addr2 =3D DREG(ext2, 12); } =20 - /* if (R1) =3D=3D Dc1 && (R2) =3D=3D Dc2 then + /* + * if (R1) =3D=3D Dc1 && (R2) =3D=3D Dc2 then * (R1) =3D Du1 * (R2) =3D Du2 * else @@ -2516,7 +2550,8 @@ DISAS_INSN(cas2l) addr2 =3D DREG(ext2, 12); } =20 - /* if (R1) =3D=3D Dc1 && (R2) =3D=3D Dc2 then + /* + * if (R1) =3D=3D Dc1 && (R2) =3D=3D Dc2 then * (R1) =3D Du1 * (R2) =3D Du2 * else @@ -2597,7 +2632,8 @@ DISAS_INSN(negx) =20 gen_flush_flags(s); /* compute old Z */ =20 - /* Perform substract with borrow. + /* + * Perform substract with borrow. * (X, N) =3D -(src + X); */ =20 @@ -2609,7 +2645,8 @@ DISAS_INSN(negx) =20 tcg_gen_andi_i32(QREG_CC_X, QREG_CC_X, 1); =20 - /* Compute signed-overflow for negation. The normal formula for + /* + * Compute signed-overflow for negation. The normal formula for * subtraction is (res ^ src) & (src ^ dest), but with dest=3D=3D0 * this simplies to res & src. */ @@ -2844,8 +2881,10 @@ DISAS_INSN(mull) =20 set_cc_op(s, CC_OP_FLAGS); } else { - /* The upper 32 bits of the product are discarded, so - muls.l and mulu.l are functionally equivalent. */ + /* + * The upper 32 bits of the product are discarded, so + * muls.l and mulu.l are functionally equivalent. + */ tcg_gen_mul_i32(DREG(ext, 12), src1, DREG(ext, 12)); gen_logic_cc(s, DREG(ext, 12), OS_LONG); } @@ -2938,8 +2977,10 @@ DISAS_INSN(jump) { TCGv tmp; =20 - /* Load the target address first to ensure correct exception - behavior. */ + /* + * Load the target address first to ensure correct exception + * behavior. + */ tmp =3D gen_lea(env, s, insn, OS_LONG); if (IS_NULL_QREG(tmp)) { gen_addr_fault(s); @@ -2976,8 +3017,10 @@ DISAS_INSN(addsubq) dest =3D tcg_temp_new(); tcg_gen_mov_i32(dest, src); if ((insn & 0x38) =3D=3D 0x08) { - /* Don't update condition codes if the destination is an - address register. */ + /* + * Don't update condition codes if the destination is an + * address register. + */ if (insn & 0x0100) { tcg_gen_sub_i32(dest, dest, val); } else { @@ -3110,7 +3153,8 @@ static inline void gen_subx(DisasContext *s, TCGv src= , TCGv dest, int opsize) =20 gen_flush_flags(s); /* compute old Z */ =20 - /* Perform substract with borrow. + /* + * Perform substract with borrow. * (X, N) =3D dest - (src + X); */ =20 @@ -3320,7 +3364,8 @@ static inline void gen_addx(DisasContext *s, TCGv src= , TCGv dest, int opsize) =20 gen_flush_flags(s); /* compute old Z */ =20 - /* Perform addition with carry. + /* + * Perform addition with carry. * (X, N) =3D src + dest + X; */ =20 @@ -3404,9 +3449,11 @@ static inline void shift_im(DisasContext *s, uint16_= t insn, int opsize) tcg_gen_shri_i32(QREG_CC_C, reg, bits - count); tcg_gen_shli_i32(QREG_CC_N, reg, count); =20 - /* Note that ColdFire always clears V (done above), - while M68000 sets if the most significant bit is changed at - any time during the shift operation */ + /* + * Note that ColdFire always clears V (done above), + * while M68000 sets if the most significant bit is changed at + * any time during the shift operation. + */ if (!logical && m68k_feature(s->env, M68K_FEATURE_M68000)) { /* if shift count >=3D bits, V is (reg !=3D 0) */ if (count >=3D bits) { @@ -3451,9 +3498,11 @@ static inline void shift_reg(DisasContext *s, uint16= _t insn, int opsize) s64 =3D tcg_temp_new_i64(); s32 =3D tcg_temp_new(); =20 - /* Note that m68k truncates the shift count modulo 64, not 32. - In addition, a 64-bit shift makes it easy to find "the last - bit shifted out", for the carry flag. */ + /* + * Note that m68k truncates the shift count modulo 64, not 32. + * In addition, a 64-bit shift makes it easy to find "the last + * bit shifted out", for the carry flag. + */ tcg_gen_andi_i32(s32, DREG(insn, 9), 63); tcg_gen_extu_i32_i64(s64, s32); tcg_gen_extu_i32_i64(t64, reg); @@ -3480,7 +3529,8 @@ static inline void shift_reg(DisasContext *s, uint16_= t insn, int opsize) tcg_gen_movcond_i32(TCG_COND_NE, QREG_CC_X, s32, QREG_CC_V, QREG_CC_C, QREG_CC_X); =20 - /* M68000 sets V if the most significant bit is changed at + /* + * M68000 sets V if the most significant bit is changed at * any time during the shift operation. Do this via creating * an extension of the sign bit, comparing, and discarding * the bits below the sign bit. I.e. @@ -3576,9 +3626,11 @@ DISAS_INSN(shift_mem) tcg_gen_shri_i32(QREG_CC_C, src, 15); tcg_gen_shli_i32(QREG_CC_N, src, 1); =20 - /* Note that ColdFire always clears V, - while M68000 sets if the most significant bit is changed at - any time during the shift operation */ + /* + * Note that ColdFire always clears V, + * while M68000 sets if the most significant bit is changed at + * any time during the shift operation + */ if (!logical && m68k_feature(s->env, M68K_FEATURE_M68000)) { src =3D gen_extend(s, src, OS_WORD, 1); tcg_gen_xor_i32(QREG_CC_V, QREG_CC_N, src); @@ -3996,9 +4048,11 @@ DISAS_INSN(bfext_reg) TCGv tmp =3D tcg_temp_new(); TCGv shift; =20 - /* In general, we're going to rotate the field so that it's at the - top of the word and then right-shift by the complement of the - width to extend the field. */ + /* + * In general, we're going to rotate the field so that it's at the + * top of the word and then right-shift by the complement of the + * width to extend the field. + */ if (ext & 0x20) { /* Variable width. */ if (ext & 0x800) { @@ -4028,8 +4082,10 @@ DISAS_INSN(bfext_reg) src =3D tmp; pos =3D 32 - len; } else { - /* Immediate offset. If the field doesn't wrap around the - end of the word, rely on (s)extract completely. */ + /* + * Immediate offset. If the field doesn't wrap around the + * end of the word, rely on (s)extract completely. + */ if (pos < 0) { tcg_gen_rotli_i32(tmp, src, ofs); src =3D tmp; @@ -4888,7 +4944,8 @@ static void gen_op_fmove_fcr(CPUM68KState *env, Disas= Context *s, addr =3D tcg_temp_new(); tcg_gen_mov_i32(addr, tmp); =20 - /* mask: + /* + * mask: * * 0b100 Floating-Point Control Register * 0b010 Floating-Point Status Register @@ -4956,7 +5013,8 @@ static void gen_op_fmovem(CPUM68KState *env, DisasCon= text *s, } =20 if (!is_load && (mode & 2) =3D=3D 0) { - /* predecrement addressing mode + /* + * predecrement addressing mode * only available to store register to memory */ if (opsize =3D=3D OS_EXTENDED) { @@ -4986,8 +5044,10 @@ static void gen_op_fmovem(CPUM68KState *env, DisasCo= ntext *s, tcg_temp_free(tmp); } =20 -/* ??? FP exceptions are not implemented. Most exceptions are deferred un= til - immediately before the next FP instruction is executed. */ +/* + * ??? FP exceptions are not implemented. Most exceptions are deferred un= til + * immediately before the next FP instruction is executed. + */ DISAS_INSN(fpu) { uint16_t ext; @@ -5511,8 +5571,10 @@ DISAS_INSN(mac) tmp =3D gen_lea(env, s, insn, OS_LONG); addr =3D tcg_temp_new(); tcg_gen_and_i32(addr, tmp, QREG_MAC_MASK); - /* Load the value now to ensure correct exception behavior. - Perform writeback after reading the MAC inputs. */ + /* + * Load the value now to ensure correct exception behavior. + * Perform writeback after reading the MAC inputs. + */ loadval =3D gen_load(s, OS_LONG, addr, 0, IS_USER(s)); =20 acc ^=3D 1; @@ -5633,8 +5695,10 @@ DISAS_INSN(mac) TCGv rw; rw =3D (insn & 0x40) ? AREG(insn, 9) : DREG(insn, 9); tcg_gen_mov_i32(rw, loadval); - /* FIXME: Should address writeback happen with the masked or - unmasked value? */ + /* + * FIXME: Should address writeback happen with the masked or + * unmasked value? + */ switch ((insn >> 3) & 7) { case 3: /* Post-increment. */ tcg_gen_addi_i32(AREG(insn, 0), addr, 4); @@ -5784,8 +5848,10 @@ register_opcode (disas_proc proc, uint16_t opcode, u= int16_t mask) opcode, mask); abort(); } - /* This could probably be cleverer. For now just optimize the case where - the top bits are known. */ + /* + * This could probably be cleverer. For now just optimize the case where + * the top bits are known. + */ /* Find the first zero bit in the mask. */ i =3D 0x8000; while ((i & mask) !=3D 0) @@ -5803,17 +5869,22 @@ register_opcode (disas_proc proc, uint16_t opcode, = uint16_t mask) } } =20 -/* Register m68k opcode handlers. Order is important. - Later insn override earlier ones. */ +/* + * Register m68k opcode handlers. Order is important. + * Later insn override earlier ones. + */ void register_m68k_insns (CPUM68KState *env) { - /* Build the opcode table only once to avoid - multithreading issues. */ + /* + * Build the opcode table only once to avoid + * multithreading issues. + */ if (opcode_table[0] !=3D NULL) { return; } =20 - /* use BASE() for instruction available + /* + * use BASE() for instruction available * for CF_ISA_A and M68000. */ #define BASE(name, opcode, mask) \ @@ -6077,10 +6148,12 @@ static bool m68k_tr_breakpoint_check(DisasContextBa= se *dcbase, CPUState *cpu, DisasContext *dc =3D container_of(dcbase, DisasContext, base); =20 gen_exception(dc, dc->base.pc_next, EXCP_DEBUG); - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size below does the right thing. */ + /* + * The address covered by the breakpoint must be included in + * [tb->pc, tb->pc + tb->size) in order to for it to be + * properly cleared -- thus we increment the PC here so that + * the logic setting tb->size below does the right thing. + */ dc->base.pc_next +=3D 2; =20 return true; @@ -6099,7 +6172,8 @@ static void m68k_tr_translate_insn(DisasContextBase *= dcbase, CPUState *cpu) dc->base.pc_next =3D dc->pc; =20 if (dc->base.is_jmp =3D=3D DISAS_NEXT) { - /* Stop translation when the next insn might touch a new page. + /* + * Stop translation when the next insn might touch a new page. * This ensures that prefetch aborts at the right place. * * We cannot determine the size of the next insn without @@ -6142,8 +6216,10 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase= , CPUState *cpu) tcg_gen_lookup_and_goto_ptr(); break; case DISAS_EXIT: - /* We updated CC_OP and PC in gen_exit_tb, but also modified - other state that may require returning to the main loop. */ + /* + * We updated CC_OP and PC in gen_exit_tb, but also modified + * other state that may require returning to the main loop. + */ tcg_gen_exit_tb(NULL, 0); break; default: --=20 2.21.0 From nobody Fri May 3 14:08:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1561566546; cv=none; d=zoho.com; s=zohoarc; b=lN8Yiit+U6z7FsoCSnHeBNMY/NpwQu3x/hSOq7WYGG7nN7j/HJJ2rLN42tjjKQy7i/K9fIPRqTkV5TUncKg0VVFyxZZXq2QybBJ2qHRyOXDYQ3dhFfq1gojKNJe3MMnbXq+kJuUbGXqjEYGqfLgmQDxi3ycIdDvQ3qeZ5EgD4BQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561566546; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=L1QmijOw6DRAIz/BkefJyKPWWpWDj+7in3pm/vFFfAU=; b=VAI1vWXn/yUaq1Zbr2Biswb/yWDhTaE1SlVZmBfrmwX2Z+7G5rAyQHeUd36MF/mc6WdKfLovLbMISt1U7DeO1iHNQuXXM3ldCSNvHjDfR+GIVfpNIvC6XGQJn+pSCVHte3I1a8f4TIUpm2vFXq/u5P77M2LBv0nKK2IdluQcnF0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561566546651237.31922106804234; Wed, 26 Jun 2019 09:29:06 -0700 (PDT) Received: from localhost ([::1]:41806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgAn6-0001ra-FQ for importer@patchew.org; Wed, 26 Jun 2019 12:29:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55806) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgAfs-0005aa-4h for qemu-devel@nongnu.org; Wed, 26 Jun 2019 12:21:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgAfp-0006nB-UJ for qemu-devel@nongnu.org; Wed, 26 Jun 2019 12:21:32 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:53557) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hgAfn-0006iJ-VR for qemu-devel@nongnu.org; Wed, 26 Jun 2019 12:21:29 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MYNW8-1i1heH0D58-00VThn; Wed, 26 Jun 2019 18:21:11 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 26 Jun 2019 18:21:00 +0200 Message-Id: <20190626162100.24774-4-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190626162100.24774-1-laurent@vivier.eu> References: <20190626162100.24774-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Gz6fRpAfz80ZpkaSNxfArQc9X6io64GaUucP7W8uS8HoDgN9ASD vqiHszx/CWmY81zr0MuYohzobKPTNKkpx+LPYHBKmmVhjAmFwh8meONcoXowLQHkvJk2UFL 1c+utwLYQ3z0JVHVs8BUk9cXvqzHjx69vMOXlqTJJColwVqivHCAlbeV3U06UAh7gDaZyw9 uuNZjXubZlkmKN2UkhjHw== X-UI-Out-Filterresults: notjunk:1;V03:K0:eH1+gEM2wfM=:2AXjq61b4+aOA8JcIcmwW3 IU4VqCdwl1XU2dErzhiEQ56CfjYdmhFcskbUkTZsDjLrBipMFAA+CCuwi9kv6bGsXaYeuaT9Y AoDimK+HMVHkzt/tT2hbD1jgdiz9wKFjePLYbQwMaoBWk46VraB5y9YZeq52Bd2JFW/rUdsv5 ZTDyk4Sjba+0ldt72Je5FgHC+9RdUcMboKCEwBwXVLvvSUTJzMWdO0mmQv8kKE86yxzoD1nB4 wQaO+plrU9bQryOCbzvUu/uZz9rZdqtCMzdkjHVGiNCdrozbv3bScNz7iK90H2qFvlwfn3X1F hyTgBp68CbjG1OAtYgxacBGSa8yQx9IUTjILZrE+7mE6TcEmlrf6d5hUm4FRGXKjnzspOfEt1 nViXJdSz4+3N+eNUViydBGs2A8jQ5d0WKmtWUzPEzWl5Sh7EQDjlr1Yfhmdd9NvHZo1nnKfQE qrkOQ0JyXK7rJnwmB8VfGcWIvXdMA3Jf+fJgevcgLJ2PH8g3JzryijCwIP8Jo7D8JPCB1s0mk qm5l/i0QYwVq+fGHOwiSohYsIWpb/pdpQS/p+efWtnJLwqWkFRZ/7sabFhHcIRcaiD9ZWqt3B uy8y9OqCiZN2o7fXKO95zoDEgA2g4a3f0CVB1QewnIQMfKwBKtnKfP7uxKjIfJUXfxJmgY6qJ kU+mErk34RefoVkVg842lXGElnBVhvvKHpFIQpiAGu0+m3dfLybaLvXS70JSp1Xb5wIk/SnHA 5s16yauqF5kAr6TX0mykhVKQ5FIGrFCoCxTKWA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.74 Subject: [Qemu-devel] [PULL 3/3] linux-user/m68k: remove simulator syscall interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This interface has been introduced in 2005 with the coldfire implementation (e6e5906b6e ColdFire target.) and looks like to do what the linux-user interface already does with the TRAP exception rather than the ILLEGAL exception. This interface has not been maintained since that. The semi-hosting interface is not removed so coldfire kernel with semi-hosting is always supported. Signed-off-by: Laurent Vivier Message-Id: <20190524162049.806-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- linux-user/Makefile.objs | 1 - linux-user/m68k-sim.c | 163 ------------------------------- linux-user/m68k/cpu_loop.c | 17 +--- linux-user/m68k/target_syscall.h | 2 - linux-user/qemu.h | 1 - 5 files changed, 1 insertion(+), 183 deletions(-) delete mode 100644 linux-user/m68k-sim.c diff --git a/linux-user/Makefile.objs b/linux-user/Makefile.objs index 285c5dfa17..d2f33beb5e 100644 --- a/linux-user/Makefile.objs +++ b/linux-user/Makefile.objs @@ -8,4 +8,3 @@ obj-$(TARGET_I386) +=3D vm86.o obj-$(TARGET_ARM) +=3D arm/nwfpe/ obj-$(TARGET_ARM) +=3D arm/semihost.o obj-$(TARGET_AARCH64) +=3D arm/semihost.o -obj-$(TARGET_M68K) +=3D m68k-sim.o diff --git a/linux-user/m68k-sim.c b/linux-user/m68k-sim.c deleted file mode 100644 index 9bc6ff3d3a..0000000000 --- a/linux-user/m68k-sim.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * m68k simulator syscall interface - * - * Copyright (c) 2005 CodeSourcery, LLC. Written by Paul Brook. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include "qemu/osdep.h" - -#include "qemu.h" - -#define SYS_EXIT 1 -#define SYS_READ 3 -#define SYS_WRITE 4 -#define SYS_OPEN 5 -#define SYS_CLOSE 6 -#define SYS_BRK 17 -#define SYS_FSTAT 28 -#define SYS_ISATTY 29 -#define SYS_LSEEK 199 - -struct m68k_sim_stat { - uint16_t sim_st_dev; - uint16_t sim_st_ino; - uint32_t sim_st_mode; - uint16_t sim_st_nlink; - uint16_t sim_st_uid; - uint16_t sim_st_gid; - uint16_t sim_st_rdev; - uint32_t sim_st_size; - uint32_t sim_st_atime; - uint32_t sim_st_mtime; - uint32_t sim_st_ctime; - uint32_t sim_st_blksize; - uint32_t sim_st_blocks; -}; - -static inline uint32_t check_err(CPUM68KState *env, uint32_t code) -{ - env->dregs[0] =3D code; - if (code =3D=3D (uint32_t)-1) { - env->dregs[1] =3D errno; - } else { - env->dregs[1] =3D 0; - } - return code; -} - -#define SIM_O_APPEND 0x0008 -#define SIM_O_CREAT 0x0200 -#define SIM_O_TRUNC 0x0400 -#define SIM_O_EXCL 0x0800 -#define SIM_O_NONBLOCK 0x4000 -#define SIM_O_NOCTTY 0x8000 -#define SIM_O_SYNC 0x2000 - -static int translate_openflags(int flags) -{ - int hf; - - switch (flags & 3) { - case 0: hf =3D O_RDONLY; break; - case 1: hf =3D O_WRONLY; break; - case 2: hf =3D O_RDWR; break; - default: hf =3D O_RDWR; break; - } - - if (flags & SIM_O_APPEND) hf |=3D O_APPEND; - if (flags & SIM_O_CREAT) hf |=3D O_CREAT; - if (flags & SIM_O_TRUNC) hf |=3D O_TRUNC; - if (flags & SIM_O_EXCL) hf |=3D O_EXCL; - if (flags & SIM_O_NONBLOCK) hf |=3D O_NONBLOCK; - if (flags & SIM_O_NOCTTY) hf |=3D O_NOCTTY; - if (flags & SIM_O_SYNC) hf |=3D O_SYNC; - - return hf; -} - -#define ARG(x) tswap32(args[x]) -void do_m68k_simcall(CPUM68KState *env, int nr) -{ - uint32_t *args; - - args =3D (uint32_t *)(unsigned long)(env->aregs[7] + 4); - switch (nr) { - case SYS_EXIT: - exit(ARG(0)); - case SYS_READ: - check_err(env, read(ARG(0), (void *)(unsigned long)ARG(1), ARG(2))= ); - break; - case SYS_WRITE: - check_err(env, write(ARG(0), (void *)(unsigned long)ARG(1), ARG(2)= )); - break; - case SYS_OPEN: - check_err(env, open((char *)(unsigned long)ARG(0), - translate_openflags(ARG(1)), ARG(2))); - break; - case SYS_CLOSE: - { - /* Ignore attempts to close stdin/out/err. */ - int fd =3D ARG(0); - if (fd > 2) - check_err(env, close(fd)); - else - check_err(env, 0); - break; - } - case SYS_BRK: - { - int32_t ret; - - ret =3D do_brk((abi_ulong)ARG(0)); - if (ret =3D=3D -ENOMEM) - ret =3D -1; - check_err(env, ret); - } - break; - case SYS_FSTAT: - { - struct stat s; - int rc; - struct m68k_sim_stat *p; - rc =3D check_err(env, fstat(ARG(0), &s)); - if (rc =3D=3D 0) { - p =3D (struct m68k_sim_stat *)(unsigned long)ARG(1); - p->sim_st_dev =3D tswap16(s.st_dev); - p->sim_st_ino =3D tswap16(s.st_ino); - p->sim_st_mode =3D tswap32(s.st_mode); - p->sim_st_nlink =3D tswap16(s.st_nlink); - p->sim_st_uid =3D tswap16(s.st_uid); - p->sim_st_gid =3D tswap16(s.st_gid); - p->sim_st_rdev =3D tswap16(s.st_rdev); - p->sim_st_size =3D tswap32(s.st_size); - p->sim_st_atime =3D tswap32(s.st_atime); - p->sim_st_mtime =3D tswap32(s.st_mtime); - p->sim_st_ctime =3D tswap32(s.st_ctime); - p->sim_st_blksize =3D tswap32(s.st_blksize); - p->sim_st_blocks =3D tswap32(s.st_blocks); - } - } - break; - case SYS_ISATTY: - check_err(env, isatty(ARG(0))); - break; - case SYS_LSEEK: - check_err(env, lseek(ARG(0), (int32_t)ARG(1), ARG(2))); - break; - default: - cpu_abort(env_cpu(env), "Unsupported m68k sim syscall %d\n", nr); - } -} diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c index e8d39d15f3..c7a500b58c 100644 --- a/linux-user/m68k/cpu_loop.c +++ b/linux-user/m68k/cpu_loop.c @@ -28,7 +28,6 @@ void cpu_loop(CPUM68KState *env) int trapnr; unsigned int n; target_siginfo_t info; - TaskState *ts =3D cs->opaque; =20 for(;;) { cpu_exec_start(cs); @@ -37,26 +36,14 @@ void cpu_loop(CPUM68KState *env) process_queued_cpu_work(cs); =20 switch(trapnr) { - case EXCP_ILLEGAL: - { - if (ts->sim_syscalls) { - uint16_t nr; - get_user_u16(nr, env->pc + 2); - env->pc +=3D 4; - do_m68k_simcall(env, nr); - } else { - goto do_sigill; - } - } - break; case EXCP_HALT_INSN: /* Semihosing syscall. */ env->pc +=3D 4; do_m68k_semihosting(env, env->dregs[0]); break; + case EXCP_ILLEGAL: case EXCP_LINEA: case EXCP_LINEF: - do_sigill: info.si_signo =3D TARGET_SIGILL; info.si_errno =3D 0; info.si_code =3D TARGET_ILL_ILLOPN; @@ -80,7 +67,6 @@ void cpu_loop(CPUM68KState *env) case EXCP_TRAP0: { abi_long ret; - ts->sim_syscalls =3D 0; n =3D env->dregs[0]; env->pc +=3D 2; ret =3D do_syscall(env, @@ -154,7 +140,6 @@ void target_cpu_copy_regs(CPUArchState *env, struct tar= get_pt_regs *regs) env->aregs[7] =3D regs->usp; env->sr =3D regs->sr; =20 - ts->sim_syscalls =3D 1; ts->stack_base =3D info->start_stack; ts->heap_base =3D info->brk; /* This will be filled in on the first SYS_HEAPINFO call. */ diff --git a/linux-user/m68k/target_syscall.h b/linux-user/m68k/target_sysc= all.h index 632ee4fcf8..c0366b1c62 100644 --- a/linux-user/m68k/target_syscall.h +++ b/linux-user/m68k/target_syscall.h @@ -26,6 +26,4 @@ struct target_pt_regs { =20 #define TARGET_WANT_OLD_SYS_SELECT =20 -void do_m68k_simcall(CPUM68KState *, int); - #endif /* M68K_TARGET_SYSCALL_H */ diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 82d33d7e93..fab287b7ec 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -116,7 +116,6 @@ typedef struct TaskState { #endif abi_ulong child_tidptr; #ifdef TARGET_M68K - int sim_syscalls; abi_ulong tp_value; #endif #if defined(TARGET_ARM) || defined(TARGET_M68K) --=20 2.21.0