From nobody Fri May 17 10:44:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.51 as permitted sender) client-ip=209.85.128.51; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f51.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1619982544; cv=none; d=zohomail.com; s=zohoarc; b=IJbNyICw3iusTYnsjBQfiN2po9ev124JNwwOY4XF/KuRw+agYInzRFGN5Y0POX+k7shLx4hxbHKvjWZtGU71oF3cD+wXQISelWYBdnaDgDvNjHNqES98gJb5BVHZGigYM4/0u3T52OK1UF3hjOwcbZZ4uRR94YGY83S7ChnX6Gw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619982544; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Sender:Subject:To; bh=Od1APi/IikRB8BlnR55ihbRQgaqYGdqucLI4V3awYJE=; b=V0RH43ojFLt21BoVurGZgp0fnip0uENbySaONma4UsXir5KzJKPS1Uwp8THsLrMyoO8DorR5z0r58htF5jT/CIgGsl29Vn1T3p9/eCQ7EmfPZlFl5mEiFUjNAd7inkO9N3ZetVLO7zeae15dPji9N0MkJ5KyKH4A+vzymDUIKcQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mx.zohomail.com with SMTPS id 1619982544636772.8958938652918; Sun, 2 May 2021 12:09:04 -0700 (PDT) Received: by mail-wm1-f51.google.com with SMTP id i21-20020a05600c3555b029012eae2af5d4so4566913wmq.4 for ; Sun, 02 May 2021 12:09:04 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (anancy-651-1-208-144.w109-217.abo.wanadoo.fr. [109.217.237.144]) by smtp.gmail.com with ESMTPSA id y14sm9473887wrs.64.2021.05.02.12.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 May 2021 12:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Od1APi/IikRB8BlnR55ihbRQgaqYGdqucLI4V3awYJE=; b=R6uJcUg8LxZJw9TBGOVTk/1Bvy6XvEoMDdj1Lqf9T9DSVWuHSk0SRW27CDUV6y6lwP BKA9qwsJwD1Ye8fBkn+dQnHFQucYqM02KbWgmxaClkSugMEF0ITiEjn4neIKfzcrNrhB +d1hBquEdfUFtPoumD386bOIZ4ZDxbUp1MbMFcQQ7kWt1jnqQA+8Un4nyHW6j7BCbi4p 2jC6Z2+Emv/5r32oStQpYjoypu7wp8R1lRvi7s2+nE7VNFgSt/Ve+RpQo+y6PjcY0txK dQ4rwEVnjY3YDdIsjUM58oyLqAqIQIQbKzqux8DdROyMefXO1asLM+fc/InKenvtQFxb V1HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=Od1APi/IikRB8BlnR55ihbRQgaqYGdqucLI4V3awYJE=; b=dK5lMEr+2jvyiBrckaHiGGBN8SsT71S5RbXFuDFvFEwL8cDzjsr/rT1E9H4Q7usUxx MnJ52cm0sXqK39y1M965CpHQqKTEUyu9EwRC9h7OQHbJZHW+3dGh55GKznSMXyrShloH eGztkMSjAJxZBYVtn+lxCwtGwsGw7sliYs2aagBA0iGbRJdklJO2n8mPKw/Ht39L/AaZ uCuhJp1UEq8M9aATaTKZ8dKmnXldfauNvIJsLihvIoTq1verDJagf3Ej3B6pjG1wa+4/ 4rhl5T6hpNIMdjdd77Sjf0ZlDCogE1bI0EMa592X5XEnZhcTFw5YDsUjsJCqJCobdI2b XfRQ== X-Gm-Message-State: AOAM531ueDhIrWBgfEruKbCs1KCSQSCIpmo95FTqwbBZYXlW45qTN0Fl XsU8utWzfl+al7QgPFbuwig= X-Google-Smtp-Source: ABdhPJw6tzNIE37xDvqZNuLotYVkGOei1wEbqvP04MS/+URzHnvlTNzjR7t9qir1Y4im3Y2ibF3qcA== X-Received: by 2002:a1c:dc41:: with SMTP id t62mr28372388wmg.14.1619982542932; Sun, 02 May 2021 12:09:02 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Michael Rolnik , Joaquin de Andres , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Fred Konrad Subject: [PATCH] target/avr: Ignore unimplemented WDR opcode Date: Sun, 2 May 2021 21:09:00 +0200 Message-Id: <20210502190900.604292-1-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Running the WDR opcode triggers a segfault: $ cat > foo.S << EOF > __start: > wdr > EOF $ avr-gcc -nostdlib -nostartfiles -mmcu=3Davr6 foo.S -o foo.elf $ qemu-system-avr -serial mon:stdio -nographic -no-reboot \ -M mega -bios foo.elf -d in_asm --singlestep IN: 0x00000000: WDR Segmentation fault (core dumped) (gdb) bt #0 0x00005555add0b23a in gdb_get_cpu_pid (cpu=3D0x5555af5a4af0) at ..= /gdbstub.c:718 #1 0x00005555add0b2dd in gdb_get_cpu_process (cpu=3D0x5555af5a4af0) a= t ../gdbstub.c:743 #2 0x00005555add0e477 in gdb_set_stop_cpu (cpu=3D0x5555af5a4af0) at .= ./gdbstub.c:2742 #3 0x00005555adc99b96 in cpu_handle_guest_debug (cpu=3D0x5555af5a4af0= ) at ../softmmu/cpus.c:306 #4 0x00005555adcc66ab in rr_cpu_thread_fn (arg=3D0x5555af5a4af0) at .= ./accel/tcg/tcg-accel-ops-rr.c:224 #5 0x00005555adefaf12 in qemu_thread_start (args=3D0x5555af5d9870) at= ../util/qemu-thread-posix.c:521 #6 0x00007f692d940ea5 in start_thread () from /lib64/libpthread.so.0 #7 0x00007f692d6699fd in clone () from /lib64/libc.so.6 Since the watchdog peripheral is not implemented, simply log the opcode as unimplemented and keep going. Reported-by: Fred Konrad Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: KONRAD Frederic --- target/avr/helper.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/avr/helper.c b/target/avr/helper.c index 35e10195940..981c29da453 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -188,11 +188,7 @@ void helper_break(CPUAVRState *env) =20 void helper_wdr(CPUAVRState *env) { - CPUState *cs =3D env_cpu(env); - - /* WD is not implemented yet, placeholder */ - cs->exception_index =3D EXCP_DEBUG; - cpu_loop_exit(cs); + qemu_log_mask(LOG_UNIMP, "WDG reset (not implemented)\n"); } =20 /* --=20 2.26.3