From patchwork Mon Jan 28 16:53:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Schnelle X-Patchwork-Id: 1032036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=stackframe.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=duncanthrax.net header.i=@duncanthrax.net header.b="CHk6eaXQ"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43pG2B2H3Vz9sQv for ; Tue, 29 Jan 2019 03:54:42 +1100 (AEDT) Received: from localhost ([127.0.0.1]:35040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goABE-0002FG-Cn for incoming@patchwork.ozlabs.org; Mon, 28 Jan 2019 11:54:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goAAg-0002Bs-5k for qemu-devel@nongnu.org; Mon, 28 Jan 2019 11:54:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goAAf-0004a3-5p for qemu-devel@nongnu.org; Mon, 28 Jan 2019 11:54:06 -0500 Received: from smtp.duncanthrax.net ([2001:470:70c5:1111::170]:41415) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goAAe-0004Ye-OC for qemu-devel@nongnu.org; Mon, 28 Jan 2019 11:54:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=duncanthrax.net; s=dkim; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From; bh=NDtCxH8SSoynmaatWUZCM3Z1GYLKc0jdMlokTc3Z65o=; b=CHk6eaXQT01jqx/1qCHaftUENJ ZxY2AAARteYhQGKYqQ8sxZaxzKA07DDQfElrdJR84BFWEure1CzHDnPuQkiaXpIKdt1iCYZyo4fxe PgGd7CHL+u7yKIiMGjMs+MtfrvQVdyQ8/gk2y0DOTMOwROqBFMvTGC/SYk1C/oL1vf7M=; Received: from hsi-kbw-109-193-150-175.hsi7.kabel-badenwuerttemberg.de ([109.193.150.175] helo=t470p.stackframe.org) by smtp.eurescom.eu with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1goAAc-00046j-6t; Mon, 28 Jan 2019 17:54:02 +0100 From: Sven Schnelle To: qemu-devel@nongnu.org Date: Mon, 28 Jan 2019 17:53:33 +0100 Message-Id: <20190128165333.3814-1-svens@stackframe.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:470:70c5:1111::170 Subject: [Qemu-devel] [PATCH] target/hppa: fix setting registers via gdb X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sven Schnelle , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" While doing 'set $pcoqh=0xf0000000' i triggered the assertion below. From looking at the source, it looks like the argument order for deposit64() is wrong, and val needs to be moved to the end. Signed-off-by: Sven Schnelle qemu-system-hppa: /home/svens/qemu/include/qemu/bitops.h:419: deposit64: Assertion `start >= 0 && length > 0 && length <= 64 - start' failed. Thread 1 "qemu-system-hpp" received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007ffff4f8785b in __GI_raise (sig=sig@entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007ffff4f72535 in __GI_abort () at abort.c:79 #2 0x00007ffff4f7240f in __assert_fail_base (fmt=0x7ffff50d4ee0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555555cc62a8 "start >= 0 && length > 0 && length <= 64 - start", file=0x555555cc6280 "/home/svens/qemu/include/qemu/bitops.h", line=0x1a3, function=) at assert.c:92 #3 0x00007ffff4f800a2 in __GI___assert_fail (assertion=0x555555cc62a8 "start >= 0 && length > 0 && length <= 64 - start", file=0x555555cc6280 "/home/svens/qemu/include/qemu/bitops.h", line=0x1a3, function=0x555555cc6760 <__PRETTY_FUNCTION__.15114> "deposit64") at assert.c:101 #4 0x00005555558dd0db in deposit64 (value=0x0, start=0x0, length=0x0, fieldval=0x20) at /home/svens/qemu/include/qemu/bitops.h:419 #5 0x00005555558dd87a in hppa_cpu_gdb_write_register (cs=0x5555563394e0, mem_buf=0x7fffffffb134 "", n=0x41) at /home/svens/qemu/target/hppa/gdbstub.c:269 #6 0x0000555555822397 in gdb_write_register (cpu=0x5555563394e0, mem_buf=0x7fffffffb134 "", reg=0x41) at /home/svens/qemu/gdbstub.c:905 #7 0x0000555555823802 in gdb_handle_packet (s=0x555556992020, line_buf=0x55555699203c "G", '0' , "fff1", '0' , "1", '0' , "6"...) at /home/svens/qemu/gdbstub.c:1481 #8 0x000055555582573c in gdb_read_byte (s=0x555556992020, ch=0x35) at /home/svens/qemu/gdbstub.c:2131 #9 0x0000555555825972 in gdb_chr_receive (opaque=0x555556992020, buf=0x7fffffffd170 "$G", '0' , "fff1", '0' , "1", '0' ..., size=0x405) at /home/svens/qemu/gdbstub.c:2369 #10 0x0000555555bd51bc in qemu_chr_be_write_impl (s=0x5555566cd100, buf=0x7fffffffd170 "$G", '0' , "fff1", '0' , "1", '0' ..., len=0x405) at chardev/char.c:175 #11 0x0000555555bd5220 in qemu_chr_be_write (s=0x5555566cd100, buf=0x7fffffffd170 "$G", '0' , "fff1", '0' , "1", '0' ..., len=0x405) at chardev/char.c:187 #12 0x0000555555bdde8d in tcp_chr_read (chan=0x55555697ea00, cond=G_IO_IN, opaque=0x5555566cd100) at chardev/char-socket.c:490 #13 0x0000555555bf81c3 in qio_channel_fd_source_dispatch (source=0x5555569c6220, callback=0x555555bddcdf , user_data=0x5555566cd100) at io/channel-watch.c:84 #14 0x00007ffff6937cb8 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #15 0x0000555555c73851 in glib_pollfds_poll () at util/main-loop.c:215 #16 0x0000555555c738cb in os_host_main_loop_wait (timeout=0x3b9aca00) at util/main-loop.c:238 #17 0x0000555555c73984 in main_loop_wait (nonblocking=0x0) at util/main-loop.c:497 #18 0x00005555558f4130 in main_loop () at vl.c:1925 #19 0x00005555558fbb43 in main (argc=0xd, argv=0x7fffffffe5e8, envp=0x7fffffffe658) at vl.c:4662 Signed-off-by: Sven Schnelle --- target/hppa/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c index e2e9c4d77f..3157a690f2 100644 --- a/target/hppa/gdbstub.c +++ b/target/hppa/gdbstub.c @@ -266,7 +266,7 @@ int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) case 65 ... 127: { uint64_t *fr = &env->fr[(n - 64) / 2]; - *fr = deposit64(*fr, val, (n & 1 ? 0 : 32), 32); + *fr = deposit64(*fr, (n & 1 ? 0 : 32), 32, val); } break; default: