merge to NetBSD-current (DeskStation and Algor support is currently broken)
This commit is contained in:
parent
8ac52796d5
commit
479e34aa41
|
@ -1,112 +0,0 @@
|
|||
/* $OpenBSD: cpu_exec.c,v 1.4 1997/04/19 17:19:41 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by Ralph
|
||||
* Campbell.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)machdep.c 8.3 (Berkeley) 1/12/94
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/exec.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <sys/exec_ecoff.h>
|
||||
#include <machine/reg.h>
|
||||
|
||||
#if defined(_KERN_DO_ECOFF)
|
||||
void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *,
|
||||
u_long, register_t *));
|
||||
#endif
|
||||
/*
|
||||
* cpu_exec_aout_makecmds():
|
||||
* cpu-dependent a.out format hook for execve().
|
||||
*
|
||||
* Determine of the given exec package refers to something which we
|
||||
* understand and, if so, set up the vmcmds for it.
|
||||
*
|
||||
*/
|
||||
int
|
||||
cpu_exec_aout_makecmds(p, epp)
|
||||
struct proc *p;
|
||||
struct exec_package *epp;
|
||||
{
|
||||
return ENOEXEC;
|
||||
}
|
||||
|
||||
|
||||
#if defined(_KERN_DO_ECOFF)
|
||||
void
|
||||
cpu_exec_ecoff_setregs(p, pack, stack, retval)
|
||||
struct proc *p;
|
||||
struct exec_package *pack;
|
||||
u_long stack;
|
||||
register_t *retval;
|
||||
{
|
||||
struct ecoff_aouthdr *eap;
|
||||
|
||||
setregs(p, pack, stack, retval);
|
||||
eap = (struct ecoff_aouthdr *)
|
||||
((caddr_t)pack->ep_hdr + sizeof(struct ecoff_filehdr));
|
||||
p->p_md.md_regs[GP] = eap->ea_gp_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* cpu_exec_ecoff_hook():
|
||||
* cpu-dependent ECOFF format hook for execve().
|
||||
*
|
||||
* Do any machine-dependent diddling of the exec package when doing ECOFF.
|
||||
*
|
||||
*/
|
||||
int
|
||||
cpu_exec_ecoff_hook(p, epp)
|
||||
struct proc *p;
|
||||
struct exec_package *epp;
|
||||
{
|
||||
#ifdef COMPAT_ULTRIX
|
||||
extern struct emul emul_ultrix;
|
||||
#endif
|
||||
|
||||
#if defined(COMPAT_ULTRIX)
|
||||
epp->ep_emul = &emul_ultrix;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _KERN_DO_ECOFF */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,57 +0,0 @@
|
|||
# $OpenBSD: genassym.cf,v 1.1 1997/04/19 17:19:42 pefo Exp $ */
|
||||
#
|
||||
# Copyright (c) 1997 Per Fogelstrom / Opsycon AB
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# This product includes software developed under OpenBSD by
|
||||
# Per Fogelstrom.
|
||||
# 4. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
|
||||
|
||||
include <sys/param.h>
|
||||
include <sys/buf.h>
|
||||
include <sys/map.h>
|
||||
include <sys/proc.h>
|
||||
include <sys/mbuf.h>
|
||||
include <sys/user.h>
|
||||
|
||||
include <machine/reg.h>
|
||||
|
||||
|
||||
define P_FORW offsetof(struct proc, p_forw)
|
||||
define P_BACK offsetof(struct proc, p_back)
|
||||
define P_PRIORITY offsetof(struct proc, p_priority)
|
||||
define P_ADDR offsetof(struct proc, p_addr)
|
||||
define P_UPTE offsetof(struct proc, p_md.md_upte)
|
||||
define U_PCB_REGS offsetof(struct user, u_pcb.pcb_regs[ZERO])
|
||||
define U_PCB_FPREGS offsetof(struct user, u_pcb.pcb_regs[F0])
|
||||
define U_PCB_CONTEXT offsetof(struct user, u_pcb.pcb_context)
|
||||
define U_PCB_ONFAULT offsetof(struct user, u_pcb.pcb_onfault)
|
||||
define U_PCB_SEGTAB offsetof(struct user, u_pcb.pcb_segtab)
|
||||
define V_SWTCH offsetof(struct vmmeter, v_swtch)
|
||||
|
||||
define VM_MIN_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS
|
||||
define SIGFPE SIGFPE
|
File diff suppressed because it is too large
Load Diff
|
@ -1,182 +0,0 @@
|
|||
/* $OpenBSD: mem.c,v 1.3 1997/04/19 17:19:45 pefo Exp $ */
|
||||
/* $NetBSD: mem.c,v 1.1.1.1 2000/01/23 20:24:25 soda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department and Ralph Campbell.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)mem.c 8.3 (Berkeley) 1/12/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Memory special file
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <machine/pte.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
extern vm_offset_t avail_end;
|
||||
caddr_t zeropage;
|
||||
|
||||
int mmopen __P((dev_t, int, int));
|
||||
int mmclose __P((dev_t, int, int));
|
||||
int mmrw __P((dev_t, struct uio *uio, int));
|
||||
int mmmmap __P((dev_t, int, int));
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mmopen(dev, flag, mode)
|
||||
dev_t dev;
|
||||
int flag, mode;
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mmclose(dev, flag, mode)
|
||||
dev_t dev;
|
||||
int flag, mode;
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mmrw(dev, uio, flags)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
{
|
||||
register vm_offset_t v;
|
||||
register int c;
|
||||
register struct iovec *iov;
|
||||
int error = 0;
|
||||
|
||||
while (uio->uio_resid > 0 && error == 0) {
|
||||
iov = uio->uio_iov;
|
||||
if (iov->iov_len == 0) {
|
||||
uio->uio_iov++;
|
||||
uio->uio_iovcnt--;
|
||||
if (uio->uio_iovcnt < 0)
|
||||
panic("mmrw");
|
||||
continue;
|
||||
}
|
||||
switch (minor(dev)) {
|
||||
|
||||
/* minor device 0 is physical memory */
|
||||
case 0:
|
||||
v = uio->uio_offset;
|
||||
c = iov->iov_len;
|
||||
if (v + c > ctob(physmem))
|
||||
return (EFAULT);
|
||||
v += CACHED_MEMORY_ADDR;
|
||||
error = uiomove((caddr_t)v, c, uio);
|
||||
continue;
|
||||
|
||||
/* minor device 1 is kernel memory */
|
||||
case 1:
|
||||
v = uio->uio_offset;
|
||||
c = min(iov->iov_len, MAXPHYS);
|
||||
if (v < CACHED_MEMORY_ADDR)
|
||||
return (EFAULT);
|
||||
if (v + c > PHYS_TO_CACHED(avail_end +
|
||||
sizeof (struct msgbuf)) &&
|
||||
(v < KSEG2_ADDR ||
|
||||
!kernacc((caddr_t)v, c,
|
||||
uio->uio_rw == UIO_READ ? B_READ : B_WRITE)))
|
||||
return (EFAULT);
|
||||
|
||||
error = uiomove((caddr_t)v, c, uio);
|
||||
continue;
|
||||
|
||||
/* minor device 2 is EOF/RATHOLE */
|
||||
case 2:
|
||||
if (uio->uio_rw == UIO_WRITE)
|
||||
uio->uio_resid = 0;
|
||||
return (0);
|
||||
|
||||
/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
|
||||
case 12:
|
||||
if (uio->uio_rw == UIO_WRITE) {
|
||||
c = iov->iov_len;
|
||||
break;
|
||||
}
|
||||
if (zeropage == NULL) {
|
||||
zeropage = (caddr_t)
|
||||
malloc(CLBYTES, M_TEMP, M_WAITOK);
|
||||
bzero(zeropage, CLBYTES);
|
||||
}
|
||||
c = min(iov->iov_len, CLBYTES);
|
||||
error = uiomove(zeropage, c, uio);
|
||||
continue;
|
||||
|
||||
default:
|
||||
return (ENXIO);
|
||||
}
|
||||
if (error)
|
||||
break;
|
||||
iov->iov_base += c;
|
||||
iov->iov_len -= c;
|
||||
uio->uio_offset += c;
|
||||
uio->uio_resid -= c;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mmmmap(dev, off, prot)
|
||||
dev_t dev;
|
||||
int off, prot;
|
||||
{
|
||||
|
||||
return (EOPNOTSUPP);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,116 +0,0 @@
|
|||
/* $OpenBSD: process_machdep.c,v 1.2 1997/04/19 17:19:47 pefo Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1994 Adam Glass
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* Copyright (c) 1993 Jan-Simon Pendry
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Jan-Simon Pendry.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* From:
|
||||
* Id: procfs_i386.c,v 4.1 1993/12/17 10:47:45 jsp Rel
|
||||
*
|
||||
* $Id: process_machdep.c,v 1.1.1.1 2000/01/23 20:24:25 soda Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file may seem a bit stylized, but that so that it's easier to port.
|
||||
* Functions to be implemented here are:
|
||||
*
|
||||
* process_read_regs(proc, regs)
|
||||
* Get the current user-visible register set from the process
|
||||
* and copy it into the regs structure (<machine/reg.h>).
|
||||
* The process is stopped at the time read_regs is called.
|
||||
*
|
||||
* process_write_regs(proc, regs)
|
||||
* Update the current register set from the passed in regs
|
||||
* structure. Take care to avoid clobbering special CPU
|
||||
* registers or privileged bits in the PSL.
|
||||
* The process is stopped at the time write_regs is called.
|
||||
*
|
||||
* process_sstep(proc)
|
||||
* Arrange for the process to trap after executing a single instruction.
|
||||
*
|
||||
* process_set_pc(proc)
|
||||
* Set the process's program counter.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <machine/pte.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/reg.h>
|
||||
|
||||
extern void cpu_singlestep __P((struct proc *));
|
||||
int
|
||||
process_read_regs(p, regs)
|
||||
struct proc *p;
|
||||
struct reg *regs;
|
||||
{
|
||||
bcopy((caddr_t)p->p_md.md_regs, (caddr_t)regs, sizeof(struct reg));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
process_write_regs(p, regs)
|
||||
struct proc *p;
|
||||
struct reg *regs;
|
||||
{
|
||||
bcopy((caddr_t)regs, (caddr_t)p->p_md.md_regs, sizeof(struct reg));
|
||||
/*XXX Clear to user set bits!! */
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
process_sstep(p, sstep)
|
||||
struct proc *p;
|
||||
{
|
||||
if(sstep)
|
||||
cpu_singlestep(p);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
process_set_pc(p, addr)
|
||||
struct proc *p;
|
||||
caddr_t addr;
|
||||
{
|
||||
p->p_md.md_regs[PC] = (int)addr;
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/* $OpenBSD: swapgeneric.c,v 1.4 1996/11/06 01:38:16 deraadt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)swapgeneric.c 8.2 (Berkeley) 3/21/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* fake swapgeneric.c -- should do this differently.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <machine/disklabel.h>
|
||||
|
||||
int (*mountroot) __P((void)) = NULL; /* tells autoconf.c that we are "generic" */
|
||||
|
||||
dev_t rootdev = NODEV;
|
||||
dev_t dumpdev = NODEV;
|
||||
|
||||
struct swdevt swdevt[] = {
|
||||
{ makedev(3, 0*MAXPARTITIONS+1), 0, 0 }, /* sd0b */
|
||||
{ makedev(3, 1*MAXPARTITIONS+1), 0, 0 }, /* sd1b */
|
||||
{ makedev(3, 2*MAXPARTITIONS+1), 0, 0 }, /* sd2b */
|
||||
{ makedev(3, 3*MAXPARTITIONS+1), 0, 0 }, /* sd3b */
|
||||
{ makedev(3, 4*MAXPARTITIONS+1), 0, 0 }, /* sd4b */
|
||||
{ makedev(3, 5*MAXPARTITIONS+1), 0, 0 }, /* sd5b */
|
||||
{ makedev(3, 6*MAXPARTITIONS+1), 0, 0 }, /* sd6b */
|
||||
{ makedev(3, 7*MAXPARTITIONS+1), 0, 0 }, /* sd7b */
|
||||
{ NODEV, 0, 0 }
|
||||
};
|
|
@ -1,128 +0,0 @@
|
|||
/* $NetBSD: sys_machdep.c,v 1.4 2000/01/23 20:09:17 soda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Ralph Campbell.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sys_machdep.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/trace.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#ifdef TRACE
|
||||
int nvualarm;
|
||||
|
||||
vtrace(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct vtrace_args /* {
|
||||
syscallarg(int) request;
|
||||
syscallarg(int) value;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
int vdoualarm();
|
||||
|
||||
switch (SCARG(uap, request)) {
|
||||
|
||||
case VTR_DISABLE: /* disable a trace point */
|
||||
case VTR_ENABLE: /* enable a trace point */
|
||||
if (SCARG(uap, value) < 0 || SCARG(uap, value) >= TR_NFLAGS)
|
||||
return (EINVAL);
|
||||
*retval = traceflags[SCARG(uap, value)];
|
||||
traceflags[SCARG(uap, value)] = SCARG(uap, request);
|
||||
break;
|
||||
|
||||
case VTR_VALUE: /* return a trace point setting */
|
||||
if (SCARG(uap, value) < 0 || SCARG(uap, value) >= TR_NFLAGS)
|
||||
return (EINVAL);
|
||||
*retval = traceflags[SCARG(uap, value)];
|
||||
break;
|
||||
|
||||
case VTR_UALARM: /* set a real-time ualarm, less than 1 min */
|
||||
if (SCARG(uap, value) <= 0 || SCARG(uap, value) > 60 * hz ||
|
||||
nvualarm > 5)
|
||||
return (EINVAL);
|
||||
nvualarm++;
|
||||
timeout(vdoualarm, (caddr_t)p->p_pid, SCARG(uap, value));
|
||||
break;
|
||||
|
||||
case VTR_STAMP:
|
||||
trace(TR_STAMP, SCARG(uap, value), p->p_pid);
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
vdoualarm(arg)
|
||||
int arg;
|
||||
{
|
||||
register struct proc *p;
|
||||
|
||||
p = pfind(arg);
|
||||
if (p)
|
||||
psignal(p, 16);
|
||||
nvualarm--;
|
||||
}
|
||||
#endif
|
||||
|
||||
sys_sysarch(p, v, retval)
|
||||
struct proc *p;
|
||||
void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
struct sys_sysarch_args /* {
|
||||
syscallarg(int) op;
|
||||
syscallarg(void *) parms;
|
||||
} */ *uap = v;
|
||||
int error = 0;
|
||||
|
||||
switch(SCARG(uap, op)) {
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
return (error);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,468 +0,0 @@
|
|||
/* $NetBSD: vm_machdep.c,v 1.9 2000/01/23 20:09:21 soda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department and Ralph Campbell.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Utah Hdr: vm_machdep.c 1.21 91/04/06
|
||||
*
|
||||
* from: @(#)vm_machdep.c 8.3 (Berkeley) 1/4/94
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_page.h>
|
||||
#if 0
|
||||
#include <vm/vm_object.h>
|
||||
#endif
|
||||
|
||||
#include <machine/pte.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
vm_offset_t kmem_alloc_wait_align();
|
||||
|
||||
/*
|
||||
* Finish a fork operation, with process p2 nearly set up.
|
||||
* Copy and update the kernel stack and pcb, making the child
|
||||
* ready to run, and marking it so that it can return differently
|
||||
* than the parent. Returns 1 in the child process, 0 in the parent.
|
||||
* We currently double-map the user area so that the stack is at the same
|
||||
* address in each process; in the future we will probably relocate
|
||||
* the frame pointers on the stack after copying.
|
||||
*/
|
||||
cpu_fork(p1, p2)
|
||||
register struct proc *p1, *p2;
|
||||
{
|
||||
register struct user *up = p2->p_addr;
|
||||
register pt_entry_t *pte;
|
||||
register int i;
|
||||
extern struct proc *machFPCurProcPtr;
|
||||
|
||||
p2->p_md.md_regs = up->u_pcb.pcb_regs;
|
||||
p2->p_md.md_flags = p1->p_md.md_flags & MDP_FPUSED;
|
||||
|
||||
/*
|
||||
* Cache the PTEs for the user area in the machine dependent
|
||||
* part of the proc struct so cpu_switch() can quickly map in
|
||||
* the user struct and kernel stack. Note: if the virtual address
|
||||
* translation changes (e.g. swapout) we have to update this.
|
||||
*/
|
||||
pte = kvtopte(up);
|
||||
for (i = 0; i < UPAGES; i++) {
|
||||
p2->p_md.md_upte[i] = pte->pt_entry & ~(PG_G | PG_RO | PG_WIRED);
|
||||
pte++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy floating point state from the FP chip if this process
|
||||
* has state stored there.
|
||||
*/
|
||||
if (p1 == machFPCurProcPtr)
|
||||
MachSaveCurFPState(p1);
|
||||
|
||||
/*
|
||||
* Copy pcb and stack from proc p1 to p2.
|
||||
* We do this as cheaply as possible, copying only the active
|
||||
* part of the stack. The stack and pcb need to agree;
|
||||
*/
|
||||
p2->p_addr->u_pcb = p1->p_addr->u_pcb;
|
||||
/* cache segtab for ULTBMiss() */
|
||||
p2->p_addr->u_pcb.pcb_segtab = (void *)p2->p_vmspace->vm_pmap.pm_segtab;
|
||||
|
||||
/*
|
||||
* Arrange for a non-local goto when the new process
|
||||
* is started, to resume here, returning nonzero from setjmp.
|
||||
*/
|
||||
#ifdef DIAGNOSTIC
|
||||
if (p1 != curproc && p1 != &proc0)
|
||||
panic("cpu_fork: curproc");
|
||||
#endif
|
||||
if (copykstack(up)) {
|
||||
/*
|
||||
* Return 1 in child.
|
||||
*/
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Finish a swapin operation.
|
||||
* We neded to update the cached PTEs for the user area in the
|
||||
* machine dependent part of the proc structure.
|
||||
*/
|
||||
void
|
||||
cpu_swapin(p)
|
||||
register struct proc *p;
|
||||
{
|
||||
register struct user *up = p->p_addr;
|
||||
register pt_entry_t *pte;
|
||||
register int i;
|
||||
|
||||
/*
|
||||
* Cache the PTEs for the user area in the machine dependent
|
||||
* part of the proc struct so cpu_switch() can quickly map in
|
||||
* the user struct and kernel stack.
|
||||
*/
|
||||
pte = kvtopte(up);
|
||||
for (i = 0; i < UPAGES; i++) {
|
||||
p->p_md.md_upte[i] = pte->pt_entry & ~(PG_G | PG_RO | PG_WIRED);
|
||||
pte++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* cpu_exit is called as the last action during exit.
|
||||
* We release the address space and machine-dependent resources,
|
||||
* including the memory for the user structure and kernel stack.
|
||||
* Once finished, we call switch_exit, which switches to a temporary
|
||||
* pcb and stack and never returns. We block memory allocation
|
||||
* until switch_exit has made things safe again.
|
||||
*/
|
||||
void cpu_exit(p)
|
||||
struct proc *p;
|
||||
{
|
||||
extern struct proc *machFPCurProcPtr;
|
||||
|
||||
if (machFPCurProcPtr == p)
|
||||
machFPCurProcPtr = (struct proc *)0;
|
||||
|
||||
vmspace_free(p->p_vmspace);
|
||||
|
||||
(void) splhigh();
|
||||
kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
|
||||
switch_exit();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/*
|
||||
* Dump the machine specific header information at the start of a core dump.
|
||||
*/
|
||||
cpu_coredump(p, vp, cred)
|
||||
struct proc *p;
|
||||
struct vnode *vp;
|
||||
struct ucred *cred;
|
||||
{
|
||||
extern struct proc *machFPCurProcPtr;
|
||||
|
||||
/*
|
||||
* Copy floating point state from the FP chip if this process
|
||||
* has state stored there.
|
||||
*/
|
||||
if (p == machFPCurProcPtr)
|
||||
MachSaveCurFPState(p);
|
||||
|
||||
return (vn_rdwr(UIO_WRITE, vp, (caddr_t)p->p_addr, ctob(UPAGES),
|
||||
(off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, NULL,
|
||||
p));
|
||||
}
|
||||
|
||||
/*
|
||||
* Move pages from one kernel virtual address to another.
|
||||
* Both addresses are assumed to reside in the Sysmap,
|
||||
* and size must be a multiple of CLSIZE.
|
||||
*/
|
||||
pagemove(from, to, size)
|
||||
register caddr_t from, to;
|
||||
int size;
|
||||
{
|
||||
register pt_entry_t *fpte, *tpte;
|
||||
|
||||
if (size % NBPG)
|
||||
panic("pagemove");
|
||||
fpte = kvtopte(from);
|
||||
tpte = kvtopte(to);
|
||||
if(((int)from & machCacheAliasMask) != ((int)to & machCacheAliasMask)) {
|
||||
MachHitFlushDCache(from, size);
|
||||
}
|
||||
while (size > 0) {
|
||||
MachTLBFlushAddr(from);
|
||||
MachTLBUpdate(to, *fpte);
|
||||
*tpte++ = *fpte;
|
||||
fpte->pt_entry = PG_NV | PG_G;
|
||||
fpte++;
|
||||
size -= NBPG;
|
||||
from += NBPG;
|
||||
to += NBPG;
|
||||
}
|
||||
}
|
||||
|
||||
extern vm_map_t phys_map;
|
||||
|
||||
/*
|
||||
* Map a user I/O request into kernel virtual address space.
|
||||
* Note: the pages are already locked by uvm_vslock(), so we
|
||||
* do not need to pass an access_type to pmap_enter().
|
||||
*/
|
||||
vmapbuf(bp)
|
||||
register struct buf *bp;
|
||||
{
|
||||
register caddr_t addr;
|
||||
register vm_size_t sz;
|
||||
struct proc *p;
|
||||
int off;
|
||||
vm_offset_t kva;
|
||||
register vm_offset_t pa;
|
||||
|
||||
if ((bp->b_flags & B_PHYS) == 0)
|
||||
panic("vmapbuf");
|
||||
addr = bp->b_saveaddr = bp->b_un.b_addr;
|
||||
off = (int)addr & PGOFSET;
|
||||
p = bp->b_proc;
|
||||
sz = round_page(bp->b_bcount + off);
|
||||
kva = kmem_alloc_wait_align(phys_map, sz, (vm_size_t)addr & machCacheAliasMask);
|
||||
bp->b_un.b_addr = (caddr_t) (kva + off);
|
||||
sz = atop(sz);
|
||||
while (sz--) {
|
||||
pa = pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),
|
||||
(vm_offset_t)addr);
|
||||
if (pa == 0)
|
||||
panic("vmapbuf: null page frame");
|
||||
pmap_enter(vm_map_pmap(phys_map), kva, trunc_page(pa),
|
||||
VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
|
||||
addr += PAGE_SIZE;
|
||||
kva += PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Unmap a previously-mapped user I/O request.
|
||||
*/
|
||||
vunmapbuf(bp)
|
||||
register struct buf *bp;
|
||||
{
|
||||
register caddr_t addr = bp->b_un.b_addr;
|
||||
register vm_size_t sz;
|
||||
vm_offset_t kva;
|
||||
|
||||
if ((bp->b_flags & B_PHYS) == 0)
|
||||
panic("vunmapbuf");
|
||||
sz = round_page(bp->b_bcount + ((int)addr & PGOFSET));
|
||||
kva = (vm_offset_t)((int)addr & ~PGOFSET);
|
||||
kmem_free_wakeup(phys_map, kva, sz);
|
||||
bp->b_un.b_addr = bp->b_saveaddr;
|
||||
bp->b_saveaddr = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SAVE_HINT:
|
||||
*
|
||||
* Saves the specified entry as the hint for
|
||||
* future lookups. Performs necessary interlocks.
|
||||
*/
|
||||
#define SAVE_HINT(map,value) \
|
||||
simple_lock(&(map)->hint_lock); \
|
||||
(map)->hint = (value); \
|
||||
simple_unlock(&(map)->hint_lock);
|
||||
|
||||
|
||||
/*
|
||||
* kmem_alloc_upage:
|
||||
*
|
||||
* Allocate pageable memory to the kernel's address map.
|
||||
* map must be "kernel_map" below.
|
||||
* (Currently only used when allocating U pages).
|
||||
*/
|
||||
vm_offset_t
|
||||
kmem_alloc_upage(map, size)
|
||||
vm_map_t map;
|
||||
register vm_size_t size;
|
||||
{
|
||||
vm_offset_t addr;
|
||||
register int result;
|
||||
|
||||
|
||||
size = round_page(size);
|
||||
|
||||
addr = vm_map_min(map);
|
||||
result = vm_map_find_U(map, NULL, (vm_offset_t) 0,
|
||||
&addr, size, TRUE);
|
||||
if (result != KERN_SUCCESS) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
return(addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* vm_map_find finds an unallocated region in the target address
|
||||
* map with the given length aligned on U viritual address.
|
||||
* The search is defined to be first-fit from the specified address;
|
||||
* the region found is returned in the same parameter.
|
||||
*
|
||||
*/
|
||||
int
|
||||
vm_map_find_U(map, object, offset, addr, length, find_space)
|
||||
vm_map_t map;
|
||||
vm_object_t object;
|
||||
vm_offset_t offset;
|
||||
vm_offset_t *addr; /* IN/OUT */
|
||||
vm_size_t length;
|
||||
boolean_t find_space;
|
||||
{
|
||||
register vm_offset_t start;
|
||||
int result;
|
||||
|
||||
start = *addr;
|
||||
vm_map_lock(map);
|
||||
if (find_space) {
|
||||
if (vm_map_findspace_align(map, start, length, addr, 0)) {
|
||||
vm_map_unlock(map);
|
||||
return (KERN_NO_SPACE);
|
||||
}
|
||||
start = *addr;
|
||||
}
|
||||
result = vm_map_insert(map, object, offset, start, start + length);
|
||||
vm_map_unlock(map);
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find sufficient space for `length' bytes in the given map, starting at
|
||||
* `start'. The map must be locked. Returns 0 on success, 1 on no space.
|
||||
*/
|
||||
int
|
||||
vm_map_findspace_align(map, start, length, addr, align)
|
||||
register vm_map_t map;
|
||||
register vm_offset_t start;
|
||||
vm_size_t length;
|
||||
vm_offset_t *addr;
|
||||
vm_size_t align;
|
||||
{
|
||||
register vm_map_entry_t entry, next;
|
||||
register vm_offset_t end;
|
||||
|
||||
if (start < map->min_offset)
|
||||
start = map->min_offset;
|
||||
if (start > map->max_offset)
|
||||
return (1);
|
||||
|
||||
/*
|
||||
* Look for the first possible address; if there's already
|
||||
* something at this address, we have to start after it.
|
||||
*/
|
||||
if (start == map->min_offset) {
|
||||
if ((entry = map->first_free) != &map->header)
|
||||
start = entry->end;
|
||||
} else {
|
||||
vm_map_entry_t tmp;
|
||||
if (vm_map_lookup_entry(map, start, &tmp))
|
||||
start = tmp->end;
|
||||
entry = tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Look through the rest of the map, trying to fit a new region in
|
||||
* the gap between existing regions, or after the very last region.
|
||||
*/
|
||||
for (;; start = (entry = next)->end) {
|
||||
/*
|
||||
* Find the end of the proposed new region. Be sure we didn't
|
||||
* go beyond the end of the map, or wrap around the address;
|
||||
* if so, we lose. Otherwise, if this is the last entry, or
|
||||
* if the proposed new region fits before the next entry, we
|
||||
* win.
|
||||
*/
|
||||
start = ((start + NBPG -1) & ~(NBPG - 1)); /* Paranoia */
|
||||
if((start & machCacheAliasMask) <= align) {
|
||||
start += align - (start & machCacheAliasMask);
|
||||
}
|
||||
else {
|
||||
start = ((start + machCacheAliasMask) & ~machCacheAliasMask);
|
||||
start += align;
|
||||
}
|
||||
|
||||
end = start + length;
|
||||
if (end > map->max_offset || end < start)
|
||||
return (1);
|
||||
next = entry->next;
|
||||
if (next == &map->header || next->start >= end)
|
||||
break;
|
||||
}
|
||||
SAVE_HINT(map, entry);
|
||||
*addr = start;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* kmem_alloc_wait_align
|
||||
*
|
||||
* Allocates pageable memory from a sub-map of the kernel. If the submap
|
||||
* has no room, the caller sleeps waiting for more memory in the submap.
|
||||
*
|
||||
*/
|
||||
vm_offset_t
|
||||
kmem_alloc_wait_align(map, size, align)
|
||||
vm_map_t map;
|
||||
vm_size_t size;
|
||||
vm_size_t align;
|
||||
{
|
||||
vm_offset_t addr;
|
||||
|
||||
size = round_page(size);
|
||||
|
||||
for (;;) {
|
||||
/*
|
||||
* To make this work for more than one map,
|
||||
* use the map's lock to lock out sleepers/wakers.
|
||||
*/
|
||||
vm_map_lock(map);
|
||||
if (vm_map_findspace_align(map, 0, size, &addr, align) == 0)
|
||||
break;
|
||||
/* no space now; see if we can ever get space */
|
||||
if (vm_map_max(map) - vm_map_min(map) < size) {
|
||||
vm_map_unlock(map);
|
||||
return (0);
|
||||
}
|
||||
assert_wait(map, TRUE);
|
||||
vm_map_unlock(map);
|
||||
thread_block();
|
||||
}
|
||||
vm_map_insert(map, NULL, (vm_offset_t)0, addr, addr + size);
|
||||
vm_map_unlock(map);
|
||||
return (addr);
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
ARCTIC
|
||||
GENERIC
|
||||
P4032
|
||||
PICA
|
||||
RAMDISK
|
|
@ -1,74 +0,0 @@
|
|||
OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
|
||||
"elf32-littlemips")
|
||||
OUTPUT_ARCH(mips)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = 0x80100000 + SIZEOF_HEADERS;
|
||||
.text :
|
||||
{
|
||||
_ftext = . ;
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.reginfo)
|
||||
*(.init)
|
||||
*(.stub)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
} =0
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.fini : { *(.fini) } =0
|
||||
.data :
|
||||
{
|
||||
_fdata = . ;
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
.data1 : { *(.data1) }
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
_gp = ALIGN(16) + 0x7ff0;
|
||||
.got :
|
||||
{
|
||||
*(.got.plt) *(.got)
|
||||
}
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
.sdata : { *(.sdata) }
|
||||
.lit8 : { *(.lit8) }
|
||||
.lit4 : { *(.lit4) }
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
__bss_start = .;
|
||||
_fbss = .;
|
||||
.sbss : { *(.sbss) *(.scommon) }
|
||||
.bss :
|
||||
{
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
/* These are needed for ELF backends which have not yet been
|
||||
converted to the new style linker. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the .debug DWARF section are relative to the beginning of the
|
||||
section so we begin .debug at 0. It's not clear yet what needs to happen
|
||||
for the others. */
|
||||
.debug 0 : { *(.debug) }
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
.line 0 : { *(.line) }
|
||||
/* These must appear regardless of . */
|
||||
.gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
|
||||
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/* $OpenBSD: dlfcn.h,v 1.1 1996/10/06 19:59:57 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Per Fogelstrom
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed under OpenBSD by
|
||||
* Per Fogelstrom.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _DLFCN_H
|
||||
#define _DLFCN_H 1
|
||||
|
||||
/*
|
||||
* This is a dummy file. Empty until libdl has been done.
|
||||
*/
|
||||
|
||||
#endif /* _DLFCN_H */
|
|
@ -1,94 +0,0 @@
|
|||
/* $OpenBSD: ecoff.h,v 1.3 1996/10/02 21:47:53 pefo Exp $ */
|
||||
/* $NetBSD: ecoff.h,v 1.1.1.1 2000/01/23 20:24:28 soda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Adam Glass
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Adam Glass.
|
||||
* 4. The name of the Author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL Adam Glass BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define ECOFF_LDPGSZ 4096
|
||||
|
||||
#define ECOFF_PAD
|
||||
|
||||
#define ECOFF_MACHDEP \
|
||||
u_long ea_gprmask; \
|
||||
u_long ea_cprmask[4]; \
|
||||
u_long ea_gp_value
|
||||
|
||||
#define ECOFF_MAGIC_MIPSEL 0x0162
|
||||
#define ECOFF_BADMAG(ex) ((ex)->f.f_magic != ECOFF_MAGIC_MIPSEL)
|
||||
|
||||
#define ECOFF_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
|
||||
|
||||
struct ecoff_symhdr {
|
||||
int16_t sh_magic;
|
||||
int16_t sh_vstamp;
|
||||
int32_t sh_linemax;
|
||||
int32_t sh_densenummax;
|
||||
int32_t sh_procmax;
|
||||
int32_t sh_lsymmax;
|
||||
int32_t sh_optsymmax;
|
||||
int32_t sh_auxxymmax;
|
||||
int32_t sh_lstrmax;
|
||||
int32_t sh_estrmax;
|
||||
int32_t sh_fdmax;
|
||||
int32_t sh_rfdmax;
|
||||
int32_t sh_esymmax;
|
||||
long sh_linesize;
|
||||
long sh_lineoff;
|
||||
long sh_densenumoff;
|
||||
long sh_procoff;
|
||||
long sh_lsymoff;
|
||||
long sh_optsymoff;
|
||||
long sh_auxsymoff;
|
||||
long sh_lstroff;
|
||||
long sh_estroff;
|
||||
long sh_fdoff;
|
||||
long sh_rfdoff;
|
||||
long sh_esymoff;
|
||||
};
|
||||
/* Some day they will make up their minds.... */
|
||||
#define esymMax sh_esymmax
|
||||
#define cbExtOffset sh_esymoff
|
||||
#define cbSsExtOffset sh_estroff
|
||||
|
||||
struct ecoff_extsym {
|
||||
long es_value;
|
||||
int es_strindex;
|
||||
unsigned es_type:6;
|
||||
unsigned es_class:5;
|
||||
unsigned :1;
|
||||
unsigned es_symauxindex:20;
|
||||
unsigned es_jmptbl:1;
|
||||
unsigned es_cmain:1;
|
||||
unsigned es_weakext:1;
|
||||
unsigned :29;
|
||||
int es_indexfld;
|
||||
};
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/* $OpenBSD: elf_abi.h,v 1.2 1996/12/11 05:55:34 imp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Per Fogelstrom
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed under OpenBSD by
|
||||
* Per Fogelstrom.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/* From MIPS ABI supplemental */
|
||||
|
||||
/* Architecture dependent Segment types - p_type */
|
||||
#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
|
||||
|
||||
/* Architecture dependent d_tag field for Elf32_Dyn. */
|
||||
#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */
|
||||
#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
|
||||
#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */
|
||||
#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
|
||||
#define DT_MIPS_FLAGS 0x70000005 /* Flags */
|
||||
#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */
|
||||
#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */
|
||||
#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */
|
||||
#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */
|
||||
#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */
|
||||
#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */
|
||||
#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */
|
||||
#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
|
||||
#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */
|
||||
#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
|
||||
#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */
|
||||
|
||||
#define DT_PROCNUM (DT_MIPS_HIPAGENO - DT_LOPROC + 1)
|
|
@ -1,56 +0,0 @@
|
|||
/* $OpenBSD: exec.h,v 1.2 1996/12/23 02:42:26 deraadt Exp $ */
|
||||
/* $NetBSD: exec.h,v 1.1.1.1 2000/01/23 20:24:28 soda Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)exec.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#define __LDPGSZ 4096
|
||||
|
||||
/*
|
||||
* Define what exec "formats" we should handle.
|
||||
*/
|
||||
#define NATIVE_EXEC_ELF
|
||||
#define EXEC_SCRIPT
|
||||
|
||||
#define ELF_TARG_CLASS ELFCLASS32
|
||||
#define ELF_TARG_DATA ELFDATA2LSB
|
||||
#define ELF_TARG_MACH EM_MIPS
|
||||
|
||||
#define _NLIST_DO_AOUT
|
||||
#define _NLIST_DO_ELF
|
||||
#define _NLIST_DO_ECOFF
|
||||
|
||||
#define _KERN_DO_ECOFF
|
||||
#define _KERN_DO_ELF
|
|
@ -1,125 +0,0 @@
|
|||
/* $OpenBSD: link.h,v 1.2 1996/12/11 05:55:35 imp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Per Fogelstrom
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed under OpenBSD by
|
||||
* Per Fogelstrom.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINK_H
|
||||
#define _LINK_H 1
|
||||
|
||||
#include <elf_abi.h>
|
||||
#include <machine/elf_abi.h>
|
||||
|
||||
/*
|
||||
* Debug rendezvous struct. Pointer to this is set up in the
|
||||
* target code pointed by the DT_MIPS_RLD_MAP tag. If it is
|
||||
* defined.
|
||||
*/
|
||||
|
||||
struct r_debug {
|
||||
int r_version; /* Protocol version. */
|
||||
struct link_map *r_map; /* Head of list of loaded objects. */
|
||||
|
||||
/* This is the address of a function internal to the run-time linker,
|
||||
that will always be called when the linker begins to map in a
|
||||
library or unmap it, and again when the mapping change is complete.
|
||||
The debugger can set a breakpoint at this address if it wants to
|
||||
notice shared object mapping changes. */
|
||||
Elf32_Addr r_brk;
|
||||
enum {
|
||||
/* This state value describes the mapping change taking place when
|
||||
the `r_brk' address is called. */
|
||||
RT_CONSISTENT, /* Mapping change is complete. */
|
||||
RT_ADD, /* Adding a new object. */
|
||||
RT_DELETE, /* Removing an object mapping. */
|
||||
} r_state;
|
||||
|
||||
Elf32_Addr r_ldbase; /* Base address the linker is loaded at. */
|
||||
};
|
||||
|
||||
/* This symbol refers to the "dynamic structure" in the `.dynamic' section
|
||||
of whatever module refers to `_DYNAMIC'. So, to find its own
|
||||
`struct r_debug', a program could do:
|
||||
for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL)
|
||||
if (dyn->d_tag == DT_MIPS_RLD_MAP) r_debug = (struct r_debug) dyn->d_un.d_ptr;
|
||||
*/
|
||||
|
||||
extern Elf32_Dyn _DYNAMIC[];
|
||||
|
||||
|
||||
/* Structure describing a loaded shared object. The `l_next' and `l_prev'
|
||||
members form a chain of all the shared objects loaded at startup.
|
||||
|
||||
These data structures exist in space used by the run-time dynamic linker;
|
||||
modifying them may have disastrous results. */
|
||||
|
||||
struct link_map
|
||||
{
|
||||
/* These first few members are part of the protocol with the debugger.
|
||||
This is the same format used in SVR4. */
|
||||
|
||||
Elf32_Addr l_addr; /* Base address shared object is loaded at. */
|
||||
Elf32_Addr l_offs; /* Offset */
|
||||
char *l_name; /* Absolute file name object was found in. */
|
||||
Elf32_Dyn *l_ld; /* Dynamic section of the shared object. */
|
||||
struct link_map *l_next, *l_prev; /* Chain of loaded objects. */
|
||||
|
||||
/* All following members are internal to the dynamic linker.
|
||||
They may change without notice. */
|
||||
|
||||
const char *l_libname; /* Name requested (before search). */
|
||||
|
||||
/* Indexed pointers to dynamic section. */
|
||||
Elf32_Dyn *l_info[DT_NUM + DT_PROCNUM];
|
||||
|
||||
const Elf32_Phdr *l_phdr; /* Pointer to program header table in core. */
|
||||
Elf32_Word l_phnum; /* Number of program header entries. */
|
||||
Elf32_Addr l_entry; /* Entry point location. */
|
||||
|
||||
/* Symbol hash table. */
|
||||
Elf32_Word l_nbuckets;
|
||||
const Elf32_Word *l_buckets, *l_chain;
|
||||
|
||||
unsigned int l_opencount; /* Reference count for dlopen/dlclose. */
|
||||
enum /* Where this object came from. */
|
||||
{
|
||||
lt_executable, /* The main executable program. */
|
||||
lt_interpreter, /* The interpreter: the dynamic linker. */
|
||||
lt_library, /* Library needed by main executable. */
|
||||
lt_loaded, /* Extra run-time loaded shared object. */
|
||||
} l_type:2;
|
||||
unsigned int l_deps_loaded:1; /* Nonzero if DT_NEEDED items loaded. */
|
||||
unsigned int l_relocated:1; /* Nonzero if object's relocations done. */
|
||||
unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */
|
||||
unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */
|
||||
};
|
||||
|
||||
#endif /* _LINK_H */
|
|
@ -1,50 +0,0 @@
|
|||
/* $OpenBSD: memconf.h,v 1.2 1996/09/14 15:58:26 pefo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Per Fogelstrom
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Per Fogelstrom.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Memory config list used by pmap_bootstrap.
|
||||
*/
|
||||
|
||||
#ifndef _MEMCONF_H_
|
||||
#define _MEMCONF_H_
|
||||
|
||||
struct mem_descriptor {
|
||||
vm_offset_t mem_start;
|
||||
u_int mem_size;
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define MAXMEMSEGS 16
|
||||
extern struct mem_descriptor mem_layout[];
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue