aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/arch_avr.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/arch_avr.go')
-rw-r--r--src/runtime/arch_avr.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/runtime/arch_avr.go b/src/runtime/arch_avr.go
index a9388ce91..9df90fcc0 100644
--- a/src/runtime/arch_avr.go
+++ b/src/runtime/arch_avr.go
@@ -37,3 +37,39 @@ func procPin() {
func procUnpin() {
interrupt.Restore(procPinnedMask)
}
+
+// The following functions are workarounds for things missing in compiler-rt.
+// They will likely need special assembly implementations.
+
+//export __mulsi3
+func __mulsi3(a, b uint32) uint32 {
+ var r uint32
+ for a != 0 {
+ if a&1 != 0 {
+ r += b
+ }
+ a >>= 1
+ b <<= 1
+ }
+ return r
+}
+
+//export __divsi3
+func __divsi3(a, b int32) int32
+
+//export __udivsi3
+func __udivsi3(a, b uint32) uint32
+
+//export __divmodsi4
+func __divmodsi4(a, b int32) uint64 {
+ d := __divsi3(a, b)
+ rem := a - (d * b)
+ return uint64(uint32(d)) | uint64(uint32(rem))<<32
+}
+
+//export __udivmodsi4
+func __udivmodsi4(a, b uint32) uint64 {
+ d := __udivsi3(a, b)
+ rem := a - (d * b)
+ return uint64(d) | uint64(rem)<<32
+}