From patchwork Wed Jun 8 13:30:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9164749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 215CF60572 for ; Wed, 8 Jun 2016 13:53:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1107025D91 for ; Wed, 8 Jun 2016 13:53:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05E632824F; Wed, 8 Jun 2016 13:53:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FSL_HELO_HOME, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8FD5B25D91 for ; Wed, 8 Jun 2016 13:53:11 +0000 (UTC) Received: from localhost ([::1]:57123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAduw-0007xs-1p for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Jun 2016 09:53:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZT-0004M2-Iz for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZR-0005nf-D0 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:58 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:33692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZR-0005nW-5Z for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:57 -0400 Received: by mail-lf0-x234.google.com with SMTP id s64so5904737lfe.0 for ; Wed, 08 Jun 2016 06:30:57 -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; bh=DYAJY32M/+s34fQf3Uti+Uw1e5x04tNPsCFEX3/9b4E=; b=kS81cb3RrKnrtyMTpY2Ms85aBa7FdshFP8qzSni93VPsAcXRyE/LqSG9aGGv68v7zN R5fZ858MdfCFc5ZqckFbis63Zw26fZ8toGntrhOCLO/j+yuURrDd61Gtb14VqrEEGLKj uN3nGRat0W+fzXnt1771nvfBkiYiNxkSOhUfE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DYAJY32M/+s34fQf3Uti+Uw1e5x04tNPsCFEX3/9b4E=; b=HuS73bZ/02IhLkBNeCIv2rSZ0A3PEuaJQwNoyzcVL9siB1h9LF+KL70RP/rbVtksqk InnopUBk/APCzUV2dpli+Wpl1ygkJIESHQ7DLIXJvoDuFMlyTRMg71xrnOHH2KS4vt5z ZEjBrVfvRp+Ewr6KwxmK1WMf8ierys6+ve2odIRBGm4qgQR4WwsTfOFdlitbXHfq8k8M JPgDj6hR/JFLRPD+azAuBu7yZ5k4o+jgLgavTD5KWXPdZuuhmqxvZnGj7lqImV5+I7/r QP2s46KrXA12/otr//QxAERQvT4bpEklsnt4P5nnz5knyKoTYO2q4EgQRUDE46myWaVk yPzQ== X-Gm-Message-State: ALyK8tII1p4hdkgxVGmPmtGafckycOlbxvmy7o3cQ/zhUhLjJMzE3510uUkVJHyLjrMqxfBY X-Received: by 10.46.9.11 with SMTP id 11mr1390243ljj.5.1465392656283; Wed, 08 Jun 2016 06:30:56 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.30.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:30:55 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:05 +0300 Message-Id: <9e024732f53b368abdd578e1795bf3d2779ea88a.1465392531.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::234 Subject: [Qemu-devel] [PULL 24/44] linux-user: provide frame information in x86-64 safe_syscall 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: Peter Maydell Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Maydell Use cfi directives in the x86-64 safe_syscall to allow gdb to get backtraces right from within it. (In particular this will be quite a common situation if the user interrupts QEMU while it's in a blocked safe-syscall: at the point of the syscall insn RBP is in use for something else, and so gdb can't find the frame then without assistance.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Riku Voipio --- linux-user/host/x86_64/safe-syscall.inc.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/linux-user/host/x86_64/safe-syscall.inc.S index dde434c..e09368d 100644 --- a/linux-user/host/x86_64/safe-syscall.inc.S +++ b/linux-user/host/x86_64/safe-syscall.inc.S @@ -24,6 +24,7 @@ * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: + .cfi_startproc /* This saves a frame pointer and aligns the stack for the syscall. * (It's unclear if the syscall ABI has the same stack alignment * requirements as the userspace function call ABI, but better safe than @@ -31,6 +32,8 @@ safe_syscall_base: * does not list any ABI differences regarding stack alignment.) */ push %rbp + .cfi_adjust_cfa_offset 8 + .cfi_rel_offset rbp, 0 /* The syscall calling convention isn't the same as the * C one: @@ -70,12 +73,19 @@ safe_syscall_start: safe_syscall_end: /* code path for having successfully executed the syscall */ pop %rbp + .cfi_remember_state + .cfi_def_cfa_offset 8 + .cfi_restore rbp ret return_ERESTARTSYS: /* code path when we didn't execute the syscall */ + .cfi_restore_state mov $-TARGET_ERESTARTSYS, %rax pop %rbp + .cfi_def_cfa_offset 8 + .cfi_restore rbp ret + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base