From patchwork Fri Aug 5 19:55:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 595514 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1560184maz; Fri, 5 Aug 2022 12:57:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR4soPYp2f2jLVxVRoPiGKVF68a2ZSDFxL09O9ncCInFhm3cmwWe1aaef/ClJaxNxm8It120 X-Received: by 2002:ac8:7e88:0:b0:31f:a54:c7c5 with SMTP id w8-20020ac87e88000000b0031f0a54c7c5mr7249303qtj.369.1659729456062; Fri, 05 Aug 2022 12:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659729456; cv=none; d=google.com; s=arc-20160816; b=M1hhwLiHzB8sW9jZJbZrZxF6sjZF3PBPDtoqmrZsxAKmB6D6MB/v+TQMP/WbMKazt7 AXbeK+oTJRVCHVXyOWvVxItfPZm9r9f5Hm7iEsTE+9I9u5A3E1fJPvdovQwjC4Z5fSPD lir4VHXDJGvKz24bWs35LwpFLo66jV6xF1VUinw4nD5IF27dKvHrkb1ahkLK8Ghm7YH3 kDzm0N09L7IrVMcvq7HkDZ2aSyoGaI1Ggtqh/EMeyonkb1bDhUTuK96yjvPYRdNIMvgc Whstb+OZIlPPVj7e1R0nD3a73K7iV5PxTLXsIQNLQlyk2NNrmVCYg0nnMaXj3K5dP1LQ 7pIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XoU1ivq664BvtVyoqP3w9U5Cy8Z2Wrd2UTjf3IBy+og=; b=z/+xUE15AYakAMqYY8TdH/IpFLcPIyYx1wziKk7Qhfk5w6txYoVo8pGvZcLxyfbS6i bsUzA+PNu2juPYEGeGcjGRoc9a6kXU+8nTWR9nCul6LnBt0InLekKlpJDJxZcy44oS3A cwlpgD+I2MDscnJoDv2BG1bVz2YJ06D9jA2UaPn1HXMQCoSxMaGFQPXQbgkWGUPFiPqY A13gEVzSd96vkpKnZXKgtvcAt/87ZsXqBdC+KG+zRzqObWgrmSTuO/CU9bszjXXRGa4O sVifNS7dHzx96vzz9GDnXrI8gW9DKnJbAuOs5zeMKxg5ZKlg7iOwa+3HWeKZAQYXKPtL zi3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FkgaMo+C; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e5-20020a0562140d8500b00474742ba599si2618499qve.148.2022.08.05.12.57.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Aug 2022 12:57:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FkgaMo+C; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oK3Rv-0000rp-L2 for patch@linaro.org; Fri, 05 Aug 2022 15:57:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oK3Pl-0006O1-89 for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:21 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:56281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oK3Pj-0004VJ-PK for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:20 -0400 Received: by mail-pj1-x1029.google.com with SMTP id a8so3657685pjg.5 for ; Fri, 05 Aug 2022 12:55:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XoU1ivq664BvtVyoqP3w9U5Cy8Z2Wrd2UTjf3IBy+og=; b=FkgaMo+C+6HJ7MZqb7CEjwD5SBayfdFuUK2Scu2quYO3o4FKx3jXcYa9ud0WAgCSin ySmjj6lMnALnumdmlEALj2IwyIZajl53PSrIqnlV0Wyy1BQpWvdjLVRGMipxLOQwH92q KzKtJMluVe3x/4NwQKX/9jpeMlI7kU2p2NbX6oZqFqR4J6n8X97gZbMH0gZddhUAXZKy HYkyIzgUH0Qj9+1BucFb7pj3dFHvoUOPDsO4CXNHAYi5bO26z1Dfze2A+MlsAlVgtuhg Y1PDhYCCH5wbuteTn4xLZGeCUsweXExqwMYPxaQsUv+FD8K7gDR8OjD0XDJurCAEJJ7U C8BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XoU1ivq664BvtVyoqP3w9U5Cy8Z2Wrd2UTjf3IBy+og=; b=pT8JXNMTs/AoAhltQhS6covNN8lE5fSPjYX8RICcisNSmjEBP0iXb7VMM75+o8adNb MaEVJjO0cg3KNDSEvxodieCnXKV/kKbod4iRs4Bb/dkxeq50aEFXh7Ur7ZjxFLcGoSX0 yZIllzExIV46WpC27QWOrDotMNmp8y7AaX+SwVtgEcLNqyS8YFub9Wst1dK8v5URHXbT QOz2bhPQv6RGdfnKh5cZyI0M73TFUthSi6uMMgiXu/y8Dz/FccVCnsgFpTzLKUZegrYg dnBtanCgMKSMvNT2zN4p46av4y1D0kQQEw32qtPd8hEHfaR9/4lG9WuHtaqe6OusMqOw pVbg== X-Gm-Message-State: ACgBeo1Ts/sf1/bp5McZ6hc7KSeoPMjhnjJm7PuSSbqfDSseaiUkUG6I CcxXlT6otC+IfBs0AVrK7TNX3pC4C0hTHA== X-Received: by 2002:a17:90b:4f42:b0:1f5:6976:7021 with SMTP id pj2-20020a17090b4f4200b001f569767021mr9472482pjb.30.1659729318421; Fri, 05 Aug 2022 12:55:18 -0700 (PDT) Received: from stoup.. ([2602:ae:154e:e201:abf8:e436:f4c:9089]) by smtp.gmail.com with ESMTPSA id h13-20020a170902f70d00b0016f0c2ea158sm3393048plo.157.2022.08.05.12.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 12:55:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Qi Hu , Song Gao Subject: [PULL 1/7] target/loongarch: Fix macros SET_FPU_* in cpu.h Date: Fri, 5 Aug 2022 12:55:09 -0700 Message-Id: <20220805195515.349768-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220805195515.349768-1-richard.henderson@linaro.org> References: <20220805195515.349768-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Qi Hu The macros SET_FPU_* are used to set corresponding bits of fcsr. Unfortunately it forgets to set the result and it causes fcsr's "CAUSE" never being updated. This patch is to fix this bug. Signed-off-by: Qi Hu Reviewed-by: Song Gao Message-Id: <20220804132450.314329-1-huqi@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index a36349df83..dce999aaac 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -47,11 +47,23 @@ FIELD(FCSR0, FLAGS, 16, 5) FIELD(FCSR0, CAUSE, 24, 5) #define GET_FP_CAUSE(REG) FIELD_EX32(REG, FCSR0, CAUSE) -#define SET_FP_CAUSE(REG, V) FIELD_DP32(REG, FCSR0, CAUSE, V) +#define SET_FP_CAUSE(REG, V) \ + do { \ + (REG) = FIELD_DP32(REG, FCSR0, CAUSE, V); \ + } while (0) + #define GET_FP_ENABLES(REG) FIELD_EX32(REG, FCSR0, ENABLES) -#define SET_FP_ENABLES(REG, V) FIELD_DP32(REG, FCSR0, ENABLES, V) +#define SET_FP_ENABLES(REG, V) \ + do { \ + (REG) = FIELD_DP32(REG, FCSR0, ENABLES, V); \ + } while (0) + #define GET_FP_FLAGS(REG) FIELD_EX32(REG, FCSR0, FLAGS) -#define SET_FP_FLAGS(REG, V) FIELD_DP32(REG, FCSR0, FLAGS, V) +#define SET_FP_FLAGS(REG, V) \ + do { \ + (REG) = FIELD_DP32(REG, FCSR0, FLAGS, V); \ + } while (0) + #define UPDATE_FP_FLAGS(REG, V) \ do { \ (REG) |= FIELD_DP32(0, FCSR0, FLAGS, V); \ From patchwork Fri Aug 5 19:55:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 595512 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1559747maz; Fri, 5 Aug 2022 12:56:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR7F1IkMhOZRBKEasONZou9uv+i0a1lSIPzY3KCKq7vhSruw21vCdQ0cmF+ZpHfOn3wMCu3L X-Received: by 2002:a05:622a:1705:b0:31e:eecb:2af6 with SMTP id h5-20020a05622a170500b0031eeecb2af6mr7419378qtk.69.1659729394486; Fri, 05 Aug 2022 12:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659729394; cv=none; d=google.com; s=arc-20160816; b=nKSspibCGkr/5Sp3nu7yiXGh3IEI9pRD2lE5/OArQ3j1fUAgBZ5SnkbfAAqpfg/TEd AsNzd0VB9PxiWunHbTRtCU9EPxoZOLw1t/snZ8bcSzxlTtNz1p0Uc4T5zIOR5q1/n8nX 6sxgSbeGZESbAw9wkVISM7+M9Mpc/ZHxHjlAO+DVDBJtA+D0nUF9iVopI/XpO9emsKd0 AHc+wmXIyrBaWezJDHBpZErKSdUE0Zm/rHoiAzEPpUvnRqa9SixaXN4cG7cTBMZxqv9A FsD/ofjGtkPsblOIKlZMWnmLmy88vn7mpUQxVdArQEMdiBjydsV1/B3G1ALcvX4xr/M0 A/SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4MB0kNBsKeqajf853oKvTERPcRFUevz8GQAfrSDwCPo=; b=Yr1+0Vm4/Q7sHbQBamJDQDrznYml6JEvaabeN581nUWhRp1GC5Qqj5iKN1/0RlT1j5 lBuTJWLjsh4nLqJHsG3R+Vmz1RytVe4SV2co2aJ1WDBJwRfOryrYixr+2gDaGkqTTH4c 0g/ppSB7AsoyKLHKGnvQsg0J+liVPRh86kp4bW3NzRl92qQWoMQSTh7sbKzmyEJTUpGt I7CG7zBATDRR9jbdGNDwdYIF1HdtDG8JO9bcYb7ySpv6RoVFAu/S6i6ETJjOq6FnD+8r tYs2dcGVA6KxYvAnEyUv2B+SFtyRwCsY8yIZ1IDB89bGIfG/VEYCq5P30+bhx0dPSEfW 3bGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y+Aanmji; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r131-20020a37a889000000b006b5939b6ea2si2702432qke.144.2022.08.05.12.56.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Aug 2022 12:56:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y+Aanmji; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oK3Qw-0006Ua-1X for patch@linaro.org; Fri, 05 Aug 2022 15:56:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oK3Pn-0006R2-9F for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:23 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:46850) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oK3Pl-0004Ve-J3 for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:23 -0400 Received: by mail-pj1-x1029.google.com with SMTP id q7-20020a17090a7a8700b001f300db8677so3810894pjf.5 for ; Fri, 05 Aug 2022 12:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4MB0kNBsKeqajf853oKvTERPcRFUevz8GQAfrSDwCPo=; b=Y+AanmjielSl7eeqmq/xQF2T/QH4R/aFHpTlJlyy4/xn4BcOhrgliBjFgNPMvPVNM4 Zf9lT4w/ZpKWZHWfe3JQ02Chd7T8nNM+nuKYYntdKYNTTHsIzffcRG0w9Atrq1UoxwdB TjnH+NAxQm4SBntvpOjpoF5q/5hzdHJWlVY6y+YVOBuQPIUOEn3aUd3f6wg+xJglwlmO 65+dg/m8A2FgGq13W6PvLvomrjhBFHuydq8yNAMyrFx1ywZWy1dSeyyZEmtGUjIwz9MA Wc+nC1M4fiKmQk+N6+yaZl2SIGwq4FCESNZHLZlgcyAK2x16eM+P5d677v7aIvnzN9br TIOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4MB0kNBsKeqajf853oKvTERPcRFUevz8GQAfrSDwCPo=; b=rMoa5+ZU6BO0z/4zUPP+RymIs9J9uAA1U+9PAdZA19v7LC2rrOC1DaglpjM/cuMrQH I75ZI2gXI9CbubE2a4eDzC/cwCiwtsaY2s3xkEYLcUOBNkGlClU7bSEkj/uJQ4EphfuC tuf5hAh8lntVCyxHbvXyDtd/eEoL7Jyq8YZF0edZhYgswtSdexVLkN9zYP5ixob+0nBs /PvPP60PEBQBMDso340aWz/MmuXg6P0ak2ln87GzrA8bMJW7lp5UIALtaU4CgtdkCGyd DLLtHhpQF+WExXLeBoz8usCC1E942VTCmBagf5/wA+i6SUloraSsIRsw30TBUlcplgNA /Ofw== X-Gm-Message-State: ACgBeo02L/jB0E6Gj8eetAijU21mUJD48lYvX/LQTofFQ0ooyFf1kcoV xktI7IxKG9AI+1pg/ex6qtWaOJWOuBVCEQ== X-Received: by 2002:a17:902:aa98:b0:16c:d74d:fe6c with SMTP id d24-20020a170902aa9800b0016cd74dfe6cmr8527868plr.134.1659729320002; Fri, 05 Aug 2022 12:55:20 -0700 (PDT) Received: from stoup.. ([2602:ae:154e:e201:abf8:e436:f4c:9089]) by smtp.gmail.com with ESMTPSA id h13-20020a170902f70d00b0016f0c2ea158sm3393048plo.157.2022.08.05.12.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 12:55:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Peter Maydell Subject: [PULL 2/7] hw/loongarch: remove acpi-build.c unused variable 'aml_len' Date: Fri, 5 Aug 2022 12:55:10 -0700 Message-Id: <20220805195515.349768-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220805195515.349768-1-richard.henderson@linaro.org> References: <20220805195515.349768-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Fix a compiler warning on openbsd: ../src/hw/loongarch/acpi-build.c:416:12: warning: variable 'aml_len' set but not used [-Wunused-but-set-variable] size_t aml_len = 0; ^ Reported-by: Peter Maydell Signed-off-by: Song Gao Reviewed-by: Richard Henderson Message-Id: <20220721040046.3985609-1-gaosong@loongson.cn> [rth: Removing aml_len in turn makes fadt set but not used.] Signed-off-by: Richard Henderson --- hw/loongarch/acpi-build.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index 4b4529a3fb..d0f01a6485 100644 --- a/hw/loongarch/acpi-build.c +++ b/hw/loongarch/acpi-build.c @@ -411,9 +411,8 @@ static void acpi_build(AcpiBuildTables *tables, MachineState *machine) LoongArchMachineState *lams = LOONGARCH_MACHINE(machine); GArray *table_offsets; AcpiFadtData fadt_data; - unsigned facs, rsdt, fadt, dsdt; + unsigned facs, rsdt, dsdt; uint8_t *u; - size_t aml_len = 0; GArray *tables_blob = tables->table_data; init_common_fadt_data(&fadt_data); @@ -437,21 +436,13 @@ static void acpi_build(AcpiBuildTables *tables, MachineState *machine) dsdt = tables_blob->len; build_dsdt(tables_blob, tables->linker, machine); - /* - * Count the size of the DSDT, we will need it for - * legacy sizing of ACPI tables. - */ - aml_len += tables_blob->len - dsdt; - /* ACPI tables pointed to by RSDT */ - fadt = tables_blob->len; acpi_add_table(table_offsets, tables_blob); fadt_data.facs_tbl_offset = &facs; fadt_data.dsdt_tbl_offset = &dsdt; fadt_data.xdsdt_tbl_offset = &dsdt; build_fadt(tables_blob, tables->linker, &fadt_data, lams->oem_id, lams->oem_table_id); - aml_len += tables_blob->len - fadt; acpi_add_table(table_offsets, tables_blob); build_madt(tables_blob, tables->linker, lams); From patchwork Fri Aug 5 19:55:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 595516 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1561146maz; Fri, 5 Aug 2022 12:59:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR6GrB5Wow3Lvyp7lE6fcaUSk/DvedG4py+TyIt1jceWCq3OdNNDfbA3JS9giGeFleCSP7Eh X-Received: by 2002:a05:622a:287:b0:31f:32f6:1db1 with SMTP id z7-20020a05622a028700b0031f32f61db1mr7400090qtw.480.1659729583833; Fri, 05 Aug 2022 12:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659729583; cv=none; d=google.com; s=arc-20160816; b=k/YBwDbI22GkUYuF3H/8+Jw0kOrd9Jx+lEXsmnYVs5IN3cJxbWDL7QlRL5TLvbPYVA V3Jemd5iucGm6wuGmBMcTwZRAAtgV+MbsExP1PWiOBCOLee59ob+AsRAFKWRbwiAnXVA WghYyECxXrBLaY1RVjDKkAo2qFb95wAj8JWwrR1BIt4s1M+Ow5/FVP8pflUfqyWjbUxu v+3Cj97TMrmH5d4uxSBzIzsMf+BB5PZMMoUpOLQo13PVjw3Owoo5Qqbm8XxtC526/Qyd Vpcv1rXEBuXEgOVnhiYsM3rny7DjJlOibvntzWbhtQmyMkksjGB/KEzIKK0A8Vpu3rHE d8JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IDbgFIeEevSSdSTdjElX+eMs94p5XOKIDT8YgfUxWj8=; b=KKap000oE5CQE9KezmQ+mFH+9pyafiMz67pjywxSp9ZT3b+HXBQMP+xe1/0WFIAnib f3JoGbS9vKjq1j3dY+FE6RSUTXE8YnJyoHgNHZT8pz6CFVny+YuLIriXfztqO84gRxsn i2obLf9l4K+CSGW+DoMG3V5BogbaZOzFV5NiCsmZqu+ltqNSxO5I4WSKBqaGeGAK5GRa xTBQOAo8jhnP9UUapvVZwO6j0tKZ1kOX3JsN03NsLgoZsrXJOxrnpUETMsPwYVs5RgUV ltQ/zDGuj+j61A0wese8vNwbRw7E85IK5tN1fyxuxemfiObv1RCCQoByOv3oz67beZEY ciLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FuER+dFB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g10-20020a0562140aca00b004795f05dd57si1174130qvi.66.2022.08.05.12.59.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Aug 2022 12:59:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FuER+dFB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oK3Tz-0005Ml-Ei for patch@linaro.org; Fri, 05 Aug 2022 15:59:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oK3Po-0006Ue-IS for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:24 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:40893) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oK3Pm-0004Vy-R8 for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:24 -0400 Received: by mail-pj1-x1035.google.com with SMTP id s5-20020a17090a13c500b001f4da9ffe5fso9184950pjf.5 for ; Fri, 05 Aug 2022 12:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IDbgFIeEevSSdSTdjElX+eMs94p5XOKIDT8YgfUxWj8=; b=FuER+dFB+hNh+OwvWV/DAyxCJ40PNyEhfYQs1+zFLHBtDvW/j3QWy/sRhvT4bSf24T 0j/EBgMPPSHP2R6GtaVytn9jHvJBrbbaM/F+irAGNVyl1AmD5KRR8lFGtM0UVDxe7POF MG0DJjtkRI2yKZ9y6WqXOXhFmTDNZZhNppCmOP9boJz3JSiHBhcs1IVZmF8dg2O9agCU aNWkKVBrlAE9ztcKpQ7HZdHcoicGgCMP4VZqPyIqjoyOC96NibchdGCDq6GykYA2JNcF Ab+vtvvDlbcCVWo7e7t0LdIWGHf9raHc+PUhR5MRyjyc2LRqsDvDbyxQvEoyAHeliEY5 fvXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IDbgFIeEevSSdSTdjElX+eMs94p5XOKIDT8YgfUxWj8=; b=6nGcSn2vTakr36iz1CRyUZZg5D/jumBknYNJi6GAdNqhyuCGwn5RLHOAqMEoH1WVFC fCKrCbDkMka+ivJjm7X49GAFHABX/HQfSHePCBC2wxpABeKL8hvpPn4wMrLt9COwaGk6 EkejAXyAtH3O7J8XHfFFMa3eCe4JjrSgMea6Z2xp4rsafLsDdLFai0WLh/J46y5V2ya1 AkH3ZKdEaWXA2jyhDTJWufGKDpQtgwNMbhc+sVYqcgmuJaw9tIVjhAI/lRUt3R08paW3 /RWQg0feUdEvuKbYgsfATAGpu1gjk4aMnUblTOnsMb+lLgTOa/5rTa6HVZAs86eF7NXA A2Rw== X-Gm-Message-State: ACgBeo2EffwLQsqaE9jVIqTQtAnC9w6uTFygR9xukzOGx5N2Lse8vEIx bQrWGqltNLPCyrDMbwrwB9bJdLGXNDWkJg== X-Received: by 2002:a17:902:e548:b0:16f:8df8:90d3 with SMTP id n8-20020a170902e54800b0016f8df890d3mr6138794plf.90.1659729321572; Fri, 05 Aug 2022 12:55:21 -0700 (PDT) Received: from stoup.. ([2602:ae:154e:e201:abf8:e436:f4c:9089]) by smtp.gmail.com with ESMTPSA id h13-20020a170902f70d00b0016f0c2ea158sm3393048plo.157.2022.08.05.12.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 12:55:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 3/7] target/loongarch: Fix GDB get the wrong pc Date: Fri, 5 Aug 2022 12:55:11 -0700 Message-Id: <20220805195515.349768-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220805195515.349768-1-richard.henderson@linaro.org> References: <20220805195515.349768-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao GDB LoongArch add a register orig_a0, see the base64.xml [1]. We should add the orig_a0 to match the upstream GDB. [1]: https://github.com/bminor/binutils-gdb/blob/master/gdb/features/loongarch/base64.xml Signed-off-by: Song Gao Reviewed-by: Richard Henderson Acked-by: Alex Bennée Message-Id: <20220805033523.1416837-2-gaosong@loongson.cn> --- target/loongarch/cpu.c | 2 +- target/loongarch/gdbstub.c | 7 +++++-- gdb-xml/loongarch-base64.xml | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 1c69a76f2b..d84ec38cf7 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -683,7 +683,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data) cc->gdb_read_register = loongarch_cpu_gdb_read_register; cc->gdb_write_register = loongarch_cpu_gdb_write_register; cc->disas_set_info = loongarch_cpu_disas_set_info; - cc->gdb_num_core_regs = 34; + cc->gdb_num_core_regs = 35; cc->gdb_core_xml_file = "loongarch-base64.xml"; cc->gdb_stop_before_watchpoint = true; diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index 24e126fb2d..5feb43445f 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -19,8 +19,11 @@ int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) if (0 <= n && n < 32) { return gdb_get_regl(mem_buf, env->gpr[n]); } else if (n == 32) { - return gdb_get_regl(mem_buf, env->pc); + /* orig_a0 */ + return gdb_get_regl(mem_buf, 0); } else if (n == 33) { + return gdb_get_regl(mem_buf, env->pc); + } else if (n == 34) { return gdb_get_regl(mem_buf, env->CSR_BADV); } return 0; @@ -36,7 +39,7 @@ int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) if (0 <= n && n < 32) { env->gpr[n] = tmp; length = sizeof(target_ulong); - } else if (n == 32) { + } else if (n == 33) { env->pc = tmp; length = sizeof(target_ulong); } diff --git a/gdb-xml/loongarch-base64.xml b/gdb-xml/loongarch-base64.xml index 4962bdbd28..a1dd4f2208 100644 --- a/gdb-xml/loongarch-base64.xml +++ b/gdb-xml/loongarch-base64.xml @@ -39,6 +39,7 @@ + From patchwork Fri Aug 5 19:55:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 595517 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1562835maz; Fri, 5 Aug 2022 13:02:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR5WvfpRHiD7s9+6oO9BHPt7Od0u8Lzqx12lKsv7fBUKh/8iZRs7DhytQ2Fj0aur+p2VWSpN X-Received: by 2002:a37:dc46:0:b0:6b6:3757:f376 with SMTP id v67-20020a37dc46000000b006b63757f376mr6486262qki.543.1659729720879; Fri, 05 Aug 2022 13:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659729720; cv=none; d=google.com; s=arc-20160816; b=yJHGlwvyW2RYKv4WHDeAMyiRilEcjJo3aqd47H3LPsQzrs2FP/D69hdw/kPHe3dxaS XVYpCOQ0cHH0Xfq07Huwm7Gmv4ye7dg6ii7WY2kEXGD5ZPjAbCpaVz6FAROHdwkZTiMZ rq0vdsBHV140Vk9uB+ZrggbKNkK7SRNAvOxx+06b5r2ihyJdvW0ju/XPNoWoGeCitfYZ NtZh6E/y51WXksk4QwlFBTVqvOr1Xx4zJRCXjHZVCxsbSUHGwFcYxo7xEwAw2ur52Eda IdSWEqobfBMtpgBbRhzMadP7xYmcYNXrqDUhGvuhl1J2jFawUei4NH2Uf07w1EjUcDaW XBmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GXhVqFyj2uRqAwlXF7c/Ivc+Hg/JsHzuWch+Fk+p75k=; b=AryDUj9DQghlqpBdmAIXFrk9wB+p3++tR8ZUuJ8LOdyjMu0KObIJDuTNlGNrJ5QumF GGC/6dBV0kPiMAmtdI2YwtZ0bB2lNzkzwzVavOf+y+Y5EpjAF55wOWv0LLKxNSsmHEwD c1VeJm1ciat5dloNBncLTLl/pjsELHwcE4JwRaY8/t8YtzYjeOXYgqnSj47wlXkrZLra Oyua9kKW1nAtvyWWRumFI6uqQ9X/fQNFGUv80uIyy0gRNrrOCytp2BD+l0h+0SKKxznv 29NL88JcdZBGLbjroIyV0GAf0ALNZIYtC+loR0QpJihD6zLN8G/gzwozVH8P8+lQGO5G d4Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EBGvIJfA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s22-20020a05620a0bd600b006b8fa9a52d6si3386730qki.67.2022.08.05.13.02.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Aug 2022 13:02:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EBGvIJfA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oK3WC-0008ED-Gg for patch@linaro.org; Fri, 05 Aug 2022 16:02:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oK3Pq-0006ay-Si for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:26 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:42789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oK3Po-0004WL-8l for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:26 -0400 Received: by mail-pj1-x1032.google.com with SMTP id d65-20020a17090a6f4700b001f303a97b14so3856495pjk.1 for ; Fri, 05 Aug 2022 12:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GXhVqFyj2uRqAwlXF7c/Ivc+Hg/JsHzuWch+Fk+p75k=; b=EBGvIJfA5Gyfc+E07cUyhypCHOY9RQOGqe3CrVFR855uUXSgeU94U9Tbai2TloGVP/ K6wA5lZ6S+IeqlUe6TdLDQi0MGuZcbWwmbSZPmFQVCXq5julbuxqa94Yci+LTebphWW0 0zCrbO/YsGL2bT4nZTaytu7FFTYwRd+TB99B0Fh5AM3QutoeSJ5OyUgaoxsRqeFxhlQu RgPYDeZHiudGlj1sRnU8hRJLY9RPekpvWLd6gRWb/LZ/e7ZzaP7bGA57a1VnStbe5cWj SEOT8tHEMezDIlgiFQCJk04VYzuGUa1m8r3v4j6p6zGswLNlH9UOVzIKcmMWL1GV4PLs Ocfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GXhVqFyj2uRqAwlXF7c/Ivc+Hg/JsHzuWch+Fk+p75k=; b=0akCeIOe1CSkvjchbUWHDo81hrQFcBFg/tlJYznqDpeSfmQUcaY8esiQu62+QeghsO x5F3CkakixKvGeBE/8Ux3lJBqUf8gY0Lu1hFBnXcYHJJUfVLJ0wAOw4BWDsbQsnWeE6W jt4r1tdxOOQ1Pqb2ZA1ioIFcwsMFGNR7I7q8adNjTI/WK8C8LTavI9yHSfN/6ESZHLlw SUg4L07JEx+Hs8xdUI58/3tfKOdUfta+HDkQ0QEnyG+liEwFnrHRJ+pYTOUUH5WJdHmY Ao0hijvYPhzgCYryluxY5OWyrqbSCpfb7Ddy4sSKYkTMHEL/U4Ill9lir+luAiAp/LJQ p+Wg== X-Gm-Message-State: ACgBeo1yKFTpe/pZspDhYQpAUoCi/3gsGbXPImhCUs9LubHacqGBtRfb xMEFTazi0WrpBf4SgnEK1Jm3BYBC08jt1Q== X-Received: by 2002:a17:902:8f91:b0:16c:151d:3e1b with SMTP id z17-20020a1709028f9100b0016c151d3e1bmr7976125plo.37.1659729322842; Fri, 05 Aug 2022 12:55:22 -0700 (PDT) Received: from stoup.. ([2602:ae:154e:e201:abf8:e436:f4c:9089]) by smtp.gmail.com with ESMTPSA id h13-20020a170902f70d00b0016f0c2ea158sm3393048plo.157.2022.08.05.12.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 12:55:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 4/7] target/loongarch: add gdb_arch_name() Date: Fri, 5 Aug 2022 12:55:12 -0700 Message-Id: <20220805195515.349768-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220805195515.349768-1-richard.henderson@linaro.org> References: <20220805195515.349768-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Matches bfd/cpu-loongarch.c, bfd_loongarch_arch. Reviewed-by: Richard Henderson Signed-off-by: Song Gao Acked-by: Alex Bennée Message-Id: <20220805033523.1416837-3-gaosong@loongson.cn> --- target/loongarch/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index d84ec38cf7..941e2772bc 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -661,6 +661,11 @@ static const struct SysemuCPUOps loongarch_sysemu_ops = { }; #endif +static gchar *loongarch_gdb_arch_name(CPUState *cs) +{ + return g_strdup("loongarch64"); +} + static void loongarch_cpu_class_init(ObjectClass *c, void *data) { LoongArchCPUClass *lacc = LOONGARCH_CPU_CLASS(c); @@ -686,6 +691,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data) cc->gdb_num_core_regs = 35; cc->gdb_core_xml_file = "loongarch-base64.xml"; cc->gdb_stop_before_watchpoint = true; + cc->gdb_arch_name = loongarch_gdb_arch_name; #ifdef CONFIG_TCG cc->tcg_ops = &loongarch_tcg_ops; From patchwork Fri Aug 5 19:55:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 595513 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1559786maz; Fri, 5 Aug 2022 12:56:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR5jm+iUnt3R3FCGda5PAOMNpYkXYfKLNC+/V8wv2iIgSq0pBhieJgtoCCl39s3627CoYaNT X-Received: by 2002:a05:6214:224c:b0:479:5daa:a06a with SMTP id c12-20020a056214224c00b004795daaa06amr2945770qvc.103.1659729399565; Fri, 05 Aug 2022 12:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659729399; cv=none; d=google.com; s=arc-20160816; b=RVOTppm5GCIl2YcZSUXGqLftXFYEfr/OnDrbVL7meYL9ZU47xdpFmZ7hLbTiRDHnVB DeFBDUzj9x+jVbmHvTDCt7JuVRBsO0N1d9pwDSu8eC6/lDdeaXw3JOVQ2bZnYW5H6F/g +x5jZ86dL06WjMbTCK/5SQlGjK2+CicaJdfNtvTYz6AE2kzyy9nP2sdwJyhXhCpyOSzM iNnKjMaoFiiTyXMqLo1wijzzJRzNBaYsKyZoYcrfEYFO7fotMxJhjyOGHe6Arwa8Ik06 hLhhH2pLIIjfAy/BQUiqDjzogWggEc8q3tnJUsk8wUEzRHQRGYkGrGS8EXYSbI4EXD+P IEsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OYksRbozJz/8hpYBfMoGN+EQkbHN1ocDywW1SbrIXTg=; b=eZrruMOR5vorcp50F0kNon3JNPtid135iEAjI6tWkxdQ20wCG9bcdkMn4G4S3Rnywx 7cMf1te+0nmz1icnNd4SHth6W6UpHE5sy8h7lQbrYQLE3L9j5o5AA8ylImOb+Gz/Nxlf HsIvCULEJtlIPcFYPICAvXBOVeuzxmu+rZIg1bnzTc3XzrPnGFvFwaBDtZKIarmZbmz3 vrQl7PW1gFOKFmaUQo6hdanx9oKqMb0ZNRQNZIWBVuHrmESSY2K7PbIluuqxZ4ct73lp lr6KTFEmhfuPSxmaE5de0wRLlNmlXvzogKjP4khOnyQEwO7ZYTlLXZVHSSzJnljMkYCQ L6sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJX4ZaOc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jv13-20020a05621429ed00b004742d801d1fsi2888293qvb.109.2022.08.05.12.56.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Aug 2022 12:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJX4ZaOc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oK3Qz-0006cy-AQ for patch@linaro.org; Fri, 05 Aug 2022 15:56:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oK3Pq-0006aA-HN for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:26 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:38411) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oK3Po-0004V6-Vv for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:26 -0400 Received: by mail-pl1-x62b.google.com with SMTP id o3so3517708ple.5 for ; Fri, 05 Aug 2022 12:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OYksRbozJz/8hpYBfMoGN+EQkbHN1ocDywW1SbrIXTg=; b=tJX4ZaOcVG9la5ThSfcF3f59T05kNoCjjvlfQVvxd627cVTFIsZ4k7gVVOkvKne9I4 AAUHcJy1YFi/wOOTiUZ/T2paWW7wzzOE9HI/TBdyvF7X6TgyEkt9o8cGiALATCND+iBf tIiV7a8S4A+RJWgLzfj1V0j5nLy/8kje0/zS3DCDVWpdN/fPU15lWLs22CUqKfWNQOkO VYmRlGnyEz2zyTXZQFJ9dSVWAff1HT86jJ/CjsZs7eWSksVq+rgaUADBga7EYNUKVkpS BvUXK7iFoVccQJKSRXzNZ7uObYpgOwAF0LE07jtHecD9/MPrchWr5K+JzjhBxcUIJI0L RZ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OYksRbozJz/8hpYBfMoGN+EQkbHN1ocDywW1SbrIXTg=; b=IHKacgm+ZJMPtiLjGc2o2bwzMkM90lgtvW0i63qmQkayg/GWFaV0xnj/N+VuMUn96Q b881g3t3JGR7UdSFywAflgYzZDt4+jYljrzZ/EOTcNjfwfjx1zQM2OtjwtmgyoOPGWCO ZEmLahEfYDCY7/nioQB1dahbBb6diL4SbHeUjd0Vxd/kKpIkvetbSNA11zuVVaI4r7bR WXkYlQBLJ0ZRzzftgqTZtOlpQkh1aWuT2H3BxMJbstGmHaTYOeJos+utbcNubem05ePh eo7zQrne3oAcIJkpN1mTFg3/LeRnVmFo1d8lztbl6V7BL5jv3J3QYr4wwUzi/rrug7CA vQKQ== X-Gm-Message-State: ACgBeo0MtJR1SZ42TIC8HOpL/xGkQ4naLkujCvHhw7Kj9U+X+rWTXmtm jReGV9BWNkTyBMfrkF8f05KdjNhIAECJ3A== X-Received: by 2002:a17:902:d50e:b0:16f:eb61:157e with SMTP id b14-20020a170902d50e00b0016feb61157emr2542213plg.3.1659729324158; Fri, 05 Aug 2022 12:55:24 -0700 (PDT) Received: from stoup.. ([2602:ae:154e:e201:abf8:e436:f4c:9089]) by smtp.gmail.com with ESMTPSA id h13-20020a170902f70d00b0016f0c2ea158sm3393048plo.157.2022.08.05.12.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 12:55:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 5/7] target/loongarch: update loongarch-base64.xml Date: Fri, 5 Aug 2022 12:55:13 -0700 Message-Id: <20220805195515.349768-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220805195515.349768-1-richard.henderson@linaro.org> References: <20220805195515.349768-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Update loongarch-base64.xml to match the upstream GDB [1]. [1]:https://github.com/bminor/binutils-gdb/blob/master/gdb/features/loongarch/base64.xml Reviewed-by: Richard Henderson Signed-off-by: Song Gao Acked-by: Alex Bennée Message-Id: <20220805033523.1416837-4-gaosong@loongson.cn> --- gdb-xml/loongarch-base64.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb-xml/loongarch-base64.xml b/gdb-xml/loongarch-base64.xml index a1dd4f2208..2d8a1f6b73 100644 --- a/gdb-xml/loongarch-base64.xml +++ b/gdb-xml/loongarch-base64.xml @@ -1,5 +1,5 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb-xml/loongarch-fpu64.xml b/gdb-xml/loongarch-fpu64.xml deleted file mode 100644 index e52cf89fbc..0000000000 --- a/gdb-xml/loongarch-fpu64.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From patchwork Fri Aug 5 19:55:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 595518 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp1565437maz; Fri, 5 Aug 2022 13:05:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Hgpfo24ffZKM+al/WRmhUGWDVPnVpgh6JsdZtM2V2+KIFMrnFV/P5Jz6oHh4yoht+qne6 X-Received: by 2002:ae9:dd05:0:b0:6b8:f29e:54ed with SMTP id r5-20020ae9dd05000000b006b8f29e54edmr6303653qkf.283.1659729904044; Fri, 05 Aug 2022 13:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659729904; cv=none; d=google.com; s=arc-20160816; b=yRJGR6G36tr3/PuaoT84keTRa5Aua+s6IDNcyWL8qsZB4ldVZZlnbpV2xPCTcGuvoP cYUrmqwuhrFc9jb+nhkl2gnjnJQEr5bpY+gmNqYM++IyHUX7d3eYz8Z2MhOaeczNrTuB TP8zY+GbvCuowVfbSWWjBZZjgdoqayacd24eyB4n76a0SCWWfcNvsU9nJVlLGYVaLgKP b3sxri1JjLLq1gPWnnpueRIGFfUla2mTPJhyZezxJCvJGeeXadbbOHBAl5Psp8NsptXQ kzOflj8yUifRnW/z2dL/fCiEDA5IPIOIOLflGjQLX3T6/7Bds/tNDknBe1lpR0ygcaUE ksvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kfx1lrx4WNwVLD4+SbP89f5w4riUSjZqaLsw6gR72p0=; b=y9ngiRRs0cH6YxRAv/dyaZRaDZmfX4Dm0dU938W8QQ5eooc7u8iLFFhUDMlMr3oxKr Zjrh4fpan4vA1vz2IX0231lDLpJVwtEJpEfDV1SI2iLatEr82FGeNiidaUBEMfEv25j7 8G3Sp7/SMc+g3xsay3lRhE2cLN2ZtXDb1WoNSzMGduchQr6EYvqSqmKkee0FphEux8az ee/Q3zA7PQrTt9FO12vm2gSGRu2cVKjEthv0UVOZsR4r4c2j5s2xtjl4C26NUEd8XCHT +WGNHR+c/uW8ptbCrWpbPMiQO104ddEXg6zTet9TG+Z9rfj49SlkvYVebWay1W9Yum4n r8rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PRh5MD0k; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x128-20020a379586000000b006b579afcaf6si2641381qkd.298.2022.08.05.13.05.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Aug 2022 13:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PRh5MD0k; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oK3Z9-0001nq-Ga for patch@linaro.org; Fri, 05 Aug 2022 16:05:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oK3Pu-0006mH-Mg for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:30 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:38701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oK3Ps-0004aZ-UV for qemu-devel@nongnu.org; Fri, 05 Aug 2022 15:55:30 -0400 Received: by mail-pj1-x1036.google.com with SMTP id q9-20020a17090a2dc900b001f58bcaca95so2402186pjm.3 for ; Fri, 05 Aug 2022 12:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Kfx1lrx4WNwVLD4+SbP89f5w4riUSjZqaLsw6gR72p0=; b=PRh5MD0k/nf8AFAs/zr4u6mkWsG07CBW9ok3jiW8PCxqEVHPwRAnMdDy9A312Hh473 DqmPzkKLW5RuWbRjsc8PmlQyVkImnUriqDuEcsDOFh1ZOpF1g2s4ZkX3hIVUZfvvuLod jc/spj1unRcS/JFxLOTcaD9Ih66V8/BKl0FlNvDe9TT/i+GC61qAQx0XWywWWW1YBoNS 3yn9ksUvXmflbRNCZaqBWW/439JTOzURQwb92Bth8ZHkmmHcT7AsptNBxYUhe9Bgkq2X Ybj8gRg7mgOdc4VYdD7RkG7ISzLvdb6vhPSW5eeedImVD8vw2Qu0IoEVLjhZc2Yigc09 HzJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Kfx1lrx4WNwVLD4+SbP89f5w4riUSjZqaLsw6gR72p0=; b=CsXpZvJdgmGG16P8yUQ/R+P4VKcmR0r7xuP7tPx+JI/Uf7IFgM0rlVJ+d7cASyiWwc run62/ZO6y/LposWkB9qR+5TDaxX8NkBVKr2hcdtFmt6zGM23xouKIjXqjRpiF930355 8RogKLOxpCmv4xEMZtw0UlHPXgNGXAnZSWs5rHK6BJek4yxIExY9fZxgCgBNrTHg3SoP 6YUeaAOuyuMi3FUnfoxiFDw9kEua2dd9Svw7Ce7Otcwxe6R6zgINCHHg1/2vLArIOtRU ZzdGb2MwU3e2ldDb2RV2OQHbicVkZRgQlkr6QhuHFUs9ywoF1vbcLdQhGZPhXhV2yHo5 b2SA== X-Gm-Message-State: ACgBeo2EDQ9nFUrRhr3hiSkw4BWieTGJhHRG5KWvncovw8rgdaEXMVdB Wbk6pcWmJKKUsVK8vXeo9FcupXwzguPN+Q== X-Received: by 2002:a17:902:e849:b0:16e:81c6:2cb7 with SMTP id t9-20020a170902e84900b0016e81c62cb7mr8457121plg.110.1659729326532; Fri, 05 Aug 2022 12:55:26 -0700 (PDT) Received: from stoup.. ([2602:ae:154e:e201:abf8:e436:f4c:9089]) by smtp.gmail.com with ESMTPSA id h13-20020a170902f70d00b0016f0c2ea158sm3393048plo.157.2022.08.05.12.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 12:55:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 7/7] target/loongarch: Update gdb_set_fpu() and gdb_get_fpu() Date: Fri, 5 Aug 2022 12:55:15 -0700 Message-Id: <20220805195515.349768-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220805195515.349768-1-richard.henderson@linaro.org> References: <20220805195515.349768-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao GDB LoongArch fpu use fcc register, update gdb_set_fpu() and gdb_get_fpu() to match it. Signed-off-by: Song Gao Reviewed-by: Richard Henderson Acked-by: Alex Bennée Message-Id: <20220805033523.1416837-6-gaosong@loongson.cn> --- target/loongarch/internals.h | 3 +++ linux-user/loongarch64/signal.c | 24 ++--------------------- target/loongarch/gdbstub.c | 34 ++++++++++++++++++++++++++------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/target/loongarch/internals.h b/target/loongarch/internals.h index ea227362b6..f01635aed6 100644 --- a/target/loongarch/internals.h +++ b/target/loongarch/internals.h @@ -51,6 +51,9 @@ bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size, hwaddr loongarch_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); #endif /* !CONFIG_USER_ONLY */ +uint64_t read_fcc(CPULoongArchState *env); +void write_fcc(CPULoongArchState *env, uint64_t val); + int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n); int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n); void loongarch_cpu_register_gdb_regs_for_features(CPUState *cs); diff --git a/linux-user/loongarch64/signal.c b/linux-user/loongarch64/signal.c index 65fd5f3857..7c7afb652e 100644 --- a/linux-user/loongarch64/signal.c +++ b/linux-user/loongarch64/signal.c @@ -71,26 +71,6 @@ struct extctx_layout { struct ctx_layout end; }; -/* The kernel's sc_save_fcc macro is a sequence of MOVCF2GR+BSTRINS. */ -static uint64_t read_all_fcc(CPULoongArchState *env) -{ - uint64_t ret = 0; - - for (int i = 0; i < 8; ++i) { - ret |= (uint64_t)env->cf[i] << (i * 8); - } - - return ret; -} - -/* The kernel's sc_restore_fcc macro is a sequence of BSTRPICK+MOVGR2CF. */ -static void write_all_fcc(CPULoongArchState *env, uint64_t val) -{ - for (int i = 0; i < 8; ++i) { - env->cf[i] = (val >> (i * 8)) & 1; - } -} - static abi_ptr extframe_alloc(struct extctx_layout *extctx, struct ctx_layout *sctx, unsigned size, unsigned align, abi_ptr orig_sp) @@ -150,7 +130,7 @@ static void setup_sigframe(CPULoongArchState *env, for (i = 0; i < 32; ++i) { __put_user(env->fpr[i], &fpu_ctx->regs[i]); } - __put_user(read_all_fcc(env), &fpu_ctx->fcc); + __put_user(read_fcc(env), &fpu_ctx->fcc); __put_user(env->fcsr0, &fpu_ctx->fcsr); /* @@ -216,7 +196,7 @@ static void restore_sigframe(CPULoongArchState *env, __get_user(env->fpr[i], &fpu_ctx->regs[i]); } __get_user(fcc, &fpu_ctx->fcc); - write_all_fcc(env, fcc); + write_fcc(env, fcc); __get_user(env->fcsr0, &fpu_ctx->fcsr); restore_fp_status(env); } diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index d3a5e404b0..a4d1e28e36 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -11,6 +11,24 @@ #include "internals.h" #include "exec/gdbstub.h" +uint64_t read_fcc(CPULoongArchState *env) +{ + uint64_t ret = 0; + + for (int i = 0; i < 8; ++i) { + ret |= (uint64_t)env->cf[i] << (i * 8); + } + + return ret; +} + +void write_fcc(CPULoongArchState *env, uint64_t val) +{ + for (int i = 0; i < 8; ++i) { + env->cf[i] = (val >> (i * 8)) & 1; + } +} + int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { LoongArchCPU *cpu = LOONGARCH_CPU(cs); @@ -51,9 +69,10 @@ static int loongarch_gdb_get_fpu(CPULoongArchState *env, { if (0 <= n && n < 32) { return gdb_get_reg64(mem_buf, env->fpr[n]); - } else if (32 <= n && n < 40) { - return gdb_get_reg8(mem_buf, env->cf[n - 32]); - } else if (n == 40) { + } else if (n == 32) { + uint64_t val = read_fcc(env); + return gdb_get_reg64(mem_buf, val); + } else if (n == 33) { return gdb_get_reg32(mem_buf, env->fcsr0); } return 0; @@ -67,10 +86,11 @@ static int loongarch_gdb_set_fpu(CPULoongArchState *env, if (0 <= n && n < 32) { env->fpr[n] = ldq_p(mem_buf); length = 8; - } else if (32 <= n && n < 40) { - env->cf[n - 32] = ldub_p(mem_buf); - length = 1; - } else if (n == 40) { + } else if (n == 32) { + uint64_t val = ldq_p(mem_buf); + write_fcc(env, val); + length = 8; + } else if (n == 33) { env->fcsr0 = ldl_p(mem_buf); length = 4; }