Basic machine-dependent code for pdp10.
Lots of stuff here not yet finished.
This commit is contained in:
parent
a08c4b9e22
commit
7ea6b903f5
75
sys/arch/pdp10/pdp10/autoconf.c
Normal file
75
sys/arch/pdp10/pdp10/autoconf.c
Normal file
@ -0,0 +1,75 @@
|
||||
/* $NetBSD: autoconf.c,v 1.1 2003/08/19 10:54:59 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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/device.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
static struct device *booted_device;
|
||||
static int booted_partition;
|
||||
|
||||
void
|
||||
cpu_rootconf(void)
|
||||
{
|
||||
printf("boot device: %s\n",
|
||||
booted_device ? booted_device->dv_xname : "<unknown>");
|
||||
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_configure(void)
|
||||
{
|
||||
|
||||
if (config_rootfound("mainbus", NULL) == NULL)
|
||||
panic("mainbus not configured");
|
||||
}
|
||||
|
||||
static int
|
||||
mainbus_print(void *aux, const char *name)
|
||||
{
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
static int
|
||||
mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
mainbus_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
printf("\n");
|
||||
config_found(self, NULL, mainbus_print);
|
||||
}
|
||||
|
||||
struct cfattach mainbus_ca = {
|
||||
sizeof(struct device), mainbus_match, mainbus_attach
|
||||
};
|
63
sys/arch/pdp10/pdp10/clock.c
Normal file
63
sys/arch/pdp10/pdp10/clock.c
Normal file
@ -0,0 +1,63 @@
|
||||
/* $NetBSD: clock.c,v 1.1 2003/08/19 10:54:59 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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/systm.h>
|
||||
|
||||
#include <machine/intr.h>
|
||||
#include <machine/io.h>
|
||||
|
||||
/*
|
||||
* The clock counts up each 10 us.
|
||||
*/
|
||||
#define TBASE 1000 /* Interrupt each 10 ms */
|
||||
|
||||
void
|
||||
cpu_initclocks()
|
||||
{
|
||||
CONO(MTR, IPL_CLOCK); /* Interrupt level */
|
||||
CONO(TIM, TIM_CON_CLIC|TIM_CON_ICON|TIM_CON_CLIF|TBASE);
|
||||
}
|
||||
|
||||
void
|
||||
microtime(struct timeval *tvp)
|
||||
{
|
||||
panic("microtime");
|
||||
}
|
||||
|
||||
void
|
||||
resettodr()
|
||||
{
|
||||
panic("resettodr");
|
||||
}
|
||||
|
||||
void
|
||||
inittodr(time_t base)
|
||||
{
|
||||
panic("inittodr");
|
||||
}
|
103
sys/arch/pdp10/pdp10/console.c
Normal file
103
sys/arch/pdp10/pdp10/console.c
Normal file
@ -0,0 +1,103 @@
|
||||
/* $NetBSD: console.c,v 1.1 2003/08/19 10:54:59 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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/systm.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <machine/pcb.h>
|
||||
#include <machine/io.h>
|
||||
|
||||
cons_decl(dte);
|
||||
|
||||
struct consdev dtetab = cons_init(dte);
|
||||
|
||||
static volatile struct dte {
|
||||
int flg; /* Operation complete flag. */
|
||||
int clk; /* Clock interrupt flag. */
|
||||
int ci; /* Clock interrupt instruction. */
|
||||
int t11; /* 10 to 11 argument. */
|
||||
int f11; /* 10 from 11 argument. */
|
||||
int cmd; /* To 11 command word. */
|
||||
int seq; /* Operation sequence number. */
|
||||
int opr; /* Operational DTE #. */
|
||||
int chr; /* Last typed character. */
|
||||
int mtd; /* Monitor TTY output complete flag. */
|
||||
int mti; /* Monitor TTY input flag. */
|
||||
int swr; /* 10 switch register. */
|
||||
} *dte;
|
||||
|
||||
static int isinited;
|
||||
|
||||
void
|
||||
dtecninit(struct consdev *cn)
|
||||
{
|
||||
extern struct ept *ept;
|
||||
if (isinited)
|
||||
return;
|
||||
|
||||
dte = (struct dte *)((int *)ept + 0444);
|
||||
cn_tab = &dtetab;
|
||||
dte->flg = dte->clk = dte->ci = 0;
|
||||
isinited++;
|
||||
}
|
||||
|
||||
void
|
||||
dtecnpollc(dev_t dev, int onoff)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
dtecnputc(dev_t dev, int ch)
|
||||
{
|
||||
dte->cmd = ch & 0177;
|
||||
dte->seq++;
|
||||
CONO(DTE,020000);
|
||||
while (dte->flg == 0)
|
||||
;
|
||||
dte->flg = 0;
|
||||
}
|
||||
|
||||
int
|
||||
dtecngetc(dev_t dev)
|
||||
{
|
||||
int rch;
|
||||
|
||||
while (dte->mti == 0)
|
||||
;
|
||||
rch = dte->f11 & 0177;
|
||||
dte->mti = 0;
|
||||
return rch;
|
||||
}
|
||||
|
||||
void
|
||||
dtecnprobe(struct consdev *cn)
|
||||
{
|
||||
}
|
44
sys/arch/pdp10/pdp10/db_disasm.c
Normal file
44
sys/arch/pdp10/pdp10/db_disasm.c
Normal file
@ -0,0 +1,44 @@
|
||||
/* $NetBSD: db_disasm.c,v 1.1 2003/08/19 10:54:59 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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 <machine/db_machdep.h>
|
||||
#include <ddb/db_sym.h>
|
||||
|
||||
#include <ddb/db_variables.h>
|
||||
#include <ddb/db_interface.h>
|
||||
#include <ddb/db_output.h>
|
||||
|
||||
db_addr_t
|
||||
db_disasm(db_addr_t loc, boolean_t altfmt)
|
||||
{
|
||||
int foo = *(int *)loc;
|
||||
db_printf("addr 0%o: 0%012o\n", loc, foo);
|
||||
return loc+4;
|
||||
}
|
128
sys/arch/pdp10/pdp10/db_machdep.c
Normal file
128
sys/arch/pdp10/pdp10/db_machdep.c
Normal file
@ -0,0 +1,128 @@
|
||||
/* $NetBSD: db_machdep.c,v 1.1 2003/08/19 10:55:00 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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 "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <machine/db_machdep.h>
|
||||
|
||||
#include <ddb/db_extern.h>
|
||||
#include <ddb/db_interface.h>
|
||||
#include <ddb/db_variables.h>
|
||||
|
||||
db_regs_t ddb_regs;
|
||||
|
||||
|
||||
void
|
||||
ddbintr()
|
||||
{
|
||||
db_trap(0, 0);
|
||||
}
|
||||
/*
|
||||
* Read bytes from kernel address space for debugger.
|
||||
*/
|
||||
void
|
||||
db_read_bytes(vaddr_t addr, size_t size, char *data)
|
||||
{
|
||||
char *faddr = (char *)addr;
|
||||
|
||||
while (size--)
|
||||
*data++ = *faddr++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write bytes to kernel address space for debugger.
|
||||
*/
|
||||
void
|
||||
db_write_bytes(vaddr_t addr, size_t size, char *data)
|
||||
{
|
||||
char *faddr = (char *)addr;
|
||||
|
||||
while (size--)
|
||||
*faddr++ = *data++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Machine register set.
|
||||
*/
|
||||
const struct db_variable db_regs[] = {
|
||||
{"0", &ddb_regs.regs[0], FCN_NULL},
|
||||
{"1", &ddb_regs.regs[1], FCN_NULL},
|
||||
{"2", &ddb_regs.regs[2], FCN_NULL},
|
||||
{"3", &ddb_regs.regs[3], FCN_NULL},
|
||||
{"4", &ddb_regs.regs[4], FCN_NULL},
|
||||
{"5", &ddb_regs.regs[5], FCN_NULL},
|
||||
{"6", &ddb_regs.regs[6], FCN_NULL},
|
||||
{"7", &ddb_regs.regs[7], FCN_NULL},
|
||||
{"10", &ddb_regs.regs[8], FCN_NULL},
|
||||
{"11", &ddb_regs.regs[9], FCN_NULL},
|
||||
{"12", &ddb_regs.regs[10], FCN_NULL},
|
||||
{"13", &ddb_regs.regs[11], FCN_NULL},
|
||||
{"14", &ddb_regs.regs[12], FCN_NULL},
|
||||
{"15", &ddb_regs.regs[13], FCN_NULL},
|
||||
{"16", &ddb_regs.regs[14], FCN_NULL},
|
||||
{"17", &ddb_regs.regs[15], FCN_NULL},
|
||||
{"pc", &ddb_regs.pc, FCN_NULL},
|
||||
};
|
||||
const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
|
||||
|
||||
void
|
||||
db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count,
|
||||
char *modif, void (*pr)(const char *, ...))
|
||||
{
|
||||
(*pr)("db_stack_trace_print\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX - must fix the sstep functions.
|
||||
*/
|
||||
|
||||
boolean_t
|
||||
inst_branch(int inst)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
boolean_t
|
||||
inst_unconditional_flow_transfer(int inst)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
db_addr_t
|
||||
branch_taken(int inst, db_addr_t pc, db_regs_t *regs)
|
||||
{
|
||||
return pc + 4;
|
||||
}
|
||||
|
||||
db_addr_t
|
||||
next_instr_address(db_addr_t pc, boolean_t bd)
|
||||
{
|
||||
return pc + 4;
|
||||
}
|
212
sys/arch/pdp10/pdp10/disksubr.c
Normal file
212
sys/arch/pdp10/pdp10/disksubr.c
Normal file
@ -0,0 +1,212 @@
|
||||
/* $NetBSD: disksubr.c,v 1.1 2003/08/19 10:55:00 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988 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.
|
||||
*
|
||||
* @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/dkbad.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
/*
|
||||
* Determine the size of the transfer, and make sure it is
|
||||
* within the boundaries of the partition. Adjust transfer
|
||||
* if needed, and signal errors or early completion.
|
||||
*/
|
||||
int
|
||||
bounds_check_with_label(struct disk *dk, struct buf *bp, int wlabel)
|
||||
{
|
||||
struct disklabel *lp = dk->dk_label;
|
||||
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
|
||||
int labelsect = lp->d_partitions[2].p_offset;
|
||||
int maxsz = p->p_size,
|
||||
sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
|
||||
/* overwriting disk label ? */
|
||||
if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
|
||||
(bp->b_flags & B_READ) == 0 && wlabel == 0) {
|
||||
bp->b_error = EROFS;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* beyond partition? */
|
||||
if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
|
||||
/* if exactly at end of disk, return an EOF */
|
||||
if (bp->b_blkno == maxsz) {
|
||||
bp->b_resid = bp->b_bcount;
|
||||
return(0);
|
||||
}
|
||||
/* or truncate if part of it fits */
|
||||
sz = maxsz - bp->b_blkno;
|
||||
if (sz <= 0) {
|
||||
bp->b_error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
bp->b_bcount = sz << DEV_BSHIFT;
|
||||
}
|
||||
|
||||
/* calculate cylinder for disksort to order transfers with */
|
||||
bp->b_cylinder = (bp->b_blkno + p->p_offset) / lp->d_secpercyl;
|
||||
return(1);
|
||||
|
||||
bad:
|
||||
bp->b_flags |= B_ERROR;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempt to read a disk label from a device
|
||||
* using the indicated strategy routine.
|
||||
* The label must be partly set up before this:
|
||||
* secpercyl and anything required in the strategy routine
|
||||
* (e.g., sector size) must be filled in before calling us.
|
||||
* Returns null on success and an error string on failure.
|
||||
*/
|
||||
char *
|
||||
readdisklabel(dev_t dev, void (*strat)(struct buf *),
|
||||
struct disklabel *lp, struct cpu_disklabel *osdep)
|
||||
{
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
char *msg = NULL;
|
||||
|
||||
if (lp->d_npartitions == 0) { /* Assume no label */
|
||||
lp->d_secperunit = 0x1fffffff;
|
||||
lp->d_npartitions = 3;
|
||||
lp->d_partitions[2].p_size = 0x1fffffff;
|
||||
lp->d_partitions[2].p_offset = 0;
|
||||
}
|
||||
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dev;
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags |= B_READ;
|
||||
bp->b_cylinder = LABELSECTOR / lp->d_secpercyl;
|
||||
(*strat)(bp);
|
||||
if (biowait(bp)) {
|
||||
msg = "I/O error";
|
||||
} else {
|
||||
dlp = (struct disklabel *)(bp->b_data + LABELOFFSET);
|
||||
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
|
||||
msg = "no disk label";
|
||||
} else if (dlp->d_npartitions > MAXPARTITIONS ||
|
||||
dkcksum(dlp) != 0)
|
||||
msg = "disk label corrupted";
|
||||
else {
|
||||
*lp = *dlp;
|
||||
}
|
||||
}
|
||||
brelse(bp);
|
||||
return (msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check new disk label for sensibility
|
||||
* before setting it.
|
||||
*/
|
||||
int
|
||||
setdisklabel(struct disklabel *olp, struct disklabel *nlp,
|
||||
u_long openmask, struct cpu_disklabel *osdep)
|
||||
{
|
||||
int i;
|
||||
struct partition *opp, *npp;
|
||||
|
||||
if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
|
||||
dkcksum(nlp) != 0)
|
||||
return (EINVAL);
|
||||
while ((i = ffs(openmask)) != 0) {
|
||||
i--;
|
||||
openmask &= ~(1 << i);
|
||||
if (nlp->d_npartitions <= i)
|
||||
return (EBUSY);
|
||||
opp = &olp->d_partitions[i];
|
||||
npp = &nlp->d_partitions[i];
|
||||
if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
|
||||
return (EBUSY);
|
||||
/*
|
||||
* Copy internally-set partition information
|
||||
* if new label doesn't include it. XXX
|
||||
*/
|
||||
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
|
||||
npp->p_fstype = opp->p_fstype;
|
||||
npp->p_fsize = opp->p_fsize;
|
||||
npp->p_frag = opp->p_frag;
|
||||
npp->p_cpg = opp->p_cpg;
|
||||
}
|
||||
}
|
||||
nlp->d_checksum = 0;
|
||||
nlp->d_checksum = dkcksum(nlp);
|
||||
*olp = *nlp;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write disk label back to device after modification.
|
||||
* Always allow writing of disk label; even if the disk is unlabeled.
|
||||
*/
|
||||
int
|
||||
writedisklabel(dev_t dev, void (*strat)(struct buf *),
|
||||
struct disklabel *lp, struct cpu_disklabel *osdep)
|
||||
{
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
int error = 0;
|
||||
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART);
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags |= B_READ;
|
||||
(*strat)(bp);
|
||||
if ((error = biowait(bp)))
|
||||
goto done;
|
||||
dlp = (struct disklabel *)(bp->b_data + LABELOFFSET);
|
||||
bcopy(lp, dlp, sizeof(struct disklabel));
|
||||
bp->b_flags &= ~(B_READ|B_DONE);
|
||||
bp->b_flags |= B_WRITE;
|
||||
(*strat)(bp);
|
||||
error = biowait(bp);
|
||||
|
||||
done:
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
61
sys/arch/pdp10/pdp10/kl10.c
Normal file
61
sys/arch/pdp10/pdp10/kl10.c
Normal file
@ -0,0 +1,61 @@
|
||||
/* $NetBSD: kl10.c,v 1.1 2003/08/19 10:55:00 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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/systm.h>
|
||||
|
||||
#include <machine/io.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
|
||||
#define OPTSTR "\177\10b\43T20PAG\0b\42EXADDR\0b\41EXOTIC\0" \
|
||||
"b\21C50HZ\0b\20CACHE\0b\17CHANNEL\0b\16EXTCPU\0b\15MASTEROSC\0\0"
|
||||
|
||||
void
|
||||
kl10_conf()
|
||||
{
|
||||
char buf[100];
|
||||
unsigned int cpup;
|
||||
|
||||
/*
|
||||
* Identify CPU type.
|
||||
*/
|
||||
BLKI(0, cpup);
|
||||
strcpy(cpu_model, "KL10-");
|
||||
cpu_model[5] = (cpup & 040000 ? 'E' : 'A');
|
||||
printf("\ncpu: %s, serial number 0%o, microcode version 0%o\n",
|
||||
cpu_model, cpup & 07777, (cpup >> 18) & 0777);
|
||||
bitmask_snprintf((unsigned long long)cpup, OPTSTR, buf, sizeof(buf));
|
||||
printf("cpu options: %s\n", buf);
|
||||
|
||||
#ifdef notyet
|
||||
/*
|
||||
* Turn on cache system.
|
||||
*/
|
||||
#endif
|
||||
}
|
532
sys/arch/pdp10/pdp10/locore.S
Normal file
532
sys/arch/pdp10/pdp10/locore.S
Normal file
@ -0,0 +1,532 @@
|
||||
/* $NetBSD: locore.S,v 1.1 2003/08/19 10:55:00 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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 "opt_ddb.h"
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/io.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#define HALT(x) jrst %4,x
|
||||
|
||||
#define PGSZ 01000 /* In words */
|
||||
#define PGMSK (PGSZ-1)
|
||||
#define NPGMSK 0777000 /* (~PGMSK) */
|
||||
#define SP %17
|
||||
#define FP %16
|
||||
|
||||
#define PTOFF(off,arg) skipa %2,.+1 ; arg ; movem %2,off(%1)
|
||||
|
||||
#define INTRDEF(eptoff, p0off, dst) \
|
||||
PTOFF(eptoff,xpcw p0off) ; xmovei %3,dst ; movem %3,@[.long p0off+3]
|
||||
/*
|
||||
* A bunch of instructions. These should be recognized by the assembler.
|
||||
*/
|
||||
#define xpcw jrst %7,
|
||||
#define xjen jrst %6,
|
||||
|
||||
/*
|
||||
* Usage of page 0 for interrupt dispatchers.
|
||||
*/
|
||||
#define HIGHPOS 020
|
||||
#define DDBPOS 024
|
||||
#define CLKPOS 030
|
||||
#define NETPOS 034
|
||||
#define BIOPOS 040
|
||||
#define TTYPOS 044
|
||||
#define SNETPOS 050
|
||||
#define SCLKPOS 054
|
||||
|
||||
.data
|
||||
.globl avail_start /* Physical memory availability */
|
||||
.globl avail_end
|
||||
.globl proc0paddr,ept
|
||||
avail_start: .long 0
|
||||
avail_end: .long 0
|
||||
proc0paddr: .long 0
|
||||
istack: .long 0
|
||||
ept: .long 0
|
||||
#ifdef DDB
|
||||
ddbstack: .long 0
|
||||
#endif
|
||||
|
||||
/* Longwords to switch between register blocks quick */
|
||||
moniw: .long 0400100000000 /* Current block 0, previous user */
|
||||
useriw: .long 0401100000000 /* Current user, previous user */
|
||||
intiw: .long 0402000000000 /* Current int, previous monitor */
|
||||
ddbiw: .long 0403000000000 /* Current ddb, previous monitor */
|
||||
|
||||
ENTRY(start)
|
||||
|
||||
/*
|
||||
* Set interrupt stack directly after end,
|
||||
* and at least one page in size.
|
||||
*/
|
||||
xmovei %10,end
|
||||
movem %10,istack
|
||||
addi %10,2*PGSZ
|
||||
trz %10,PGMSK # trunc to page boundary
|
||||
datao %PAG,intiw # switch to interrupt block
|
||||
move %17,istack # set interrupt stack
|
||||
datao %PAG,moniw # back to monitor block
|
||||
|
||||
/*
|
||||
* Setup Executive Process Table as next.
|
||||
*/
|
||||
movem %10,ept
|
||||
move %1,010
|
||||
skipa %2,.+1
|
||||
pushj %17,earov
|
||||
movem %2,0421(%1)
|
||||
PTOFF(0422,jrst esov)
|
||||
PTOFF(0423,jrst etrap3)
|
||||
|
||||
/*
|
||||
* Interrupt setup. This is somewhat hairy, the interrupt protocol
|
||||
* on KL10 is not simple. Page 0 in memory is used for xpcw.
|
||||
*/
|
||||
INTRDEF(0514,CLKPOS,_hardclock)
|
||||
INTRDEF(040,HIGHPOS,panic) /* Yech! */
|
||||
INTRDEF(042,DDBPOS,_ddbintr)
|
||||
/* INTRDEF(044,CLKPOS,_hardclock) separate vector */
|
||||
INTRDEF(046,NETPOS,_netintr)
|
||||
INTRDEF(050,BIOPOS,_biointr)
|
||||
INTRDEF(052,TTYPOS,_ttyintr)
|
||||
INTRDEF(054,SNETPOS,_softnet)
|
||||
INTRDEF(056,SCLKPOS,_softclock)
|
||||
|
||||
addi %10,PGSZ
|
||||
/*
|
||||
* Process 0 user area (proc0paddr) located directly thereafter.
|
||||
* Guard pages?
|
||||
*/
|
||||
movem %10,proc0paddr
|
||||
addi %10,PGSZ /* Skip UPT */
|
||||
move %17,%10 /* Process 0 stackpointer XXX uarea */
|
||||
addi %10,PGSZ /* The rest of USPACE */
|
||||
move %1,proc0paddr
|
||||
pushj %17,setup_upt /* Set trap addresses */
|
||||
|
||||
#ifdef DDB
|
||||
movem %10,ddbstack # ddb has a private stack
|
||||
addi %10,PGSZ # make it one page in size
|
||||
movsi %1,0403000 # set ac block, current == 3
|
||||
datao %PAG,1 # doit!
|
||||
move %17,ddbstack # put stack address in stack pointer
|
||||
datao %PAG,moniw # back to monitor ac block,
|
||||
#endif
|
||||
|
||||
movem %10,avail_start /* available memory */
|
||||
|
||||
/*
|
||||
* Setup memory management.
|
||||
*/
|
||||
pushj %17,pmap_bootstrap
|
||||
|
||||
/*
|
||||
* Done here, jump to main now.
|
||||
*/
|
||||
pushj %17,main
|
||||
HALT(1)
|
||||
|
||||
/*
|
||||
* Check if this address is nonexisting.
|
||||
*/
|
||||
ENTRY(badaddr)
|
||||
move %3,proc0paddr+0503 # save old trap pc
|
||||
xmovei %4,bad1 # address if trapping
|
||||
movem %4,proc0paddr+0503 # set new address
|
||||
move %2,020(%1) # skip register block
|
||||
movem %3,proc0paddr+0503 # restore trap handler
|
||||
movei %1,0 # not a bad address
|
||||
popj %17,
|
||||
|
||||
bad1: movem %3,proc0paddr+0503 # restore trap handler
|
||||
movei %1,1 # was bad address
|
||||
popj %17,
|
||||
|
||||
/*
|
||||
* Copy routines.
|
||||
*/
|
||||
.data
|
||||
reta: .long 0 # return address after fault
|
||||
retv: .long 0 # return value
|
||||
|
||||
ENTRY(copyin) HALT(017)
|
||||
ENTRY(copyout) HALT(022)
|
||||
ENTRY(copyinstr) HALT(023)
|
||||
ENTRY(copyoutstr) HALT(024)
|
||||
|
||||
/*
|
||||
* Copy string in-kernel.
|
||||
* Check for fault in trap routine, not here.
|
||||
* XXX - *done length is wrong if it faults, is this OK?
|
||||
*/
|
||||
ENTRY(copystr)
|
||||
jrst %4,0567
|
||||
xmovei %6,L_cps3 # r6 = &L_cps3;
|
||||
movem %6,reta # reta = r6
|
||||
setzm retv # retv = 0;
|
||||
move %6,%3 # olen = len
|
||||
|
||||
L_cps2: subi %3,1 # len--
|
||||
camn %3,[.long -1] # if (len == -1)
|
||||
jrst L_cps1 # goto L_cps1
|
||||
ldb %7,%1 # r7 = *from
|
||||
dpb %7,%2 # *to = r7
|
||||
ibp %1 # from++;
|
||||
ibp %2 # to++;
|
||||
jumpn %7,L_cps2 # if (r7 != 0) goto L_cps2
|
||||
|
||||
L_cps1: jumpe %4,L_cps3 # if (done == 0) goto L_cps3
|
||||
sub %6,%3 # olen -= len;
|
||||
addi %6,1 # olen++;
|
||||
movem %6,(%4) # *done = olen;
|
||||
|
||||
L_cps3: move %1,retv # r1 = retv
|
||||
popj %17, # return r1;
|
||||
|
||||
|
||||
|
||||
ENTRY(kcopy) HALT(026)
|
||||
|
||||
ENTRY(suword) HALT(027)
|
||||
ENTRY(subyte) HALT(030)
|
||||
ENTRY(suswintr) HALT(031)
|
||||
ENTRY(fuswintr) HALT(032)
|
||||
|
||||
/*
|
||||
* spl routines should be macron in the future.
|
||||
*/
|
||||
#define SVPRI coni PI,%1 ; andi %1,PI_ALL
|
||||
#define ALTERSPL(val) SVPRI ; cono PI,(PI_LVLOFF|val) ; popj SP,
|
||||
|
||||
ENTRY(splhigh)
|
||||
ALTERSPL(PI_ALL) # Block all levels
|
||||
|
||||
ENTRY(splclock)
|
||||
ALTERSPL(PI_CLOCK) # Block hardclock
|
||||
|
||||
ENTRY(splnet)
|
||||
ALTERSPL(PI_NET) # Block network adapters
|
||||
|
||||
ENTRY(splsched)
|
||||
ALTERSPL(PI_ALL) # Block all levels XXX
|
||||
|
||||
ENTRY(splvm)
|
||||
ALTERSPL(PI_BIO|PI_TTY|PI_NET) # Block disks, ttys and network adapters
|
||||
|
||||
ENTRY(spllock)
|
||||
ALTERSPL(PI_ALL) # Block all levels XXX
|
||||
|
||||
ENTRY(splbio)
|
||||
ALTERSPL(PI_BIO) # Block disks
|
||||
|
||||
ENTRY(splstatclock)
|
||||
ALTERSPL(PI_CLOCK) # Block hardclock
|
||||
|
||||
ENTRY(splsoftnet)
|
||||
ALTERSPL(PI_SOFTCLOCK) # Block soft network protocols
|
||||
|
||||
ENTRY(spltty)
|
||||
ALTERSPL(PI_TTY) # Block ttys
|
||||
|
||||
ENTRY(spl0) # Unblock everything
|
||||
cono PI,PI_LVLON|PI_ON|PI_ALL
|
||||
popj SP,
|
||||
|
||||
|
||||
/*
|
||||
* This routine is problematic. The only way to lower an interrupt is
|
||||
* through xjen, which resets the interrupt level. For now we don't try
|
||||
* to do anything clever; set CLKF_BASEPRI() to 0 and avoid this routine.
|
||||
*/
|
||||
ENTRY(spllowersoftclock)
|
||||
HALT(044)
|
||||
|
||||
/*
|
||||
* Lower the current interrupt level. If softclock was blocked but is
|
||||
* now unblocked, call for an interrupt.
|
||||
*/
|
||||
ENTRY(splx)
|
||||
move %1,-1(SP)
|
||||
iori %1,PI_LVLON
|
||||
cono PI,(%1)
|
||||
skipn %1,L_want_soft # Skip if any softbit is set
|
||||
popj SP,
|
||||
trne %1,PI_SOFTCLOCK # Skip if softclock not set.
|
||||
pushj SP,setsoftclock # Try to send another
|
||||
trne %1,PI_SOFTNET # Skip if softnet not set.
|
||||
pushj SP,setsoftnet # Try to send another setsoftnet
|
||||
popj SP,
|
||||
|
||||
.data
|
||||
L_want_soft:
|
||||
.long 0
|
||||
|
||||
/*
|
||||
* Ask for a softclock interrupt. If softclock is blocked, set a flag that
|
||||
* posts a softclock interrupt when it is unblocked.
|
||||
*/
|
||||
ENTRY(setsoftclock)
|
||||
coni PI,%1 # get current interrupt mask
|
||||
trne %1,PI_SOFTCLOCK # skip if masked
|
||||
cono PI,PI_INIT|PI_SOFTCLOCK # send interrupt request
|
||||
movei %1,PI_SOFTCLOCK
|
||||
iorm %1,L_want_soft # request soft intr
|
||||
popj SP,
|
||||
|
||||
ENTRY(setsoftnet)
|
||||
coni PI,%1 # get current interrupt mask
|
||||
trne %1,PI_SOFTNET # skip if masked
|
||||
cono PI,PI_INIT|PI_SOFTNET # send interrupt request
|
||||
movei %1,PI_SOFTNET
|
||||
iorm %1,L_want_soft # request soft intr
|
||||
popj SP,
|
||||
|
||||
ENTRY(sigcode)
|
||||
HALT(0)
|
||||
ENTRY(esigcode)
|
||||
|
||||
ENTRY(signotify)
|
||||
popj %17,
|
||||
|
||||
ENTRY(need_proftick) HALT(066)
|
||||
|
||||
earov:
|
||||
|
||||
HALT(067)
|
||||
esov: HALT(070)
|
||||
etrap3: HALT(071)
|
||||
|
||||
/*
|
||||
* Interrupt handling stuff
|
||||
*/
|
||||
#define INTR_SAVE(myword) \
|
||||
datai PAG,myword ; datao PAG,intiw ; \
|
||||
xmovei SP,011(SP) ; dmovem %0,-010(SP) ; dmovem %2,-6(SP) ; \
|
||||
dmovem %4,-4(SP) ; dmovem %6,-2(SP) ; move %1,myword ; movem %1,(SP)
|
||||
#define INTR_RESTORE(myword) \
|
||||
move %1,(SP) ; tlz %1,0100000 ; movem %1,myword ; dmove %6,-2(SP) ; \
|
||||
dmove %4,-4(SP) ; dmove %2,-6(SP) ; dmove %0,-010(SP) ; \
|
||||
xmovei %17,-011(SP) ; datao %PAG,myword ;
|
||||
|
||||
.data
|
||||
L_hcpw: .long 0 /* Saved pager word at hardclock */
|
||||
L_scpw: .long 0 /* Saved pager word at softclock */
|
||||
L_biow: .long 0 /* Saved pager word at diskintr */
|
||||
L_ddbw: .long 0 /* Saved pager word at ddb */
|
||||
|
||||
.text
|
||||
|
||||
#ifdef DDB
|
||||
# Workaround for buggy assembler
|
||||
xct1: blt %1,ddb_regs+15
|
||||
xct2: blt %1,015
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Save a trapframe onto the interrupt stack with the current
|
||||
* register contents. First set the previous context correct.
|
||||
*/
|
||||
_ddbintr:
|
||||
#ifdef DDB
|
||||
datai %PAG,L_ddbw ; datao %PAG,ddbiw
|
||||
hllz %1,L_ddbw # fetch only left-half of pager word
|
||||
tlz %1,0770777 # clear everything except "current" AC block
|
||||
lsh %1,-3 # put ac block in previous position
|
||||
ior %1,ddbiw # create pager word
|
||||
datao %PAG,01 # set correct previous context
|
||||
|
||||
movei %1,ddb_regs # only lower 18 bits please
|
||||
xct %1,xct1 # pxct, fetch regs
|
||||
move %2,@[ .long DDBPOS+1 ] # get pc
|
||||
xmovei %1,ddb_regs
|
||||
movem %2,020(%1) # store pc
|
||||
|
||||
pushj %17,ddbintr
|
||||
|
||||
movsi %1,ddb_regs
|
||||
xct %4,xct2 # restore regs
|
||||
xmovei %1,ddb_regs
|
||||
move %2,020(%1)
|
||||
movem %2,@[ .long DDBPOS+1 ]
|
||||
|
||||
#endif
|
||||
cono PI,020100 # clear ddb interrupt
|
||||
xjen @[.long DDBPOS]
|
||||
|
||||
_hardclock:
|
||||
cono TIM,061750 # Clear timer interrupt
|
||||
INTR_SAVE(L_hcpw)
|
||||
xmovei %1,(SP) # Clock frame
|
||||
pushj SP,hardclock
|
||||
INTR_RESTORE(L_hcpw)
|
||||
xjen @[.long CLKPOS]
|
||||
|
||||
_netintr:
|
||||
HALT(072)
|
||||
|
||||
_biointr:
|
||||
#if 1
|
||||
INTR_SAVE(L_biow)
|
||||
pushj SP,rhintr
|
||||
INTR_RESTORE(L_biow)
|
||||
xjen @[.long BIOPOS]
|
||||
#else
|
||||
HALT(073)
|
||||
#endif
|
||||
|
||||
_ttyintr:
|
||||
HALT(074)
|
||||
|
||||
_softnet:
|
||||
HALT(075)
|
||||
|
||||
_softclock:
|
||||
INTR_SAVE(L_scpw)
|
||||
pushj SP,softclock
|
||||
INTR_RESTORE(L_scpw)
|
||||
cono PI,PI_DROP|PI_SOFTCLOCK # clear softclock interrupt
|
||||
movei %1,2
|
||||
andi %1,L_want_soft # clear request word
|
||||
xjen @[.long SCLKPOS]
|
||||
|
||||
|
||||
ENTRY(pcb_ovtrap) HALT(0421)
|
||||
ENTRY(pcb_ovstack) HALT(0422)
|
||||
ENTRY(pcb_trap3) HALT(0423)
|
||||
ENTRY(pcb_knotrap) HALT(0430)
|
||||
ENTRY(pcb_ktrap) HALT(0431)
|
||||
ENTRY(pcb_snotrap) HALT(0432)
|
||||
ENTRY(pcb_strap) HALT(0433)
|
||||
ENTRY(pcb_cnotrap) HALT(0434)
|
||||
ENTRY(pcb_ctrap) HALT(0435)
|
||||
ENTRY(pcb_pnotrap) HALT(0436)
|
||||
ENTRY(pcb_ptrap) HALT(0437)
|
||||
|
||||
ENTRY(pcb_pfnpc)
|
||||
push SP,proc0paddr
|
||||
pushj SP,pagefail
|
||||
HALT(0503);
|
||||
|
||||
/*
|
||||
* Write the needed trap addresses into a new User Process Table.
|
||||
* The UPT page must be zeroed before call. Pointer to it in reg 1.
|
||||
*/
|
||||
ENTRY(setup_upt)
|
||||
PTOFF(0421, jrst pcb_ovtrap)
|
||||
PTOFF(0422, jrst pcb_ovstack)
|
||||
PTOFF(0423, jrst pcb_trap3)
|
||||
PTOFF(0430, .long pcb_knotrap)
|
||||
PTOFF(0431, .long pcb_ktrap)
|
||||
PTOFF(0432, .long pcb_snotrap)
|
||||
PTOFF(0433, .long pcb_strap)
|
||||
PTOFF(0434, .long pcb_cnotrap)
|
||||
PTOFF(0435, .long pcb_ctrap)
|
||||
PTOFF(0436, .long pcb_pnotrap)
|
||||
PTOFF(0437, .long pcb_ptrap)
|
||||
PTOFF(0503, .long pcb_pfnpc)
|
||||
popj SP,
|
||||
|
||||
#ifdef __PCC__
|
||||
ENTRY(datao)
|
||||
move %1,-1(%17) # get device
|
||||
lsh %1,030 # shift left 24 step
|
||||
ior %1,[.long 0700140000002 ] # create instruction
|
||||
move %2,-2(%17) # get value
|
||||
xct %1 # doit!
|
||||
popj %17,
|
||||
|
||||
ENTRY(datai)
|
||||
move %1,-1(%17) # get device
|
||||
lsh %1,030 # shift left 24 step
|
||||
ior %1,[.long 0700040000001 ] # create instruction
|
||||
xct %1 # doit!
|
||||
popj %17,
|
||||
|
||||
ENTRY(cono)
|
||||
move %1,-1(%17) # get device
|
||||
lsh %1,030 # shift left 24 step
|
||||
tlo %1,0700200 # create instruction
|
||||
hrr %1,-2(%17) # get value
|
||||
xct %1 # doit!
|
||||
popj %17,
|
||||
|
||||
ENTRY(coni)
|
||||
move %1,-1(%17) # get device
|
||||
lsh %1,030 # shift left 24 step
|
||||
ior %1,[.long 0700240000001 ] # create instruction
|
||||
xct %1 # doit!
|
||||
popj %17,
|
||||
|
||||
ENTRY(blko)
|
||||
HALT(0604);
|
||||
|
||||
ENTRY(blki)
|
||||
move %1,-1(%17) # get device
|
||||
lsh %1,030 # shift left 24 step
|
||||
ior %1,[.long 0700000000001 ] # create instruction
|
||||
xct %1
|
||||
popj %17,
|
||||
|
||||
ENTRY(clrpt)
|
||||
HALT(0606);
|
||||
#endif
|
||||
|
||||
#ifdef DDB
|
||||
ENTRY(setjmp)
|
||||
move %1,-1(%17) # Get jmp_buf pointer
|
||||
move %2,(%17) # Get return PC
|
||||
movem %2,1(%1) # Save PC
|
||||
move %2,%17 # Get SP
|
||||
movem %2,2(%1) # Save SP
|
||||
movem %16,3(%1) # Save FP
|
||||
dmovem %10,010(%1) # Save reg 10+11
|
||||
dmovem %12,012(%1) # Save reg 12+13
|
||||
dmovem %14,014(%1) # Save reg 14+15
|
||||
setz %1, # Return 0
|
||||
popj %17,
|
||||
|
||||
ENTRY(longjmp)
|
||||
move %3,-1(%17) # Get jmp_buf pointer
|
||||
move %1,-2(%17) # Get return value
|
||||
dmove %14,014(%3) # Restore reg 14+15
|
||||
dmove %12,012(%3) # Restore reg 12+13
|
||||
dmove %10,010(%3) # Restore reg 10+11
|
||||
move %16,3(%3) # Restore FP
|
||||
move %17,2(%3) # Restore SP
|
||||
move %2,1(%3) # Get return PC
|
||||
movem %2,(%17) # Save PC
|
||||
popj %17,
|
||||
|
||||
ENTRY(cpu_Debugger)
|
||||
cono PI,06300 # debugger runs on IPL 1
|
||||
jrst %4,.+1
|
||||
popj %17,
|
||||
#endif
|
283
sys/arch/pdp10/pdp10/machdep.c
Normal file
283
sys/arch/pdp10/pdp10/machdep.c
Normal file
@ -0,0 +1,283 @@
|
||||
/* $NetBSD: machdep.c,v 1.1 2003/08/19 10:55:00 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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/signal.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/sa.h>
|
||||
#include <sys/syscallargs.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
int physmem;
|
||||
struct cpu_info cpu_info_store;
|
||||
struct vm_map *exec_map, *mb_map;
|
||||
char machine[] = MACHINE; /* from <machine/param.h> */
|
||||
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
|
||||
char cpu_model[100];
|
||||
caddr_t msgbufaddr;
|
||||
|
||||
void
|
||||
cpu_startup()
|
||||
{
|
||||
extern int avail_end;
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
caddr_t v;
|
||||
char pbuf[9];
|
||||
int sz, base, i, residual;
|
||||
|
||||
spl0(); /* Enable interrupts */
|
||||
|
||||
/*
|
||||
* Initialize error message buffer.
|
||||
*/
|
||||
initmsgbuf(msgbufaddr, round_page(MSGBUFSIZE));
|
||||
|
||||
/*
|
||||
* Good {morning,afternoon,evening,night}.
|
||||
*/
|
||||
format_bytes(pbuf, sizeof(pbuf), avail_end);
|
||||
pbuf[strlen(pbuf)-1] = 0; /* Remove 'B' */
|
||||
printf("total memory = %sW\n", pbuf);
|
||||
/*
|
||||
* Find out how much space we need, allocate it, and then give
|
||||
* everything true virtual addresses.
|
||||
*/
|
||||
|
||||
sz = (int) allocsys(NULL, NULL);
|
||||
if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
|
||||
panic("startup: no room for tables");
|
||||
if ((allocsys(v, NULL) - v) != sz)
|
||||
panic("startup: table size inconsistency");
|
||||
/*
|
||||
* Now allocate buffers proper. They are different than the above in
|
||||
* that they usually occupy more virtual memory than physical.
|
||||
*/
|
||||
size = MAXBSIZE * nbuf; /* # bytes for buffers */
|
||||
|
||||
/* allocate VM for buffers... area is not managed by VM system */
|
||||
if (uvm_map(kernel_map, &minaddr, round_page(size),
|
||||
NULL, UVM_UNKNOWN_OFFSET, 0,
|
||||
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
|
||||
UVM_ADV_NORMAL, 0)) != 0)
|
||||
panic("cpu_startup: cannot allocate VM for buffers");
|
||||
|
||||
buffers = (char *)minaddr;
|
||||
if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
|
||||
/* don't want to alloc more physical mem than needed */
|
||||
bufpages = btoc(MAXBSIZE) * nbuf;
|
||||
}
|
||||
base = bufpages / nbuf;
|
||||
residual = bufpages % nbuf;
|
||||
/* now allocate RAM for buffers */
|
||||
for (i = 0 ; i < nbuf ; i++) {
|
||||
vaddr_t curbuf;
|
||||
vsize_t curbufsize;
|
||||
struct vm_page *pg;
|
||||
|
||||
/*
|
||||
* First <residual> buffers get (base+1) physical pages
|
||||
* allocated for them. The rest get (base) physical pages.
|
||||
*
|
||||
* The rest of each buffer occupies virtual space, but has no
|
||||
* physical memory allocated for it.
|
||||
*/
|
||||
curbuf = (vaddr_t) buffers + i * MAXBSIZE;
|
||||
curbufsize = NBPG * (i < residual ? base + 1 : base);
|
||||
while (curbufsize) {
|
||||
pg = uvm_pagealloc(NULL, 0, NULL, 0);
|
||||
if (pg == NULL)
|
||||
panic("cpu_startup: "
|
||||
"not enough RAM for buffer cache");
|
||||
pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
|
||||
VM_PROT_READ | VM_PROT_WRITE);
|
||||
curbuf += NBPG;
|
||||
curbufsize -= NBPG;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a submap for exec arguments. This map effectively limits
|
||||
* the number of processes exec'ing at any time.
|
||||
* At most one process with the full length is allowed.
|
||||
*/
|
||||
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
NCARGS/4, VM_MAP_PAGEABLE, FALSE, NULL);
|
||||
|
||||
/*
|
||||
* allocate mbuf cluster submap.
|
||||
*/
|
||||
mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
nmbclusters * mclbytes, VM_MAP_INTRSAFE, FALSE, NULL);
|
||||
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free)/4);
|
||||
pbuf[strlen(pbuf)-1] = 0; /* Remove 'B' */
|
||||
printf("avail memory = %sW\n", pbuf);
|
||||
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * NBPG/4);
|
||||
pbuf[strlen(pbuf)-1] = 0; /* Remove 'B' */
|
||||
printf("using %d buffers containing %sW of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disk labels.
|
||||
*/
|
||||
|
||||
bufinit();
|
||||
#ifdef DDB
|
||||
if (boothowto & RB_KDB)
|
||||
Debugger();
|
||||
#endif
|
||||
|
||||
kl10_conf();
|
||||
}
|
||||
|
||||
void
|
||||
consinit()
|
||||
{
|
||||
void dtecninit(struct consdev *);
|
||||
dtecninit(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
process_read_regs(struct lwp *p, struct reg *regs)
|
||||
{
|
||||
panic("process_read_regs");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
cpu_dumpconf()
|
||||
{
|
||||
panic("cpu_dumpconf");
|
||||
}
|
||||
|
||||
void
|
||||
setstatclockrate(int hzrate)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
sys___sigreturn14(struct lwp *p, void *v, register_t *retval)
|
||||
{
|
||||
panic("sys___sigreturn14");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
sendsig(int sig, sigset_t *mask, u_long code)
|
||||
{
|
||||
panic("sendsig");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_wait(struct lwp *p)
|
||||
{
|
||||
panic("cpu_wait");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_exit(struct lwp *p, int a)
|
||||
{
|
||||
panic("cpu_exit");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_reboot(int howto, char *b)
|
||||
{
|
||||
printf("cpu_reboot\n");
|
||||
asm("jrst 4,0765432");
|
||||
panic("foo");
|
||||
}
|
||||
|
||||
int
|
||||
cpu_sysctl(int *a, u_int b, void *c, size_t *d, void *e,
|
||||
size_t f, struct proc *g)
|
||||
{
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
int
|
||||
process_set_pc(struct lwp *p, caddr_t addr)
|
||||
{
|
||||
panic("process_set_pc");
|
||||
}
|
||||
|
||||
int
|
||||
process_sstep(struct lwp *p, int sstep)
|
||||
{
|
||||
panic("process_sstep");
|
||||
}
|
||||
|
||||
int
|
||||
process_write_regs(struct lwp *p, struct reg *regs)
|
||||
{
|
||||
panic("process_write_regs");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_upcall(struct lwp *l, int type, int nevents, int ninterrupted,
|
||||
void *sas, void *ap, void *sp, sa_upcall_t upcall)
|
||||
{
|
||||
panic("cpu_upcall");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags)
|
||||
{
|
||||
panic("cpu_getmcontext");
|
||||
}
|
||||
|
||||
int
|
||||
cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
|
||||
{
|
||||
panic("cpu_setmcontext");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
cpu_switch (struct lwp *p, struct lwp *op)
|
||||
{
|
||||
panic("cpu_switch");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_switchto (struct lwp *p, struct lwp *op)
|
||||
{
|
||||
panic("cpu_switchto");
|
||||
}
|
||||
|
162
sys/arch/pdp10/pdp10/mem.c
Normal file
162
sys/arch/pdp10/pdp10/mem.c
Normal file
@ -0,0 +1,162 @@
|
||||
/* $NetBSD: mem.c,v 1.1 2003/08/19 10:55:00 ragge 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.
|
||||
*
|
||||
* 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/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.1 2003/08/19 10:55:00 ragge Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
extern char *vmmap; /* poor name! */
|
||||
caddr_t zeropage;
|
||||
|
||||
dev_type_read(mmrw);
|
||||
dev_type_ioctl(mmioctl);
|
||||
|
||||
const struct cdevsw mem_cdevsw = {
|
||||
nullopen, nullclose, mmrw, mmrw, mmioctl,
|
||||
nostop, notty, nopoll, nommap, nokqfilter,
|
||||
};
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mmrw(dev, uio, flags)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
{
|
||||
register vaddr_t o, v;
|
||||
register int c;
|
||||
register struct iovec *iov;
|
||||
int error = 0;
|
||||
static int physlock;
|
||||
vm_prot_t prot;
|
||||
|
||||
if (minor(dev) == DEV_MEM) {
|
||||
/* lock against other uses of shared vmmap */
|
||||
while (physlock > 0) {
|
||||
physlock++;
|
||||
error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
|
||||
"mmrw", 0);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
physlock = 1;
|
||||
}
|
||||
while (uio->uio_resid > 0 && !error) {
|
||||
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)) {
|
||||
case DEV_MEM:
|
||||
v = uio->uio_offset;
|
||||
prot = uio->uio_rw == UIO_READ ? VM_PROT_READ :
|
||||
VM_PROT_WRITE;
|
||||
pmap_enter(pmap_kernel(), (vaddr_t)vmmap,
|
||||
trunc_page(v), prot, PMAP_WIRED|prot);
|
||||
pmap_update(pmap_kernel());
|
||||
o = uio->uio_offset & PGOFSET;
|
||||
c = min(uio->uio_resid, (int)(PAGE_SIZE - o));
|
||||
error = uiomove((caddr_t)vmmap + o, c, uio);
|
||||
pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
|
||||
(vaddr_t)vmmap + PAGE_SIZE);
|
||||
pmap_update(pmap_kernel());
|
||||
break;
|
||||
|
||||
case DEV_KMEM:
|
||||
v = uio->uio_offset;
|
||||
c = min(iov->iov_len, MAXPHYS);
|
||||
if (!uvm_kernacc((caddr_t)v, c,
|
||||
uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
|
||||
return (EFAULT);
|
||||
error = uiomove((caddr_t)v, c, uio);
|
||||
break;
|
||||
|
||||
case DEV_NULL:
|
||||
if (uio->uio_rw == UIO_WRITE)
|
||||
uio->uio_resid = 0;
|
||||
return (0);
|
||||
|
||||
case DEV_ZERO:
|
||||
if (uio->uio_rw == UIO_WRITE) {
|
||||
uio->uio_resid = 0;
|
||||
return (0);
|
||||
}
|
||||
if (zeropage == NULL) {
|
||||
zeropage = (caddr_t)
|
||||
malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
|
||||
memset(zeropage, 0, PAGE_SIZE);
|
||||
}
|
||||
c = min(iov->iov_len, PAGE_SIZE);
|
||||
error = uiomove(zeropage, c, uio);
|
||||
break;
|
||||
|
||||
default:
|
||||
return (ENXIO);
|
||||
}
|
||||
}
|
||||
if (minor(dev) == DEV_MEM) {
|
||||
if (physlock > 1)
|
||||
wakeup((caddr_t)&physlock);
|
||||
physlock = 0;
|
||||
}
|
||||
return (error);
|
||||
}
|
393
sys/arch/pdp10/pdp10/pmap.c
Normal file
393
sys/arch/pdp10/pdp10/pmap.c
Normal file
@ -0,0 +1,393 @@
|
||||
/* $NetBSD: pmap.c,v 1.1 2003/08/19 10:55:00 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
#include <uvm/uvm.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <machine/pcb.h>
|
||||
#include <machine/io.h>
|
||||
|
||||
#define PGSH 9 /* Page shift in words */
|
||||
#define PGSZ (1 << PGSH) /* Page size in words */
|
||||
#define SECTSZ (PGSZ << PGSH) /* Size of a section */
|
||||
#define NSECT 32 /* 32 sections */
|
||||
#define PTOV_COMP 2 /* Shift to compensate for word addresses */
|
||||
|
||||
#define SEGNO(addr) ((addr) >> 18) /* Get segment */
|
||||
#define PGINSEG(page) (((page) & 0777000) >> PGSH)
|
||||
#define PGNO(page) ((page) >> PGSH)
|
||||
|
||||
#define mk2word(x) ((x) /= 4)
|
||||
#define word2byte(x) ((x) * 4)
|
||||
|
||||
#define PMAPDEBUG
|
||||
#ifdef PMAPDEBUG
|
||||
int startpmapdebug = 0;
|
||||
#define PMDEBUG(x) if (startpmapdebug)printf x
|
||||
#else
|
||||
#define PMDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CLRPT(x) \
|
||||
asm("move 6,%0 \n .long 0701106000000" : : "r"(x) : "6");
|
||||
#endif
|
||||
#ifdef __PCC__
|
||||
#define CLRPT(x) clrpt(x)
|
||||
void clrpt(int);
|
||||
#endif
|
||||
|
||||
void pmap_bootstrap(void);
|
||||
int badaddr(int addr);
|
||||
|
||||
struct pmap kernel_pmap_store;
|
||||
char *vmmap;
|
||||
static int *mapaddr, *mappte; /* Used for pmap_{copy,zero}_page */
|
||||
extern int avail_start, avail_end; /* These are in words, not bytes */
|
||||
extern struct ept *ept;
|
||||
extern int proc0paddr;
|
||||
|
||||
void
|
||||
pmap_bootstrap()
|
||||
{
|
||||
int i, guardpage;
|
||||
extern caddr_t msgbufaddr;
|
||||
TUNION uu;
|
||||
|
||||
/*
|
||||
* Setup executive and user process table but do not enable paging.
|
||||
*/
|
||||
DATAO(PAG,proc0paddr >> PGSH | PAG_DATA_LUBA | PAG_DATA_DNUA);
|
||||
CONO(PAG, TPTOINT(ept) >> PGSH);
|
||||
|
||||
#ifdef notyet
|
||||
/* Count up memory */
|
||||
for (i = 1*1024*1024; ; i += PGSZ)
|
||||
if (badaddr(i))
|
||||
break;
|
||||
#else
|
||||
i = 4*1024*1024;
|
||||
#endif
|
||||
avail_end = i;
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
extern int end[];
|
||||
consinit();
|
||||
printf("Kernel end %o kstack end %o\n", end, avail_start);
|
||||
printf("EPT %o UPT %o\n", ept, proc0paddr);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enter the following 32 pages as kernel page table pages.
|
||||
* Skip section 0 page, and let it act as a guard page.
|
||||
*/
|
||||
guardpage = avail_start;
|
||||
for (i = 0; i < NSECT; i++) {
|
||||
ept->ept_section[i] = PG_IMM|PG_WRITE | PGNO(avail_start);
|
||||
avail_start += PGSZ;
|
||||
}
|
||||
/* Map kernel memory 1:1 */
|
||||
for (i = KERNBASE; i < avail_start; i += PGSZ)
|
||||
pmap_kenter_pa(i*4, i*4, VM_PROT_READ|VM_PROT_WRITE);
|
||||
|
||||
/* Map in page 0 at page 0. It is used for interrupts */
|
||||
pmap_kenter_pa(0, 0, VM_PROT_READ|VM_PROT_WRITE);
|
||||
|
||||
/* Remove section page for section 0. Used as a guard page */
|
||||
{ /* XXX - use pmap_kremove */
|
||||
int *ptep = TINTTOP((ept->ept_section[1] & 07777777) << PGSH);
|
||||
mappte = &ptep[PGINSEG(guardpage)];
|
||||
mapaddr = TINTTOP(guardpage);
|
||||
ptep[PGINSEG(guardpage)] = 0;
|
||||
}
|
||||
|
||||
/* Set logical page size */
|
||||
uvmexp.pagesize = NBPG;
|
||||
uvm_setpagesize();
|
||||
physmem = avail_end/PGSZ;
|
||||
|
||||
/* Kernel message buffer */
|
||||
avail_end -= MSGBUFSIZE/4;
|
||||
msgbufaddr = TINTTOCP(avail_start | 0700000000000);
|
||||
for (i = 0; i < MSGBUFSIZE/4; i += PGSZ)
|
||||
pmap_kenter_pa(word2byte(avail_start+i),
|
||||
word2byte(avail_end+i), VM_PROT_READ|VM_PROT_WRITE);
|
||||
avail_start += MSGBUFSIZE/4;
|
||||
|
||||
/*
|
||||
* Give away memory to UVM.
|
||||
*/
|
||||
uvm_page_physload(avail_start >> PGSH, avail_end >> PGSH,
|
||||
avail_start >> PGSH, avail_end >> PGSH, VM_FREELIST_DEFAULT);
|
||||
#ifdef notyet
|
||||
/* Lost section zero pages */
|
||||
uvm_page_physload(0, PGSZ. 0, PGSZ, VM_FREELIST_DEFAULT);
|
||||
#endif
|
||||
#if 0
|
||||
kernel_pmap_store.pm_count = 1;
|
||||
simple_lock_init(&kernel_pmap_store.pm_lock);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ready! Turn on paging.
|
||||
*/
|
||||
CONO(PAG,TPTOINT(ept) >> PGSH | PAG_CON_ENABLE | PAG_CON_T20);
|
||||
DATAO(PAG,proc0paddr >> PGSH | PAG_DATA_LUBA | PAG_DATA_DNUA);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("section pages at %o\n", guardpage);
|
||||
printf("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
pmap_virtual_space(vaddr_t *v1, vaddr_t *v2)
|
||||
{
|
||||
*v1 = avail_start * sizeof(int);
|
||||
*v2 = 0200000000; /* Max virtual memory address in bytes */
|
||||
}
|
||||
|
||||
long
|
||||
pmap_resident_count(pmap_t pmap)
|
||||
{
|
||||
panic("pmap_resident_count");
|
||||
}
|
||||
|
||||
void
|
||||
pmap_update(pmap_t pmap)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
pmap_kenter_pa(vaddr_t v, paddr_t p, vm_prot_t prot)
|
||||
{
|
||||
int seg, off, pte, *ptep;
|
||||
TUNION uu;
|
||||
|
||||
seg = (v >> 20) & 0777;
|
||||
off = (v >> 11) & 0777;
|
||||
|
||||
PMDEBUG(("pmap_kenter_pa: va: %lo, pa %lo, prot %o\n", v/4, p/4, prot));
|
||||
|
||||
if (ept->ept_section[seg] == 0)
|
||||
panic("pmap_kenter_pa: need to add section, va %o", v);
|
||||
ptep = TINTTOP(((ept->ept_section[seg] & 07777777) << PGSH));
|
||||
pte = PG_IMM | (p >> 11);
|
||||
if (prot & VM_PROT_WRITE)
|
||||
pte |= PG_WRITE;
|
||||
ptep[off] = pte;
|
||||
}
|
||||
|
||||
void
|
||||
pmap_kremove(vaddr_t v, vsize_t size)
|
||||
{
|
||||
panic("pmap_kremove");
|
||||
}
|
||||
|
||||
boolean_t
|
||||
pmap_clear_modify(struct vm_page *vm)
|
||||
{
|
||||
panic("pmap_clear_modify");
|
||||
}
|
||||
|
||||
void
|
||||
pmap_page_protect(struct vm_page *vm, vm_prot_t prot)
|
||||
{
|
||||
panic("pmap_page_protect");
|
||||
}
|
||||
|
||||
boolean_t
|
||||
pmap_clear_reference(struct vm_page *vm)
|
||||
{
|
||||
panic("pmap_clear_reference");
|
||||
}
|
||||
|
||||
void
|
||||
pmap_remove(pmap_t pmap, vaddr_t v1, vaddr_t v2)
|
||||
{
|
||||
panic("pmap_remove");
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the physical page address for the virtual address v.
|
||||
* Return FALSE if no mapping exists.
|
||||
*/
|
||||
boolean_t
|
||||
pmap_extract(pmap_t pmap, vaddr_t v, paddr_t *pp)
|
||||
{
|
||||
int nv = v >> PTOV_COMP;
|
||||
int seg, pga, pg, *pgp, paddr;
|
||||
|
||||
if (pmap != pmap_kernel())
|
||||
panic("pmap_extract");
|
||||
seg = SEGNO(nv);
|
||||
if (((pga = ept->ept_section[seg]) & PG_IMM) == 0)
|
||||
return FALSE;
|
||||
pg = PGINSEG(nv);
|
||||
pgp = (int *)(((pga << PGSH) & 017777777) << PTOV_COMP);
|
||||
if (((paddr = pgp[pg]) & PG_IMM) == 0)
|
||||
return FALSE;
|
||||
*pp = (paddr << PGSH) & 037777777;
|
||||
*pp <<= PTOV_COMP;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
pmap_enter(pmap_t pmap, vaddr_t v, paddr_t p, vm_prot_t prot, int flags)
|
||||
{
|
||||
PMDEBUG(("pmap_enter: pmap %o v %o p %o prot %o access %o\n",
|
||||
pmap, v/4, p/4, prot, flags & VM_PROT_ALL));
|
||||
|
||||
if (pmap != pmap_kernel())
|
||||
panic("user mapping");
|
||||
pmap_kenter_pa(v, p, prot); /* XXX */
|
||||
return 0;
|
||||
}
|
||||
|
||||
paddr_t
|
||||
pmap_phys_address(int a)
|
||||
{
|
||||
panic("pmap_phys_address");
|
||||
}
|
||||
|
||||
void
|
||||
pmap_unwire(pmap_t pmap, vaddr_t v)
|
||||
{
|
||||
panic("pmap_unwire");
|
||||
}
|
||||
|
||||
void
|
||||
pmap_collect(pmap_t pmap)
|
||||
{
|
||||
panic("pmap_collect");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_swapout(struct lwp *p)
|
||||
{
|
||||
panic("cpu_swapout");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_swapin(struct lwp *p)
|
||||
{
|
||||
panic("cpu_swapin");
|
||||
}
|
||||
|
||||
/*
|
||||
* Increment the reference count.
|
||||
*/
|
||||
void
|
||||
pmap_reference(pmap_t pmap)
|
||||
{
|
||||
#ifdef notyet
|
||||
pmap->pm_count++;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
pmap_protect(pmap_t pmap, vaddr_t v1, vaddr_t v2, vm_prot_t prot)
|
||||
{
|
||||
panic("pmap_protect");
|
||||
}
|
||||
|
||||
void
|
||||
pmap_destroy(pmap_t pmap)
|
||||
{
|
||||
panic("pmap_destroy");
|
||||
}
|
||||
|
||||
void
|
||||
pmap_activate(struct lwp *p)
|
||||
{
|
||||
panic("pmap_activate");
|
||||
}
|
||||
|
||||
void
|
||||
pmap_deactivate(struct lwp *p)
|
||||
{
|
||||
panic("pmap_deactivate");
|
||||
}
|
||||
|
||||
struct pmap *
|
||||
pmap_create()
|
||||
{
|
||||
struct pmap *pmap;
|
||||
|
||||
MALLOC(pmap, struct pmap *, sizeof(*pmap), M_VMPMAP, M_WAITOK);
|
||||
memset(pmap, 0, sizeof(struct pmap));
|
||||
return (pmap);
|
||||
}
|
||||
|
||||
void
|
||||
pmap_copy(pmap_t pm1, pmap_t pm2, vaddr_t v1, vsize_t ax, vaddr_t v2)
|
||||
{
|
||||
panic("pmap_copy");
|
||||
}
|
||||
|
||||
void
|
||||
pmap_zero_page(paddr_t p)
|
||||
{
|
||||
PMDEBUG(("pmap_zero_page: paddr %o\n", p >> 2));
|
||||
mk2word(p);
|
||||
|
||||
*mappte = PG_IMM | PG_WRITE | PGNO(p);
|
||||
memset(mapaddr, 0, PGSZ);
|
||||
*mappte = 0;
|
||||
CLRPT((int)mapaddr);
|
||||
}
|
||||
|
||||
void
|
||||
pmap_copy_page(paddr_t p1, paddr_t p2)
|
||||
{
|
||||
panic("pmap_copy_page");
|
||||
}
|
||||
|
||||
/*
|
||||
* Init VM pmap system. Nothing special to do.
|
||||
*/
|
||||
void
|
||||
pmap_init()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove all mappings.
|
||||
*/
|
||||
void
|
||||
pmap_remove_all(struct pmap *p)
|
||||
{
|
||||
}
|
74
sys/arch/pdp10/pdp10/trap.c
Normal file
74
sys/arch/pdp10/pdp10/trap.c
Normal file
@ -0,0 +1,74 @@
|
||||
/* $NetBSD: trap.c,v 1.1 2003/08/19 10:55:00 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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/systm.h>
|
||||
#include <sys/exec.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <machine/pcb.h>
|
||||
|
||||
void syscall(void);
|
||||
void pagefail(struct pcb *pcb);
|
||||
|
||||
void
|
||||
pagefail(struct pcb *pcb)
|
||||
{
|
||||
printf("pagefail at %o word %012o flags %012o\n", pcb->pcb_pfopc,
|
||||
pcb->pcb_pfw, pcb->pcb_pff);
|
||||
|
||||
panic("pagefail");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
syscall(void)
|
||||
{
|
||||
panic("syscall");
|
||||
}
|
||||
|
||||
void
|
||||
setregs(struct lwp *p, struct exec_package *epp, u_long stack)
|
||||
{
|
||||
panic("setregs");
|
||||
}
|
||||
|
||||
void
|
||||
child_return(void *arg)
|
||||
{
|
||||
panic("child_return");
|
||||
}
|
||||
|
||||
void
|
||||
upcallret(struct lwp *l)
|
||||
{
|
||||
/* XXX - profiling */
|
||||
panic("upcallret");
|
||||
/* userret(l, l->l_addr->u_pcb.framep, l->l_proc->p_sticks); */
|
||||
}
|
89
sys/arch/pdp10/pdp10/vm_machdep.c
Normal file
89
sys/arch/pdp10/pdp10/vm_machdep.c
Normal file
@ -0,0 +1,89 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.1 2003/08/19 10:55:00 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
|
||||
* 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. 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/signalvar.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/sa.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
void
|
||||
pagemove(caddr_t from, caddr_t to, size_t size)
|
||||
{
|
||||
panic("pagemove");
|
||||
}
|
||||
|
||||
int
|
||||
cpu_coredump(struct lwp *p, struct vnode *vp,
|
||||
struct ucred *cred, struct core *chdr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sys_sysarch(struct lwp *p, void *v, register_t *retval)
|
||||
{
|
||||
return (ENOSYS);
|
||||
}
|
||||
|
||||
void
|
||||
vmapbuf(struct buf *bp, vsize_t len)
|
||||
{
|
||||
panic("vmapbuf");
|
||||
}
|
||||
|
||||
void
|
||||
vunmapbuf(struct buf *bp, vsize_t len)
|
||||
{
|
||||
panic("vunmapbuf");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
|
||||
void (*func)(void *), void *arg)
|
||||
{
|
||||
panic("cpu_lwp_fork");
|
||||
}
|
||||
|
||||
void
|
||||
cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg)
|
||||
{
|
||||
panic("cpu_setfunc");
|
||||
}
|
||||
|
||||
/*
|
||||
* Start a new LWP
|
||||
*/
|
||||
void
|
||||
startlwp(void *arg)
|
||||
{
|
||||
panic("startlwp");
|
||||
}
|
Loading…
Reference in New Issue
Block a user