summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDino Li <dino.li@ite.com.tw>2015-08-14 17:24:34 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-08-14 14:34:26 +0000
commit26984c7de4ac14347e8395e6e111677a707807f2 (patch)
treee5f0b58ea5ea0175c44c4dc39026a7644819172e
parent68088eb93fe2d275b4347ac25479d6b6cce52dd9 (diff)
downloadchrome-ec-26984c7de4ac14347e8395e6e111677a707807f2.tar.gz
it8380dev: add __muldi3.S
symptom: Enable debugging and profiling statistics for hook functions (#define CONFIG_HOOK_DEBUG), and __muldi3 function is missing while link. Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST=1. compile successful and hook_notify starting to print message. 2. console "hookstats" Change-Id: Ia2815bcefd0f9ac06dab9c75ea6ee06312878ca2 Reviewed-on: https://chromium-review.googlesource.com/293432 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Dino Li <dino.li@ite.com.tw> Tested-by: Dino Li <dino.li@ite.com.tw>
-rw-r--r--core/nds32/__muldi3.S40
-rw-r--r--core/nds32/build.mk2
2 files changed, 41 insertions, 1 deletions
diff --git a/core/nds32/__muldi3.S b/core/nds32/__muldi3.S
new file mode 100644
index 0000000000..ef4a491183
--- /dev/null
+++ b/core/nds32/__muldi3.S
@@ -0,0 +1,40 @@
+/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * __muldi3.S: signed 64 bit multiplication
+ */
+
+#define P1H $r1
+#define P1L $r0
+#define P2H $r3
+#define P2L $r2
+
+ .text
+ .align 2
+ .globl __muldi3
+ .type __muldi3, @function
+__muldi3:
+ mul $r5, P1H, P2L ! (ah=a>>31)*(bl=b&0xffffffff)
+ srli P1H, P1L, 16 ! alh=al>>16
+ maddr32 $r5, P1L, P2H ! ah*bl+(bh=b>>31)*(al=a&0xffffffff)
+ zeh P1L, P1L ! all=al&0xffff
+ srli P2H, P2L, 16 ! blh=bl>>16
+ zeh P2L, P2L ! bll=bl&0xffff
+
+ mul $ta, P1L, P2H ! zA=all*blh
+ mul $r4, P1L, P2L ! zl=all*bll
+ mul P2L, P1H, P2L ! zB=alh*bll
+ add P1L, $ta, P2L ! zA+=zB
+ slt $ta, P1L, P2L ! zA<zB
+ slli $ta, $ta, 16 ! (zA<zB)<<16
+ slli P2L, P1L, 16 ! zA<<16
+ maddr32 $ta, P1H, P2H ! zh=alh*blh+((zA<zB)<<16)
+ srli P1H, P1L, 16 ! zA>>16
+ add P1H, P1H, $ta ! zh+=(zA>>16)
+ add P1L, $r4, P2L ! zl+=(zA<<16)
+ slt $ta, P1L, $r4 ! zl<zA
+ add P1H, P1H, $ta ! zh+=(zl<zA)
+ add P1H, P1H, $r5 ! zh+=ah*bl+bh*al
+ ret
+ .size __muldi3, .-__muldi3
diff --git a/core/nds32/build.mk b/core/nds32/build.mk
index df89e3c8ac..d35f7d455e 100644
--- a/core/nds32/build.mk
+++ b/core/nds32/build.mk
@@ -12,4 +12,4 @@ CROSS_COMPILE?=nds32le-cros-elf-
# CPU specific compilation flags
CFLAGS_CPU+=-march=v3m -Os
-core-y=cpu.o init.o panic.o task.o switch.o
+core-y=cpu.o init.o panic.o task.o switch.o __muldi3.o