Skip to contentSkip to conversation

Subject: [PATCH 28/33] score: create lib/ files Makefile libgcc.h cmpdi2.c ucmpdi2.c string.S

PATCH Chen Liqin 1 participant 1 message Aug 26, 2009 Generic include/asm header files

lore
Share & tools
lore

Chen Liqin

author
#0 lore raw

From 3515e5ea96a4fa1f1f8cbeb0415b636540dc77b6 Mon Sep 17 00:00:00 2001
From: Chen Liqin <[email protected]>
Date: Wed, 26 Aug 2009 10:05:10 +0800
Subject: [PATCH 28/33] score: create lib/ files Makefile libgcc.h cmpdi2.c ucmpdi2.c string.S

---
 arch/score/lib/Makefile  |    8 ++
 arch/score/lib/cmpdi2.c  |   44 +++++++++++
 arch/score/lib/libgcc.h  |   37 +++++++++
 arch/score/lib/string.S  |  184 ++++++++++++++++++++++++++++++++++++++++++++++
 arch/score/lib/ucmpdi2.c |   38 ++++++++++
 5 files changed, 311 insertions(+), 0 deletions(-)
 create mode 100644 arch/score/lib/Makefile
 create mode 100644 arch/score/lib/cmpdi2.c
 create mode 100644 arch/score/lib/libgcc.h
 create mode 100644 arch/score/lib/string.S
 create mode 100644 arch/score/lib/ucmpdi2.c
arch/score/lib/Makefile new file +8 -0
new file mode 100644
index 0000000..553e30e
@@ -0,0 +1,8 @@
+#
+# Makefile for SCORE-specific library files..
+#
+
+lib-y += string.o checksum.o checksum_copy.o
+
+# libgcc-style stuff needed in the kernel
+obj-y += ashldi3.o ashrdi3.o cmpdi2.o lshrdi3.o ucmpdi2.o
arch/score/lib/cmpdi2.c new file +44 -0

44 lines not on this page · raw message

arch/score/lib/libgcc.h new file +37 -0
new file mode 100644
index 0000000..0f12543
@@ -0,0 +1,37 @@
+/*
+ * arch/score/lib/libgcc.h
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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, see the file COPYING, or write
+ * to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+
+#ifndef __ASM_LIBGCC_H
+#define __ASM_LIBGCC_H
+
+#include <asm/byteorder.h>
+
+typedef int word_type __attribute__((mode(__word__)));
+
+struct DWstruct {
+	int low, high;
+};
+
+typedef union {
+	struct DWstruct s;
+	long long ll;
+} DWunion;
+
+#endif /* __ASM_LIBGCC_H */
arch/score/lib/string.S new file +184 -0

184 lines not on this page · raw message

arch/score/lib/ucmpdi2.c new file +38 -0
new file mode 100644
index 0000000..b15241e
@@ -0,0 +1,38 @@
+/*
+ * arch/score/lib/ucmpdi2.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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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, see the file COPYING, or write
+ * to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/module.h>
+#include "libgcc.h"
+
+word_type __ucmpdi2(unsigned long long a, unsigned long long b)
+{
+	const DWunion au = {.ll = a};
+	const DWunion bu = {.ll = b};
+
+	if ((unsigned int) au.s.high < (unsigned int) bu.s.high)
+		return 0;
+	else if ((unsigned int) au.s.high > (unsigned int) bu.s.high)
+		return 2;
+	if ((unsigned int) au.s.low < (unsigned int) bu.s.low)
+		return 0;
+	else if ((unsigned int) au.s.low > (unsigned int) bu.s.low)
+		return 2;
+	return 1;
+}
+EXPORT_SYMBOL(__ucmpdi2);
Signature · 1 line
1.6.2