qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <alex@csgraf.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/5] (PPC) Fix in-between branch returns
Date: Thu, 17 Jan 2008 07:42:48 +0100	[thread overview]
Message-ID: <478EF8E8.8090707@csgraf.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

Thanks to the branch detection I found several places where op.o
contained branch returns somewhere not at the end of the function. This
did not happen on other platforms for me, but I may be wrong.

This patch adds FORCE_RET at the end of those functions, to force gcc to
use a jump to the end and not return from it. The idea and most of the
debugging for this comes from Michael Matz.

[-- Attachment #2: qemu-gcc4-forceret.patch --]
[-- Type: text/x-patch, Size: 1247 bytes --]

Index: qemu-snapshot-2008-01-15_05/target-i386/op.c
===================================================================
--- qemu-snapshot-2008-01-15_05.orig/target-i386/op.c
+++ qemu-snapshot-2008-01-15_05/target-i386/op.c
@@ -291,6 +291,7 @@ void OPPROTO op_imull_EAX_T0(void)
     EDX = (uint32_t)(res >> 32);
     CC_DST = res;
     CC_SRC = (res != (int32_t)res);
+    FORCE_RET();
 }
 
 void OPPROTO op_imulw_T0_T1(void)
@@ -300,6 +301,7 @@ void OPPROTO op_imulw_T0_T1(void)
     T0 = res;
     CC_DST = res;
     CC_SRC = (res != (int16_t)res);
+    FORCE_RET();
 }
 
 void OPPROTO op_imull_T0_T1(void)
@@ -309,6 +311,7 @@ void OPPROTO op_imull_T0_T1(void)
     T0 = res;
     CC_DST = res;
     CC_SRC = (res != (int32_t)res);
+    FORCE_RET();
 }
 
 #ifdef TARGET_X86_64
Index: qemu-snapshot-2008-01-15_05/target-i386/ops_template.h
===================================================================
--- qemu-snapshot-2008-01-15_05.orig/target-i386/ops_template.h
+++ qemu-snapshot-2008-01-15_05/target-i386/ops_template.h
@@ -467,6 +467,7 @@ void OPPROTO glue(glue(op_bt, SUFFIX), _
     int count;
     count = T1 & SHIFT_MASK;
     CC_SRC = T0 >> count;
+    FORCE_RET();
 }
 
 void OPPROTO glue(glue(op_bts, SUFFIX), _T0_T1_cc)(void)

                 reply	other threads:[~2008-01-17 10:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=478EF8E8.8090707@csgraf.de \
    --to=alex@csgraf.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).