commit 4cf23365482ef11c4a0b856c0601648c05d04e44
parent 097cb6692dd6ec81b8101b3800550c09077cc6c4
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