0004-lib-c-Add-umoddi3.s-and-udivdi3.s-for-i386-linux.patch (1921B)
1 From 851950841c51b9378980e17f9f179ecfb82279ea Mon Sep 17 00:00:00 2001 2 From: zerous Naveen Narayanan <zerous@nocebo.space> 3 Date: Fri, 1 Nov 2019 15:23:20 +0100 4 Subject: [PATCH 04/10] [lib/c] Add umoddi3.s and udivdi3.s for i386/linux 5 6 --- 7 src/libc/arch/i386/linux/Makefile | 2 ++ 8 src/libc/arch/i386/linux/udivdi3.s | 20 ++++++++++++++++++++ 9 src/libc/arch/i386/linux/umoddi3.s | 21 +++++++++++++++++++++ 10 3 files changed, 43 insertions(+) 11 create mode 100644 src/libc/arch/i386/linux/udivdi3.s 12 create mode 100644 src/libc/arch/i386/linux/umoddi3.s 13 14 diff --git a/src/libc/arch/i386/linux/Makefile b/src/libc/arch/i386/linux/Makefile 15 index 03ab52ec..d264ea56 100644 16 --- a/src/libc/arch/i386/linux/Makefile 17 +++ b/src/libc/arch/i386/linux/Makefile 18 @@ -16,6 +16,8 @@ OBJS =\ 19 _Exit.o\ 20 _kill.o\ 21 crt.o\ 22 + umoddi3.o\ 23 + udivdi3.o\ 24 25 all: syscall 26 $(MAKE) objs 27 diff --git a/src/libc/arch/i386/linux/udivdi3.s b/src/libc/arch/i386/linux/udivdi3.s 28 new file mode 100644 29 index 00000000..0fa2ace0 30 --- /dev/null 31 +++ b/src/libc/arch/i386/linux/udivdi3.s 32 @@ -0,0 +1,20 @@ 33 + .file "udivdi3.s" 34 + 35 + .text 36 + .globl __udivdi3 37 + .type __udivdi3,@function 38 +__udivdi3: 39 + pushl %ebp 40 + movl %esp,%ebp 41 + addl $-16,%esp 42 + 43 + movl 8(%ebp),%ecx 44 + movl %ecx,-16(%ebp) 45 + movl 16(%ebp),%ecx 46 + movl %ecx,-8(%ebp) 47 + movl -16(%ebp),%eax 48 + xor %edx,%edx 49 + divl -8(%ebp) 50 + movl %ebp,%esp 51 + popl %ebp 52 + ret 53 diff --git a/src/libc/arch/i386/linux/umoddi3.s b/src/libc/arch/i386/linux/umoddi3.s 54 new file mode 100644 55 index 00000000..3cfc5615 56 --- /dev/null 57 +++ b/src/libc/arch/i386/linux/umoddi3.s 58 @@ -0,0 +1,21 @@ 59 + .file "umoddi3.s" 60 + 61 + .text 62 + .globl __umoddi3 63 + .type __umoddi3,@function 64 +__umoddi3: 65 + pushl %ebp 66 + movl %esp,%ebp 67 + addl $-16,%esp 68 + 69 + movl 8(%ebp),%ecx 70 + movl %ecx,-16(%ebp) 71 + movl 16(%ebp),%ecx 72 + movl %ecx,-8(%ebp) 73 + movl -16(%ebp),%eax 74 + xor %edx,%edx 75 + divl -8(%ebp) 76 + movl %edx,%eax 77 + movl %ebp,%esp 78 + popl %ebp 79 + ret 80 -- 81 2.23.0 82