Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/compat/ibcs2 Approved by thorpej:
details: https://anonhg.NetBSD.org/src/rev/50e296581de4
branches: netbsd-1-5
changeset: 489386:50e296581de4
user: matt <matt%NetBSD.org@localhost>
date: Tue Sep 05 01:43:18 2000 +0000
description:
Approved by thorpej:
> Add gtty(2) emulation.
> Fix directory reading.
> Fix NMAGIC/ZMAGIC loading of image with non-page offset/lengths.
>
> syscalls.master (1.22)
> ibsc2_exec.c (1.33, 1.35)
> ibcs2_ioctl.c (1.20)
> ibcs2_misc.c (1.49)
> ibcs2_stat.h (1.3)
> ibcs2_termios.h (1.4)
diffstat:
sys/compat/ibcs2/ibcs2_exec.c | 56 +++++++++++++++++++++++++++++------
sys/compat/ibcs2/ibcs2_ioctl.c | 41 +++++++++++++++++++++++++-
sys/compat/ibcs2/ibcs2_misc.c | 2 +-
sys/compat/ibcs2/ibcs2_stat.h | 4 +-
sys/compat/ibcs2/ibcs2_syscall.h | 7 +++-
sys/compat/ibcs2/ibcs2_syscallargs.h | 10 +++++-
sys/compat/ibcs2/ibcs2_syscalls.c | 6 +-
sys/compat/ibcs2/ibcs2_sysent.c | 8 ++--
sys/compat/ibcs2/ibcs2_termios.h | 27 ++++++++++++++++-
9 files changed, 134 insertions(+), 27 deletions(-)
diffs (truncated from 348 to 300 lines):
diff -r ced0e86f0e9d -r 50e296581de4 sys/compat/ibcs2/ibcs2_exec.c
--- a/sys/compat/ibcs2/ibcs2_exec.c Tue Sep 05 01:08:26 2000 +0000
+++ b/sys/compat/ibcs2/ibcs2_exec.c Tue Sep 05 01:43:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibcs2_exec.c,v 1.28.2.1 2000/06/22 16:37:09 matt Exp $ */
+/* $NetBSD: ibcs2_exec.c,v 1.28.2.2 2000/09/05 01:43:18 matt Exp $ */
/*
* Copyright (c) 1994, 1995, 1998 Scott Bartram
@@ -367,6 +367,12 @@
epp->ep_dsize = ap->a_dsize;
epp->ep_entry = ap->a_entry;
+ DPRINTF(("ibcs2_omagic: text=%#lx/%#lx, data=%#lx/%#lx, bss=%#lx/%#lx, entry=%#lx\n",
+ epp->ep_taddr, epp->ep_tsize,
+ epp->ep_daddr, epp->ep_dsize,
+ ap->a_dstart + ap->a_dsize, ap->a_bsize,
+ epp->ep_entry));
+
/* set up command for text and data segments */
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn,
ap->a_tsize + ap->a_dsize, epp->ep_taddr, epp->ep_vp,
@@ -381,6 +387,16 @@
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
epp->ep_dsize += ap->a_bsize;
}
+ /* The following is to make obreak(2) happy. It expects daddr
+ * to on a page boundary and will round up dsize to a page
+ * address.
+ */
+ if (trunc_page(epp->ep_daddr) != epp->ep_daddr) {
+ epp->ep_dsize += epp->ep_daddr - trunc_page(epp->ep_daddr);
+ epp->ep_daddr = trunc_page(epp->ep_daddr);
+ if (epp->ep_taddr + epp->ep_tsize > epp->ep_daddr)
+ epp->ep_tsize = epp->ep_daddr - epp->ep_taddr;
+ }
return exec_ibcs2_coff_setup_stack(p, epp);
}
@@ -449,8 +465,8 @@
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, tsize,
epp->ep_taddr, epp->ep_vp, COFF_TXTOFF(fp, ap),
VM_PROT_READ|VM_PROT_EXECUTE);
- DPRINTF((" map_readvn(%#lx/%#lx@%#x)",
- epp->ep_taddr, tsize, COFF_TXTOFF(fp, ap)));
+ DPRINTF((" map_readvn(%#lx/%#lx@%#lx)",
+ epp->ep_taddr, tsize, (u_long) COFF_TXTOFF(fp, ap)));
}
if (toverlap > 0) {
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn, toverlap,
@@ -496,6 +512,16 @@
epp->ep_dsize += ap->a_bsize;
}
DPRINTF(("\n"));
+ /* The following is to make obreak(2) happy. It expects daddr
+ * to on a page boundary and will round up dsize to a page
+ * address.
+ */
+ if (trunc_page(epp->ep_daddr) != epp->ep_daddr) {
+ epp->ep_dsize += epp->ep_daddr - trunc_page(epp->ep_daddr);
+ epp->ep_daddr = trunc_page(epp->ep_daddr);
+ if (epp->ep_taddr + epp->ep_tsize > epp->ep_daddr)
+ epp->ep_tsize = epp->ep_daddr - epp->ep_taddr;
+ }
return exec_ibcs2_coff_setup_stack(p, epp);
}
@@ -529,9 +555,9 @@
}
siz -= resid;
if (siz != sizeof(struct coff_scnhdr)) {
- DPRINTF(("incomplete read: hdr %d ask=%d, rem=%d got %d\n",
+ DPRINTF(("incomplete read: hdr %d ask=%d, rem=%lu got %d\n",
s_type, sizeof(struct coff_scnhdr),
- resid, siz));
+ (u_long) resid, siz));
return ENOEXEC;
}
/* DPRINTF(("found section: %x\n", sh->s_flags)); */
@@ -699,12 +725,22 @@
/* set up entry point */
epp->ep_entry = ap->a_entry;
-#if 0
- DPRINTF(("text addr: %x size: %d data addr: %x size: %d entry: %x\n",
+ DPRINTF(("ibcs2_zmagic: text addr: %#lx size: %#lx data addr: %#lx size: %#lx entry: %#lx\n",
epp->ep_taddr, epp->ep_tsize,
epp->ep_daddr, epp->ep_dsize,
epp->ep_entry));
-#endif
+
+ /* The following is to make obreak(2) happy. It expects daddr
+ * to on a page boundary and will round up dsize to a page
+ * address.
+ */
+ if (trunc_page(epp->ep_daddr) != epp->ep_daddr) {
+ epp->ep_dsize += epp->ep_daddr - trunc_page(epp->ep_daddr);
+ epp->ep_daddr = trunc_page(epp->ep_daddr);
+ if (epp->ep_taddr + epp->ep_tsize > epp->ep_daddr)
+ epp->ep_tsize = epp->ep_daddr - epp->ep_taddr;
+ }
+
return exec_ibcs2_coff_setup_stack(p, epp);
}
@@ -745,8 +781,8 @@
}
siz -= resid;
if (siz != sizeof(struct coff_filehdr)) {
- DPRINTF(("coff_load_shlib: incomplete read: ask=%d, rem=%d got %d\n",
- sizeof(struct coff_filehdr), resid, siz));
+ DPRINTF(("coff_load_shlib: incomplete read: ask=%d, rem=%lu got %d\n",
+ sizeof(struct coff_filehdr), (u_long) resid, siz));
vrele(nd.ni_vp);
return ENOEXEC;
}
diff -r ced0e86f0e9d -r 50e296581de4 sys/compat/ibcs2/ibcs2_ioctl.c
--- a/sys/compat/ibcs2/ibcs2_ioctl.c Tue Sep 05 01:08:26 2000 +0000
+++ b/sys/compat/ibcs2/ibcs2_ioctl.c Tue Sep 05 01:43:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibcs2_ioctl.c,v 1.19 2000/06/16 01:56:37 matt Exp $ */
+/* $NetBSD: ibcs2_ioctl.c,v 1.19.2.1 2000/09/05 01:43:18 matt Exp $ */
/*
* Copyright (c) 1994, 1995 Scott Bartram
@@ -559,3 +559,42 @@
return ENOSYS;
}
+int
+ibcs2_sys_gtty(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct ibcs2_sys_gtty_args /* {
+ syscallarg(int) fd;
+ syscallarg(struct sgttyb *) tb;
+ } */ *uap = v;
+ struct filedesc *fdp = p->p_fd;
+ struct file *fp;
+ struct sgttyb tb;
+ struct ibcs2_sgttyb itb;
+ int error;
+
+ if (SCARG(uap, fd) < 0 || SCARG(uap, fd) >= fdp->fd_nfiles ||
+ (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) {
+ DPRINTF(("ibcs2_sys_gtty(%d): bad fd %d ", p->p_pid,
+ SCARG(uap, fd)));
+ return EBADF;
+ }
+
+ if ((fp->f_flag & (FREAD|FWRITE)) == 0) {
+ DPRINTF(("ibcs2_sys_gtty(%d): bad fp flag ", p->p_pid));
+ return EBADF;
+ }
+
+ error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETP, (caddr_t)&tb, p);
+ if (error)
+ return error;
+
+ itb.sg_ispeed = tb.sg_ispeed;
+ itb.sg_ospeed = tb.sg_ospeed;
+ itb.sg_erase = tb.sg_erase;
+ itb.sg_kill = tb.sg_kill;
+ itb.sg_flags = tb.sg_flags & ~(IBCS2_GHUPCL|IBCS2_GXTABS);
+ return copyout((caddr_t)&itb, SCARG(uap, tb), sizeof(itb));
+}
diff -r ced0e86f0e9d -r 50e296581de4 sys/compat/ibcs2/ibcs2_misc.c
--- a/sys/compat/ibcs2/ibcs2_misc.c Tue Sep 05 01:08:26 2000 +0000
+++ b/sys/compat/ibcs2/ibcs2_misc.c Tue Sep 05 01:43:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibcs2_misc.c,v 1.47.4.2 2000/09/05 01:08:26 matt Exp $ */
+/* $NetBSD: ibcs2_misc.c,v 1.47.4.3 2000/09/05 01:43:18 matt Exp $ */
/*
* Copyright (c) 1994, 1995, 1998 Scott Bartram
diff -r ced0e86f0e9d -r 50e296581de4 sys/compat/ibcs2/ibcs2_stat.h
--- a/sys/compat/ibcs2/ibcs2_stat.h Tue Sep 05 01:08:26 2000 +0000
+++ b/sys/compat/ibcs2/ibcs2_stat.h Tue Sep 05 01:43:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibcs2_stat.h,v 1.2 1994/10/26 02:53:03 cgd Exp $ */
+/* $NetBSD: ibcs2_stat.h,v 1.2.42.1 2000/09/05 01:43:18 matt Exp $ */
/*
* Copyright (c) 1994 Scott Bartram
@@ -72,7 +72,7 @@
#define IBCS2_S_IXUSR 0x0040
#define IBCS2_S_IRWXG 0x0038
#define IBCS2_S_IRGRP 0x0020
-#define IBCS2_S_IWGRP 0x000f
+#define IBCS2_S_IWGRP 0x0010
#define IBCS2_S_IXGRP 0x0008
#define IBCS2_S_IRWXO 0x0007
#define IBCS2_S_IROTH 0x0004
diff -r ced0e86f0e9d -r 50e296581de4 sys/compat/ibcs2/ibcs2_syscall.h
--- a/sys/compat/ibcs2/ibcs2_syscall.h Tue Sep 05 01:08:26 2000 +0000
+++ b/sys/compat/ibcs2/ibcs2_syscall.h Tue Sep 05 01:43:18 2000 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: ibcs2_syscall.h,v 1.25 2000/01/10 03:12:19 matt Exp $ */
+/* $NetBSD: ibcs2_syscall.h,v 1.25.4.1 2000/09/05 01:43:19 matt Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.21 2000/01/10 03:10:15 matt Exp
+ * created from NetBSD: syscalls.master,v 1.21.4.1 2000/09/05 01:00:54 matt Exp
*/
/* syscall: "syscall" ret: "int" args: */
@@ -97,6 +97,9 @@
/* syscall: "utime" ret: "int" args: "const char *" "struct ibcs2_utimbuf *" */
#define IBCS2_SYS_utime 30
+/* syscall: "gtty" ret: "int" args: "int" "struct ibcs2_sgttyb *" */
+#define IBCS2_SYS_gtty 32
+
/* syscall: "access" ret: "int" args: "const char *" "int" */
#define IBCS2_SYS_access 33
diff -r ced0e86f0e9d -r 50e296581de4 sys/compat/ibcs2/ibcs2_syscallargs.h
--- a/sys/compat/ibcs2/ibcs2_syscallargs.h Tue Sep 05 01:08:26 2000 +0000
+++ b/sys/compat/ibcs2/ibcs2_syscallargs.h Tue Sep 05 01:43:18 2000 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: ibcs2_syscallargs.h,v 1.25 2000/01/10 03:12:19 matt Exp $ */
+/* $NetBSD: ibcs2_syscallargs.h,v 1.25.4.1 2000/09/05 01:43:19 matt Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.21 2000/01/10 03:10:15 matt Exp
+ * created from NetBSD: syscalls.master,v 1.21.4.1 2000/09/05 01:00:54 matt Exp
*/
#ifndef _IBCS2_SYS__SYSCALLARGS_H_
@@ -123,6 +123,11 @@
syscallarg(struct ibcs2_utimbuf *) buf;
};
+struct ibcs2_sys_gtty_args {
+ syscallarg(int) fd;
+ syscallarg(struct ibcs2_sgttyb *) tb;
+};
+
struct ibcs2_sys_access_args {
syscallarg(const char *) path;
syscallarg(int) flags;
@@ -447,6 +452,7 @@
int ibcs2_sys_fstat __P((struct proc *, void *, register_t *));
int ibcs2_sys_pause __P((struct proc *, void *, register_t *));
int ibcs2_sys_utime __P((struct proc *, void *, register_t *));
+int ibcs2_sys_gtty __P((struct proc *, void *, register_t *));
int ibcs2_sys_access __P((struct proc *, void *, register_t *));
int ibcs2_sys_nice __P((struct proc *, void *, register_t *));
int ibcs2_sys_statfs __P((struct proc *, void *, register_t *));
diff -r ced0e86f0e9d -r 50e296581de4 sys/compat/ibcs2/ibcs2_syscalls.c
--- a/sys/compat/ibcs2/ibcs2_syscalls.c Tue Sep 05 01:08:26 2000 +0000
+++ b/sys/compat/ibcs2/ibcs2_syscalls.c Tue Sep 05 01:43:18 2000 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: ibcs2_syscalls.c,v 1.24 2000/01/10 03:12:19 matt Exp $ */
+/* $NetBSD: ibcs2_syscalls.c,v 1.24.4.1 2000/09/05 01:43:19 matt Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.21 2000/01/10 03:10:15 matt Exp
+ * created from NetBSD: syscalls.master,v 1.21.4.1 2000/09/05 01:00:54 matt Exp
*/
#if defined(_KERNEL) && !defined(_LKM)
@@ -53,7 +53,7 @@
"pause", /* 29 = pause */
"utime", /* 30 = utime */
"#31 (unimplemented was stty)", /* 31 = unimplemented was stty */
- "#32 (unimplemented was gtty)", /* 32 = unimplemented was gtty */
+ "gtty", /* 32 = gtty */
"access", /* 33 = access */
"nice", /* 34 = nice */
"statfs", /* 35 = statfs */
diff -r ced0e86f0e9d -r 50e296581de4 sys/compat/ibcs2/ibcs2_sysent.c
--- a/sys/compat/ibcs2/ibcs2_sysent.c Tue Sep 05 01:08:26 2000 +0000
+++ b/sys/compat/ibcs2/ibcs2_sysent.c Tue Sep 05 01:43:18 2000 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: ibcs2_sysent.c,v 1.25 2000/01/10 03:12:19 matt Exp $ */
+/* $NetBSD: ibcs2_sysent.c,v 1.25.4.1 2000/09/05 01:43:19 matt Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.21 2000/01/10 03:10:15 matt Exp
+ * created from NetBSD: syscalls.master,v 1.21.4.1 2000/09/05 01:00:54 matt Exp
*/
#include "opt_sysv.h"
@@ -85,8 +85,8 @@
ibcs2_sys_utime }, /* 30 = utime */
Home |
Main Index |
Thread Index |
Old Index