~ubuntu-branches/ubuntu/vivid/qemu/vivid

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu/arm64/0095-softfloat-Fix-float64_to_uint32.patch

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2014-02-25 22:31:43 UTC
  • mfrom: (1.8.5)
  • Revision ID: package-import@ubuntu.com-20140225223143-odhqxfc60wxrjl15
Tags: 2.0.0~rc1+dfsg-0ubuntu1
* Merge 2.0.0-rc1
* debian/rules: consolidate ppc filter entries.
* Move qemu-system-arch64 into qemu-system-arm
* debian/patches/define-trusty-machine-type.patch: define a trusty machine
  type, currently the same as pc-i440fx-2.0, to put is in a better position
  to enable live migrations from trusty onward.  (LP: #1294823)
* debian/control: build-dep on libfdt >= 1.4.0  (LP: #1295072)
* Merge latest upstream git to commit dc9528f
* Debian/rules:
  - remove -enable-uname-release=2.6.32
  - don't make the aarch64 target Ubuntu-specific.
* Remove patches which are now upstream:
  - fix-smb-security-share.patch
  - slirp-smb-redirect-port-445-too.patch 
  - linux-user-Implement-sendmmsg-syscall.patch (better version is upstream)
  - signal-added-a-wrapper-for-sigprocmask-function.patch
  - ubuntu/signal-sigsegv-protection-on-do_sigprocmask.patch
  - ubuntu/Don-t-block-SIGSEGV-at-more-places.patch
  - ubuntu/ppc-force-cpu-threads-count-to-be-power-of-2.patch
* add link for /usr/share/qemu/bios-256k.bin
* Remove all linaro patches.
* Remove all arm64/ patches.  Many but not all are upstream.
* Remove CVE-2013-4377.patch which is upstream.
* debian/control-in: don't make qemu-system-aarch64 ubuntu-specific

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 0f42c3554641a1b3cfffc71f5a5e6e6f56ac1bcb Mon Sep 17 00:00:00 2001
2
 
From: Tom Musta <tommusta@gmail.com>
3
 
Date: Tue, 7 Jan 2014 17:17:51 +0000
4
 
Subject: [PATCH 095/158] softfloat: Fix float64_to_uint32
5
 
 
6
 
The float64_to_uint32 has several flaws:
7
 
 
8
 
 - for numbers between 2**32 and 2**64, the inexact exception flag
9
 
   may get incorrectly set.  In this case, only the invalid flag
10
 
   should be set.
11
 
 
12
 
       test pattern: 425F81378DC0CD1F / 0x1.f81378dc0cd1fp+38
13
 
 
14
 
 - for numbers between 2**63 and 2**64, incorrect results may
15
 
   be produced:
16
 
 
17
 
       test pattern: 43EAAF73F1F0B8BD / 0x1.aaf73f1f0b8bdp+63
18
 
 
19
 
This patch re-implements float64_to_uint32 to re-use the
20
 
float64_to_uint64 routine (instead of float64_to_int64).  For the
21
 
saturation case, we ignore any flags which the conversion routine
22
 
has set and raise only the invalid flag.
23
 
 
24
 
This contribution can be licensed under either the softfloat-2a or -2b
25
 
license.
26
 
 
27
 
Signed-off-by: Tom Musta <tommusta@gmail.com>
28
 
Message-id: 1387397961-4894-5-git-send-email-tommusta@gmail.com
29
 
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
30
 
Reviewed-by: Richard Henderson <rth@twiddle.net>
31
 
---
32
 
 fpu/softfloat.c | 15 +++++++--------
33
 
 1 file changed, 7 insertions(+), 8 deletions(-)
34
 
 
35
 
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
36
 
index 141e7fd..ba476a8 100644
37
 
--- a/fpu/softfloat.c
38
 
+++ b/fpu/softfloat.c
39
 
@@ -6650,19 +6650,18 @@ uint_fast16_t float32_to_uint16_round_to_zero(float32 a STATUS_PARAM)
40
 
 
41
 
 uint32 float64_to_uint32( float64 a STATUS_PARAM )
42
 
 {
43
 
-    int64_t v;
44
 
+    uint64_t v;
45
 
     uint32 res;
46
 
+    int old_exc_flags = get_float_exception_flags(status);
47
 
 
48
 
-    v = float64_to_int64(a STATUS_VAR);
49
 
-    if (v < 0) {
50
 
-        res = 0;
51
 
-        float_raise( float_flag_invalid STATUS_VAR);
52
 
-    } else if (v > 0xffffffff) {
53
 
+    v = float64_to_uint64(a STATUS_VAR);
54
 
+    if (v > 0xffffffff) {
55
 
         res = 0xffffffff;
56
 
-        float_raise( float_flag_invalid STATUS_VAR);
57
 
     } else {
58
 
-        res = v;
59
 
+        return v;
60
 
     }
61
 
+    set_float_exception_flags(old_exc_flags, status);
62
 
+    float_raise(float_flag_invalid STATUS_VAR);
63
 
     return res;
64
 
 }
65
 
 
66
 
1.9.rc1
67