commit 074d2d430db947164948e6778259504aed29778c
parent f55a034c33fd1a5b6b35f78abeef23741cb6f65f
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date: Sat, 16 Nov 2019 13:43:46 +0100
Add umoddi3 and udivdi3
Diffstat:
3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/src/libcrt/i386/Makefile b/src/libcrt/i386/Makefile
@@ -2,7 +2,10 @@
PROJECTDIR=../../..
include $(PROJECTDIR)/scripts/rules.mk
-OBJS = dummy.o
+OBJS = dummy.o \
+ umoddi3.o \
+ udivdi3.o \
+
TARGET = $(LIBCDIR)/libcrt.a
all: $(TARGET)
diff --git a/src/libcrt/i386/udivdi3.s b/src/libcrt/i386/udivdi3.s
@@ -0,0 +1,19 @@
+ .file "udivdi3.s"
+
+ .text
+ .globl __udivdi3
+__udivdi3:
+ pushl %ebp
+ movl %esp,%ebp
+ addl $-16,%esp
+
+ movl 8(%ebp),%ecx
+ movl %ecx,-16(%ebp)
+ movl 16(%ebp),%ecx
+ movl %ecx,-8(%ebp)
+ movl -16(%ebp),%eax
+ xor %edx,%edx
+ divl -8(%ebp)
+ movl %ebp,%esp
+ popl %ebp
+ ret
diff --git a/src/libcrt/i386/umoddi3.s b/src/libcrt/i386/umoddi3.s
@@ -0,0 +1,20 @@
+ .file "umoddi3.s"
+
+ .text
+ .globl __umoddi3
+__umoddi3:
+ pushl %ebp
+ movl %esp,%ebp
+ addl $-16,%esp
+
+ movl 8(%ebp),%ecx
+ movl %ecx,-16(%ebp)
+ movl 16(%ebp),%ecx
+ movl %ecx,-8(%ebp)
+ movl -16(%ebp),%eax
+ xor %edx,%edx
+ divl -8(%ebp)
+ movl %edx,%eax
+ movl %ebp,%esp
+ popl %ebp
+ ret