Remove src/sys/arch{pmax/pmax,pica/pica}cpu_exec.c; no significant differences,
or for which the Pica port is an older revision of the pmax branch. A merged version with the NetBSD/pmax revision history is in mips/mips/. cpu_exec.c elf.c mem.c process_machdep.c
This commit is contained in:
parent
f01ac0c37f
commit
467aeaf9f5
@ -1,157 +0,0 @@
|
||||
/* $NetBSD: cpu_exec.c,v 1.1.1.1 1996/03/13 04:58:10 jonathan 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>
|
||||
#ifdef COMPAT_09
|
||||
#include <machine/bsd-aout.h>
|
||||
#endif
|
||||
#include <machine/reg.h>
|
||||
|
||||
/*
|
||||
* 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;
|
||||
{
|
||||
/* If COMPAT_09 is defined, allow loading of old-style 4.4bsd a.out
|
||||
executables. */
|
||||
#ifdef COMPAT_09
|
||||
struct bsd_aouthdr *hdr = (struct bsd_aouthdr *)epp -> ep_hdr;
|
||||
|
||||
/* Only handle paged files (laziness). */
|
||||
if (hdr -> a_magic != BSD_ZMAGIC)
|
||||
#endif
|
||||
/* If it's not a.out, maybe it's ELF. (This wants to
|
||||
be moved up to the machine independent code as soon
|
||||
as possible.) XXX */
|
||||
return pmax_elf_makecmds (p, epp);
|
||||
|
||||
#ifdef COMPAT_09
|
||||
epp -> ep_taddr = 0x1000;
|
||||
epp -> ep_entry = hdr -> a_entry;
|
||||
epp -> ep_tsize = hdr -> a_text;
|
||||
epp -> ep_daddr = epp -> ep_taddr + hdr -> a_text;
|
||||
epp -> ep_dsize = hdr -> a_data + hdr -> a_bss;
|
||||
|
||||
/*
|
||||
* check if vnode is in open for writing, because we want to
|
||||
* demand-page out of it. if it is, don't do it, for various
|
||||
* reasons
|
||||
*/
|
||||
if ((hdr -> a_text != 0 || hdr -> a_data != 0)
|
||||
&& epp->ep_vp->v_writecount != 0) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (epp->ep_vp->v_flag & VTEXT)
|
||||
panic("exec: a VTEXT vnode has writecount != 0\n");
|
||||
#endif
|
||||
return ETXTBSY;
|
||||
}
|
||||
epp->ep_vp->v_flag |= VTEXT;
|
||||
|
||||
/* set up command for text segment */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, hdr -> a_text,
|
||||
epp->ep_taddr, epp->ep_vp, 0, VM_PROT_READ|VM_PROT_EXECUTE);
|
||||
|
||||
/* set up command for data segment */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, hdr -> a_data,
|
||||
epp->ep_daddr, epp->ep_vp, hdr -> a_text,
|
||||
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
|
||||
|
||||
/* set up command for bss segment */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, hdr -> a_bss,
|
||||
epp->ep_daddr + hdr -> a_data, NULLVP, 0,
|
||||
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
|
||||
|
||||
return exec_aout_setup_stack(p, epp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef COMPAT_ULTRIX
|
||||
extern struct emul emul_ultrix;
|
||||
|
||||
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, eap)
|
||||
struct proc *p;
|
||||
struct exec_package *epp;
|
||||
struct ecoff_aouthdr *eap;
|
||||
{
|
||||
|
||||
epp->ep_emul = &emul_ultrix;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
@ -1,169 +0,0 @@
|
||||
/* $NetBSD: mem.c,v 1.1.1.1 1996/03/13 04:58:12 jonathan 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/systm.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
extern vm_offset_t avail_end;
|
||||
caddr_t zeropage;
|
||||
|
||||
/*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 o, 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 += MACH_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 < MACH_CACHED_MEMORY_ADDR)
|
||||
return (EFAULT);
|
||||
if (v + c > MACH_PHYS_TO_CACHED(avail_end) &&
|
||||
(v < MACH_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);
|
||||
}
|
||||
|
||||
int
|
||||
mmmmap(dev, off, prot)
|
||||
dev_t dev;
|
||||
int off, prot;
|
||||
{
|
||||
|
||||
return (EOPNOTSUPP);
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* 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 1996/03/13 04:58:13 jonathan 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/psl.h>
|
||||
#include <machine/reg.h>
|
||||
|
||||
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,157 +0,0 @@
|
||||
/* $NetBSD: cpu_exec.c,v 1.4 1995/04/25 19:16:46 mellon 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>
|
||||
#ifdef COMPAT_09
|
||||
#include <machine/bsd-aout.h>
|
||||
#endif
|
||||
#include <machine/reg.h>
|
||||
|
||||
/*
|
||||
* 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;
|
||||
{
|
||||
/* If COMPAT_09 is defined, allow loading of old-style 4.4bsd a.out
|
||||
executables. */
|
||||
#ifdef COMPAT_09
|
||||
struct bsd_aouthdr *hdr = (struct bsd_aouthdr *)epp -> ep_hdr;
|
||||
|
||||
/* Only handle paged files (laziness). */
|
||||
if (hdr -> a_magic != BSD_ZMAGIC)
|
||||
#endif
|
||||
/* If it's not a.out, maybe it's ELF. (This wants to
|
||||
be moved up to the machine independent code as soon
|
||||
as possible.) XXX */
|
||||
return pmax_elf_makecmds (p, epp);
|
||||
|
||||
#ifdef COMPAT_09
|
||||
epp -> ep_taddr = 0x1000;
|
||||
epp -> ep_entry = hdr -> a_entry;
|
||||
epp -> ep_tsize = hdr -> a_text;
|
||||
epp -> ep_daddr = epp -> ep_taddr + hdr -> a_text;
|
||||
epp -> ep_dsize = hdr -> a_data + hdr -> a_bss;
|
||||
|
||||
/*
|
||||
* check if vnode is in open for writing, because we want to
|
||||
* demand-page out of it. if it is, don't do it, for various
|
||||
* reasons
|
||||
*/
|
||||
if ((hdr -> a_text != 0 || hdr -> a_data != 0)
|
||||
&& epp->ep_vp->v_writecount != 0) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (epp->ep_vp->v_flag & VTEXT)
|
||||
panic("exec: a VTEXT vnode has writecount != 0\n");
|
||||
#endif
|
||||
return ETXTBSY;
|
||||
}
|
||||
epp->ep_vp->v_flag |= VTEXT;
|
||||
|
||||
/* set up command for text segment */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, hdr -> a_text,
|
||||
epp->ep_taddr, epp->ep_vp, 0, VM_PROT_READ|VM_PROT_EXECUTE);
|
||||
|
||||
/* set up command for data segment */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, hdr -> a_data,
|
||||
epp->ep_daddr, epp->ep_vp, hdr -> a_text,
|
||||
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
|
||||
|
||||
/* set up command for bss segment */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, hdr -> a_bss,
|
||||
epp->ep_daddr + hdr -> a_data, NULLVP, 0,
|
||||
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
|
||||
|
||||
return exec_aout_setup_stack(p, epp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef COMPAT_ULTRIX
|
||||
extern struct emul emul_ultrix;
|
||||
|
||||
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, eap)
|
||||
struct proc *p;
|
||||
struct exec_package *epp;
|
||||
struct ecoff_aouthdr *eap;
|
||||
{
|
||||
|
||||
epp->ep_emul = &emul_ultrix;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
@ -1,194 +0,0 @@
|
||||
/* $NetBSD: elf.c,v 1.1 1995/01/18 06:16:33 mellon Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Ted Lemon
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/filedesc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/acct.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <vm/vm.h>
|
||||
#include <sys/exec.h>
|
||||
#include <machine/elf.h>
|
||||
|
||||
/* pmax_elf_makecmds (p, epp)
|
||||
|
||||
Test if an executable is a MIPS ELF executable. If it is,
|
||||
try to load it. */
|
||||
|
||||
pmax_elf_makecmds (p, epp)
|
||||
struct proc *p;
|
||||
struct exec_package *epp;
|
||||
{
|
||||
struct ehdr *ex = (struct ehdr *)epp -> ep_hdr;
|
||||
struct phdr ph;
|
||||
int i, error, resid;
|
||||
|
||||
/* Make sure we got enough data to check magic numbers... */
|
||||
if (epp -> ep_hdrvalid < sizeof (struct ehdr)) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (epp -> ep_hdrlen < sizeof (struct ehdr))
|
||||
printf ("pmax_elf_makecmds: execsw hdrsize too short!\n");
|
||||
#endif
|
||||
return ENOEXEC;
|
||||
}
|
||||
|
||||
/* See if it's got the basic elf magic number leadin... */
|
||||
if (ex -> elf_magic [0] != 127
|
||||
|| bcmp ("ELF", &ex -> elf_magic [1], 3)) {
|
||||
return ENOEXEC;
|
||||
}
|
||||
/* XXX: Check other magic numbers here. */
|
||||
|
||||
/* See if we got any program header information... */
|
||||
if (!ex -> phoff || !ex -> phcount) {
|
||||
return ENOEXEC;
|
||||
}
|
||||
|
||||
/* Set the entry point... */
|
||||
epp -> ep_entry = ex -> entry;
|
||||
|
||||
/*
|
||||
* Check if vnode is open for writing, because we want to
|
||||
* demand-page out of it. If it is, don't do it.
|
||||
*/
|
||||
if (epp->ep_vp->v_writecount != 0) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (epp->ep_vp->v_flag & VTEXT)
|
||||
panic("exec: a VTEXT vnode has writecount != 0\n");
|
||||
#endif
|
||||
return ETXTBSY;
|
||||
}
|
||||
epp->ep_vp->v_flag |= VTEXT;
|
||||
|
||||
epp->ep_taddr = 0;
|
||||
epp->ep_tsize = 0;
|
||||
epp->ep_daddr = 0;
|
||||
epp->ep_dsize = 0;
|
||||
|
||||
for (i = 0; i < ex -> phcount; i++) {
|
||||
if (error = vn_rdwr(UIO_READ, epp -> ep_vp, (caddr_t)&ph,
|
||||
sizeof ph, ex -> phoff + i * sizeof ph,
|
||||
UIO_SYSSPACE, IO_NODELOCKED,
|
||||
p->p_ucred, &resid, p))
|
||||
return error;
|
||||
|
||||
if (resid != 0) {
|
||||
return ENOEXEC;
|
||||
}
|
||||
|
||||
/* We only care about loadable sections... */
|
||||
if (ph.type == PT_LOAD) {
|
||||
int prot = VM_PROT_READ | VM_PROT_EXECUTE;
|
||||
int residue;
|
||||
unsigned vaddr, offset, length;
|
||||
|
||||
vaddr = ph.vaddr;
|
||||
offset = ph.offset;
|
||||
length = ph.filesz;
|
||||
residue = ph.memsz - ph.filesz;
|
||||
|
||||
if (ph.flags & PF_W) {
|
||||
prot |= VM_PROT_WRITE;
|
||||
if (!epp->ep_daddr || vaddr < epp -> ep_daddr)
|
||||
epp->ep_daddr = vaddr;
|
||||
epp->ep_dsize += ph.memsz;
|
||||
/* Read the data from the file... */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_readvn,
|
||||
length, vaddr,
|
||||
epp->ep_vp, offset, prot);
|
||||
if (residue) {
|
||||
vaddr &= ~(NBPG - 1);
|
||||
offset &= ~(NBPG - 1);
|
||||
length = roundup (length + ph.vaddr
|
||||
- vaddr, NBPG);
|
||||
residue = (ph.vaddr + ph.memsz)
|
||||
- (vaddr + length);
|
||||
}
|
||||
} else {
|
||||
vaddr &= ~(NBPG - 1);
|
||||
offset &= ~(NBPG - 1);
|
||||
length = roundup (length + ph.vaddr - vaddr,
|
||||
NBPG);
|
||||
residue = (ph.vaddr + ph.memsz)
|
||||
- (vaddr + length);
|
||||
if (!epp->ep_taddr || vaddr < epp -> ep_taddr)
|
||||
epp->ep_taddr = vaddr;
|
||||
epp->ep_tsize += ph.memsz;
|
||||
/* Map the data from the file... */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn,
|
||||
length, vaddr,
|
||||
epp->ep_vp, offset, prot);
|
||||
}
|
||||
/* If part of the segment is just zeros (e.g., bss),
|
||||
map that. */
|
||||
if (residue > 0) {
|
||||
NEW_VMCMD (&epp->ep_vmcmds, vmcmd_map_zero,
|
||||
residue, vaddr + length,
|
||||
NULLVP, 0, prot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
epp->ep_maxsaddr = USRSTACK - MAXSSIZ;
|
||||
epp->ep_minsaddr = USRSTACK;
|
||||
epp->ep_ssize = p->p_rlimit[RLIMIT_STACK].rlim_cur;
|
||||
|
||||
/*
|
||||
* set up commands for stack. note that this takes *two*, one to
|
||||
* map the part of the stack which we can access, and one to map
|
||||
* the part which we can't.
|
||||
*
|
||||
* arguably, it could be made into one, but that would require the
|
||||
* addition of another mapping proc, which is unnecessary
|
||||
*
|
||||
* note that in memory, things assumed to be: 0 ....... ep_maxsaddr
|
||||
* <stack> ep_minsaddr
|
||||
*/
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
|
||||
((epp->ep_minsaddr - epp->ep_ssize) - epp->ep_maxsaddr),
|
||||
epp->ep_maxsaddr, NULLVP, 0, VM_PROT_NONE);
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, epp->ep_ssize,
|
||||
(epp->ep_minsaddr - epp->ep_ssize), NULLVP, 0,
|
||||
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,171 +0,0 @@
|
||||
/* $NetBSD: mem.c,v 1.7 1995/09/29 21:53:29 jonathan 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/systm.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/msgbuf.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
extern vm_offset_t avail_end;
|
||||
caddr_t zeropage;
|
||||
|
||||
/*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 o, 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 += MACH_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 < MACH_CACHED_MEMORY_ADDR)
|
||||
return (EFAULT);
|
||||
if (v + c > MACH_PHYS_TO_CACHED(avail_end +
|
||||
sizeof (struct msgbuf)) &&
|
||||
(v < MACH_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);
|
||||
}
|
||||
|
||||
int
|
||||
mmmmap(dev, off, prot)
|
||||
dev_t dev;
|
||||
int off, prot;
|
||||
{
|
||||
|
||||
return (EOPNOTSUPP);
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
/* $NetBSD: process_machdep.c,v 1.5 1996/03/20 01:30:49 jonathan 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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/psl.h>
|
||||
#include <machine/reg.h>
|
||||
|
||||
|
||||
int
|
||||
process_read_regs(p, regs)
|
||||
struct proc *p;
|
||||
struct reg *regs;
|
||||
{
|
||||
bcopy(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, p->p_md.md_regs, sizeof(struct reg));
|
||||
/*
|
||||
* XXX: is it safe to let users set system coprocessor regs?
|
||||
* XXX: Clear to user set bits!!
|
||||
*/
|
||||
/*p->p_md.md_tf->tf_psr = psr | (regs->r_psr & PSR_ICC);*/
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
process_sstep(p, sstep)
|
||||
struct proc *p;
|
||||
{
|
||||
/* XXX correct semantics: sstep once or forevermore? */
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user