diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-04-21 22:33:19 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-04-21 22:33:19 +0000 |
commit | 67d88b0a9910a68bb666b448d2dac29cb4d3d8c2 (patch) | |
tree | 967b89f6e07398a22bd8c76d30179b648776542d /sys/lib/libkern | |
parent | ba95d3c1d69cdb251d15a12ebf70f50b0ea2019b (diff) |
partial sync with netbsd 960418, more to come
Diffstat (limited to 'sys/lib/libkern')
-rw-r--r-- | sys/lib/libkern/arch/alpha/Makefile.inc | 5 | ||||
-rw-r--r-- | sys/lib/libkern/arch/arm32/Makefile.inc | 6 | ||||
-rw-r--r-- | sys/lib/libkern/arch/arm32/_mcount.S | 17 | ||||
-rw-r--r-- | sys/lib/libkern/arch/arm32/div.S | 322 | ||||
-rw-r--r-- | sys/lib/libkern/arch/i386/Makefile.inc | 7 | ||||
-rw-r--r-- | sys/lib/libkern/arch/mips/Makefile.inc | 6 | ||||
-rw-r--r-- | sys/lib/libkern/arch/ns32k/Makefile.inc | 5 | ||||
-rw-r--r-- | sys/lib/libkern/arch/sparc/Makefile.inc | 6 | ||||
-rw-r--r-- | sys/lib/libkern/arch/vax/Makefile.inc | 5 |
9 files changed, 366 insertions, 13 deletions
diff --git a/sys/lib/libkern/arch/alpha/Makefile.inc b/sys/lib/libkern/arch/alpha/Makefile.inc index c78b3c0a8fa..8a3b6cd3636 100644 --- a/sys/lib/libkern/arch/alpha/Makefile.inc +++ b/sys/lib/libkern/arch/alpha/Makefile.inc @@ -1,9 +1,10 @@ -# $NetBSD: Makefile.inc,v 1.3 1995/10/20 01:15:37 cgd Exp $ +# $OpenBSD: Makefile.inc,v 1.3 1996/04/21 22:27:45 deraadt Exp $ +# $NetBSD: Makefile.inc,v 1.4 1996/04/13 01:17:27 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ bcmp.c bzero.S ffs.c strcat.c strcmp.c strcpy.c strlen.c strncmp.c \ strncpy.c scanc.c skpc.c locc.c htonl.c htons.c ntohl.c ntohs.c \ - random.c + random.c strncasecmp.c # `source' files built from m4 source SRCS+= __divqu.S __divq.S __divlu.S __divl.S diff --git a/sys/lib/libkern/arch/arm32/Makefile.inc b/sys/lib/libkern/arch/arm32/Makefile.inc new file mode 100644 index 00000000000..af5cd572ac9 --- /dev/null +++ b/sys/lib/libkern/arch/arm32/Makefile.inc @@ -0,0 +1,6 @@ +# $Id: Makefile.inc,v 1.1 1996/04/21 22:27:47 deraadt Exp $ + +SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ + bcmp.c bzero.c ffs.c strcat.c strcmp.c strcpy.c strlen.c strncmp.c \ + strncpy.c scanc.c skpc.c locc.c htonl.c htons.c ntohl.c ntohs.c \ + div.S random.c strncasecmp.c diff --git a/sys/lib/libkern/arch/arm32/_mcount.S b/sys/lib/libkern/arch/arm32/_mcount.S new file mode 100644 index 00000000000..63cf52e3d62 --- /dev/null +++ b/sys/lib/libkern/arch/arm32/_mcount.S @@ -0,0 +1,17 @@ +fp .req r11 +ip .req r12 +sp .req r13 +lr .req r14 +pc .req r15 + +.text + .align 0 + + .global mcount +mcount: + stmfd sp!, {lr} + mov r1, lr + mov r0, ip + bl __mcount + ldmfd sp!, {lr} + add pc, lr, #0x00000004 diff --git a/sys/lib/libkern/arch/arm32/div.S b/sys/lib/libkern/arch/arm32/div.S new file mode 100644 index 00000000000..bb96d183ad9 --- /dev/null +++ b/sys/lib/libkern/arch/arm32/div.S @@ -0,0 +1,322 @@ +a1 .req r0 +a2 .req r1 +a3 .req r2 +a4 .req r3 +v1 .req r4 +v2 .req r5 +v3 .req r6 +v4 .req r7 +v5 .req r8 +v6 .req r9 +v7 .req r10 +fp .req r11 +ip .req r12 +sp .req r13 +lr .req r14 +pc .req r15 + +.text + + .global __rt_sdiv +__rt_sdiv: + b x_divide + + .global __rt_udiv +__rt_udiv: + b x_udivide + + .global ___umodsi3 +___umodsi3: + mov a3, a1 + mov a1, a2 + mov a2, a3 + b x_uremainder + + .global ___udivsi3 +___udivsi3: + mov a3, a1 + mov a1, a2 + mov a2, a3 + b x_udivide + + .global ___modsi3 +___modsi3: + mov a3, a1 + mov a1, a2 + mov a2, a3 + b x_remainder + + .global ___divsi3 +___divsi3: + mov a3, a1 + mov a1, a2 + mov a2, a3 + b x_divide + + .global x_divtest +x_divtest: + mov pc,lr + + .global x_remainder +x_remainder: + stmfd sp!,{lr} + bl x_divide + mov a1,a2 + ldmfd sp!,{pc} + + .global x_uremainder +x_uremainder: + stmfd sp!,{lr} + bl x_udivide + mov a1,a2 + ldmfd sp!,{pc} + +x_overflow: + mvn a1,#0 + mov pc,lr + + .global x_udivide /* a1 = a2 / a1; a2 = a2 % a1 */ +x_udivide: + cmp a1,#1 + bcc x_overflow + beq x_divide_l0 + mov ip,#0 + movs a2,a2 + bpl x_divide_l1 + orr ip,ip,#0x20000000 /* ip bit 0x20000000 = -ve a2 */ + movs a2,a2,lsr #1 + orrcs ip,ip,#0x10000000 /* ip bit 0x10000000 = bit 0 of a2 */ + b x_divide_l1 + +x_divide_l0: /* a1 == 1 */ + mov a1,a2 + mov a2,#0 + mov pc,lr + + .global x_divide /* a1 = a2 / a1; a2 = a2 % a1 */ +x_divide: + cmp a1,#1 + bcc x_overflow + beq x_divide_l0 + ands ip,a1,#0x80000000 + rsbmi a1,a1,#0 + ands a3,a2,#0x80000000 + eor ip,ip,a3 + rsbmi a2,a2,#0 + orr ip,a3,ip,lsr #1 /* ip bit 0x40000000 = -ve division */ + /* ip bit 0x80000000 = -ve remainder */ + +x_divide_l1: + mov a3,#1 + mov a4,#0 + + cmp a2,a1 + bcc x_divide_b0 + cmp a2,a1,lsl #1 + bcc x_divide_b1 + cmp a2,a1,lsl #2 + bcc x_divide_b2 + cmp a2,a1,lsl #3 + bcc x_divide_b3 + cmp a2,a1,lsl #4 + bcc x_divide_b4 + cmp a2,a1,lsl #5 + bcc x_divide_b5 + cmp a2,a1,lsl #6 + bcc x_divide_b6 + cmp a2,a1,lsl #7 + bcc x_divide_b7 + cmp a2,a1,lsl #8 + bcc x_divide_b8 + cmp a2,a1,lsl #9 + bcc x_divide_b9 + cmp a2,a1,lsl #10 + bcc x_divide_b10 + cmp a2,a1,lsl #11 + bcc x_divide_b11 + cmp a2,a1,lsl #12 + bcc x_divide_b12 + cmp a2,a1,lsl #13 + bcc x_divide_b13 + cmp a2,a1,lsl #14 + bcc x_divide_b14 + cmp a2,a1,lsl #15 + bcc x_divide_b15 + cmp a2,a1,lsl #16 + bcc x_divide_b16 + cmp a2,a1,lsl #17 + bcc x_divide_b17 + cmp a2,a1,lsl #18 + bcc x_divide_b18 + cmp a2,a1,lsl #19 + bcc x_divide_b19 + cmp a2,a1,lsl #20 + bcc x_divide_b20 + cmp a2,a1,lsl #21 + bcc x_divide_b21 + cmp a2,a1,lsl #22 + bcc x_divide_b22 + cmp a2,a1,lsl #23 + bcc x_divide_b23 + cmp a2,a1,lsl #24 + bcc x_divide_b24 + cmp a2,a1,lsl #25 + bcc x_divide_b25 + cmp a2,a1,lsl #26 + bcc x_divide_b26 + cmp a2,a1,lsl #27 + bcc x_divide_b27 + cmp a2,a1,lsl #28 + bcc x_divide_b28 + cmp a2,a1,lsl #29 + bcc x_divide_b29 + cmp a2,a1,lsl #30 + bcc x_divide_b30 + cmp a2,a1,lsl #31 + subhs a2,a2,a1,lsl #31 + addhs a4,a4,a3,lsl #31 + cmp a2,a1,lsl #30 + subhs a2,a2,a1,lsl #30 + addhs a4,a4,a3,lsl #30 +x_divide_b30: + cmp a2,a1,lsl #29 + subhs a2,a2,a1,lsl #29 + addhs a4,a4,a3,lsl #29 +x_divide_b29: + cmp a2,a1,lsl #28 + subhs a2,a2,a1,lsl #28 + addhs a4,a4,a3,lsl #28 +x_divide_b28: + cmp a2,a1,lsl #27 + subhsS a2,a2,a1,lsl #27 + addhs a4,a4,a3,lsl #27 +x_divide_b27: + cmp a2,a1,lsl #26 + subhs a2,a2,a1,lsl #26 + addhs a4,a4,a3,lsl #26 +x_divide_b26: + cmp a2,a1,lsl #25 + subhs a2,a2,a1,lsl #25 + addhs a4,a4,a3,lsl #25 +x_divide_b25: + cmp a2,a1,lsl #24 + subhs a2,a2,a1,lsl #24 + addhs a4,a4,a3,lsl #24 +x_divide_b24: + cmp a2,a1,lsl #23 + subhs a2,a2,a1,lsl #23 + addhs a4,a4,a3,lsl #23 +x_divide_b23: + cmp a2,a1,lsl #22 + subhs a2,a2,a1,lsl #22 + addhs a4,a4,a3,lsl #22 +x_divide_b22: + cmp a2,a1,lsl #21 + subhs a2,a2,a1,lsl #21 + addhs a4,a4,a3,lsl #21 +x_divide_b21: + cmp a2,a1,lsl #20 + subhs a2,a2,a1,lsl #20 + addhs a4,a4,a3,lsl #20 +x_divide_b20: + cmp a2,a1,lsl #19 + subhs a2,a2,a1,lsl #19 + addhs a4,a4,a3,lsl #19 +x_divide_b19: + cmp a2,a1,lsl #18 + subhs a2,a2,a1,lsl #18 + addhs a4,a4,a3,lsl #18 +x_divide_b18: + cmp a2,a1,lsl #17 + subhs a2,a2,a1,lsl #17 + addhs a4,a4,a3,lsl #17 +x_divide_b17: + cmp a2,a1,lsl #16 + subhs a2,a2,a1,lsl #16 + addhs a4,a4,a3,lsl #16 +x_divide_b16: + cmp a2,a1,lsl #15 + subhs a2,a2,a1,lsl #15 + addhs a4,a4,a3,lsl #15 +x_divide_b15: + cmp a2,a1,lsl #14 + subhs a2,a2,a1,lsl #14 + addhs a4,a4,a3,lsl #14 +x_divide_b14: + cmp a2,a1,lsl #13 + subhs a2,a2,a1,lsl #13 + addhs a4,a4,a3,lsl #13 +x_divide_b13: + cmp a2,a1,lsl #12 + subhs a2,a2,a1,lsl #12 + addhs a4,a4,a3,lsl #12 +x_divide_b12: + cmp a2,a1,lsl #11 + subhs a2,a2,a1,lsl #11 + addhs a4,a4,a3,lsl #11 +x_divide_b11: + cmp a2,a1,lsl #10 + subhs a2,a2,a1,lsl #10 + addhs a4,a4,a3,lsl #10 +x_divide_b10: + cmp a2,a1,lsl #9 + subhs a2,a2,a1,lsl #9 + addhs a4,a4,a3,lsl #9 +x_divide_b9: + cmp a2,a1,lsl #8 + subhs a2,a2,a1,lsl #8 + addhs a4,a4,a3,lsl #8 +x_divide_b8: + cmp a2,a1,lsl #7 + subhs a2,a2,a1,lsl #7 + addhs a4,a4,a3,lsl #7 +x_divide_b7: + cmp a2,a1,lsl #6 + subhs a2,a2,a1,lsl #6 + addhs a4,a4,a3,lsl #6 +x_divide_b6: + cmp a2,a1,lsl #5 + subhs a2,a2,a1,lsl #5 + addhs a4,a4,a3,lsl #5 +x_divide_b5: + cmp a2,a1,lsl #4 + subhs a2,a2,a1,lsl #4 + addhs a4,a4,a3,lsl #4 +x_divide_b4: + cmp a2,a1,lsl #3 + subhs a2,a2,a1,lsl #3 + addhs a4,a4,a3,lsl #3 +x_divide_b3: + cmp a2,a1,lsl #2 + subhs a2,a2,a1,lsl #2 + addhs a4,a4,a3,lsl #2 +x_divide_b2: + cmp a2,a1,lsl #1 + subhs a2,a2,a1,lsl #1 + addhs a4,a4,a3,lsl #1 +x_divide_b1: + cmp a2,a1 + subhs a2,a2,a1 + addhs a4,a4,a3 +x_divide_b0: + + tst ip,#0x20000000 + bne x_udivide_l1 + mov a1,a4 + cmp ip,#0 + rsbmi a2,a2,#0 + movs ip,ip,lsl #1 + rsbmi a1,a1,#0 + mov pc,lr + +x_udivide_l1: + tst ip,#0x10000000 + mov a2,a2,lsl #1 + orrne a2,a2,#1 + mov a4,a4,lsl #1 + cmp a2,a1 + subhs a2,a2,a1 + addhs a4,a4,a3 + mov a1,a4 + mov pc,lr + diff --git a/sys/lib/libkern/arch/i386/Makefile.inc b/sys/lib/libkern/arch/i386/Makefile.inc index a39aac330eb..857134d5146 100644 --- a/sys/lib/libkern/arch/i386/Makefile.inc +++ b/sys/lib/libkern/arch/i386/Makefile.inc @@ -1,6 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.3 1996/04/19 16:09:44 niklas Exp $ -# $NetBSD: Makefile.inc,v 1.9 1996/03/11 05:32:00 scottr Exp $ +# $OpenBSD: Makefile.inc,v 1.4 1996/04/21 22:27:52 deraadt Exp $ +# $NetBSD: Makefile.inc,v 1.10 1996/04/13 01:17:41 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ bcmp.S ffs.S memset.S strcat.S strcmp.S strcpy.S strlen.S strncmp.c \ - strncpy.c scanc.S skpc.S locc.S htonl.S htons.S ntohl.S ntohs.S + strncpy.c scanc.S skpc.S locc.S htonl.S htons.S ntohl.S ntohs.S \ + strncasecmp.c diff --git a/sys/lib/libkern/arch/mips/Makefile.inc b/sys/lib/libkern/arch/mips/Makefile.inc index 950464fd39b..68b09ace259 100644 --- a/sys/lib/libkern/arch/mips/Makefile.inc +++ b/sys/lib/libkern/arch/mips/Makefile.inc @@ -1,8 +1,10 @@ -# $NetBSD: Makefile.inc,v 1.3 1994/10/26 06:39:40 cgd Exp $ +# $OpenBSD: Makefile.inc,v 1.3 1996/04/21 22:27:55 deraadt Exp $ +# $NetBSD: Makefile.inc,v 1.4 1996/04/13 01:17:46 cgd Exp $ # # There are likely more that we will notice when we go native SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ bcmp.S bzero.S strcat.c strcmp.c strcpy.c ffs.S strlen.S strncmp.c \ - random.c scanc.c skpc.c strcat.c strcpy.c strncmp.c strncpy.c + random.c scanc.c skpc.c strcat.c strcpy.c strncmp.c strncpy.c \ + strncasecmp.c diff --git a/sys/lib/libkern/arch/ns32k/Makefile.inc b/sys/lib/libkern/arch/ns32k/Makefile.inc index 26eb4002710..67162a67186 100644 --- a/sys/lib/libkern/arch/ns32k/Makefile.inc +++ b/sys/lib/libkern/arch/ns32k/Makefile.inc @@ -1,6 +1,7 @@ -# $NetBSD: Makefile.inc,v 1.6 1995/11/30 01:00:10 jtc Exp $ +# $OpenBSD: Makefile.inc,v 1.3 1996/04/21 22:27:58 deraadt Exp $ +# $NetBSD: Makefile.inc,v 1.7 1996/04/13 01:17:50 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ bcmp.c ffs.c strcat.c strcmp.c strcpy.c strlen.c strncmp.c strncpy.c \ - scanc.c skpc.c locc.c \ + scanc.c skpc.c locc.c strncasecmp.c \ htonl.S htons.S ntohl.S ntohs.S diff --git a/sys/lib/libkern/arch/sparc/Makefile.inc b/sys/lib/libkern/arch/sparc/Makefile.inc index 5ddc09a1273..260b25ab570 100644 --- a/sys/lib/libkern/arch/sparc/Makefile.inc +++ b/sys/lib/libkern/arch/sparc/Makefile.inc @@ -1,8 +1,10 @@ -# $NetBSD: Makefile.inc,v 1.10 1995/10/07 22:26:53 mycroft Exp $ +# $OpenBSD: Makefile.inc,v 1.2 1996/04/21 22:28:01 deraadt Exp $ +# $NetBSD: Makefile.inc,v 1.11 1996/04/13 01:17:53 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ bcmp.c bzero.S strcat.c strcmp.c strcpy.c strlen.S strncmp.c \ - strncpy.c htonl.S htons.S ntohl.S ntohs.S scanc.c skpc.c memset.c + strncpy.c htonl.S htons.S ntohl.S ntohs.S scanc.c skpc.c memset.c \ + strncasecmp.c SRCS+= umul.S mul.S rem.S sdiv.S udiv.S umul.S urem.S SRCS+= mul.S saveregs.S umul.S diff --git a/sys/lib/libkern/arch/vax/Makefile.inc b/sys/lib/libkern/arch/vax/Makefile.inc index fbee47ca691..fdfc8488216 100644 --- a/sys/lib/libkern/arch/vax/Makefile.inc +++ b/sys/lib/libkern/arch/vax/Makefile.inc @@ -1,5 +1,6 @@ -# $NetBSD: Makefile.inc,v 1.1 1995/04/18 21:59:46 ragge Exp $ +# $OpenBSD: Makefile.inc,v 1.2 1996/04/21 22:28:04 deraadt Exp $ +# $NetBSD: Makefile.inc,v 1.2 1996/04/13 01:17:58 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ strcat.c strcmp.c strcpy.c strlen.c strncmp.c \ - strncpy.c scanc.c skpc.c locc.c + strncpy.c scanc.c skpc.c locc.c strncasecmp.c |