aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/amd64/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/amd64/stdlib')
-rw-r--r--lib/libc/amd64/stdlib/Makefile.inc1
-rw-r--r--lib/libc/amd64/stdlib/div.S18
-rw-r--r--lib/libc/amd64/stdlib/ldiv.S16
-rw-r--r--lib/libc/amd64/stdlib/lldiv.S16
4 files changed, 51 insertions, 0 deletions
diff --git a/lib/libc/amd64/stdlib/Makefile.inc b/lib/libc/amd64/stdlib/Makefile.inc
new file mode 100644
index 000000000000..568f8eb4afa7
--- /dev/null
+++ b/lib/libc/amd64/stdlib/Makefile.inc
@@ -0,0 +1 @@
+MDSRCS+=div.S ldiv.S lldiv.S
diff --git a/lib/libc/amd64/stdlib/div.S b/lib/libc/amd64/stdlib/div.S
new file mode 100644
index 000000000000..f15ef2ffc5bb
--- /dev/null
+++ b/lib/libc/amd64/stdlib/div.S
@@ -0,0 +1,18 @@
+/* $NetBSD: div.S,v 1.1 2001/06/19 00:25:04 fvdl Exp $ */
+
+/*-
+ * Written by Frank van der Linden (fvdl@wasabisystems.com)
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+ENTRY(div)
+ movl %edi,%eax
+ cltd
+ idivl %esi
+ salq $32,%rdx
+ orq %rdx,%rax
+ ret
+END(div)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/stdlib/ldiv.S b/lib/libc/amd64/stdlib/ldiv.S
new file mode 100644
index 000000000000..6c1e2292d7f2
--- /dev/null
+++ b/lib/libc/amd64/stdlib/ldiv.S
@@ -0,0 +1,16 @@
+/* $NetBSD: ldiv.S,v 1.1 2001/06/19 00:25:04 fvdl Exp $ */
+
+/*-
+ * Written by gcc 3.0.
+ * Copy/pasted by Frank van der Linden (fvdl@wasabisystems.com)
+ */
+
+#include <machine/asm.h>
+ENTRY(ldiv)
+ movq %rdi,%rax
+ cqto
+ idivq %rsi
+ ret
+END(ldiv)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/stdlib/lldiv.S b/lib/libc/amd64/stdlib/lldiv.S
new file mode 100644
index 000000000000..744cfefd064b
--- /dev/null
+++ b/lib/libc/amd64/stdlib/lldiv.S
@@ -0,0 +1,16 @@
+/* $NetBSD: ldiv.S,v 1.1 2001/06/19 00:25:04 fvdl Exp $ */
+
+/*-
+ * Written by gcc 3.0.
+ * Copy/pasted by Frank van der Linden (fvdl@wasabisystems.com)
+ */
+
+#include <machine/asm.h>
+ENTRY(lldiv)
+ movq %rdi,%rax
+ cqto
+ idivq %rsi
+ ret
+END(lldiv)
+
+ .section .note.GNU-stack,"",%progbits