From: deraadt Date: Thu, 14 Dec 1995 04:57:19 +0000 (+0000) Subject: update from netbsd X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4d95ca798d68f4f65bffec944b85be5e8c863bb9;p=openbsd update from netbsd --- diff --git a/sys/conf/files b/sys/conf/files index ca08404f781..c9be5824759 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.69 1995/10/04 23:33:14 pk Exp $ +# $NetBSD: files,v 1.70 1995/11/25 00:37:39 cgd Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -73,7 +73,7 @@ file isofs/cd9660/cd9660_vfsops.c cd9660 file isofs/cd9660/cd9660_vnops.c cd9660 file kern/exec_aout.c file kern/exec_conf.c -file kern/exec_ecoff.c compat_ultrix compat_osf1 +file kern/exec_ecoff.c compat_ultrix compat_osf1 exec_ecoff file kern/exec_elf.c compat_svr4 compat_linux file kern/exec_script.c file kern/exec_subr.c diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index 7b6a14cb7fc..5792e9bc6e7 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_command.c,v 1.13 1994/10/09 08:29:59 mycroft Exp $ */ +/* $NetBSD: db_command.c,v 1.15 1995/10/26 14:52:33 gwr Exp $ */ /* * Mach Operating System @@ -32,6 +32,8 @@ #include #include +#include + #include /* type definitions */ #include @@ -291,7 +293,7 @@ db_map_print_cmd(addr, have_addr, count, modif) if (modif[0] == 'f') full = TRUE; - _vm_map_print(addr, full, db_printf); + _vm_map_print((vm_map_t)addr, full, db_printf); } /*ARGSUSED*/ @@ -308,7 +310,7 @@ db_object_print_cmd(addr, have_addr, count, modif) if (modif[0] == 'f') full = TRUE; - _vm_object_print(addr, full, db_printf); + _vm_object_print((vm_object_t)addr, full, db_printf); } /* diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index eb6c46f5811..a7e02583cd9 100644 --- a/sys/ddb/db_output.c +++ b/sys/ddb/db_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_output.c,v 1.8 1994/06/29 22:41:41 deraadt Exp $ */ +/* $NetBSD: db_output.c,v 1.9 1995/10/16 05:28:16 mycroft Exp $ */ /* * Mach Operating System @@ -186,6 +186,7 @@ db_print_position() extern int db_radix; /*VARARGS1*/ +void #ifdef __STDC__ db_printf(char *fmt, ...) #else @@ -202,6 +203,7 @@ db_printf(fmt, va_alist) /* alternate name */ /*VARARGS1*/ +void #ifdef __STDC__ kdbprintf(char *fmt, ...) #else diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h index f378482ecbf..7c313d6018b 100644 --- a/sys/ddb/db_output.h +++ b/sys/ddb/db_output.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_output.h,v 1.5 1994/10/09 08:19:36 mycroft Exp $ */ +/* $NetBSD: db_output.h,v 1.6 1995/10/16 05:28:17 mycroft Exp $ */ /* * Mach Operating System @@ -35,4 +35,4 @@ void db_force_whitespace __P((void)); int db_print_position __P((void)); void db_end_line __P((void)); -int db_printf __P((char *, ...)); +void db_printf __P((const char *, ...)); diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index 416a3ae8fa0..52f7f4622c9 100644 --- a/sys/ddb/db_sym.c +++ b/sys/ddb/db_sym.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_sym.c,v 1.9 1995/05/24 20:21:00 gwr Exp $ */ +/* $NetBSD: db_sym.c,v 1.11 1995/11/24 22:13:08 cgd Exp $ */ /* * Mach Operating System @@ -326,8 +326,8 @@ db_symbol_values(sym, namep, valuep) */ extern char end[]; -unsigned int db_lastsym = (int)end; -unsigned int db_maxoff = 0x10000000; +unsigned long db_lastsym = (long)end; +db_expr_t db_maxoff = 0x10000000; void diff --git a/sys/lib/libkern/Makefile b/sys/lib/libkern/Makefile index 8282d8b9100..af57b69848e 100644 --- a/sys/lib/libkern/Makefile +++ b/sys/lib/libkern/Makefile @@ -1,10 +1,14 @@ -# $NetBSD: Makefile,v 1.23 1995/10/07 09:56:54 mycroft Exp $ +# $NetBSD: Makefile,v 1.24 1995/10/20 01:10:06 cgd Exp $ LIB= kern NOPIC= DIR=${KERNREL}${KERNDIR} +CC= ${KERNCC} +CFLAGS= -I${DIR}/arch/${MACHINE_ARCH} \ + ${KERNCFLAGS:S/-D_KERNEL//:S@-I.@-I${KERNREL}.@g} + .if exists (${DIR}/arch/${MACHINE_ARCH}/Makefile.inc) .PATH: ${DIR}/arch/${MACHINE_ARCH} .include "${DIR}/arch/${MACHINE_ARCH}/Makefile.inc" @@ -12,10 +16,6 @@ DIR=${KERNREL}${KERNDIR} .PATH: ${DIR} -CC = ${KERNCC} -CFLAGS += -I${DIR}/arch/${MACHINE_ARCH} \ - ${KERNCFLAGS:S/-D_KERNEL//:S@-I.@-I${KERNREL}.@g} - .if (${MACHINE_ARCH} != "alpha") # Quad support SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ diff --git a/sys/lib/libkern/arch/alpha/Makefile.inc b/sys/lib/libkern/arch/alpha/Makefile.inc index 588ef8da0a1..c78b3c0a8fa 100644 --- a/sys/lib/libkern/arch/alpha/Makefile.inc +++ b/sys/lib/libkern/arch/alpha/Makefile.inc @@ -1,7 +1,7 @@ -# $Id: Makefile.inc,v 1.1.1.1 1995/10/18 08:52:51 deraadt Exp $ +# $NetBSD: Makefile.inc,v 1.3 1995/10/20 01:15:37 cgd 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 \ + 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 diff --git a/sys/lib/libkern/arch/alpha/bzero.S b/sys/lib/libkern/arch/alpha/bzero.S new file mode 100644 index 00000000000..3bf1e75a9f8 --- /dev/null +++ b/sys/lib/libkern/arch/alpha/bzero.S @@ -0,0 +1,110 @@ +/* $NetBSD: bzero.S,v 1.1 1995/10/20 01:16:02 cgd Exp $ */ + +/* + * Copyright (c) 1995 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Trevor Blackwell + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#include "DEFS.h" + +LEAF(bzero,2) + ble a1,bzero_done + bic a1,63,t3 /* t3 is # bytes to do 64 bytes at a time */ + + /* If nothing in first word, ignore it */ + subq zero,a0,t0 + and t0,7,t0 /* t0 = (0-size)%8 */ + beq t0,bzero_nostart1 + + cmpult a1,t0,t1 /* if size > size%8 goto noshort */ + beq t1,bzero_noshort + + /* + * The whole thing is less than a word. + * Mask off 1..7 bytes, and finish. + */ + ldq_u t2,0(a0) + lda t0,-1(zero) /* t0=-1 */ + mskql t0,a1,t0 /* Get ff in bytes (a0%8)..((a0+a1-1)%8) */ + insql t0,a0,t0 + bic t2,t0,t2 /* zero those bytes in word */ + stq_u t2,0(a0) + RET + +bzero_noshort: + /* Handle the first partial word */ + ldq_u t2,0(a0) + subq a1,t0,a1 + mskql t2,a0,t2 /* zero bytes (a0%8)..7 in word */ + stq_u t2,0(a0) + + addq a0,t0,a0 /* round a0 up to next word */ + bic a1,63,t3 /* recalc t3 (# bytes to do 64 bytes at a + time) */ + +bzero_nostart1: + /* + * Loop, zeroing 64 bytes at a time + */ + beq t3,bzero_lp_done +bzero_lp: + stq zero,0(a0) + stq zero,8(a0) + stq zero,16(a0) + stq zero,24(a0) + subq t3,64,t3 + stq zero,32(a0) + stq zero,40(a0) + stq zero,48(a0) + stq zero,56(a0) + addq a0,64,a0 + bne t3,bzero_lp + +bzero_lp_done: + /* + * Handle the last 0..7 words. + * We mask off the low bits, so we don't need an extra + * compare instruction for the loop (just a bne. heh-heh) + */ + and a1,0x38,t4 + beq t4,bzero_finish_lp_done +bzero_finish_lp: + stq zero,0(a0) + subq t4,8,t4 + addq a0,8,a0 + bne t4,bzero_finish_lp + + /* Do the last partial word */ +bzero_finish_lp_done: + and a1,7,t5 /* 0..7 bytes left */ + beq t5,bzero_done /* mskqh won't change t0 if t5==0, but I + don't want to touch, say, a new VM page */ + ldq t0,0(a0) + mskqh t0,t5,t0 + stq t0,0(a0) +bzero_done: + RET + + END(bzero) diff --git a/sys/lib/libkern/arch/alpha/divrem.m4 b/sys/lib/libkern/arch/alpha/divrem.m4 index dd33e37b527..f0a9a10409a 100644 --- a/sys/lib/libkern/arch/alpha/divrem.m4 +++ b/sys/lib/libkern/arch/alpha/divrem.m4 @@ -1,4 +1,4 @@ -/* $NetBSD: divrem.m4,v 1.2 1995/03/03 01:14:11 cgd Exp $ */ +/* $NetBSD: divrem.m4,v 1.3 1995/10/20 00:53:28 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -40,7 +40,7 @@ * M4 Parameters * NAME name of function to generate * OP OP=div: t10 / t11 -> t12; OP=rem: t10 % t11 -> t12 - * S S=true: signed; S=false: unsigned [XXX NOT YET] + * S S=true: signed; S=false: unsigned * WORDSIZE total number of bits */ @@ -52,50 +52,65 @@ define(BIT, `t0') define(I, `t1') define(CC, `t2') define(T_0, `t3') -ifelse(S, `true', `define(SIGN, `t4')') +ifelse(S, `true', `define(NEG, `t4')') #include "DEFS.h" LEAF(NAME, 0) /* XXX */ - lda sp, -48(sp) + lda sp, -64(sp) stq BIT, 0(sp) stq I, 8(sp) stq CC, 16(sp) stq T_0, 24(sp) ifelse(S, `true', -` stq SIGN, 32(sp)') +` stq NEG, 32(sp)') + stq A, 40(sp) + stq B, 48(sp) mov zero, RESULT /* Initialize result to zero */ ifelse(S, `true', ` /* Compute sign of result. If either is negative, this is easy. */ - or A, B, SIGN /* not the sign, but... */ - bgt SIGN, Ldoit /* neither negative? do it! */ + or A, B, NEG /* not the sign, but... */ + srl NEG, WORDSIZE - 1, NEG /* rather, or of high bits */ + blbc NEG, Ldoit /* neither negative? do it! */ ifelse(OP, `div', -` xor A, B, SIGN /* THIS is the sign! */ -', ` mov A, SIGN /* sign follows A. */ +` xor A, B, NEG /* THIS is the sign! */ +', ` mov A, NEG /* sign follows A. */ ') - bge A, LnegB /* see if A is negative */ + srl NEG, WORDSIZE - 1, NEG /* make negation the low bit. */ + + srl A, WORDSIZE - 1, I /* is A negative? */ + blbc I, LnegB /* no. */ /* A is negative; flip it. */ +ifelse(WORDSIZE, `32', ` + /* top 32 bits may be random junk */ + zap A, 0xf0, A +') subq zero, A, A - bge B, Ldoit /* see if B is negative */ + srl B, WORDSIZE - 1, I /* is B negative? */ + blbc I, Ldoit /* no. */ LnegB: /* B is definitely negative, no matter how we got here. */ +ifelse(WORDSIZE, `32', ` + /* top 32 bits may be random junk */ + zap B, 0xf0, B +') subq zero, B, B Ldoit: -', ` +') ifelse(WORDSIZE, `32', ` /* - * Clear the top 32 bits of each operand, as the compiler may - * have sign extended them, if the 31st bit was set. + * Clear the top 32 bits of each operand, as they may + * sign extension (if negated above), or random junk. */ zap A, 0xf0, A zap B, 0xf0, B -')' ) +') /* kill the special cases. */ - beq B, Ldotrap /* division by zero! XXX */ + beq B, Ldotrap /* division by zero! */ 1: cmpult A, B, CC /* A < B? */ /* RESULT is already zero, from above. A is untouched. */ @@ -157,7 +172,7 @@ ifelse(S, `true', ` /* Check to see if we should negate it. */ subqv zero, RESULT, T_0 - cmovlt SIGN, T_0, RESULT + cmovlbs NEG, T_0, RESULT ') ldq BIT, 0(sp) @@ -165,8 +180,10 @@ ifelse(S, `true', ldq CC, 16(sp) ldq T_0, 24(sp) ifelse(S, `true', -` ldq SIGN, 32(sp)') - lda sp, 48(sp) +` ldq NEG, 32(sp)') + ldq A, 40(sp) + ldq B, 48(sp) + lda sp, 64(sp) ret zero, (t9), 1 Ldotrap: diff --git a/sys/lib/libkern/arch/ns32k/Makefile.inc b/sys/lib/libkern/arch/ns32k/Makefile.inc index d4398986a7b..26eb4002710 100644 --- a/sys/lib/libkern/arch/ns32k/Makefile.inc +++ b/sys/lib/libkern/arch/ns32k/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.5.2.1 1995/10/13 20:29:29 phil Exp $ +# $NetBSD: Makefile.inc,v 1.6 1995/11/30 01:00:10 jtc 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 \ diff --git a/sys/lib/libkern/arch/ns32k/setjmp.S b/sys/lib/libkern/arch/ns32k/setjmp.S new file mode 100644 index 00000000000..dfca3d55691 --- /dev/null +++ b/sys/lib/libkern/arch/ns32k/setjmp.S @@ -0,0 +1,70 @@ +/* $NetBSD: setjmp.S,v 1.3 1995/11/30 01:00:12 jtc Exp $ */ + +/* + * Copyright (c) 1992 Helsinki University of Technology + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN + * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY + * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE + * USE OF THIS SOFTWARE. + */ +/* + * HISTORY + * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology + * Created. + */ + +#include +#include + +ENTRY(setjmp) + movqd 0, tos + bsr EX(sigblock) + adjspb -4 + movd 4(sp), r2 /* jmp_buf */ + movd 0(sp), JMP_BUF_PC(r2) /* pc of caller */ + movd r0, JMP_BUF_SIGMASK(r2) /* save mask */ + + sprd sp, JMP_BUF_SP(r2) + sprd fp, JMP_BUF_FP(r2) + sprd sb, JMP_BUF_SB(r2) + movd r3, JMP_BUF_R3(r2) /* save registers r3-r7 */ + movd r4, JMP_BUF_R4(r2) + movd r5, JMP_BUF_R5(r2) + movd r6, JMP_BUF_R6(r2) + movd r7, JMP_BUF_R7(r2) + + movqd 0, r0 + ret 0 + +ENTRY(longjmp) + movd 4(sp),r2 /* jmp_buf */ + movd JMP_BUF_SIGMASK(r2), tos /* restore mask */ + bsr EX(sigsetmask) + adjspb -4 + movd 4(sp), r2 /* jmp_buf */ + movd 8(sp), r0 /* value */ + + lprd sp, JMP_BUF_SP(r2) + lprd fp, JMP_BUF_FP(r2) + lprd sb, JMP_BUF_SB(r2) + movd JMP_BUF_R3(r2), r3 /* load registers r3-r7 */ + movd JMP_BUF_R4(r2), r4 + movd JMP_BUF_R5(r2), r5 + movd JMP_BUF_R6(r2), r6 + movd JMP_BUF_R7(r2), r7 + movd JMP_BUF_PC(r2), 0(sp) /* patch return pc */ + + cmpqd 0, r0 + bne nonzero + movqd 1, r0 +nonzero: + ret 0 + diff --git a/sys/lib/libkern/quad.h b/sys/lib/libkern/quad.h index 2d4d2523c51..f7eea7a31ec 100644 --- a/sys/lib/libkern/quad.h +++ b/sys/lib/libkern/quad.h @@ -1,4 +1,4 @@ -/* $NetBSD: quad.h,v 1.4.2.1 1995/10/12 15:17:26 jtc Exp $ */ +/* $NetBSD: quad.h,v 1.5 1995/10/12 15:13:58 jtc Exp $ */ /*- * Copyright (c) 1992, 1993