diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c index 1ff8dd98c184..5ec561d6e56f 100644 --- a/sys/arch/i386/i386/autoconf.c +++ b/sys/arch/i386/i386/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.19 1996/03/29 01:15:04 mycroft Exp $ */ +/* $NetBSD: autoconf.c,v 1.20 1996/05/03 19:41:56 christos Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -57,10 +57,10 @@ #include #include +#include -void setroot __P((void)); -void swapconf __P((void)); -void dumpconf __P((void)); +void swapconf __P((void)); +void setroot __P((void)); /* * The following several variables are related to @@ -131,11 +131,11 @@ swapconf() u_long bootdev = 0; /* should be dev_t, but not until 32 bits */ static char devname[][2] = { - 'w','d', /* 0 = wd */ - 's','w', /* 1 = sw */ - 'f','d', /* 2 = fd */ - 'w','t', /* 3 = wt */ - 's','d', /* 4 = sd -- new SCSI system */ + { 'w','d' }, /* 0 = wd */ + { 's','w' }, /* 1 = sw */ + { 'f','d' }, /* 2 = fd */ + { 'w','t' }, /* 3 = wt */ + { 's','d' }, /* 4 = sd -- new SCSI system */ }; /* @@ -147,10 +147,15 @@ void setroot() { int majdev, mindev, unit, part, adaptor; - dev_t temp, orootdev; + dev_t orootdev; +#ifdef DOSWAP + dev_t temp = 0; +#endif struct swdevt *swp; -/*printf("howto %x bootdev %x ", boothowto, bootdev);*/ +#if 0 + printf("howto %x bootdev %x ", boothowto, bootdev); +#endif if (boothowto & RB_DFLTROOT || (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC) return; diff --git a/sys/arch/i386/i386/db_disasm.c b/sys/arch/i386/i386/db_disasm.c index f083aef1771b..398bd2c6fa9f 100644 --- a/sys/arch/i386/i386/db_disasm.c +++ b/sys/arch/i386/i386/db_disasm.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_disasm.c,v 1.10 1996/02/02 18:05:58 mycroft Exp $ */ +/* $NetBSD: db_disasm.c,v 1.11 1996/05/03 19:41:58 christos Exp $ */ /* * Mach Operating System @@ -37,6 +37,8 @@ #include #include +#include +#include /* * Size attributes @@ -807,9 +809,9 @@ char * db_index_reg_16[8] = { }; char * db_reg[3][8] = { - "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh", - "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di", - "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi" + { "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh" }, + { "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di" }, + { "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi" } }; char * db_seg_reg[8] = { @@ -835,6 +837,11 @@ int db_lengths[] = { (loc) += (size); \ } while (0) + +db_addr_t db_read_address __P((db_addr_t, int, int, struct i_addr *)); +void db_print_address __P((char *, int, struct i_addr *)); +db_addr_t db_disasm_esc __P((db_addr_t, int, int, int, char *)); + /* * Read address at location and return updated location. */ @@ -845,7 +852,7 @@ db_read_address(loc, short_addr, regmodrm, addrp) int regmodrm; struct i_addr *addrp; /* out */ { - int mod, rm, sib, index, ss, disp; + int mod, rm, sib, index, disp; mod = f_mod(regmodrm); rm = f_rm(regmodrm); @@ -1045,7 +1052,7 @@ db_disasm(loc, altfmt) char * i_name; int i_size; int i_mode; - int regmodrm; + int regmodrm = 0; boolean_t first; int displ; int prefix; diff --git a/sys/arch/i386/i386/db_interface.c b/sys/arch/i386/i386/db_interface.c index e4f2e625b8be..6e45f113bd7c 100644 --- a/sys/arch/i386/i386/db_interface.c +++ b/sys/arch/i386/i386/db_interface.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.21 1996/03/30 07:57:16 mycroft Exp $ */ +/* $NetBSD: db_interface.c,v 1.22 1996/05/03 19:42:00 christos Exp $ */ /* * Mach Operating System @@ -34,18 +34,29 @@ #include #include #include -#include /* just for boothowto --eichin */ +#include #include +#include + #include +#include +#include +#include +#include +#include + + extern label_t *db_recover; extern char *trap_type[]; extern int trap_types; int db_active = 0; +void kdbprinttrap __P((int, int)); + /* * Print trap reason. */ @@ -67,7 +78,7 @@ kdbprinttrap(type, code) int kdb_trap(type, code, regs) int type, code; - register db_regs_t *regs; + db_regs_t *regs; { int s; @@ -135,13 +146,13 @@ kdb_trap(type, code, regs) void db_read_bytes(addr, size, data) vm_offset_t addr; - register int size; + register size_t size; register char *data; { register char *src; src = (char *)addr; - while (--size >= 0) + while (size-- > 0) *data++ = *src++; } @@ -153,7 +164,7 @@ pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t)); void db_write_bytes(addr, size, data) vm_offset_t addr; - register int size; + register size_t size; register char *data; { register char *dst; @@ -183,7 +194,7 @@ db_write_bytes(addr, size, data) dst = (char *)addr; - while (--size >= 0) + while (size-- > 0) *dst++ = *data++; if (ptep0) { diff --git a/sys/arch/i386/i386/db_trace.c b/sys/arch/i386/i386/db_trace.c index 377392cd9a04..8aacd7121b7d 100644 --- a/sys/arch/i386/i386/db_trace.c +++ b/sys/arch/i386/i386/db_trace.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.17 1995/10/11 04:19:35 mycroft Exp $ */ +/* $NetBSD: db_trace.c,v 1.18 1996/05/03 19:42:01 christos Exp $ */ /* * Mach Operating System @@ -27,32 +27,35 @@ */ #include +#include #include #include -#include #include +#include #include +#include +#include /* * Machine register set. */ struct db_variable db_regs[] = { - "es", &ddb_regs.tf_es, FCN_NULL, - "ds", &ddb_regs.tf_ds, FCN_NULL, - "edi", &ddb_regs.tf_edi, FCN_NULL, - "esi", &ddb_regs.tf_esi, FCN_NULL, - "ebp", &ddb_regs.tf_ebp, FCN_NULL, - "ebx", &ddb_regs.tf_ebx, FCN_NULL, - "edx", &ddb_regs.tf_edx, FCN_NULL, - "ecx", &ddb_regs.tf_ecx, FCN_NULL, - "eax", &ddb_regs.tf_eax, FCN_NULL, - "eip", &ddb_regs.tf_eip, FCN_NULL, - "cs", &ddb_regs.tf_cs, FCN_NULL, - "eflags", &ddb_regs.tf_eflags, FCN_NULL, - "esp", &ddb_regs.tf_esp, FCN_NULL, - "ss", &ddb_regs.tf_ss, FCN_NULL, + { "es", &ddb_regs.tf_es, FCN_NULL }, + { "ds", &ddb_regs.tf_ds, FCN_NULL }, + { "edi", &ddb_regs.tf_edi, FCN_NULL }, + { "esi", &ddb_regs.tf_esi, FCN_NULL }, + { "ebp", &ddb_regs.tf_ebp, FCN_NULL }, + { "ebx", &ddb_regs.tf_ebx, FCN_NULL }, + { "edx", &ddb_regs.tf_edx, FCN_NULL }, + { "ecx", &ddb_regs.tf_ecx, FCN_NULL }, + { "eax", &ddb_regs.tf_eax, FCN_NULL }, + { "eip", &ddb_regs.tf_eip, FCN_NULL }, + { "cs", &ddb_regs.tf_cs, FCN_NULL }, + { "eflags", &ddb_regs.tf_eflags, FCN_NULL }, + { "esp", &ddb_regs.tf_esp, FCN_NULL }, + { "ss", &ddb_regs.tf_ss, FCN_NULL }, }; struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); @@ -77,6 +80,10 @@ db_addr_t db_syscall_symbol_value = 0; db_addr_t db_kdintr_symbol_value = 0; boolean_t db_trace_symbols_found = FALSE; +void db_find_trace_symbols __P((void)); +int db_numargs __P((struct i386_frame *)); +void db_nextframe __P((struct i386_frame **, db_addr_t *, int *, int)); + void db_find_trace_symbols() { @@ -177,7 +184,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif) struct i386_frame *frame, *lastframe; int *argp; db_addr_t callpc; - int is_trap; + int is_trap = 0; boolean_t kernel_only = TRUE; boolean_t trace_thread = FALSE; @@ -205,7 +212,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif) frame = (struct i386_frame *)ddb_regs.tf_ebp; callpc = (db_addr_t)ddb_regs.tf_eip; } else if (trace_thread) { - printf ("db_trace.c: can't trace thread\n"); + db_printf ("db_trace.c: can't trace thread\n"); } else { frame = (struct i386_frame *)addr; callpc = (db_addr_t) @@ -307,7 +314,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif) if (INKERNEL((int)frame)) { /* staying in kernel */ if (frame <= lastframe) { - db_printf("Bad frame pointer: 0x%x\n", frame); + db_printf("Bad frame pointer: %p\n", frame); break; } } else if (INKERNEL((int)lastframe)) { @@ -317,7 +324,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif) } else { /* in user */ if (frame <= lastframe) { - db_printf("Bad user frame pointer: 0x%x\n", + db_printf("Bad user frame pointer: %p\n", frame); break; } diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index d7f44411a2dd..9941b4411917 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: disksubr.c,v 1.20 1996/04/03 08:18:27 mycroft Exp $ */ +/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1988 Regents of the University of California. @@ -64,7 +64,7 @@ int fat_types[] = { DOSPTYP_FAT12, DOSPTYP_FAT16S, char * readdisklabel(dev, strat, lp, osdep) dev_t dev; - void (*strat)(); + void (*strat) __P((struct buf *)); register struct disklabel *lp; struct cpu_disklabel *osdep; { @@ -228,7 +228,6 @@ setdisklabel(olp, nlp, openmask, osdep) u_long openmask; struct cpu_disklabel *osdep; { - struct dos_partition *dp = osdep->dosparts; register i; register struct partition *opp, *npp; @@ -282,7 +281,7 @@ setdisklabel(olp, nlp, openmask, osdep) int writedisklabel(dev, strat, lp, osdep) dev_t dev; - void (*strat)(); + void (*strat) __P((struct buf *)); register struct disklabel *lp; struct cpu_disklabel *osdep; { @@ -340,7 +339,7 @@ writedisklabel(dev, strat, lp, osdep) (*strat)(bp); /* if successful, locate disk label within block and validate */ - if (error = biowait(bp)) + if ((error = biowait(bp)) != 0) goto done; for (dlp = (struct disklabel *)bp->b_data; dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp)); diff --git a/sys/arch/i386/i386/freebsd_machdep.c b/sys/arch/i386/i386/freebsd_machdep.c index 547f839ef190..79c4a3fc0f9a 100644 --- a/sys/arch/i386/i386/freebsd_machdep.c +++ b/sys/arch/i386/i386/freebsd_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: freebsd_machdep.c,v 1.9 1996/04/18 08:36:20 mycroft Exp $ */ +/* $NetBSD: freebsd_machdep.c,v 1.10 1996/05/03 19:42:05 christos Exp $ */ /*- * Copyright (c) 1993, 1994, 1995, 1996 Charles M. Hannum. All rights reserved. @@ -374,7 +374,7 @@ freebsd_ptrace_getregs(fregs, addr, datap) return 0; } #ifdef DIAGNOSTIC - printf("freebsd_ptrace_getregs: *(0x%08x)\n", offset); + printf("freebsd_ptrace_getregs: *(0x%08lx)\n", offset); #endif return EFAULT; } @@ -401,7 +401,7 @@ freebsd_ptrace_setregs(fregs, addr, data) return 0; } #ifdef DIAGNOSTIC - printf("freebsd_ptrace_setregs: *(0x%08x) = 0x%08x\n", offset, data); + printf("freebsd_ptrace_setregs: *(0x%08lx) = 0x%08x\n", offset, data); #endif return EFAULT; } diff --git a/sys/arch/i386/i386/gdt.c b/sys/arch/i386/i386/gdt.c index 4a8700b77931..86fdeb2ea28f 100644 --- a/sys/arch/i386/i386/gdt.c +++ b/sys/arch/i386/i386/gdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: gdt.c,v 1.7 1996/02/27 22:45:01 jtc Exp $ */ +/* $NetBSD: gdt.c,v 1.8 1996/05/03 19:42:06 christos Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -59,6 +59,15 @@ int gdt_flags; #define GDT_LOCKED 0x1 #define GDT_WANTED 0x2 +static __inline void gdt_lock __P((void)); +static __inline void gdt_unlock __P((void)); +void gdt_compact __P((void)); +void gdt_init __P((void)); +void gdt_grow __P((void)); +void gdt_shrink __P((void)); +int gdt_get_slot __P((void)); +void gdt_put_slot __P((int)); + /* * Lock and unlock the GDT, to avoid races in case gdt_{ge,pu}t_slot() sleep * waiting for memory. @@ -68,7 +77,7 @@ int gdt_flags; * some time after the GDT is unlocked, so gdt_compact() could attempt to * reclaim it. */ -static inline void +static __inline void gdt_lock() { @@ -79,7 +88,7 @@ gdt_lock() gdt_flags |= GDT_LOCKED; } -static inline void +static __inline void gdt_unlock() { diff --git a/sys/arch/i386/i386/genassym.c b/sys/arch/i386/i386/genassym.c index d3e01c4094d2..5709d3e17934 100644 --- a/sys/arch/i386/i386/genassym.c +++ b/sys/arch/i386/i386/genassym.c @@ -1,4 +1,4 @@ -/* $NetBSD: genassym.c,v 1.48 1996/03/28 23:44:04 mycroft Exp $ */ +/* $NetBSD: genassym.c,v 1.49 1996/05/03 19:42:07 christos Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -71,6 +71,8 @@ #include #include +int main __P((void)); + int main() { diff --git a/sys/arch/i386/i386/in_cksum.c b/sys/arch/i386/i386/in_cksum.c index 95a82ae502cb..91bfee78410c 100644 --- a/sys/arch/i386/i386/in_cksum.c +++ b/sys/arch/i386/i386/in_cksum.c @@ -1,4 +1,4 @@ -/* $NetBSD: in_cksum.c,v 1.8 1995/05/01 01:24:04 mycroft Exp $ */ +/* $NetBSD: in_cksum.c,v 1.9 1996/05/03 19:42:09 christos Exp $ */ /*- * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -38,7 +38,9 @@ */ #include +#include #include +#include /* * Checksum routine for Internet Protocol family headers. diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c index b903749a1663..2d4d5c4a5314 100644 --- a/sys/arch/i386/i386/linux_machdep.c +++ b/sys/arch/i386/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.28 1996/04/18 08:36:22 mycroft Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,14 @@ #include #endif +#ifdef USER_LDT +#include +int linux_read_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *, + register_t *)); +int linux_write_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *, + register_t *)); +#endif + /* * Deal with some i386-specific things in the Linux emulation code. * This means just signals for now, will include stuff like @@ -284,10 +293,10 @@ linux_read_ldt(p, uap, retval) parms = stackgap_alloc(&sg, sizeof(gl)); - if (error = copyout(&gl, parms, sizeof(gl))) + if ((error = copyout(&gl, parms, sizeof(gl))) != 0) return (error); - if (error = i386_get_ldt(p, parms, retval)) + if ((error = i386_get_ldt(p, parms, retval)) != 0) return (error); *retval *= sizeof(union descriptor); @@ -324,7 +333,7 @@ linux_write_ldt(p, uap, retval) if (SCARG(uap, bytecount) != sizeof(ldt_info)) return (EINVAL); - if (error = copyin(SCARG(uap, ptr), &ldt_info, sizeof(ldt_info))) + if ((error = copyin(SCARG(uap, ptr), &ldt_info, sizeof(ldt_info))) != 0) return error; if (ldt_info.contents == 3) return (EINVAL); @@ -353,12 +362,12 @@ linux_write_ldt(p, uap, retval) parms = stackgap_alloc(&sg, sizeof(sl)); - if (error = copyout(&sd, sl.desc, sizeof(sd))) + if ((error = copyout(&sd, sl.desc, sizeof(sd))) != 0) return (error); - if (error = copyout(&sl, parms, sizeof(sl))) + if ((error = copyout(&sl, parms, sizeof(sl))) != 0) return (error); - if (error = i386_set_ldt(p, parms, retval)) + if ((error = i386_set_ldt(p, parms, retval)) != 0) return (error); *retval = 0; @@ -423,15 +432,12 @@ linux_machdepioctl(p, v, retval) syscallarg(u_long) com; syscallarg(caddr_t) data; } */ *uap = v; - struct sys_ioctl_args bia, tmparg; + struct sys_ioctl_args bia; u_long com; #if NVT > 0 - int error, mode; + int error; struct vt_mode lvt; caddr_t bvtp, sg; - u_int fd; - struct file *fp; - struct filedesc *fdp; #endif SCARG(&bia, fd) = SCARG(uap, fd); @@ -506,7 +512,7 @@ linux_machdepioctl(p, v, retval) break; #endif default: - printf("linux_machdepioctl: invalid ioctl %08x\n", com); + printf("linux_machdepioctl: invalid ioctl %08lx\n", com); return EINVAL; } SCARG(&bia, com) = com; @@ -524,9 +530,11 @@ linux_sys_iopl(p, v, retval) void *v; register_t *retval; { +#if 0 struct linux_sys_iopl_args /* { syscallarg(int) level; } */ *uap = v; +#endif struct trapframe *fp = p->p_md.md_regs; if (suser(p->p_ucred, &p->p_acflag) != 0) diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 339424f820f4..e16f82a27cb4 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.199 1996/04/18 09:58:13 mycroft Exp $ */ +/* $NetBSD: machdep.c,v 1.200 1996/05/03 19:42:15 christos Exp $ */ /*- * Copyright (c) 1993, 1994, 1995, 1996 Charles M. Hannum. All rights reserved. @@ -77,6 +77,8 @@ #include #include +#include + #include #include #include @@ -92,6 +94,13 @@ #include #include +#ifdef DDB +#include +#include +#include +#include +#endif + #ifdef VM86 #include #endif @@ -135,10 +144,14 @@ extern vm_offset_t avail_start, avail_end; static vm_offset_t hole_start, hole_end; static vm_offset_t avail_next; -void identifycpu __P((void)); -caddr_t allocsys __P((caddr_t)); -void dumpsys __P((void)); -void cpu_reset __P((void)); +caddr_t allocsys __P((caddr_t)); +void dumpsys __P((void)); +void identifycpu __P((void)); +void init386 __P((vm_offset_t)); +void consinit __P((void)); +#ifdef COMPAT_NOMID +static int exec_nomid __P((struct proc *, struct exec_package *)); +#endif /* * Machine-dependent startup code @@ -243,7 +256,7 @@ cpu_startup() for (i = 1; i < ncallout; i++) callout[i-1].c_next = &callout[i]; - printf("avail mem = %d\n", ptoa(cnt.v_free_count)); + printf("avail mem = %ld\n", ptoa(cnt.v_free_count)); printf("using %d buffers containing %d bytes of memory\n", nbuf, bufpages * CLBYTES); @@ -362,7 +375,6 @@ struct cpu_nameclass i386_cpus[] = { void identifycpu() { - int len; extern char cpu_vendor[]; printf("CPU: "); @@ -484,6 +496,8 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) } #ifdef COMPAT_IBCS2 +void ibcs2_sendsig __P((sig_t, int, int, u_long)); + void ibcs2_sendsig(catcher, sig, mask, code) sig_t catcher; @@ -799,8 +813,7 @@ dumpsys() int maddr, psize; daddr_t blkno; int (*dump) __P((dev_t, daddr_t, caddr_t, size_t)); - int error = 0; - int c; + int error; /* Save registers. */ savectx(&dumppcb); @@ -817,7 +830,7 @@ dumpsys() dumpconf(); if (dumplo < 0) return; - printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo); + printf("\ndumping to dev %x, offset %ld\n", dumpdev, dumplo); psize = (*bdevsw[major(dumpdev)].d_psize)(dumpdev); printf("dump "); @@ -835,6 +848,7 @@ dumpsys() maddr = 0; blkno = dumplo; dump = bdevsw[major(dumpdev)].d_dump; + error = 0; for (i = 0; i < bytes; i += n) { /* * Avoid dumping the ISA memory hole, and areas that @@ -1044,9 +1058,7 @@ init386(first_avail) int x; unsigned biosbasemem, biosextmem; struct region_descriptor region; - extern char etext[], sigcode[], esigcode[]; extern void consinit __P((void)); - extern void lgdt(); proc0.p_addr = proc0paddr; @@ -1291,7 +1303,6 @@ cpu_exec_aout_prep_oldzmagic(p, epp) struct exec_package *epp; { struct exec *execp = epp->ep_hdr; - struct exec_vmcmd *ccmdp; epp->ep_taddr = 0; epp->ep_tsize = execp->a_text; diff --git a/sys/arch/i386/i386/math_emulate.c b/sys/arch/i386/i386/math_emulate.c index 64b23ebbdb33..23477eaf322e 100644 --- a/sys/arch/i386/i386/math_emulate.c +++ b/sys/arch/i386/i386/math_emulate.c @@ -1,4 +1,4 @@ -/* $NetBSD: math_emulate.c,v 1.16 1996/02/02 18:06:01 mycroft Exp $ */ +/* $NetBSD: math_emulate.c,v 1.17 1996/05/03 19:42:17 christos Exp $ */ /* * expediant "port" of linux 8087 emulator to 386BSD, with apologies -wfj @@ -68,7 +68,9 @@ static temp_real_unaligned * __st(int i); I387.twd = 0x0000; \ } while (0) -math_emulate(struct trapframe *info) +int +math_emulate(info) + struct trapframe *info; { u_short code; temp_real tmp; @@ -652,7 +654,7 @@ void get_short_int(temp_real * tmp, addr = ea(info,code); ti.a = (signed short) fusword((u_short *) addr); ti.b = 0; - if (ti.sign = (ti.a < 0)) + if ((ti.sign = (ti.a < 0)) != 0) ti.a = - ti.a; int_to_real(&ti,tmp); } @@ -666,7 +668,7 @@ void get_long_int(temp_real * tmp, addr = ea(info,code); ti.a = fuword((u_long *) addr); ti.b = 0; - if (ti.sign = (ti.a < 0)) + if ((ti.sign = (ti.a < 0)) != 0) ti.a = - ti.a; int_to_real(&ti,tmp); } @@ -680,7 +682,7 @@ void get_longlong_int(temp_real * tmp, addr = ea(info,code); ti.a = fuword((u_long *) addr); ti.b = fuword((u_long *) addr + 1); - if (ti.sign = (ti.b < 0)) + if ((ti.sign = (ti.b < 0)) != 0) __asm__("notl %0 ; notl %1\n\t" "addl $1,%0 ; adcl $0,%1" :"=r" (ti.a),"=r" (ti.b) diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index 658050555986..175b016f3346 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.30 1995/10/11 04:19:46 mycroft Exp $ */ +/* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -45,7 +45,6 @@ */ #include -#include #include #include #include @@ -54,6 +53,7 @@ #include #include +#include #include @@ -62,9 +62,10 @@ caddr_t zeropage; /*ARGSUSED*/ int -mmopen(dev, flag, mode) +mmopen(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { switch (minor(dev)) { @@ -87,9 +88,10 @@ mmopen(dev, flag, mode) /*ARGSUSED*/ int -mmclose(dev, flag, mode) +mmclose(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); @@ -185,7 +187,6 @@ mmrw(dev, uio, flags) uio->uio_resid -= c; } if (minor(dev) == 0) { -unlock: if (physlock > 1) wakeup((caddr_t)&physlock); physlock = 0; diff --git a/sys/arch/i386/i386/ns_cksum.c b/sys/arch/i386/i386/ns_cksum.c index 023e4a4b26b2..b979784ba059 100644 --- a/sys/arch/i386/i386/ns_cksum.c +++ b/sys/arch/i386/i386/ns_cksum.c @@ -1,4 +1,4 @@ -/* $NetBSD: ns_cksum.c,v 1.4 1996/02/02 18:06:03 mycroft Exp $ */ +/* $NetBSD: ns_cksum.c,v 1.5 1996/05/03 19:42:20 christos Exp $ */ /* * Copyright (c) 1982, 1988 Regents of the University of California. @@ -37,6 +37,7 @@ #include #include +#include /* * Checksum routine for Network Systems Protocol Packets (Big-Endian). diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 6650d075537d..ee423fc77ec0 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.35 1996/04/03 08:21:05 mycroft Exp $ */ +/* $NetBSD: pmap.c,v 1.36 1996/05/03 19:42:22 christos Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -79,6 +79,7 @@ */ #include +#include #include #include #include @@ -178,7 +179,14 @@ TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist; int pv_nfree; pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t)); +struct pv_entry * pmap_alloc_pv __P((void)); +void pmap_free_pv __P((struct pv_entry *)); void i386_protection_init __P((void)); +void pmap_collect_pv __P((void)); +__inline void pmap_remove_pv __P((pmap_t, vm_offset_t, u_int)); +__inline void pmap_enter_pv __P((pmap_t, vm_offset_t, u_int)); +void pmap_deactivate __P((pmap_t, struct pcb *)); +void pmap_remove_all __P((vm_offset_t)); #if BSDVM_COMPAT #include @@ -211,9 +219,6 @@ pmap_bootstrap(virtual_start) vm_offset_t va; pt_entry_t *pte; #endif - extern int physmem; - extern vm_offset_t reserve_dumppages(vm_offset_t); - /* XXX: allow for msgbuf */ avail_end -= i386_round_page(sizeof(struct msgbuf)); @@ -301,9 +306,8 @@ pmap_virtual_space(startp, endp) void pmap_init() { - vm_offset_t addr, addr2; + vm_offset_t addr; vm_size_t s; - int rv; if (PAGE_SIZE != NBPG) panic("pmap_init: CLSIZE != 1"); @@ -368,7 +372,6 @@ pmap_free_pv(pv) struct pv_entry *pv; { register struct pv_page *pvp; - register int i; pvp = (struct pv_page *) trunc_page(pv); switch (++pvp->pvp_pgi.pgi_nfree) { @@ -828,7 +831,9 @@ reduce wiring count on page table pages as references drop *pte = 0; +#ifndef __GNUC__ next: +#endif sva += NBPG; pte++; } @@ -1006,7 +1011,9 @@ pmap_protect(pmap, sva, eva, prot) i386prot |= PG_u | PG_RW; pmap_pte_set_prot(pte, i386prot); +#ifndef __GNUC__ next: +#endif sva += NBPG; pte++; } @@ -1079,7 +1086,8 @@ pmap_enter(pmap, va, pa, prot, wired) /* * Check for wiring change and adjust statistics. */ - if (wired && !pmap_pte_w(pte) || !wired && pmap_pte_w(pte)) { + if ((wired && !pmap_pte_w(pte)) || + (!wired && pmap_pte_w(pte))) { /* * We don't worry about wiring PT pages as they remain * resident as long as there are valid mappings in them. @@ -1245,7 +1253,7 @@ pmap_change_wiring(pmap, va, wired) } #endif - if (wired && !pmap_pte_w(pte) || !wired && pmap_pte_w(pte)) { + if ((wired && !pmap_pte_w(pte)) || (!wired && pmap_pte_w(pte))) { if (wired) pmap->pm_stats.wired_count++; else @@ -1361,12 +1369,6 @@ void pmap_collect(pmap) pmap_t pmap; { - register vm_offset_t pa; - register struct pv_entry *pv; - register pt_entry_t *pte; - vm_offset_t kpa; - int s; - #ifdef DEBUG printf("pmap_collect(%x) ", pmap); #endif diff --git a/sys/arch/i386/i386/process_machdep.c b/sys/arch/i386/i386/process_machdep.c index b96920013d8e..14eec0004e67 100644 --- a/sys/arch/i386/i386/process_machdep.c +++ b/sys/arch/i386/i386/process_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: process_machdep.c,v 1.21 1996/04/11 07:47:48 mycroft Exp $ */ +/* $NetBSD: process_machdep.c,v 1.22 1996/05/03 19:42:25 christos Exp $ */ /* * Copyright (c) 1995, 1996 Charles M. Hannum. All rights reserved. @@ -80,7 +80,10 @@ #include #endif -static inline struct trapframe * +static __inline struct trapframe *process_frame __P((struct proc *)); +static __inline struct save87 *process_fpframe __P((struct proc *)); + +static __inline struct trapframe * process_frame(p) struct proc *p; { @@ -88,7 +91,7 @@ process_frame(p) return (p->p_md.md_regs); } -static inline struct save87 * +static __inline struct save87 * process_fpframe(p) struct proc *p; { diff --git a/sys/arch/i386/i386/svr4_machdep.c b/sys/arch/i386/i386/svr4_machdep.c index 0be6c9eb13e6..930144db6e8a 100644 --- a/sys/arch/i386/i386/svr4_machdep.c +++ b/sys/arch/i386/i386/svr4_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_machdep.c,v 1.23 1996/04/18 08:36:31 mycroft Exp $ */ +/* $NetBSD: svr4_machdep.c,v 1.24 1996/05/03 19:42:26 christos Exp $ */ /* * Copyright (c) 1994 Christos Zoulas @@ -137,7 +137,6 @@ svr4_setcontext(p, uc) struct proc *p; struct svr4_ucontext *uc; { - struct sigcontext *scp, context; struct sigacts *psp = p->p_sigacts; register struct trapframe *tf; svr4_greg_t *r = uc->uc_mcontext.greg; @@ -297,7 +296,7 @@ svr4_getsiginfo(si, sig, code, addr) si->si_code = 0; si->si_trap = 0; #ifdef DIAGNOSTIC - printf("sig %d code %d\n", sig, code); + printf("sig %d code %ld\n", sig, code); panic("svr4_getsiginfo"); #endif break; @@ -359,8 +358,10 @@ svr4_sendsig(catcher, sig, mask, code) frame.sf_sip = &fp->sf_si; frame.sf_ucp = &fp->sf_uc; frame.sf_handler = catcher; - printf("sig = %d, sip %x, ucp = %x, handler = %x\n", +#ifdef DEBUG_SVR4 + printf("sig = %d, sip %p, ucp = %p, handler = %p\n", frame.sf_signum, frame.sf_sip, frame.sf_ucp, frame.sf_handler); +#endif if (copyout(&frame, fp, sizeof(frame)) != 0) { /* @@ -470,7 +471,7 @@ svr4_sys_sysarch(p, v, retval) #endif default: - printf("svr4_sysarch(%d), a1 %x\n", SCARG(uap, op), + printf("svr4_sysarch(%d), a1 %p\n", SCARG(uap, op), SCARG(uap, a1)); return 0; } diff --git a/sys/arch/i386/i386/swapgeneric.c b/sys/arch/i386/i386/swapgeneric.c index 44d0526db2ab..dc4c4eeaf8b8 100644 --- a/sys/arch/i386/i386/swapgeneric.c +++ b/sys/arch/i386/i386/swapgeneric.c @@ -1,4 +1,4 @@ -/* $NetBSD: swapgeneric.c,v 1.11 1996/04/03 09:15:26 mycroft Exp $ */ +/* $NetBSD: swapgeneric.c,v 1.12 1996/05/03 19:42:28 christos Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -46,7 +46,10 @@ #include #include +#include + #include +#include #include "wdc.h" #include "fdc.h" @@ -107,8 +110,8 @@ struct genericconf { { 0 } }; -extern int ffs_mountroot(); -int (*mountroot)() = ffs_mountroot; +extern int ffs_mountroot __P((void *)); +int (*mountroot) __P((void *)) = ffs_mountroot; void gets __P((char *)); diff --git a/sys/arch/i386/i386/sys_machdep.c b/sys/arch/i386/i386/sys_machdep.c index 412f5f128a96..bf9981887a18 100644 --- a/sys/arch/i386/i386/sys_machdep.c +++ b/sys/arch/i386/i386/sys_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_machdep.c,v 1.27 1996/01/08 13:51:36 mycroft Exp $ */ +/* $NetBSD: sys_machdep.c,v 1.28 1996/05/03 19:42:29 christos Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -72,9 +72,18 @@ extern vm_map_t kernel_map; +#ifdef USER_LDT +int i386_get_ldt __P((struct proc *, char *, register_t *)); +int i386_set_ldt __P((struct proc *, char *, register_t *)); +#endif +int i386_iopl __P((struct proc *, char *, register_t *)); +int i386_get_ioperm __P((struct proc *, char *, register_t *)); +int i386_set_ioperm __P((struct proc *, char *, register_t *)); + #ifdef TRACE int nvualarm; +int sys_vtrace(p, v, retval) struct proc *p; void *v; @@ -160,7 +169,7 @@ i386_get_ldt(p, args, retval) union descriptor *lp; struct i386_get_ldt_args ua; - if (error = copyin(args, &ua, sizeof(ua))) + if ((error = copyin(args, &ua, sizeof(ua))) != 0) return (error); #ifdef DEBUG @@ -185,7 +194,8 @@ i386_get_ldt(p, args, retval) lp += ua.start; num = min(ua.num, nldt - ua.start); - if (error = copyout(lp, ua.desc, num * sizeof(union descriptor))) + error = copyout(lp, ua.desc, num * sizeof(union descriptor)); + if (error) return (error); *retval = num; @@ -205,7 +215,7 @@ i386_set_ldt(p, args, retval) struct i386_set_ldt_args ua; union descriptor desc; - if (error = copyin(args, &ua, sizeof(ua))) + if ((error = copyin(args, &ua, sizeof(ua))) != 0) return (error); #ifdef DEBUG @@ -258,10 +268,11 @@ i386_set_ldt(p, args, retval) savectx(curpcb); fsslot = IDXSEL(pcb->pcb_fs); gsslot = IDXSEL(pcb->pcb_gs); + error = 0; /* Check descriptors for access violations. */ for (i = 0, n = ua.start; i < ua.num; i++, n++) { - if (error = copyin(&ua.desc[i], &desc, sizeof(desc))) + if ((error = copyin(&ua.desc[i], &desc, sizeof(desc))) != 0) return (error); switch (desc.sd.sd_type) { @@ -315,7 +326,7 @@ i386_set_ldt(p, args, retval) /* Now actually replace the descriptors. */ for (i = 0, n = ua.start; i < ua.num; i++, n++) { - if (error = copyin(&ua.desc[i], &desc, sizeof(desc))) + if ((error = copyin(&ua.desc[i], &desc, sizeof(desc))) != 0) goto out; pcb->pcb_ldt[n] = desc; @@ -339,10 +350,10 @@ i386_iopl(p, args, retval) struct trapframe *tf = p->p_md.md_regs; struct i386_iopl_args ua; - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return error; - if (error = copyin(args, &ua, sizeof(ua))) + if ((error = copyin(args, &ua, sizeof(ua))) != 0) return error; if (ua.iopl) @@ -363,7 +374,7 @@ i386_get_ioperm(p, args, retval) struct pcb *pcb = &p->p_addr->u_pcb; struct i386_get_ioperm_args ua; - if (error = copyin(args, &ua, sizeof(ua))) + if ((error = copyin(args, &ua, sizeof(ua))) != 0) return (error); return copyout(pcb->pcb_iomap, ua.iomap, sizeof(pcb->pcb_iomap)); @@ -379,10 +390,10 @@ i386_set_ioperm(p, args, retval) struct pcb *pcb = &p->p_addr->u_pcb; struct i386_set_ioperm_args ua; - if (error = suser(p->p_ucred, &p->p_acflag)) + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return error; - if (error = copyin(args, &ua, sizeof(ua))) + if ((error = copyin(args, &ua, sizeof(ua))) != 0) return (error); return copyin(ua.iomap, pcb->pcb_iomap, sizeof(pcb->pcb_iomap)); diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index a491407f5376..4840c2838d5e 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.93 1996/04/15 00:20:32 mycroft Exp $ */ +/* $NetBSD: trap.c,v 1.94 1996/05/03 19:42:31 christos Exp $ */ #undef DEBUG #define DEBUG @@ -66,6 +66,9 @@ #include #include #include +#ifdef DDB +#include +#endif #ifdef COMPAT_IBCS2 #include @@ -83,11 +86,16 @@ extern struct emul emul_freebsd; #include "npx.h" +static __inline void userret __P((struct proc *, int, u_quad_t)); +void trap __P((struct trapframe)); +int trapwrite __P((unsigned)); +void syscall __P((struct trapframe)); + /* * Define the code needed before returning to user mode, for * trap and syscall. */ -static inline void +static __inline void userret(p, pc, oticks) register struct proc *p; int pc; @@ -172,7 +180,7 @@ trap(frame) register struct proc *p = curproc; int type = frame.tf_trapno; u_quad_t sticks; - struct pcb *pcb; + struct pcb *pcb = NULL; extern char fusubail[], resume_iret[], resume_pop_ds[], resume_pop_es[]; struct trapframe *vframe; @@ -185,7 +193,7 @@ trap(frame) printf("trap %d code %x eip %x cs %x eflags %x cr2 %x cpl %x\n", frame.tf_trapno, frame.tf_err, frame.tf_eip, frame.tf_cs, frame.tf_eflags, rcr2(), cpl); - printf("curproc %x\n", curproc); + printf("curproc %p\n", curproc); } #endif @@ -362,7 +370,7 @@ trap(frame) #ifdef DIAGNOSTIC if (map == kernel_map && va == 0) { - printf("trap: bad kernel access at %x\n", va); + printf("trap: bad kernel access at %lx\n", va); goto we_re_toast; } #endif @@ -408,7 +416,7 @@ trap(frame) if (type == T_PAGEFLT) { if (pcb->pcb_onfault != 0) goto copyfault; - printf("vm_fault(%x, %x, %x, 0) -> %x\n", + printf("vm_fault(%p, %lx, %x, 0) -> %x\n", map, va, ftype, rv); goto we_re_toast; } @@ -429,7 +437,9 @@ trap(frame) case T_BPTFLT|T_USER: /* bpt instruction fault */ case T_TRCTRAP|T_USER: /* trace trap */ +#ifdef MATH_EMULATE trace: +#endif trapsignal(p, SIGTRAP, type &~ T_USER); break; @@ -513,7 +523,6 @@ syscall(frame) cnt.v_syscall++; if (!USERMODE(frame.tf_cs, frame.tf_eflags)) panic("syscall"); - p = curproc; sticks = p->p_sticks; p->p_md.md_regs = &frame; opc = frame.tf_eip; diff --git a/sys/arch/i386/i386/vm86.c b/sys/arch/i386/i386/vm86.c index bff572a06383..a968c811bc99 100644 --- a/sys/arch/i386/i386/vm86.c +++ b/sys/arch/i386/i386/vm86.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm86.c,v 1.14 1996/04/30 10:35:25 mycroft Exp $ */ +/* $NetBSD: vm86.c,v 1.15 1996/05/03 19:42:33 christos Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -72,6 +72,7 @@ #include static void fast_intxx __P((struct proc *, int)); +static __inline int is_bitset __P((int, caddr_t)); #define CS(tf) (*(u_short *)&tf->tf_cs) #define IP(tf) (*(u_short *)&tf->tf_eip) @@ -141,7 +142,7 @@ __asm__ __volatile__( \ __res; }) -static __inline__ int +static __inline int is_bitset(nr, bitmap) int nr; caddr_t bitmap; diff --git a/sys/arch/i386/i386/vm_machdep.c b/sys/arch/i386/i386/vm_machdep.c index d3861e97ca66..59241a893dce 100644 --- a/sys/arch/i386/i386/vm_machdep.c +++ b/sys/arch/i386/i386/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.60 1996/04/25 01:15:41 christos Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.61 1996/05/03 19:42:35 christos Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -68,6 +69,8 @@ extern struct proc *npxproc; #endif +void setredzone __P((u_short *, caddr_t)); + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the kernel stack and pcb, making the child @@ -84,7 +87,6 @@ cpu_fork(p1, p2) register struct pcb *pcb = &p2->p_addr->u_pcb; register struct trapframe *tf; register struct switchframe *sf; - extern void proc_trampoline(), child_return(); #if NNPX > 0 /* @@ -262,6 +264,7 @@ cpu_coredump(p, vp, cred, chdr) /* * Set a red zone in the kernel stack after the u. area. */ +void setredzone(pte, vaddr) u_short *pte; caddr_t vaddr; diff --git a/sys/compat/linux/arch/i386/linux_machdep.c b/sys/compat/linux/arch/i386/linux_machdep.c index b903749a1663..2d4d5c4a5314 100644 --- a/sys/compat/linux/arch/i386/linux_machdep.c +++ b/sys/compat/linux/arch/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.28 1996/04/18 08:36:22 mycroft Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,14 @@ #include #endif +#ifdef USER_LDT +#include +int linux_read_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *, + register_t *)); +int linux_write_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *, + register_t *)); +#endif + /* * Deal with some i386-specific things in the Linux emulation code. * This means just signals for now, will include stuff like @@ -284,10 +293,10 @@ linux_read_ldt(p, uap, retval) parms = stackgap_alloc(&sg, sizeof(gl)); - if (error = copyout(&gl, parms, sizeof(gl))) + if ((error = copyout(&gl, parms, sizeof(gl))) != 0) return (error); - if (error = i386_get_ldt(p, parms, retval)) + if ((error = i386_get_ldt(p, parms, retval)) != 0) return (error); *retval *= sizeof(union descriptor); @@ -324,7 +333,7 @@ linux_write_ldt(p, uap, retval) if (SCARG(uap, bytecount) != sizeof(ldt_info)) return (EINVAL); - if (error = copyin(SCARG(uap, ptr), &ldt_info, sizeof(ldt_info))) + if ((error = copyin(SCARG(uap, ptr), &ldt_info, sizeof(ldt_info))) != 0) return error; if (ldt_info.contents == 3) return (EINVAL); @@ -353,12 +362,12 @@ linux_write_ldt(p, uap, retval) parms = stackgap_alloc(&sg, sizeof(sl)); - if (error = copyout(&sd, sl.desc, sizeof(sd))) + if ((error = copyout(&sd, sl.desc, sizeof(sd))) != 0) return (error); - if (error = copyout(&sl, parms, sizeof(sl))) + if ((error = copyout(&sl, parms, sizeof(sl))) != 0) return (error); - if (error = i386_set_ldt(p, parms, retval)) + if ((error = i386_set_ldt(p, parms, retval)) != 0) return (error); *retval = 0; @@ -423,15 +432,12 @@ linux_machdepioctl(p, v, retval) syscallarg(u_long) com; syscallarg(caddr_t) data; } */ *uap = v; - struct sys_ioctl_args bia, tmparg; + struct sys_ioctl_args bia; u_long com; #if NVT > 0 - int error, mode; + int error; struct vt_mode lvt; caddr_t bvtp, sg; - u_int fd; - struct file *fp; - struct filedesc *fdp; #endif SCARG(&bia, fd) = SCARG(uap, fd); @@ -506,7 +512,7 @@ linux_machdepioctl(p, v, retval) break; #endif default: - printf("linux_machdepioctl: invalid ioctl %08x\n", com); + printf("linux_machdepioctl: invalid ioctl %08lx\n", com); return EINVAL; } SCARG(&bia, com) = com; @@ -524,9 +530,11 @@ linux_sys_iopl(p, v, retval) void *v; register_t *retval; { +#if 0 struct linux_sys_iopl_args /* { syscallarg(int) level; } */ *uap = v; +#endif struct trapframe *fp = p->p_md.md_regs; if (suser(p->p_ucred, &p->p_acflag) != 0) diff --git a/sys/compat/linux/i386/linux_machdep.c b/sys/compat/linux/i386/linux_machdep.c index b903749a1663..2d4d5c4a5314 100644 --- a/sys/compat/linux/i386/linux_machdep.c +++ b/sys/compat/linux/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.28 1996/04/18 08:36:22 mycroft Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */ /* * Copyright (c) 1995 Frank van der Linden @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,14 @@ #include #endif +#ifdef USER_LDT +#include +int linux_read_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *, + register_t *)); +int linux_write_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *, + register_t *)); +#endif + /* * Deal with some i386-specific things in the Linux emulation code. * This means just signals for now, will include stuff like @@ -284,10 +293,10 @@ linux_read_ldt(p, uap, retval) parms = stackgap_alloc(&sg, sizeof(gl)); - if (error = copyout(&gl, parms, sizeof(gl))) + if ((error = copyout(&gl, parms, sizeof(gl))) != 0) return (error); - if (error = i386_get_ldt(p, parms, retval)) + if ((error = i386_get_ldt(p, parms, retval)) != 0) return (error); *retval *= sizeof(union descriptor); @@ -324,7 +333,7 @@ linux_write_ldt(p, uap, retval) if (SCARG(uap, bytecount) != sizeof(ldt_info)) return (EINVAL); - if (error = copyin(SCARG(uap, ptr), &ldt_info, sizeof(ldt_info))) + if ((error = copyin(SCARG(uap, ptr), &ldt_info, sizeof(ldt_info))) != 0) return error; if (ldt_info.contents == 3) return (EINVAL); @@ -353,12 +362,12 @@ linux_write_ldt(p, uap, retval) parms = stackgap_alloc(&sg, sizeof(sl)); - if (error = copyout(&sd, sl.desc, sizeof(sd))) + if ((error = copyout(&sd, sl.desc, sizeof(sd))) != 0) return (error); - if (error = copyout(&sl, parms, sizeof(sl))) + if ((error = copyout(&sl, parms, sizeof(sl))) != 0) return (error); - if (error = i386_set_ldt(p, parms, retval)) + if ((error = i386_set_ldt(p, parms, retval)) != 0) return (error); *retval = 0; @@ -423,15 +432,12 @@ linux_machdepioctl(p, v, retval) syscallarg(u_long) com; syscallarg(caddr_t) data; } */ *uap = v; - struct sys_ioctl_args bia, tmparg; + struct sys_ioctl_args bia; u_long com; #if NVT > 0 - int error, mode; + int error; struct vt_mode lvt; caddr_t bvtp, sg; - u_int fd; - struct file *fp; - struct filedesc *fdp; #endif SCARG(&bia, fd) = SCARG(uap, fd); @@ -506,7 +512,7 @@ linux_machdepioctl(p, v, retval) break; #endif default: - printf("linux_machdepioctl: invalid ioctl %08x\n", com); + printf("linux_machdepioctl: invalid ioctl %08lx\n", com); return EINVAL; } SCARG(&bia, com) = com; @@ -524,9 +530,11 @@ linux_sys_iopl(p, v, retval) void *v; register_t *retval; { +#if 0 struct linux_sys_iopl_args /* { syscallarg(int) level; } */ *uap = v; +#endif struct trapframe *fp = p->p_md.md_regs; if (suser(p->p_ucred, &p->p_acflag) != 0)