[coreboot-gerrit] New patch to review for coreboot: adace79 Linux copy of mips/ashldi3.c

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Thu Mar 19 15:52:07 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8759

-gerrit

commit adace79fac25e1276fb340916d56cd44d00757ef
Author: Vadim Bendebury <vbendeb at chromium.org>
Date:   Mon Aug 25 17:45:57 2014 -0700

    Linux copy of mips/ashldi3.c
    
    As MIPS toolchain does not provide adequate support for 64 bit
    division and shift operations, the missing functions are required to
    be provided by the user.
    
    This patch brings in the Linux implementation of the 64 bit arithmetic
    shift borrowed from arch/mips/lib/ashldi3.c.
    
    BUG=chromium:406038
    TEST=With the upcoming patches coreboot successfully builds for MIPS
         targets in chroot (coming later).
    
    Change-Id: I2168f69352a9b9e3c5d197489f701a442e65703c
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: 8ec616161be8ad3aeb6494e7121615e3329b414d
    Original-Change-Id: Ia1ccb29d4c9f3c95e04e06f6af7ce8a00e2e7455
    Original-Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/214156
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
---
 src/arch/mips/ashldi3.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/src/arch/mips/ashldi3.c b/src/arch/mips/ashldi3.c
new file mode 100644
index 0000000..caa69fa
--- /dev/null
+++ b/src/arch/mips/ashldi3.c
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Google, Inc.
+ *
+ * Based on linux arch/mips/lib/ashldi3.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#ifndef __ORDER_LITTLE_ENDIAN__
+#errror "What endian are you!?"
+#endif
+
+typedef unsigned word_type;
+long long __ashldi3(long long u, word_type b);
+
+struct DWstruct {
+	int low, high;
+};
+typedef union {
+	struct DWstruct s;
+	long long ll;
+} DWunion;
+
+long long __ashldi3(long long u, word_type b)
+{
+	DWunion uu, w;
+	word_type bm;
+
+	if (b == 0)
+		return u;
+
+	uu.ll = u;
+	bm = 32 - b;
+
+	if (bm <= 0) {
+		w.s.low = 0;
+		w.s.high = (unsigned int) uu.s.low << -bm;
+	} else {
+		const unsigned int carries = (unsigned int) uu.s.low >> bm;
+
+		w.s.low = (unsigned int) uu.s.low << b;
+		w.s.high = ((unsigned int) uu.s.high << b) | carries;
+	}
+
+	return w.ll;
+}
+



More information about the coreboot-gerrit mailing list