diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2001-06-26 03:34:52 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2001-06-26 03:34:52 +0000 |
commit | d2aa366e5deea752b8a6dbaf7dd6d0e442ac912c (patch) | |
tree | a6104c412c05b2df3fdd7f06d36cf03ff2409371 /sys | |
parent | 9be5bb13825f44778075a9cc61d93df3d2a7b414 (diff) |
bye bye
--
Ok'd by deraadt@ & ericj@
Diffstat (limited to 'sys')
59 files changed, 0 insertions, 12483 deletions
diff --git a/sys/arch/mips/README b/sys/arch/mips/README deleted file mode 100644 index 42befb130d8..00000000000 --- a/sys/arch/mips/README +++ /dev/null @@ -1,9 +0,0 @@ -This directory is intended to include all Mips common code used by several -ports. This is mainly include files, common locore code, trap code, mmu -code etc. - -Any code added here must be endian safe. Code with different ISA targets -has to be well documented and preferbly generate error messages if compiled -without the appropriate switches set. - -Questions can be directed to pefo@openbsd.org. diff --git a/sys/arch/mips/conf/files.mips b/sys/arch/mips/conf/files.mips deleted file mode 100644 index 2e30373c505..00000000000 --- a/sys/arch/mips/conf/files.mips +++ /dev/null @@ -1,11 +0,0 @@ -# $OpenBSD: files.mips,v 1.2 1998/03/16 09:02:53 pefo Exp $ - -file arch/mips/mips/clock.c -file arch/mips/mips/cpu_ecoff.c -file arch/mips/mips/disksubr.c -file arch/mips/mips/mem.c -file arch/mips/mips/process_machdep.c -file arch/mips/mips/sys_machdep.c -file arch/mips/mips/vm_machdep.c -file arch/mips/mips/db_disasm.c ddb -file arch/mips/mips/db_machdep.c ddb diff --git a/sys/arch/mips/dev/clock_ds.c b/sys/arch/mips/dev/clock_ds.c deleted file mode 100644 index 61e6c042ea3..00000000000 --- a/sys/arch/mips/dev/clock_ds.c +++ /dev/null @@ -1,271 +0,0 @@ -/* $OpenBSD: clock_ds.c,v 1.1 1998/01/29 15:06:17 pefo Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <machine/autoconf.h> -#include <machine/pio.h> -#include <machine/cpu.h> - -#include <mips/dev/clockvar.h> -#include <mips/archtype.h> -#include <mips/dev/ds1386reg.h> - - -void md_clk_attach __P((struct device *, struct device *, void *)); -static void dsclk_init __P((struct clock_softc *)); -static void dsclk_get __P((struct clock_softc *, time_t, struct tod_time *)); -static void dsclk_set __P((struct clock_softc *, struct tod_time *)); - -struct dsclkdata { - void (*ds_write) __P((struct clock_softc *, u_int, u_int)); - u_int (*ds_read) __P((struct clock_softc *, u_int)); - void *ds_addr; -}; - -#define ds1386_write(sc, reg, datum) \ - (*((struct dsclkdata *)sc->sc_data)->ds_write)(sc, reg, datum) -#define ds1386_read(sc, reg) \ - (*((struct dsclkdata *)sc->sc_data)->ds_read)(sc, reg) - -#ifdef hkmips -static void ds_write_laguna __P((struct clock_softc *, u_int, u_int)); -static u_int ds_read_laguna __P((struct clock_softc *, u_int)); -static struct dsclkdata dsclkdata_laguna = { - ds_write_laguna, - ds_read_laguna, - (void *)NULL -}; -static u_char ethaddr[8]; -#endif - -#ifdef sgi -u_int32_t cpu_counter_interval; /* Number of counter ticks/tick */ -u_int32_t cpu_counter_last; /* Last compare value loaded */ - -static void ds_write_sgi_indy __P((struct clock_softc *, u_int, u_int)); -static u_int ds_read_sgi_indy __P((struct clock_softc *, u_int)); -static struct dsclkdata dsclkdata_sgi_indy = { - ds_write_sgi_indy, - ds_read_sgi_indy, - (void *)NULL -}; -#endif - -void -md_clk_attach(parent, self, aux) - struct device *parent; - struct device *self; - void *aux; -{ - struct clock_softc *sc; - struct confargs *ca; - - sc = (struct clock_softc *)self; - ca = aux; - - printf(": DS1[234]86 or compatible"); - - sc->sc_init = dsclk_init; - sc->sc_get = dsclk_get; - sc->sc_set = dsclk_set; - - switch (system_type) { - -#ifdef hkmips - case LAGUNA: - /* - * XXX should really allocate a new one and copy, or - * something. unlikely we'll have more than one... - */ - sc->sc_data = &dsclkdata_laguna; - dsclkdata_laguna.ds_addr = BUS_CVTADDR(ca); - - ethaddr[0] = ds_read_laguna(sc, DS_ETHERADR+0); - ethaddr[1] = ds_read_laguna(sc, DS_ETHERADR+1); - ethaddr[2] = ds_read_laguna(sc, DS_ETHERADR+2); - ethaddr[3] = ds_read_laguna(sc, DS_ETHERADR+3); - ethaddr[4] = ds_read_laguna(sc, DS_ETHERADR+4); - ethaddr[5] = ds_read_laguna(sc, DS_ETHERADR+5); - break; -#endif - -#ifdef sgi - case SGI_INDY: - sc->sc_data = &dsclkdata_sgi_indy; - dsclkdata_sgi_indy.ds_addr = BUS_CVTADDR(ca); - break; -#endif - default: - printf("\n"); - panic("don't know how to set up for other system types."); - } - - /* Turn interrupts off, just in case. */ - ds1386_write(sc, DS_REGC, DS_REGC_TE); -} - -/* - * Clock initialization. - * - * INDY's use the CPU timer register to generate the - * system ticker. This due to a rumour that the 8254 - * has a bug that makes it unusable. Well who knows... - */ -static void -dsclk_init (sc) - struct clock_softc *sc ; -{ -#ifdef sgi - /* XXX get cpu frquency! */ - cpu_counter_interval = 50000000 / hz; - cpu_counter_last = R4K_GetCOUNT(); - cpu_counter_last += cpu_counter_interval; - R4K_SetCOMPARE(cpu_counter_last); -#endif -} - -/* - * Get the clock device idea of the time of day. - */ -static void -dsclk_get(sc, base, ct) - struct clock_softc *sc; - time_t base; - struct tod_time *ct; -{ - ds_todregs regs; - int s; - - s = splclock(); - DS1386_GETTOD(sc, ®s) - splx(s); - -#define hex_to_bin(x,m) (((x) & m & 0xf) + (((x) & m) >> 4) * 10) - ct->sec = hex_to_bin(regs[DS_SEC], 0x7f); - ct->min = hex_to_bin(regs[DS_MIN], 0x7f); - ct->hour = hex_to_bin(regs[DS_HOUR], 0x3f); - ct->dow = hex_to_bin(regs[DS_DOW], 0x07); - ct->day = hex_to_bin(regs[DS_DOM], 0x3f); - ct->mon = hex_to_bin(regs[DS_MONTH], 0x1f); - ct->year = hex_to_bin(regs[DS_YEAR], 0xff); - -printf("%d:%d:%d-%d-%d-%d\n", ct->hour, ct->min, ct->sec, ct->year, ct->mon, ct->day); -} - -/* - * Reset the clock device to the current time value. - */ -static void -dsclk_set(sc, ct) - struct clock_softc *sc; - struct tod_time *ct; -{ - ds_todregs regs; - int s; - - s = splclock(); - DS1386_GETTOD(sc, ®s); - splx(s); - -#define bin_to_hex(x,m) ((((x) / 10 << 4) + (x) % 10) & m) - regs[DS_SEC_100] = 0x00; - regs[DS_SEC] = bin_to_hex(ct->sec, 0x7f); - regs[DS_MIN] = bin_to_hex(ct->min, 0x7f); - regs[DS_HOUR] = bin_to_hex(ct->hour, 0x3f); - regs[DS_DOW] = bin_to_hex(ct->dow, 0x07); - regs[DS_DOM] = bin_to_hex(ct->day, 0x3f); - regs[DS_MONTH] = bin_to_hex(ct->mon, 0x1f); - regs[DS_YEAR] = bin_to_hex(ct->year, 0xff); - - s = splclock(); - DS1386_PUTTOD(sc, ®s); - splx(s); -} - - -/* - * Clock register acces routines for different clock chips - */ - -#ifdef hkmips -static void -ds_write_laguna(sc, reg, datum) - struct clock_softc *sc; - u_int reg, datum; -{ - int i,brc1; - - brc1 = inb(LAGUNA_BRC1_REG); - outb(LAGUNA_BRC1_REG, brc1 | LAGUNA_BRC1_ENRTCWR); - outb(((struct dsclkdata *)sc->sc_data)->ds_addr + (reg * 4), datum); -} - -static u_int -ds_read_laguna(sc, reg) - struct clock_softc *sc; - u_int reg; -{ - int i; - - i = inb(((struct dsclkdata *)sc->sc_data)->ds_addr + (reg * 4)); - i &= 0xff; - return(i); -} -#endif - -#ifdef sgi -static void -ds_write_sgi_indy(sc, reg, datum) - struct clock_softc *sc; - u_int reg, datum; -{ - outb(((struct dsclkdata *)sc->sc_data)->ds_addr + (reg * 4), datum); -} - -static u_int -ds_read_sgi_indy(sc, reg) - struct clock_softc *sc; - u_int reg; -{ - int i; - - i = inb(((struct dsclkdata *)sc->sc_data)->ds_addr + (reg * 4)); - i &= 0xff; - return(i); -} -#endif diff --git a/sys/arch/mips/dev/clockvar.h b/sys/arch/mips/dev/clockvar.h deleted file mode 100644 index f5420f436ac..00000000000 --- a/sys/arch/mips/dev/clockvar.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $OpenBSD: clockvar.h,v 1.1 1998/01/29 15:06:19 pefo Exp $ */ -/* $NetBSD: clockvar.h,v 1.1 1995/06/28 02:44:59 cgd Exp $ */ - -/* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * Adopted for r4400: Per Fogelstrom - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -/* - * Definitions for "cpu-independent" clock handling for the mips arc arch. - */ - -/* - * clocktime structure: - * - * structure passed to TOY clocks when setting them. broken out this - * way, so that the time_t -> field conversion can be shared. - */ -struct tod_time { - int year; /* year - 1900 */ - int mon; /* month (1 - 12) */ - int day; /* day (1 - 31) */ - int hour; /* hour (0 - 23) */ - int min; /* minute (0 - 59) */ - int sec; /* second (0 - 59) */ - int dow; /* day of week (0 - 6; 0 = Sunday) */ -}; - -/* - * clockdesc structure: - * - * provides clock-specific functions to do necessary operations. - */ -struct clock_softc { - struct device sc_dev; - - /* - * The functions that all types of clock provide. - */ - void (*sc_attach) __P((struct device *, struct device *, void *)); - void (*sc_init) __P((struct clock_softc *)); - void (*sc_get) __P((struct clock_softc *, time_t, struct tod_time *)); - void (*sc_set) __P((struct clock_softc *, struct tod_time *)); - - /* - * Private storage for particular clock types. - */ - void *sc_data; - - /* - * Has the time been initialized? - */ - int sc_initted; -}; diff --git a/sys/arch/mips/dev/ds1386reg.h b/sys/arch/mips/dev/ds1386reg.h deleted file mode 100644 index 362ac80e7d5..00000000000 --- a/sys/arch/mips/dev/ds1386reg.h +++ /dev/null @@ -1,119 +0,0 @@ -/* $NetBSD: ds1386reg.h,v 1.1 1995/05/04 19:31:18 cgd Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -/* - * Definitions for the Dallas Semiconductor DS1386 Real Time Clock. - * - */ - -/* - * The registers, and the bits within each register. - */ - -#define DS_SEC_100 0x0 /* Time of year: hundreds seconds (0-99) */ -#define DS_SEC 0x1 /* Time of year: seconds (0-59) */ -#define DS_MIN 0x2 /* Time of year: minutes (0-59) */ -#define DS_HOUR 0x4 /* Time of year: hour (see above) */ -#define DS_DOW 0x6 /* Time of year: day of week (1-7) */ -#define DS_DOM 0x8 /* Time of year: day of month (1-31) */ -#define DS_MONTH 0x9 /* Time of year: month (1-12) */ -#define DS_YEAR 0xa /* Time of year: year in century (0-99) */ -#define DS_AMIN 0x3 /* Alarm: minutes */ -#define DS_AHOUR 0x5 /* Alarm: hour */ -#define DS_ADOW 0x7 /* Alarm: day */ - - - -#define DS_HOUR_12 0x40 /* 12-hour mode. In DS_HOUR reg */ -#define DS_EOSC 0x80 /* Enable TOD osc if 0. In DS_MONTH reg. */ - -#define DS_REGC 0xb /* Control register */ - -#define DS_REGC_TE 0x80 /* Transfer enable bit. 0 freezes regs */ -#define DS_REGC_IPSW 0x40 /* Interrupt routing bit */ -#define DS_REGC_WAM 0x08 /* Watchdog alarm int enab. 1 enables */ -#define DS_REGC_TDM 0x04 /* Time Of Day alarm int enab. 1 enables */ -#define DS_REGC_WAF 0x02 /* Watchdog alarm int status */ -#define DS_REGC_TDF 0x01 /* Time Of Day alarm int status */ - - -#define DS_NTODREGS 0xb /* 10 of those regs are for TOD and alarm */ - -#define DS_NVRAM_START 0xe /* start of NVRAM: offset 14 */ -#define DS_NVRAM_SIZE (0x8000-0xe) /* 32k of NVRAM */ - -/* - * Special NVRAM locations. - */ -#define DS_ETHERADR 0x115 /* Ethernet address */ - -/* - * RTC register/NVRAM read and write functions -- machine-dependent. - * Appropriately manipulate RTC registers to get/put data values. - */ -u_int ds1386_read __P((void *sc, u_int reg)); -void ds1386_write __P((void *sc, u_int reg, u_int datum)); - -/* - * A collection of TOD/Alarm registers. - */ -typedef u_int ds_todregs[DS_NTODREGS]; - -/* - * Get all of the TOD/Alarm registers - * Must be called at splhigh(), and with the RTC properly set up. - */ -#define DS1386_GETTOD(sc, regs) \ - do { \ - int i; \ - \ - /* wait for update; spin loop */ \ - i = ds1386_read(sc, DS_SEC_100); \ - while (ds1386_read(sc, DS_SEC_100) == i) \ - ; \ - \ - /* read all of the tod/alarm regs */ \ - for (i = 0; i < DS_NTODREGS; i++) \ - (*regs)[i] = ds1386_read(sc, i); \ - } while (0); - -/* - * Set all of the TOD/Alarm registers - * Must be called at splhigh(), and with the RTC properly set up. - */ -#define DS1386_PUTTOD(sc, regs) \ - do { \ - int i; \ - \ - /* stop updates while setting */ \ - ds1386_write(sc, DS_MONTH, DS_EOSC); \ - \ - /* write all of the tod/alarm regs */ \ - for (i = 0; i < DS_NTODREGS; i++) \ - ds1386_write(sc, i, (*regs)[i]); \ - \ - } while (0); diff --git a/sys/arch/mips/include/ansi.h b/sys/arch/mips/include/ansi.h deleted file mode 100644 index b9354728e50..00000000000 --- a/sys/arch/mips/include/ansi.h +++ /dev/null @@ -1,83 +0,0 @@ -/* $OpenBSD: ansi.h,v 1.4 2000/02/22 17:29:13 millert Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ansi.h 8.2 (Berkeley) 1/4/94 - */ - -#ifndef _MIPS_ANSI_H_ -#define _MIPS_ANSI_H_ - -/* - * Types which are fundamental to the implementation and may appear in - * more than one standard header are defined here. Standard headers - * then use: - * #ifdef _BSD_SIZE_T_ - * typedef _BSD_SIZE_T_ size_t; - * #undef _BSD_SIZE_T_ - * #endif - */ -#define _BSD_CLOCK_T_ unsigned long /* clock() */ -#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ -#define _BSD_SIZE_T_ unsigned int /* sizeof() */ -#define _BSD_SSIZE_T_ int /* byte count or error */ -#define _BSD_TIME_T_ int /* time() */ -#define _BSD_VA_LIST_ char * /* va_list */ -#define _BSD_CLOCKID_T_ int -#define _BSD_TIMER_T_ int - -/* - * Runes (wchar_t) is declared to be an ``int'' instead of the more natural - * ``unsigned long'' or ``long''. Two things are happening here. It is not - * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, - * it looks like 10646 will be a 31 bit standard. This means that if your - * ints cannot hold 32 bits, you will be in trouble. The reason an int was - * chosen over a long is that the is*() and to*() routines take ints (says - * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you - * lose a bit of ANSI conformance, but your programs will still work. - * - * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t - * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains - * defined for ctype.h. - */ -#define _BSD_WCHAR_T_ int /* wchar_t */ -#define _BSD_WINT_T_ int /* wint_t */ -#define _BSD_RUNE_T_ int /* rune_t */ - -/* - * We describe off_t here so its declaration can be visible to - * stdio without pulling in all of <sys/type.h>, thus appeasing ANSI. - */ -#define _BSD_OFF_T_ long long /* file offset */ - -#endif /* !_MIPS_ANSI_H_ */ diff --git a/sys/arch/mips/include/archtype.h b/sys/arch/mips/include/archtype.h deleted file mode 100644 index b90a59e1c1c..00000000000 --- a/sys/arch/mips/include/archtype.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $OpenBSD: archtype.h,v 1.6 1999/01/27 04:46:04 imp Exp $ */ -/* - * Copyright (c) 1997 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS_ARCHTYPE_H_ -#define _MIPS_ARCHTYPE_H_ -/* - * Define architectural identitys for the different Mips machines. - */ -#define ARC_CLASS 0x00 /* Arch class ARC */ -#define ACER_PICA_61 0x01 /* Acer Labs Pica 61 */ -#define MAGNUM 0x02 /* Mips MAGNUM R4000 */ -#define DESKSTATION_RPC44 0x03 /* Deskstation xxx */ -#define DESKSTATION_TYNE 0x04 /* Deskstation xxx */ -#define NKK_AQUARIUS 0x05 /* NKK R4{67}00 PC */ -#define NEC_R94 0x06 /* NEC Magnum class */ -#define SNI_RM200 0x07 /* Siemens Nixdorf RM200 */ - -#define SGI_CLASS 0x10 /* Silicon Graphics Class */ -#define SGI_CRIMSON 0x11 /* Crimson */ -#define SGI_ONYX 0x12 /* Onyx (!S model Challenge) */ -#define SGI_INDIGO 0x13 /* Indigo */ -#define SGI_POWER 0x14 /* POWER Challenge, POWER Onyx */ -#define SGI_INDY 0x15 /* Indy, Indigo2, Challenge S */ -#define SGI_POWER10 0x16 /* POWER Challenge R10k */ -#define SGI_POWERI 0x17 /* POWER Indigo2 */ -#define SGI_O2 0x18 /* O2/Moosehead */ - -#define ALGOR_CLASS 0x20 /* Algorithmics Class */ -#define ALGOR_P4032 0x21 /* ALGORITHMICS P-4032 */ -#define ALGOR_P5064 0x22 /* ALGORITHMICS P-5064 */ - -extern int system_type; /* Global system type indicator */ - -#endif /* !_MIPS_ARCHTYPE_H_ */ diff --git a/sys/arch/mips/include/asm.h b/sys/arch/mips/include/asm.h deleted file mode 100644 index eec81c0d31c..00000000000 --- a/sys/arch/mips/include/asm.h +++ /dev/null @@ -1,203 +0,0 @@ -/* $OpenBSD: asm.h,v 1.3 1999/06/01 17:54:32 pefo Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Copyright (C) 1989 Digital Equipment Corporation. - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies. - * Digital Equipment Corporation makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#ifndef _MIPS_ASM_H -#define _MIPS_ASM_H - -#include <machine/regdef.h> - -#ifndef ABICALLS -#define ABICALLS .abicalls -#endif - -#if defined(ABICALLS) && !defined(_KERNEL) - ABICALLS -#endif - -#define RCSID(x) - -#define _C_LABEL(x) x - -/* - * Define how to access unaligned data word - */ -#if defined(MIPSEL) || defined(__MIPSEL__) -#define LWLO lwl -#define LWHI lwr -#define SWLO swl -#define SWHI swr -#endif -#if defined(MIPSEB) || defined(__MIPSEB__) -#define LWLO lwr -#define LWHI lwl -#define SWLO swr -#define SWHI swl -#endif - -/* - * Code for setting gp reg if abicalls are used. - */ -#if defined(ABICALLS) && !defined(_KERNEL) -#define ABISETUP \ - .set noreorder; \ - .cpload t9; \ - .set reorder; -#else -#define ABISETUP -#endif - -/* - * Define -pg profile entry code. - */ -#if defined(GPROF) || defined(PROF) -#define MCOUNT \ - subu sp, sp, 32; \ - .cprestore 16; \ - sw ra, 28(sp); \ - sw gp, 24(sp); \ - .set noat; \ - .set noreorder; \ - move AT, ra; \ - jal _mcount; \ - subu sp, sp, 8; \ - lw ra, 28(sp); \ - addu sp, sp, 32; \ - .set reorder; \ - .set at; -#else -#define MCOUNT -#endif - -/* - * LEAF(x) - * - * Declare a leaf routine. - */ -#define LEAF(x) \ - .align 3; \ - .globl x; \ - .ent x, 0; \ -x: ; \ - .frame sp, 0, ra; \ - ABISETUP \ - MCOUNT - -#define ALEAF(x) \ - .globl x; \ -x: - -/* - * NLEAF(x) - * - * Declare a non-profiled leaf routine. - */ -#define NLEAF(x) \ - .align 3; \ - .globl x; \ - .ent x, 0; \ -x: ; \ - .frame sp, 0, ra; \ - ABISETUP - -/* - * NON_LEAF(x) - * - * Declare a non-leaf routine (a routine that makes other C calls). - */ -#define NON_LEAF(x, fsize, retpc) \ - .align 3; \ - .globl x; \ - .ent x, 0; \ -x: ; \ - .frame sp, fsize, retpc; \ - ABISETUP \ - MCOUNT - -/* - * NNON_LEAF(x) - * - * Declare a non-profiled non-leaf routine - * (a routine that makes other C calls). - */ -#define NNON_LEAF(x, fsize, retpc) \ - .align 3; \ - .globl x; \ - .ent x, 0; \ -x: ; \ - .frame sp, fsize, retpc \ - ABISETUP - -/* - * END(x) - * - * Mark end of a procedure. - */ -#define END(x) \ - .end x - -/* - * Macros to panic and printf from assembly language. - */ -#define PANIC(msg) \ - la a0, 9f; \ - jal panic; \ - MSG(msg) - -#define PRINTF(msg) \ - la a0, 9f; \ - jal printf; \ - MSG(msg) - -#define MSG(msg) \ - .rdata; \ -9: .asciiz msg; \ - .text - -#define ASMSTR(str) \ - .asciiz str; \ - .align 3 - -#endif /* _MIPS_ASM_H */ diff --git a/sys/arch/mips/include/cdefs.h b/sys/arch/mips/include/cdefs.h deleted file mode 100644 index a877ff00828..00000000000 --- a/sys/arch/mips/include/cdefs.h +++ /dev/null @@ -1,39 +0,0 @@ -/* $OpenBSD: cdefs.h,v 1.2 1999/01/27 04:46:04 imp Exp $ */ -/* $NetBSD: cdefs.h,v 1.3 1995/05/03 06:04:54 mellon Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#ifndef _MIPS_CDEFS_H_ -#define _MIPS_CDEFS_H_ - -#define _C_LABEL(x) _STRING(x) - -#define __indr_references(sym,msg) /* nothing */ -#define __warn_references(sym,msg) /* nothing */ - -#endif /* !_MIPS_CDEFS_H_ */ diff --git a/sys/arch/mips/include/cpu.h b/sys/arch/mips/include/cpu.h deleted file mode 100644 index cd507216c8c..00000000000 --- a/sys/arch/mips/include/cpu.h +++ /dev/null @@ -1,446 +0,0 @@ -/* $OpenBSD: cpu.h,v 1.6 1999/01/27 04:46:04 imp 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 and Rick Macklem. - * - * 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. - * - * Copyright (C) 1989 Digital Equipment Corporation. - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies. - * Digital Equipment Corporation makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94 - */ - -#ifndef _MIPS_CPU_H_ -#define _MIPS_CPU_H_ - -#include <machine/psl.h> - -#define KUSEG_ADDR 0x0 -#define CACHED_MEMORY_ADDR 0x80000000 -#define UNCACHED_MEMORY_ADDR 0xa0000000 -#define KSEG2_ADDR 0xc0000000 -#define MAX_MEM_ADDR 0xbe000000 -#define RESERVED_ADDR 0xbfc80000 - -#define CACHED_TO_PHYS(x) ((unsigned)(x) & 0x1fffffff) -#define PHYS_TO_CACHED(x) ((unsigned)(x) | CACHED_MEMORY_ADDR) -#define UNCACHED_TO_PHYS(x) ((unsigned)(x) & 0x1fffffff) -#define PHYS_TO_UNCACHED(x) ((unsigned)(x) | UNCACHED_MEMORY_ADDR) -#define VA_TO_CINDEX(x) ((unsigned)(x) & 0xffffff | CACHED_MEMORY_ADDR) -#define CACHED_TO_UNCACHED(x) (PHYS_TO_UNCACHED(CACHED_TO_PHYS(x))) - -#ifdef _KERNEL -/* - * The bits in the cause register. - * - * CR_BR_DELAY Exception happened in branch delay slot. - * CR_COP_ERR Coprocessor error. - * CR_IP Interrupt pending bits defined below. - * CR_EXC_CODE The exception type (see exception codes below). - */ -#define CR_BR_DELAY 0x80000000 -#define CR_COP_ERR 0x30000000 -#define CR_EXC_CODE 0x0000007c -#define CR_IP 0x0000FF00 -#define CR_EXC_CODE_SHIFT 2 - -/* - * The bits in the status register. All bits are active when set to 1. - */ -#define SR_COP_USABILITY 0xf0000000 -#define SR_COP_0_BIT 0x10000000 -#define SR_COP_1_BIT 0x20000000 -#define SR_RP 0x08000000 -#define SR_FR_32 0x04000000 -#define SR_RE 0x02000000 -#define SR_BOOT_EXC_VEC 0x00400000 -#define SR_TLB_SHUTDOWN 0x00200000 -#define SR_SOFT_RESET 0x00100000 -#define SR_DIAG_CH 0x00040000 -#define SR_DIAG_CE 0x00020000 -#define SR_DIAG_PE 0x00010000 -#define SR_KX 0x00000080 -#define SR_SX 0x00000040 -#define SR_UX 0x00000020 -#define SR_KSU_MASK 0x00000018 -#define SR_KSU_USER 0x00000010 -#define SR_KSU_SUPER 0x00000008 -#define SR_KSU_KERNEL 0x00000000 -#define SR_ERL 0x00000004 -#define SR_EXL 0x00000002 -#define SR_INT_ENAB 0x00000001 -/*#define SR_INT_MASK 0x0000ff00*/ - -/* - * The interrupt masks. - * If a bit in the mask is 1 then the interrupt is enabled (or pending). - */ -#define INT_MASK 0xff00 -#define INT_MASK_5 0x8000 -#define INT_MASK_4 0x4000 -#define INT_MASK_3 0x2000 -#define INT_MASK_2 0x1000 -#define INT_MASK_1 0x0800 -#define INT_MASK_0 0x0400 -#define HARD_INT_MASK 0xfc00 -#define SOFT_INT_MASK_1 0x0200 -#define SOFT_INT_MASK_0 0x0100 - -/* - * The bits in the context register. - */ -#define CNTXT_PTE_BASE 0xff800000 -#define CNTXT_BAD_VPN2 0x007ffff0 - -/* - * Location of exception vectors. - */ -#define RESET_EXC_VEC 0xbfc00000 -#define TLB_MISS_EXC_VEC 0x80000000 -#define XTLB_MISS_EXC_VEC 0x80000080 -#define CACHE_ERR_EXC_VEC 0x80000100 -#define GEN_EXC_VEC 0x80000180 - -/* - * Coprocessor 0 registers: - */ -#define COP_0_TLB_INDEX $0 -#define COP_0_TLB_RANDOM $1 -#define COP_0_TLB_LO0 $2 -#define COP_0_TLB_LO1 $3 -#define COP_0_TLB_CONTEXT $4 -#define COP_0_TLB_PG_MASK $5 -#define COP_0_TLB_WIRED $6 -#define COP_0_BAD_VADDR $8 -#define COP_0_COUNT $9 -#define COP_0_TLB_HI $10 -#define COP_0_COMPARE $11 -#define COP_0_STATUS_REG $12 -#define COP_0_CAUSE_REG $13 -#define COP_0_EXC_PC $14 -#define COP_0_PRID $15 -#define COP_0_CONFIG $16 -#define COP_0_LLADDR $17 -#define COP_0_WATCH_LO $18 -#define COP_0_WATCH_HI $19 -#define COP_0_TLB_XCONTEXT $20 -#define COP_0_ECC $26 -#define COP_0_CACHE_ERR $27 -#define COP_0_TAG_LO $28 -#define COP_0_TAG_HI $29 -#define COP_0_ERROR_PC $30 - -/* - * Values for the code field in a break instruction. - */ -#define BREAK_INSTR 0x0000000d -#define BREAK_VAL_MASK 0x03ff0000 -#define BREAK_VAL_SHIFT 16 -#define BREAK_KDB_VAL 512 -#define BREAK_SSTEP_VAL 513 -#define BREAK_BRKPT_VAL 514 -#define BREAK_SOVER_VAL 515 -#define BREAK_DDB_VAL 516 -#define BREAK_KDB (BREAK_INSTR | (BREAK_KDB_VAL << BREAK_VAL_SHIFT)) -#define BREAK_SSTEP (BREAK_INSTR | (BREAK_SSTEP_VAL << BREAK_VAL_SHIFT)) -#define BREAK_BRKPT (BREAK_INSTR | (BREAK_BRKPT_VAL << BREAK_VAL_SHIFT)) -#define BREAK_SOVER (BREAK_INSTR | (BREAK_SOVER_VAL << BREAK_VAL_SHIFT)) -#define BREAK_DDB (BREAK_INSTR | (BREAK_DDB_VAL << BREAK_VAL_SHIFT)) - -/* - * Mininum and maximum cache sizes. - */ -#define MIN_CACHE_SIZE (16 * 1024) -#define MAX_CACHE_SIZE (256 * 1024) - -/* - * The floating point version and status registers. - */ -#define FPC_ID $0 -#define FPC_CSR $31 - -/* - * The floating point coprocessor status register bits. - */ -#define FPC_ROUNDING_BITS 0x00000003 -#define FPC_ROUND_RN 0x00000000 -#define FPC_ROUND_RZ 0x00000001 -#define FPC_ROUND_RP 0x00000002 -#define FPC_ROUND_RM 0x00000003 -#define FPC_STICKY_BITS 0x0000007c -#define FPC_STICKY_INEXACT 0x00000004 -#define FPC_STICKY_UNDERFLOW 0x00000008 -#define FPC_STICKY_OVERFLOW 0x00000010 -#define FPC_STICKY_DIV0 0x00000020 -#define FPC_STICKY_INVALID 0x00000040 -#define FPC_ENABLE_BITS 0x00000f80 -#define FPC_ENABLE_INEXACT 0x00000080 -#define FPC_ENABLE_UNDERFLOW 0x00000100 -#define FPC_ENABLE_OVERFLOW 0x00000200 -#define FPC_ENABLE_DIV0 0x00000400 -#define FPC_ENABLE_INVALID 0x00000800 -#define FPC_EXCEPTION_BITS 0x0003f000 -#define FPC_EXCEPTION_INEXACT 0x00001000 -#define FPC_EXCEPTION_UNDERFLOW 0x00002000 -#define FPC_EXCEPTION_OVERFLOW 0x00004000 -#define FPC_EXCEPTION_DIV0 0x00008000 -#define FPC_EXCEPTION_INVALID 0x00010000 -#define FPC_EXCEPTION_UNIMPL 0x00020000 -#define FPC_COND_BIT 0x00800000 -#define FPC_FLUSH_BIT 0x01000000 -#define FPC_MBZ_BITS 0xfe7c0000 - -/* - * Constants to determine if have a floating point instruction. - */ -#define OPCODE_SHIFT 26 -#define OPCODE_C1 0x11 - -/* - * The low part of the TLB entry. - */ -#define VMTLB_PF_NUM 0x3fffffc0 -#define VMTLB_ATTR_MASK 0x00000038 -#define VMTLB_MOD_BIT 0x00000004 -#define VMTLB_VALID_BIT 0x00000002 -#define VMTLB_GLOBAL_BIT 0x00000001 - -#define VMTLB_PHYS_PAGE_SHIFT 6 - -/* - * The high part of the TLB entry. - */ -#define VMTLB_VIRT_PAGE_NUM 0xffffe000 -#define VMTLB_PID 0x000000ff -#define VMTLB_PID_SHIFT 0 -#define VMTLB_VIRT_PAGE_SHIFT 12 - -/* - * The number of TLB entries and the first one that write random hits. - */ -/*#define VMNUM_TLB_ENTRIES 48 XXX We never use this... */ -#define VMWIRED_ENTRIES 8 - -/* - * The number of process id entries. - */ -#define VMNUM_PIDS 256 - -/* - * TLB probe return codes. - */ -#define VMTLB_NOT_FOUND 0 -#define VMTLB_FOUND 1 -#define VMTLB_FOUND_WITH_PATCH 2 -#define VMTLB_PROBE_ERROR 3 - -/* - * Exported definitions unique to mips cpu support. - */ - -/* - * definitions of cpu-dependent requirements - * referenced in generic code - */ -#define COPY_SIGCODE /* copy sigcode above user stack in exec */ - -#define cpu_wait(p) /* nothing */ -#define cpu_set_init_frame(p, fp) /* nothing */ -#define cpu_swapout(p) panic("cpu_swapout: can't get here"); - -#ifndef _LOCORE -/* - * Arguments to hardclock and gatherstats encapsulate the previous - * machine state in an opaque clockframe. - */ -struct clockframe { - int pc; /* program counter at time of interrupt */ - int sr; /* status register at time of interrupt */ - int cr; /* cause register at time of interrupt */ -}; - -#define CLKF_USERMODE(framep) ((framep)->sr & SR_KSU_USER) -#define CLKF_BASEPRI(framep) ((~(framep)->sr & (INT_MASK|SR_INT_ENAB)) == 0) -#define CLKF_PC(framep) ((framep)->pc) -#define CLKF_INTR(framep) (0) - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define need_resched() { want_resched = 1; aston(); } - -/* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the PICA, request an ast to send us - * through trap, marking the proc as needing a profiling tick. - */ -#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); } - -/* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define signotify(p) aston() - -#define aston() (astpending = 1) - -int astpending; /* need to trap before returning to user mode */ -int want_resched; /* resched() was called */ - -/* - * CPU identification, from PRID register. - */ -union cpuprid { - int cpuprid; - struct { -#if BYTE_ORDER == BIG_ENDIAN - u_int pad1:16; /* reserved */ - u_int cp_imp:8; /* implementation identifier */ - u_int cp_majrev:4; /* major revision identifier */ - u_int cp_minrev:4; /* minor revision identifier */ -#else - u_int cp_minrev:4; /* minor revision identifier */ - u_int cp_majrev:4; /* major revision identifier */ - u_int cp_imp:8; /* implementation identifier */ - u_int pad1:16; /* reserved */ -#endif - } cpu; -}; - -/* - * CTL_MACHDEP definitions. - */ -#define CPU_CONSDEV 1 /* dev_t: console terminal device */ -#define CPU_MAXID 2 /* number of valid machdep ids */ - -#define CTL_MACHDEP_NAMES { \ - { 0, 0 }, \ - { "console_device", CTLTYPE_STRUCT }, \ -} - -#endif /* !_LOCORE */ -#endif /* _KERNEL */ - -/* - * MIPS CPU types (cp_imp). - */ -#define MIPS_R2000 0x01 /* MIPS R2000 CPU ISA I */ -#define MIPS_R3000 0x02 /* MIPS R3000 CPU ISA I */ -#define MIPS_R6000 0x03 /* MIPS R6000 CPU ISA II */ -#define MIPS_R4000 0x04 /* MIPS R4000/4400 CPU ISA III */ -#define MIPS_R3LSI 0x05 /* LSI Logic R3000 derivate ISA I */ -#define MIPS_R6000A 0x06 /* MIPS R6000A CPU ISA II */ -#define MIPS_R3IDT 0x07 /* IDT R3000 derivate ISA I */ -#define MIPS_R10000 0x09 /* MIPS R10000/T5 CPU ISA IV */ -#define MIPS_R4200 0x0a /* MIPS R4200 CPU (ICE) ISA III */ -#define MIPS_R4300 0x0b /* NEC VR4300 CPU ISA III */ -#define MIPS_R4100 0x0c /* NEC VR41xx CPU MIPS-16 ISA III */ -#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */ -#define MIPS_R4600 0x20 /* QED R4600 Orion ISA III */ -#define MIPS_R4700 0x21 /* QED R4700 Orion ISA III */ -#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based CPU ISA I */ -#define MIPS_R5000 0x23 /* MIPS R5000 based CPU ISA IV */ -#define MIPS_RM52X0 0x28 /* QED RM52X0 based CPU ISA IV */ - -/* - * MIPS FPU types - */ -#define MIPS_SOFT 0x00 /* Software emulation ISA I */ -#define MIPS_R2360 0x01 /* MIPS R2360 FPC ISA I */ -#define MIPS_R2010 0x02 /* MIPS R2010 FPC ISA I */ -#define MIPS_R3010 0x03 /* MIPS R3010 FPC ISA I */ -#define MIPS_R6010 0x04 /* MIPS R6010 FPC ISA II */ -#define MIPS_R4010 0x05 /* MIPS R4000/R4400 FPC ISA II */ -#define MIPS_R31LSI 0x06 /* LSI Logic derivate ISA I */ -#define MIPS_R10010 0x09 /* MIPS R10000/T5 FPU ISA IV */ -#define MIPS_R4210 0x0a /* MIPS R4200 FPC (ICE) ISA III */ -#define MIPS_UNKF1 0x0b /* unnanounced product cpu ISA III */ -#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */ -#define MIPS_R4600 0x20 /* QED R4600 Orion ISA III */ -#define MIPS_R3SONY 0x21 /* Sony R3000 based FPU ISA I */ -#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based FPU ISA I */ -#define MIPS_R5010 0x23 /* MIPS R5000 based FPU ISA IV */ -#define MIPS_RM5230 0x28 /* QED RM52X0 based FPU ISA IV */ - -#if defined(_KERNEL) && !defined(_LOCORE) -union cpuprid cpu_id; -union cpuprid fpu_id; -u_int CpuPrimaryDataCacheSize; -u_int CpuPrimaryInstCacheSize; -u_int CpuPrimaryDataCacheLSize; -u_int CpuPrimaryInstCacheLSize; -u_int CpuCacheAliasMask; -u_int CpuTwoWayCache; -int l2cache_is_snooping; -extern struct intr_tab intr_tab[]; - -struct tlb; -struct user; - -int R4K_ConfigCache __P((void)); -void R4K_SetWIRED __P((int)); -void R4K_SetPID __P((int)); -u_int R4K_GetCOUNT __P((void)); -void R4K_SetCOMPARE __P((u_int)); -void R4K_FlushCache __P((void)); -void R4K_FlushDCache __P((vm_offset_t, int)); -void R4K_HitFlushDCache __P((vm_offset_t, int)); -void R4K_FlushICache __P((vm_offset_t, int)); -void R4K_TLBFlush __P((int)); -void R4K_TLBFlushAddr __P((vm_offset_t)); -void R4K_TLBWriteIndexed __P((int, struct tlb *)); -void R4K_TLBUpdate __P((vm_offset_t, unsigned)); -void R4K_TLBRead __P((int, struct tlb *)); -void wbflush __P((void)); -void savectx __P((struct user *, int)); -int copykstack __P((struct user *)); -void switch_exit __P((void)); -void MipsSaveCurFPState __P((struct proc *)); - -extern u_int32_t cpu_counter_interval; /* Number of counter ticks/tick */ -extern u_int32_t cpu_counter_last; /* Last compare value loaded */ - -/* - * Enable realtime clock (always enabled). - */ -#define enablertclock() -#endif /* _KERNEL */ - -#endif /* !_MIPS_CPU_H_ */ diff --git a/sys/arch/mips/include/db_machdep.h b/sys/arch/mips/include/db_machdep.h deleted file mode 100644 index 9d4f66ee948..00000000000 --- a/sys/arch/mips/include/db_machdep.h +++ /dev/null @@ -1,80 +0,0 @@ -/* $OpenBSD: db_machdep.h,v 1.4 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1998 Per Fogelstrom, Opsycon AB - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom, Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS_DB_MACHDEP_H_ -#define _MIPS_DB_MACHDEP_H_ - -#include <machine/regnum.h> -#include <machine/frame.h> -#include <machine/trap.h> -#include <vm/vm_param.h> - -#define MID_MACHINE 0 /* XXX booo... */ - -typedef struct trap_frame db_regs_t; -db_regs_t ddb_regs; - -typedef int db_expr_t; -typedef vm_offset_t db_addr_t; - -#define SOFTWARE_SSTEP /* Need software single step */ -#define SOFTWARE_SSTEP_EMUL /* next_instr_address() emulates 100% */ -db_addr_t next_instr_address __P((db_addr_t, boolean_t)); -#define BKPT_SIZE (4) -#define BKPT_SET(ins) (BREAK_DDB) -#define DB_VALID_BREAKPOINT(addr) (((addr) & 3) == 0) - -#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAK) -#define IS_WATCHPOINT_TRAP(type, code) (0) /* XXX mips3 watchpoint */ - -#define PC_REGS(regs) ((db_addr_t)(regs)->reg[PC]) -#define DDB_REGS (&ddb_regs) - -/* - * Test of instructions to see class. - */ -#define IT_CALL 0x01 -#define IT_BRANCH 0x02 -#define IT_LOAD 0x03 -#define IT_STORE 0x04 - -#define inst_branch(i) (db_inst_type(i) == IT_BRANCH) -#define inst_trap_return(i) ((i) & 0) -#define inst_call(i) (db_inst_type(i) == IT_CALL) -#define inst_return(i) ((i) == 0x03e00008) -#define inst_load(i) (db_inst_type(i) == IT_LOAD) -#define inst_store(i) (db_inst_type(i) == IT_STORE) - -int db_inst_type __P((int)); -#endif /* !_MIPS_DB_MACHDEP_H_ */ diff --git a/sys/arch/mips/include/disklabel.h b/sys/arch/mips/include/disklabel.h deleted file mode 100644 index c9df62ec4b6..00000000000 --- a/sys/arch/mips/include/disklabel.h +++ /dev/null @@ -1,87 +0,0 @@ -/* $OpenBSD: disklabel.h,v 1.4 1999/01/27 04:46:05 imp Exp $ */ -/* $NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp $ */ - -/* - * Copyright (c) 1994 Christopher G. Demetriou - * 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 Christopher G. Demetriou. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MIPS_DISKLABEL_H_ -#define _MIPS_DISKLABEL_H_ - -#define LABELSECTOR 1 /* sector containing label */ -#define LABELOFFSET 0 /* offset of label in sector */ -#define MAXPARTITIONS 16 /* number of partitions */ -#define RAW_PART 2 /* raw partition: ie. rsd0c */ - -/* DOS partition table -- located in boot block */ -#define DOSBBSECTOR 0 /* DOS boot block relative sector # */ -#define DOSPARTOFF 446 -#define NDOSPART 4 - -struct dos_partition { - u_int8_t dp_flag; /* bootstrap flags */ - u_int8_t dp_shd; /* starting head */ - u_int8_t dp_ssect; /* starting sector */ - u_int8_t dp_scyl; /* starting cylinder */ - u_int8_t dp_typ; /* partition type (see below) */ - u_int8_t dp_ehd; /* end head */ - u_int8_t dp_esect; /* end sector */ - u_int8_t dp_ecyl; /* end cylinder */ - u_int32_t dp_start; /* absolute starting sector number */ - u_int32_t dp_size; /* partition size in sectors */ -}; - -/* Known DOS partition types. */ -#define DOSPTYP_UNUSED 0x00 /* Unused partition */ -#define DOSPTYP_FAT12 0x01 /* 12-bit FAT */ -#define DOSPTYP_FAT16S 0x04 /* 16-bit FAT, less than 32M */ -#define DOSPTYP_EXTEND 0x05 /* Extended; contains sub-partitions */ -#define DOSPTYP_FAT16B 0x06 /* 16-bit FAT, more than 32M */ -#define DOSPTYP_FAT32 0x0b /* 32-bit FAT */ -#define DOSPTYP_FAT32L 0x0c /* 32-bit FAT, LBA-mapped */ -#define DOSPTYP_FAT16L 0x0e /* 16-bit FAT, LBA-mapped */ -#define DOSPTYP_ONTRACK 0x54 -#define DOSPTYP_LINUX 0x83 /* That other thing */ -#define DOSPTYP_FREEBSD 0xa5 /* FreeBSD partition type */ -#define DOSPTYP_OPENBSD 0xa6 /* OpenBSD partition type */ -#define DOSPTYP_NETBSD 0xa9 /* NetBSD partition type */ - -#include <sys/dkbad.h> -struct cpu_disklabel { - struct dos_partition dosparts[NDOSPART]; - struct dkbad bad; -}; - -#define DKBAD(x) ((x)->bad) - -/* Isolate the relevant bits to get sector and cylinder. */ -#define DPSECT(s) ((s) & 0x3f) -#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) - -#endif /* !_MIPS_DISKLABEL_H_ */ diff --git a/sys/arch/mips/include/dlfcn.h b/sys/arch/mips/include/dlfcn.h deleted file mode 100644 index a427f955612..00000000000 --- a/sys/arch/mips/include/dlfcn.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: dlfcn.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1996 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS_DLFCN_H_ -#define _MIPS_DLFCN_H_ - -/* - * This is a dummy file. Empty until libdl has been done. - */ - -#endif /* _MIPS_DLFCN_H_ */ diff --git a/sys/arch/mips/include/ecoff_machdep.h b/sys/arch/mips/include/ecoff_machdep.h deleted file mode 100644 index 4f7c5ecc029..00000000000 --- a/sys/arch/mips/include/ecoff_machdep.h +++ /dev/null @@ -1,98 +0,0 @@ -/* $OpenBSD: ecoff_machdep.h,v 1.1 2000/09/10 05:27:17 miod Exp $ */ -/* $NetBSD: ecoff.h,v 1.4 1995/06/16 02:07:33 mellon Exp $ */ - -/* - * Copyright (c) 1994 Adam Glass - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Adam Glass. - * 4. The name of the Author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL Adam Glass BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MIPS_ECOFF_H_ -#define _MIPS_ECOFF_H_ - -#define ECOFF_LDPGSZ 4096 - -#define ECOFF_PAD - -#define ECOFF_MACHDEP \ - u_long ea_gprmask; \ - u_long ea_cprmask[4]; \ - u_long ea_gp_value - -#define ECOFF_MAGIC_MIPSEL 0x0162 -#define ECOFF_BADMAG(ex) ((ex)->f.f_magic != ECOFF_MAGIC_MIPSEL) - -#define ECOFF_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16) - -struct ecoff_symhdr { - int16_t sh_magic; - int16_t sh_vstamp; - int32_t sh_linemax; - int32_t sh_densenummax; - int32_t sh_procmax; - int32_t sh_lsymmax; - int32_t sh_optsymmax; - int32_t sh_auxxymmax; - int32_t sh_lstrmax; - int32_t sh_estrmax; - int32_t sh_fdmax; - int32_t sh_rfdmax; - int32_t sh_esymmax; - long sh_linesize; - long sh_lineoff; - long sh_densenumoff; - long sh_procoff; - long sh_lsymoff; - long sh_optsymoff; - long sh_auxsymoff; - long sh_lstroff; - long sh_estroff; - long sh_fdoff; - long sh_rfdoff; - long sh_esymoff; -}; -/* Some day they will make up their minds.... */ -#define esymMax sh_esymmax -#define cbExtOffset sh_esymoff -#define cbSsExtOffset sh_estroff - -struct ecoff_extsym { - long es_value; - int es_strindex; - unsigned es_type:6; - unsigned es_class:5; - unsigned :1; - unsigned es_symauxindex:20; - unsigned es_jmptbl:1; - unsigned es_cmain:1; - unsigned es_weakext:1; - unsigned :29; - int es_indexfld; -}; - -#endif /* !_MIPS_ECOFF_H_ */ diff --git a/sys/arch/mips/include/elf_abi.h b/sys/arch/mips/include/elf_abi.h deleted file mode 100644 index a2f61bdc300..00000000000 --- a/sys/arch/mips/include/elf_abi.h +++ /dev/null @@ -1,63 +0,0 @@ -/* $OpenBSD: elf_abi.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1996 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS_ELF_ABI_H -#define _MIPS_ELF_ABI_H - -/* From MIPS ABI supplemental */ - -/* Architecture dependent Segment types - p_type */ -#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ - -/* Architecture dependent d_tag field for Elf32_Dyn. */ -#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */ -#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */ -#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */ -#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */ -#define DT_MIPS_FLAGS 0x70000005 /* Flags */ -#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */ -#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */ -#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */ -#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */ -#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */ -#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */ -#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */ -#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */ -#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */ -#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */ -#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */ - -#define DT_PROCNUM (DT_MIPS_HIPAGENO - DT_LOPROC + 1) - -#endif /* _MIPS_ELF_ABI_H */ diff --git a/sys/arch/mips/include/float.h b/sys/arch/mips/include/float.h deleted file mode 100644 index 3934aff1a02..00000000000 --- a/sys/arch/mips/include/float.h +++ /dev/null @@ -1,80 +0,0 @@ -/* $OpenBSD: float.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)float.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_FLOAT_H_ -#define _MIPS_FLOAT_H_ - -#include <sys/cdefs.h> - -__BEGIN_DECLS -int __flt_rounds __P((void)); -__END_DECLS - -#define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS __flt_rounds() - -#define FLT_MANT_DIG 24 /* p */ -#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ -#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ -#define FLT_MIN_EXP -125 /* emin */ -#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */ -#define FLT_MIN_10_EXP -37 /* ceil(log10(b**(emin-1))) */ -#define FLT_MAX_EXP 128 /* emax */ -#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ -#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ - -#define DBL_MANT_DIG 53 -#define DBL_EPSILON 2.2204460492503131E-16 -#define DBL_DIG 15 -#define DBL_MIN_EXP -1021 -#define DBL_MIN 2.225073858507201E-308 -#define DBL_MIN_10_EXP -307 -#define DBL_MAX_EXP 1024 -#define DBL_MAX 1.797693134862316E+308 -#define DBL_MAX_10_EXP 308 - -#define LDBL_MANT_DIG DBL_MANT_DIG -#define LDBL_EPSILON DBL_EPSILON -#define LDBL_DIG DBL_DIG -#define LDBL_MIN_EXP DBL_MIN_EXP -#define LDBL_MIN DBL_MIN -#define LDBL_MIN_10_EXP DBL_MIN_10_EXP -#define LDBL_MAX_EXP DBL_MAX_EXP -#define LDBL_MAX DBL_MAX -#define LDBL_MAX_10_EXP DBL_MAX_10_EXP - -#endif /* _MIPS_FLOAT_H_ */ diff --git a/sys/arch/mips/include/frame.h b/sys/arch/mips/include/frame.h deleted file mode 100644 index 3043845d44f..00000000000 --- a/sys/arch/mips/include/frame.h +++ /dev/null @@ -1,41 +0,0 @@ -/* $OpenBSD: frame.h,v 1.5 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1998 Per Fogelstrom, Opsycon AB - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom, Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#ifndef _MIPS_FRAME_H_ -#define _MIPS_FRAME_H_ - -struct trap_frame { - int reg[NUMSAVEREGS]; -}; - -#endif /* !_MIPS_FRAME_H_ */ diff --git a/sys/arch/mips/include/ieeefp.h b/sys/arch/mips/include/ieeefp.h deleted file mode 100644 index a68423cf7d6..00000000000 --- a/sys/arch/mips/include/ieeefp.h +++ /dev/null @@ -1,25 +0,0 @@ -/* $OpenBSD: ieeefp.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Written by J.T. Conklin, Apr 11, 1995 - * Public domain. - */ - -#ifndef _MIPS_IEEEFP_H_ -#define _MIPS_IEEEFP_H_ - -typedef int fp_except; -#define FP_X_IMP 0x01 /* imprecise (loss of precision) */ -#define FP_X_UFL 0x02 /* underflow exception */ -#define FP_X_OFL 0x04 /* overflow exception */ -#define FP_X_DZ 0x08 /* divide-by-zero exception */ -#define FP_X_INV 0x10 /* invalid operation exception */ - -typedef enum { - FP_RN=0, /* round to nearest representable number */ - FP_RZ=1, /* round to zero (truncate) */ - FP_RP=2, /* round toward positive infinity */ - FP_RM=3 /* round toward negative infinity */ -} fp_rnd; - -#endif /* !_MIPS_IEEEFP_H_ */ diff --git a/sys/arch/mips/include/kbdreg.h b/sys/arch/mips/include/kbdreg.h deleted file mode 100644 index 5c3a6e71bd8..00000000000 --- a/sys/arch/mips/include/kbdreg.h +++ /dev/null @@ -1,162 +0,0 @@ -/* $OpenBSD: kbdreg.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1996 Per Fogelstrom - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MIPS_KBDREG_H_ -#define _MIPS_KBDREG_H_ - -/* - * Keyboard controller definitions - */ - -#define KBS_DIB 0x01 /* data in buffer */ -#define KBS_IBF 0x02 /* input buffer low */ -#define KBS_WARM 0x04 /* input buffer low */ -#define KBS_OCMD 0x08 /* output buffer has command */ -#define KBS_NOSEC 0x10 /* security lock not engaged */ -#define KBS_TERR 0x20 /* transmission error */ -#define KBS_RERR 0x40 /* receive error */ -#define KBS_PERR 0x80 /* parity error */ - -#define K_RDCMDBYTE 0x20 -#define K_LDCMDBYTE 0x60 - -#define KC8_TRANS 0x40 /* convert to old scan codes */ -#define KC8_MDISABLE 0x20 /* disable mouse */ -#define KC8_KDISABLE 0x10 /* disable keyboard */ -#define KC8_IGNSEC 0x08 /* ignore security lock */ -#define KC8_CPU 0x04 /* exit from protected mode reset */ -#define KC8_MENABLE 0x02 /* enable mouse interrupt */ -#define KC8_KENABLE 0x01 /* enable keyboard interrupt */ -#define CMDBYTE (KC8_TRANS|KC8_CPU|KC8_MENABLE|KC8_KENABLE) - -/* keyboard commands */ -#define KBC_RESET 0xFF /* reset the keyboard */ -#define KBC_RESEND 0xFE /* request the keyboard resend the last byte */ -#define KBC_SETDEFAULT 0xF6 /* resets keyboard to its power-on defaults */ -#define KBC_DISABLE 0xF5 /* as per KBC_SETDEFAULT, but also disable key scanning */ -#define KBC_ENABLE 0xF4 /* enable key scanning */ -#define KBC_TYPEMATIC 0xF3 /* set typematic rate and delay */ -#define KBC_SETTABLE 0xF0 /* set scancode translation table */ -#define KBC_MODEIND 0xED /* set mode indicators (i.e. LEDs) */ -#define KBC_ECHO 0xEE /* request an echo from the keyboard */ - -/* keyboard responses */ -#define KBR_EXTENDED 0xE0 /* extended key sequence */ -#define KBR_RESEND 0xFE /* needs resend of command */ -#define KBR_ACK 0xFA /* received a valid command */ -#define KBR_OVERRUN 0x00 /* flooded */ -#define KBR_FAILURE 0xFD /* diagnosic failure */ -#define KBR_BREAK 0xF0 /* break code prefix - sent on key release */ -#define KBR_RSTDONE 0xAA /* reset complete */ -#define KBR_ECHO 0xEE /* echo response */ - - -#ifdef _KERNEL - -static __inline int kb_output_wait __P((void)); -static __inline int kb_input_wait __P((void)); -static __inline void kb_input_flush __P((void)); -static __inline u_int8_t kb_get8042 __P((void)); -static __inline int kb_put8042 __P((u_char)); - -static int kb_cmd_port; -static int kb_data_port; - -static __inline int -kb_output_wait() -{ - int to = 100000; - - while(to--) { - if((inb(kb_cmd_port) & KBS_IBF) == 0) { - DELAY(10); - return(1); - } - } - return(0); -} - -static __inline int -kb_input_wait() -{ - int to = 100000; - - while(to--) { - if((inb(kb_cmd_port) & KBS_DIB) == 0) { - DELAY(10); - return(1); - } - } - return(0); -} - -static __inline void -kb_input_flush() -{ - u_int c; - - while((c = inb(kb_cmd_port) & (KBS_DIB | KBS_IBF))) { - if(c == KBS_DIB) { - DELAY(10); - c = inb(kb_data_port); - } - } -} - -static __inline u_int8_t -kb_get8042() -{ - if(!kb_output_wait()) - return(0); - outb(kb_cmd_port, K_LDCMDBYTE); - if(!kb_input_wait()) - return(0); - return(inb(kb_data_port)); -} - -static __inline int -kb_put8042(v) - u_char v; -{ - if(!kb_output_wait()) - return(0); - outb(kb_cmd_port, K_LDCMDBYTE); - if(!kb_output_wait()) - return(0); - outb(kb_data_port, v); - return(1); -} - - -#endif /* _KERNEL */ - -#endif /* _MIPS_KBDREG_H_ */ diff --git a/sys/arch/mips/include/kcore.h b/sys/arch/mips/include/kcore.h deleted file mode 100644 index 48139015eff..00000000000 --- a/sys/arch/mips/include/kcore.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $OpenBSD: kcore.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ -/* $NetBSD: kcore.h,v 1.1 1996/03/10 21:55:18 leo Exp $ */ - -/* - * Copyright (c) 1996 Leo Weppelman. - * 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 Leo Weppelman. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MIPS_KCORE_H_ -#define _MIPS_KCORE_H_ - -#define NPHYS_RAM_SEGS 8 - -typedef struct cpu_kcore_hdr { - vm_offset_t kernel_pa; /* Phys. address of kernel VA 0 */ - int mmutype; - phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS]; -} cpu_kcore_hdr_t; - -#endif /* _MIPS_KCORE_H_ */ diff --git a/sys/arch/mips/include/kdbparam.h b/sys/arch/mips/include/kdbparam.h deleted file mode 100644 index d9a04f2543b..00000000000 --- a/sys/arch/mips/include/kdbparam.h +++ /dev/null @@ -1,79 +0,0 @@ -/* $OpenBSD: kdbparam.h,v 1.2 1999/01/27 04:46:05 imp 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. - * - * @(#)kdbparam.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_KDBPARAM_H_ -#define _MIPS_KDBPARAM_H_ - -/* - * Machine dependent definitions for kdb. - */ - -#if BYTE_ORDER == LITTLE_ENDIAN -#define kdbshorten(w) ((w) & 0xFFFF) -#define kdbbyte(w) ((w) & 0xFF) -#define kdbitol(a,b) ((long)(((b) << 16) | ((a) & 0xFFFF))) -#define kdbbtol(a) ((long)(a)) -#endif - -#define LPRMODE "%R" -#define OFFMODE "+%R" - -#define SETBP(ins) BREAK_BRKPT - -/* return the program counter value modified if we are in a delay slot */ -#define kdbgetpc(pcb) (kdbvar[kdbvarchk('t')] < 0 ? \ - (pcb).pcb_regs[34] + 4 : (pcb).pcb_regs[34]) -#define kdbishiddenreg(p) ((p) >= &kdbreglist[33]) -#define kdbisbreak(type) (((type) & CR_EXC_CODE) == 0x24) - -/* check for address wrap around */ -#define kdbaddrwrap(addr,newaddr) (((addr)^(newaddr)) >> 31) - -/* declare machine dependent routines defined in kadb.c */ -void kdbprinttrap __P((unsigned, unsigned)); -void kdbsetsstep __P((void)); -void kdbclrsstep __P((void)); -void kdbreadc __P((char *)); -void kdbwrite __P((char *, int)); -void kdbprintins __P((int, long)); -void kdbstacktrace __P((int)); -char *kdbmalloc __P((int)); - -#endif /* !_MIPS_KDBPARAM_H_ */ diff --git a/sys/arch/mips/include/limits.h b/sys/arch/mips/include/limits.h deleted file mode 100644 index 2eb37fd1adf..00000000000 --- a/sys/arch/mips/include/limits.h +++ /dev/null @@ -1,111 +0,0 @@ -/* $OpenBSD: limits.h,v 1.4 2000/07/31 20:06:02 millert Exp $ */ - -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - */ - -#ifndef _MIPS_LIMITS_H_ -#define _MIPS_LIMITS_H_ - -#define CHAR_BIT 8 /* number of bits in a char */ -#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ - -#ifdef _KERNEL -#define CLK_TCK 100 /* ticks per second */ -#endif - -/* - * According to ANSI (section 2.2.4.2), the values below must be usable by - * #if preprocessing directives. Additionally, the expression must have the - * same type as would an expression that is an object of the corresponding - * type converted according to the integral promotions. The subtraction for - * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an - * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). - * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values - * are written as hex so that GCC will be quiet about large integer constants. - */ -#define SCHAR_MAX 127 /* min value for a signed char */ -#define SCHAR_MIN (-128) /* max value for a signed char */ - -#define UCHAR_MAX 255 /* max value for an unsigned char */ -#define CHAR_MAX 127 /* max value for a char */ -#define CHAR_MIN (-128) /* min value for a char */ - -#define USHRT_MAX 65535 /* max value for an unsigned short */ -#define SHRT_MAX 32767 /* max value for a short */ -#define SHRT_MIN (-32768) /* min value for a short */ - -#define UINT_MAX 0xffffffff /* max value for an unsigned int */ -#define INT_MAX 2147483647 /* max value for an int */ -#define INT_MIN (-2147483647-1) /* min value for an int */ - -#define ULONG_MAX 0xffffffff /* max value for an unsigned long */ -#define LONG_MAX 2147483647 /* max value for a long */ -#define LONG_MIN (-2147483647-1) /* min value for a long */ - -#if !defined(_ANSI_SOURCE) -#define SSIZE_MAX INT_MAX /* max value for a ssize_t */ - -#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) -#define SIZE_T_MAX UINT_MAX /* max value for a size_t */ - -#define UID_MAX UINT_MAX /* max value for a uid_t */ -#define GID_MAX UINT_MAX /* max value for a gid_t */ - -/* GCC requires that quad constants be written as expressions. */ -#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */ - /* max value for a quad_t */ -#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1)) -#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */ -#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */ -#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */ -#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */ - -#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */ -#endif /* !_ANSI_SOURCE */ - -#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE) -#define LONG_BIT 32 -#define WORD_BIT 32 - -#define DBL_DIG 15 -#define DBL_MAX 1.797693134862316E+308 -#define DBL_MIN 2.225073858507201E-308 - -#define FLT_DIG 6 -#define FLT_MAX 3.40282347E+38F -#define FLT_MIN 1.17549435E-38F -#endif - -#endif /* !_MIPS_LIMITS_H_ */ diff --git a/sys/arch/mips/include/link.h b/sys/arch/mips/include/link.h deleted file mode 100644 index 87c4c9f7bde..00000000000 --- a/sys/arch/mips/include/link.h +++ /dev/null @@ -1,125 +0,0 @@ -/* $OpenBSD: link.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1996 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MIPS_LINK_H -#define _MIPS_LINK_H - -#include <elf_abi.h> -#include <machine/elf_abi.h> - -/* - * Debug rendezvous struct. Pointer to this is set up in the - * target code pointed by the DT_MIPS_RLD_MAP tag. If it is - * defined. - */ - -struct r_debug { - int r_version; /* Protocol version. */ - struct link_map *r_map; /* Head of list of loaded objects. */ - - /* This is the address of a function internal to the run-time linker, - that will always be called when the linker begins to map in a - library or unmap it, and again when the mapping change is complete. - The debugger can set a breakpoint at this address if it wants to - notice shared object mapping changes. */ - Elf32_Addr r_brk; - enum { - /* This state value describes the mapping change taking place when - the `r_brk' address is called. */ - RT_CONSISTENT, /* Mapping change is complete. */ - RT_ADD, /* Adding a new object. */ - RT_DELETE, /* Removing an object mapping. */ - } r_state; - - Elf32_Addr r_ldbase; /* Base address the linker is loaded at. */ - }; - -/* This symbol refers to the "dynamic structure" in the `.dynamic' section - of whatever module refers to `_DYNAMIC'. So, to find its own - `struct r_debug', a program could do: - for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL) - if (dyn->d_tag == DT_MIPS_RLD_MAP) r_debug = (struct r_debug) dyn->d_un.d_ptr; - */ - -extern Elf32_Dyn _DYNAMIC[]; - - -/* Structure describing a loaded shared object. The `l_next' and `l_prev' - members form a chain of all the shared objects loaded at startup. - - These data structures exist in space used by the run-time dynamic linker; - modifying them may have disastrous results. */ - -struct link_map - { - /* These first few members are part of the protocol with the debugger. - This is the same format used in SVR4. */ - - Elf32_Addr l_addr; /* Base address shared object is loaded at. */ - Elf32_Addr l_offs; /* Offset */ - char *l_name; /* Absolute file name object was found in. */ - Elf32_Dyn *l_ld; /* Dynamic section of the shared object. */ - struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ - - /* All following members are internal to the dynamic linker. - They may change without notice. */ - - const char *l_libname; /* Name requested (before search). */ - - /* Indexed pointers to dynamic section. */ - Elf32_Dyn *l_info[DT_NUM + DT_PROCNUM]; - - const Elf32_Phdr *l_phdr; /* Pointer to program header table in core. */ - Elf32_Word l_phnum; /* Number of program header entries. */ - Elf32_Addr l_entry; /* Entry point location. */ - - /* Symbol hash table. */ - Elf32_Word l_nbuckets; - const Elf32_Word *l_buckets, *l_chain; - - unsigned int l_opencount; /* Reference count for dlopen/dlclose. */ - enum /* Where this object came from. */ - { - lt_executable, /* The main executable program. */ - lt_interpreter, /* The interpreter: the dynamic linker. */ - lt_library, /* Library needed by main executable. */ - lt_loaded, /* Extra run-time loaded shared object. */ - } l_type:2; - unsigned int l_deps_loaded:1; /* Nonzero if DT_NEEDED items loaded. */ - unsigned int l_relocated:1; /* Nonzero if object's relocations done. */ - unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */ - unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */ - }; - -#endif /* !_MIPS_LINK_H */ diff --git a/sys/arch/mips/include/memconf.h b/sys/arch/mips/include/memconf.h deleted file mode 100644 index aba51444904..00000000000 --- a/sys/arch/mips/include/memconf.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: memconf.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1996 Per Fogelstrom - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Memory config list used by pmap_bootstrap. - */ - -#ifndef _MIPS_MEMCONF_H_ -#define _MIPS_MEMCONF_H_ - -struct mem_descriptor { - vm_offset_t mem_start; - u_int mem_size; -}; - -#ifdef _KERNEL -#define MAXMEMSEGS 16 -extern struct mem_descriptor mem_layout[]; -#endif - -#endif /* !_MIPS_MEMCONF_H_ */ diff --git a/sys/arch/mips/include/mips_opcode.h b/sys/arch/mips/include/mips_opcode.h deleted file mode 100644 index d55bc8e2d55..00000000000 --- a/sys/arch/mips/include/mips_opcode.h +++ /dev/null @@ -1,296 +0,0 @@ -/* $OpenBSD: mips_opcode.h,v 1.2 1999/01/27 04:46:05 imp 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. - * - * from: @(#)mips_opcode.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_MIPS_OPCODE_H -#define _MIPS_MIPS_OPCODE_H -/* - * Define the instruction formats and opcode values for the - * MIPS instruction set. - */ - -/* - * Define the instruction formats. - */ -typedef union { - unsigned word; - -#if BYTE_ORDER == BIG_ENDIAN - struct { - unsigned op: 6; - unsigned rs: 5; - unsigned rt: 5; - unsigned imm: 16; - } IType; - - struct { - unsigned op: 6; - unsigned target: 26; - } JType; - - struct { - unsigned op: 6; - unsigned rs: 5; - unsigned rt: 5; - unsigned rd: 5; - unsigned shamt: 5; - unsigned func: 6; - } RType; - - struct { - unsigned op: 6; /* always '0x11' */ - unsigned : 1; /* always '1' */ - unsigned fmt: 4; - unsigned ft: 5; - unsigned fs: 5; - unsigned fd: 5; - unsigned func: 6; - } FRType; -#endif -#if BYTE_ORDER == LITTLE_ENDIAN - struct { - unsigned imm: 16; - unsigned rt: 5; - unsigned rs: 5; - unsigned op: 6; - } IType; - - struct { - unsigned target: 26; - unsigned op: 6; - } JType; - - struct { - unsigned func: 6; - unsigned shamt: 5; - unsigned rd: 5; - unsigned rt: 5; - unsigned rs: 5; - unsigned op: 6; - } RType; - - struct { - unsigned func: 6; - unsigned fd: 5; - unsigned fs: 5; - unsigned ft: 5; - unsigned fmt: 4; - unsigned : 1; /* always '1' */ - unsigned op: 6; /* always '0x11' */ - } FRType; -#endif -} InstFmt; - -/* - * Values for the 'op' field. - */ -#define OP_SPECIAL 000 -#define OP_BCOND 001 -#define OP_J 002 -#define OP_JAL 003 -#define OP_BEQ 004 -#define OP_BNE 005 -#define OP_BLEZ 006 -#define OP_BGTZ 007 - -#define OP_ADDI 010 -#define OP_ADDIU 011 -#define OP_SLTI 012 -#define OP_SLTIU 013 -#define OP_ANDI 014 -#define OP_ORI 015 -#define OP_XORI 016 -#define OP_LUI 017 - -#define OP_COP0 020 -#define OP_COP1 021 -#define OP_COP2 022 -#define OP_COP3 023 -#define OP_BEQL 024 -#define OP_BNEL 025 -#define OP_BLEZL 026 -#define OP_BGTZL 027 - -#define OP_DADDI 030 -#define OP_DADDIU 031 -#define OP_LDL 032 -#define OP_LDR 033 - -#define OP_LB 040 -#define OP_LH 041 -#define OP_LWL 042 -#define OP_LW 043 -#define OP_LBU 044 -#define OP_LHU 045 -#define OP_LWR 046 -#define OP_LHU 045 -#define OP_LWR 046 -#define OP_LWU 047 - -#define OP_SB 050 -#define OP_SH 051 -#define OP_SWL 052 -#define OP_SW 053 -#define OP_SDL 054 -#define OP_SDR 055 -#define OP_SWR 056 -#define OP_CACHE 057 - -#define OP_LL 060 -#define OP_LWC1 061 -#define OP_LWC2 062 -#define OP_LWC3 063 -#define OP_LLD 064 -#define OP_LD 067 - -#define OP_SC 070 -#define OP_SWC1 071 -#define OP_SWC2 072 -#define OP_SWC3 073 -#define OP_SCD 074 -#define OP_SD 077 - -/* - * Values for the 'func' field when 'op' == OP_SPECIAL. - */ -#define OP_SLL 000 -#define OP_SRL 002 -#define OP_SRA 003 -#define OP_SLLV 004 -#define OP_SRLV 006 -#define OP_SRAV 007 - -#define OP_JR 010 -#define OP_JALR 011 -#define OP_SYSCALL 014 -#define OP_BREAK 015 -#define OP_SYNC 017 - -#define OP_MFHI 020 -#define OP_MTHI 021 -#define OP_MFLO 022 -#define OP_MTLO 023 -#define OP_DSLLV 024 -#define OP_DSRLV 026 -#define OP_DSRAV 027 - -#define OP_MULT 030 -#define OP_MULTU 031 -#define OP_DIV 032 -#define OP_DIVU 033 -#define OP_DMULT 034 -#define OP_DMULTU 035 -#define OP_DDIV 036 -#define OP_DDIVU 037 - - -#define OP_ADD 040 -#define OP_ADDU 041 -#define OP_SUB 042 -#define OP_SUBU 043 -#define OP_AND 044 -#define OP_OR 045 -#define OP_XOR 046 -#define OP_NOR 047 - -#define OP_SLT 052 -#define OP_SLTU 053 -#define OP_DADD 054 -#define OP_DADDU 055 -#define OP_DSUB 056 -#define OP_DSUBU 057 - -#define OP_TGE 060 -#define OP_TGEU 061 -#define OP_TLT 062 -#define OP_TLTU 063 -#define OP_TEQ 064 -#define OP_TNE 066 - -#define OP_DSLL 070 -#define OP_DSRL 072 -#define OP_DSRA 073 -#define OP_DSLL32 074 -#define OP_DSRL32 076 -#define OP_DSRA32 077 - -/* - * Values for the 'func' field when 'op' == OP_BCOND. - */ -#define OP_BLTZ 000 -#define OP_BGEZ 001 -#define OP_BLTZL 002 -#define OP_BGEZL 003 - -#define OP_TGEI 010 -#define OP_TGEIU 011 -#define OP_TLTI 012 -#define OP_TLTIU 013 -#define OP_TEQI 014 -#define OP_TNEI 016 - -#define OP_BLTZAL 020 -#define OP_BLTZAL 020 -#define OP_BGEZAL 021 -#define OP_BLTZALL 022 -#define OP_BGEZALL 023 - -/* - * Values for the 'rs' field when 'op' == OP_COPz. - */ -#define OP_MF 000 -#define OP_DMF 001 -#define OP_MT 004 -#define OP_DMT 005 -#define OP_BCx 010 -#define OP_BCy 014 -#define OP_CF 002 -#define OP_CT 006 - -/* - * Values for the 'rt' field when 'op' == OP_COPz. - */ -#define COPz_BC_TF_MASK 0x01 -#define COPz_BC_TRUE 0x01 -#define COPz_BC_FALSE 0x00 -#define COPz_BCL_TF_MASK 0x02 -#define COPz_BCL_TRUE 0x02 -#define COPz_BCL_FALSE 0x00 - -#endif /* !_MIPS_MIPS_OPCODE_H */ diff --git a/sys/arch/mips/include/param.h b/sys/arch/mips/include/param.h deleted file mode 100644 index 7dd123c4a3f..00000000000 --- a/sys/arch/mips/include/param.h +++ /dev/null @@ -1,161 +0,0 @@ -/* $OpenBSD: param.h,v 1.5 2001/05/13 02:37:29 millert Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: machparam.h 1.11 89/08/14 - * from: @(#)param.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_PARAM_H_ -#define _MIPS_PARAM_H_ - -#ifdef _KERNEL -#ifdef _LOCORE -#include <machine/psl.h> -#else -#include <machine/cpu.h> -#endif -#endif - -/* - * Machine dependent constants for MIPS machines. - */ -#define MACHINE_ARCH "mips" -#define _MACHINE_ARCH mips - -/* - * Round p (pointer or byte index) up to a correctly-aligned value for all - * data types (int, long, ...). The result is u_int and must be cast to - * any desired pointer type. - */ -#define ALIGNBYTES 7 -#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) - -#define NBPG 4096 /* bytes/page */ -#define PGOFSET (NBPG-1) /* byte offset into page */ -#define PGSHIFT 12 /* LOG2(NBPG) */ - -#define PAGE_SHIFT 12 -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE - 1) - -#define NPTEPG (NBPG/4) - -#define NBSEG 0x400000 /* bytes/segment */ -#define SEGOFSET (NBSEG-1) /* byte offset into segment */ -#define SEGSHIFT 22 /* LOG2(NBSEG) */ - -#define KERNBASE 0x80000000 /* start of kernel virtual */ -#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) - -#define DEV_BSIZE 512 -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ -#define BLKDEV_IOSIZE 2048 -/* XXX Maxphys temporary changed to 32K while SCSI driver is fixed. */ -#define MAXPHYS (32 * 1024) /* max raw I/O transfer size */ - -#define SSIZE 1 /* initial stack size/NBPG */ -#define SINCR 1 /* increment of stack/NBPG */ - -#define UPAGES 2 /* pages of u-area */ -#if defined(_LOCORE) && defined(notyet) -#define UADDR 0xffffffffffffc000 /* address of u */ -#else -#define UADDR 0xffffc000 /* address of u */ -#endif -#define USPACE (UPAGES*NBPG) /* size of u-area in bytes */ -#define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */ -#define KERNELSTACK (UADDR+UPAGES*NBPG) /* top of kernel stack */ - -/* - * Constants related to network buffer management. - * MCLBYTES must be no larger than the software page size, and, - * on machines that exchange pages of input or output buffers with mbuf - * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple - * of the hardware page size. - */ -#define MSIZE 128 /* size of an mbuf */ -#define MCLSHIFT 11 -#define MCLBYTES (1 << MCLSHIFT) /* enough for whole Ethernet packet */ -#define MCLOFSET (MCLBYTES - 1) -#ifndef NMBCLUSTERS -#ifdef GATEWAY -#define NMBCLUSTERS 2048 /* map size, max cluster allocation */ -#else -#define NMBCLUSTERS 1024 /* map size, max cluster allocation */ -#endif -#endif - -/* - * Size of kernel malloc arena in logical pages - */ -#ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (4096*1024/PAGE_SIZE) -#endif - -/* pages ("clicks") (4096 bytes) to disk blocks */ -#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) -#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) - -/* pages to bytes */ -#define ctob(x) ((x) << PGSHIFT) -#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) - -/* bytes to disk blocks */ -#define btodb(x) ((x) >> DEV_BSHIFT) -#define dbtob(x) ((x) << DEV_BSHIFT) - -/* - * Map a ``block device block'' to a file system block. - * This should be device dependent, and should use the bsize - * field from the disk label. - * For now though just use DEV_BSIZE. - */ -#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) - -/* - * Conversion macros - */ -#define mips_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) -#define mips_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) -#define mips_btop(x) ((unsigned)(x) >> PGSHIFT) -#define mips_ptob(x) ((unsigned)(x) << PGSHIFT) - -#define DELAY(n) { register int N = (n); while (--N > 0); } - -#endif /* !_MIPS_PARAM_H_ */ diff --git a/sys/arch/mips/include/pcb.h b/sys/arch/mips/include/pcb.h deleted file mode 100644 index 28295350643..00000000000 --- a/sys/arch/mips/include/pcb.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $OpenBSD: pcb.h,v 1.5 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: pcb.h 1.13 89/04/23 - * from: @(#)pcb.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_PCB_H_ -#define _MIPS_PCB_H_ - -/* - * MIPS process control block - */ -struct pcb -{ - int pcb_regs[71]; /* saved CPU and floating point registers */ - label_t pcb_context; /* kernel context for resume */ - int pcb_onfault; /* for copyin/copyout faults */ - void *pcb_segtab; /* copy of pmap pm_segtab */ -}; - -/* - * The pcb is augmented with machine-dependent additional data for - * core dumps. For the MIPS, there is nothing to add. - */ -struct md_coredump { - long md_pad[8]; -}; -#endif /* !_MIPS_PCB_H_ */ diff --git a/sys/arch/mips/include/pio.h b/sys/arch/mips/include/pio.h deleted file mode 100644 index 428af11425a..00000000000 --- a/sys/arch/mips/include/pio.h +++ /dev/null @@ -1,57 +0,0 @@ -/* $OpenBSD: pio.h,v 1.4 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1995 Per Fogelstrom. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MIPS_PIO_H_ -#define _MIPS_PIO_H_ - -/* - * I/O macros. - */ - -#define outb(a,v) (*(volatile unsigned char*)(a) = (v)) -#define outw(a,v) (*(volatile unsigned short*)(a) = (v)) -#define out16(a,v) outw(a,v) -#define outl(a,v) (*(volatile unsigned int*)(a) = (v)) -#define out32(a,v) outl(a,v) -#define inb(a) (*(volatile unsigned char*)(a)) -#define inw(a) (*(volatile unsigned short*)(a)) -#define in16(a) inw(a) -#define inl(a) (*(volatile unsigned int*)(a)) -#define in32(a) inl(a) - -void insb __P((u_int8_t *, u_int8_t *,int)); -void insw __P((u_int16_t *, u_int16_t *,int)); -void insl __P((u_int32_t *, u_int32_t *,int)); -void outsb __P((u_int8_t *, const u_int8_t *,int)); -void outsw __P((u_int16_t *, const u_int16_t *,int)); -void outsl __P((u_int32_t *, const u_int32_t *,int)); - -#endif /* !_MIPS_PIO_H_ */ diff --git a/sys/arch/mips/include/pmap.h b/sys/arch/mips/include/pmap.h deleted file mode 100644 index d7ee4c0bfcd..00000000000 --- a/sys/arch/mips/include/pmap.h +++ /dev/null @@ -1,120 +0,0 @@ -/* $OpenBSD: pmap.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ - -/* - * Copyright (c) 1987 Carnegie-Mellon University - * 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. - * - * from: @(#)pmap.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_PMAP_H_ -#define _MIPS_PMAP_H_ - -/* - * The user address space is 2Gb (0x0 - 0x80000000). - * User programs are laid out in memory as follows: - * address - * USRTEXT 0x00400000 - * USRDATA 0x10000000 - * USRSTACK 0x7FFFFFFF - * - * The user address space is mapped using a two level structure where - * virtual address bits 30..22 are used to index into a segment table which - * points to a page worth of PTEs (4096 page can hold 1024 PTEs). - * Bits 21..12 are then used to index a PTE which describes a page within - * a segment. - * - * The wired entries in the TLB will contain the following: - * 0-1 (UPAGES) for curproc user struct and kernel stack. - * - * Note: The kernel doesn't use the same data structures as user programs. - * All the PTE entries are stored in a single array in Sysmap which is - * dynamically allocated at boot time. - */ - -#define mips_trunc_seg(x) ((vm_offset_t)(x) & ~SEGOFSET) -#define mips_round_seg(x) (((vm_offset_t)(x) + SEGOFSET) & ~SEGOFSET) -#define pmap_segmap(m, v) ((m)->pm_segtab->seg_tab[((v) >> SEGSHIFT)]) - -#define PMAP_SEGTABSIZE 512 - -union pt_entry; - -struct segtab { - union pt_entry *seg_tab[PMAP_SEGTABSIZE]; -}; - -/* - * Machine dependent pmap structure. - */ -typedef struct pmap { - int pm_count; /* pmap reference count */ - simple_lock_data_t pm_lock; /* lock on pmap */ - struct pmap_statistics pm_stats; /* pmap statistics */ - int pm_tlbpid; /* address space tag */ - u_int pm_tlbgen; /* TLB PID generation number */ - struct segtab *pm_segtab; /* pointers to pages of PTEs */ -} *pmap_t; - -/* - * Defines for pmap_attributes[phys_mach_page]; - */ -#define PMAP_ATTR_MOD 0x01 /* page has been modified */ -#define PMAP_ATTR_REF 0x02 /* page has been referenced */ - -#ifdef _KERNEL -extern char *pmap_attributes; /* reference and modify bits */ -extern struct pmap kernel_pmap_store; - -#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) -#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) -#define pmap_kernel() (&kernel_pmap_store) - -#define PMAP_PREFER(pa, va) pmap_prefer((pa), (va)) - -void pmap_prefer __P((vm_offset_t, vm_offset_t *)); - -void pmap_bootstrap __P((vm_offset_t)); -void pmap_zero_page __P((vm_offset_t)); -int pmap_is_page_ro __P(( pmap_t, vm_offset_t, int)); -int pmap_alloc_tlbpid __P((struct proc *)); -int pmap_remove_pv __P((pmap_t, vm_offset_t, vm_offset_t)); -int pmap_is_pa_mapped __P((vm_offset_t)); -vm_offset_t pmap_pa_to_va __P((vm_offset_t)); -void pmap_page_cache __P((vm_offset_t, int));; - -#endif /* _KERNEL */ - -#endif /* !_MIPS_PMAP_H_ */ diff --git a/sys/arch/mips/include/proc.h b/sys/arch/mips/include/proc.h deleted file mode 100644 index 7ad4d1ead07..00000000000 --- a/sys/arch/mips/include/proc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: proc.h,v 1.4 1999/01/27 04:46:05 imp 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. - * - * @(#)proc.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_PROC_H_ -#define _MIPS_PROC_H_ - -/* - * Machine-dependent part of the proc structure. - */ -struct mdproc { - int *md_regs; /* registers on current frame */ - int md_flags; /* machine-dependent flags */ - int md_upte[UPAGES]; /* ptes for mapping u page */ - int md_ss_addr; /* single step address for ptrace */ - int md_ss_instr; /* single step instruction for ptrace */ -}; - -/* md_flags */ -#define MDP_FPUSED 0x0001 /* floating point coprocessor used */ - -#endif /* !_MIPS_PROC_H_ */ diff --git a/sys/arch/mips/include/profile.h b/sys/arch/mips/include/profile.h deleted file mode 100644 index 429c8ee0a47..00000000000 --- a/sys/arch/mips/include/profile.h +++ /dev/null @@ -1,88 +0,0 @@ -/* $OpenBSD: profile.h,v 1.2 1999/01/27 04:46:05 imp 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. - * - * from: @(#)profile.h 8.1 (Berkeley) 6/10/93 - */ -#ifndef _MIPS_PROFILE_H_ -#define _MIPS_PROFILE_H_ - -#define _MCOUNT_DECL static void ___mcount - -/*XXX The cprestore instruction is a "dummy" to shut up as(1). */ - -#define MCOUNT \ - __asm(".globl _mcount;" \ - ".type _mcount,@function;" \ - "_mcount:;" \ - ".set noreorder;" \ - ".set noat;" \ - ".cpload $25;" \ - ".cprestore 4;" \ - "sw $4,8($29);" \ - "sw $5,12($29);" \ - "sw $6,16($29);" \ - "sw $7,20($29);" \ - "sw $1,0($29);" \ - "sw $31,4($29);" \ - "move $5,$31;" \ - "jal ___mcount;" \ - "move $4,$1;" \ - "lw $4,8($29);" \ - "lw $5,12($29);" \ - "lw $6,16($29);" \ - "lw $7,20($29);" \ - "lw $31,4($29);" \ - "lw $1,0($29);" \ - "addu $29,$29,8;" \ - "j $31;" \ - "move $31,$1;" \ - ".set reorder;" \ - ".set at"); - -#ifdef _KERNEL -/* - * The following two macros do splhigh and splx respectively. - * They have to be defined this way because these are real - * functions on the MIPS, and we do not want to invoke mcount - * recursively. - */ -#define MCOUNT_ENTER s = _splhigh() - -#define MCOUNT_EXIT _splx(s) -#endif /* _KERNEL */ - -#endif /* !_MIPS_PROFILE_H_ */ diff --git a/sys/arch/mips/include/ptrace.h b/sys/arch/mips/include/ptrace.h deleted file mode 100644 index cb92fb71dbc..00000000000 --- a/sys/arch/mips/include/ptrace.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: ptrace.h,v 1.2 1999/01/27 04:46:06 imp Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)ptrace.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_PTRACE_H_ -#define _MIPS_PTRACE_H_ - -/* - * Machine dependent trace commands. - * - */ - -#define PT_GETREGS (PT_FIRSTMACH+0) -#define PT_SETREGS (PT_FIRSTMACH+1) -#define PT_STEP (PT_FIRSTMACH+2) - -#endif /* !_MIPS_PTRACE_H_ */ diff --git a/sys/arch/mips/include/reg.h b/sys/arch/mips/include/reg.h deleted file mode 100644 index ca64bb189f7..00000000000 --- a/sys/arch/mips/include/reg.h +++ /dev/null @@ -1,61 +0,0 @@ -/* $OpenBSD: reg.h,v 1.2 1999/01/27 04:46:06 imp Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: reg.h 1.1 90/07/09 - * @(#)reg.h 8.2 (Berkeley) 1/11/94 - */ - -#ifndef _MIPS_REG_H_ -#define _MIPS_REG_H_ -/* - * Location of the users' stored - * registers relative to ZERO. - * Usage is p->p_regs[XX]. - * - * must be visible to assembly code. - */ -#include <machine/regnum.h> - -/* - * Register set accessible via /proc/$pid/reg - */ -struct reg { - int r_regs[71]; /* numbered as above */ -}; -#endif /*_MIPS_REG_H_*/ diff --git a/sys/arch/mips/include/regdef.h b/sys/arch/mips/include/regdef.h deleted file mode 100644 index 5e5979e21c4..00000000000 --- a/sys/arch/mips/include/regdef.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $OpenBSD: regdef.h,v 1.3 1999/01/27 04:46:06 imp 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. This file is derived from the MIPS RISC - * Architecture book by Gerry Kane. - * - * 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. - * - * @(#)regdef.h 8.1 (Berkeley) 6/10/93 - */ -#ifndef _MIPS_REGDEF_H_ -#define _MIPS_REGDEF_H_ - -#define zero $0 /* always zero */ -#define AT $at /* assembler temp */ -#define v0 $2 /* return value */ -#define v1 $3 -#define a0 $4 /* argument registers */ -#define a1 $5 -#define a2 $6 -#define a3 $7 -#define t0 $8 /* temp registers (not saved across subroutine calls) */ -#define t1 $9 -#define t2 $10 -#define t3 $11 -#define t4 $12 -#define t5 $13 -#define t6 $14 -#define t7 $15 -#define s0 $16 /* saved across subroutine calls (callee saved) */ -#define s1 $17 -#define s2 $18 -#define s3 $19 -#define s4 $20 -#define s5 $21 -#define s6 $22 -#define s7 $23 -#define t8 $24 /* two more temp registers */ -#define t9 $25 -#define k0 $26 /* kernel temporary */ -#define k1 $27 -#define gp $28 /* global pointer */ -#define sp $29 /* stack pointer */ -#define s8 $30 /* one more callee saved */ -#define ra $31 /* return address */ - -#endif /* !_MIPS_REGDEF_H_ */ diff --git a/sys/arch/mips/include/regnum.h b/sys/arch/mips/include/regnum.h deleted file mode 100644 index 7c5cfc0b142..00000000000 --- a/sys/arch/mips/include/regnum.h +++ /dev/null @@ -1,144 +0,0 @@ -/* $OpenBSD: regnum.h,v 1.3 1999/01/27 04:46:06 imp Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: reg.h 1.1 90/07/09 - * @(#)reg.h 8.2 (Berkeley) 1/11/94 - */ - -#ifndef _MIPS_REGNUM_H_ -#define _MIPS_REGNUM_H_ - -#define STAND_ARG_SIZE 16 -#define STAND_FRAME_SIZE 24 -#define STAND_RA_OFFSET 20 - -/* - * Location of the saved registers relative to ZERO. - * Usage is p->p_regs[XX]. - */ -#define ZERO 0 -#define AST 1 -#define V0 2 -#define V1 3 -#define A0 4 -#define A1 5 -#define A2 6 -#define A3 7 -#define T0 8 -#define T1 9 -#define T2 10 -#define T3 11 -#define T4 12 -#define T5 13 -#define T6 14 -#define T7 15 -#define S0 16 -#define S1 17 -#define S2 18 -#define S3 19 -#define S4 20 -#define S5 21 -#define S6 22 -#define S7 23 -#define T8 24 -#define T9 25 -#define K0 26 -#define K1 27 -#define GP 28 -#define SP 29 -#define S8 30 -#define RA 31 -#define SR 32 -#define PS SR /* alias for SR */ -#define MULLO 33 -#define MULHI 34 -#define BADVADDR 35 -#define CAUSE 36 -#define PC 37 - -#define NUMSAVEREGS 38 /* Number of registers saved in trap */ - -#define FPBASE 38 -#define F0 (FPBASE+0) -#define F1 (FPBASE+1) -#define F2 (FPBASE+2) -#define F3 (FPBASE+3) -#define F4 (FPBASE+4) -#define F5 (FPBASE+5) -#define F6 (FPBASE+6) -#define F7 (FPBASE+7) -#define F8 (FPBASE+8) -#define F9 (FPBASE+9) -#define F10 (FPBASE+10) -#define F11 (FPBASE+11) -#define F12 (FPBASE+12) -#define F13 (FPBASE+13) -#define F14 (FPBASE+14) -#define F15 (FPBASE+15) -#define F16 (FPBASE+16) -#define F17 (FPBASE+17) -#define F18 (FPBASE+18) -#define F19 (FPBASE+19) -#define F20 (FPBASE+20) -#define F21 (FPBASE+21) -#define F22 (FPBASE+22) -#define F23 (FPBASE+23) -#define F24 (FPBASE+24) -#define F25 (FPBASE+25) -#define F26 (FPBASE+26) -#define F27 (FPBASE+27) -#define F28 (FPBASE+28) -#define F29 (FPBASE+29) -#define F30 (FPBASE+30) -#define F31 (FPBASE+31) -#define FSR (FPBASE+32) - -#ifdef IPCREG -#define NIPCREG (FSR + 1) -int ipcreg[NIPCREG] = { - ZERO, AST, V0, V1, A0, A1, A2, A3, T0, T1, T2, T3, T4, T5, T6, T7, - S0, S1, S2, S3, S4, S5, S6, S7, T8, T9, K0, K1, GP, SP, S8, RA, - SR, MULLO, MULHI, BADVADDR, CAUSE, PC, - F0, F1, F2, F3, F4, F5, F6, F7, - F8, F9, F10, F11, F12, F13, F14, F15, - F16, F17, F18, F19, F20, F21, F22, F23, - F24, F25, F26, F27, F28, F29, F30, F31, FSR, -}; -#endif -#endif /* !_MIPS_REGNUM_H_ */ diff --git a/sys/arch/mips/include/reloc.h b/sys/arch/mips/include/reloc.h deleted file mode 100644 index 0fc60b24444..00000000000 --- a/sys/arch/mips/include/reloc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* $OpenBSD: reloc.h,v 1.1 1998/01/28 11:14:55 pefo Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)reloc.h 8.1 (Berkeley) 6/10/93 - * from: Header: reloc.h,v 1.6 92/06/20 09:59:37 torek Exp - */ - diff --git a/sys/arch/mips/include/setjmp.h b/sys/arch/mips/include/setjmp.h deleted file mode 100644 index df2aee0bf7b..00000000000 --- a/sys/arch/mips/include/setjmp.h +++ /dev/null @@ -1,12 +0,0 @@ -/* $OpenBSD: setjmp.h,v 1.2 1999/01/27 04:46:06 imp Exp $ */ - -/* - * mips/setjmp.h: machine dependent setjmp-related information. - */ - -#ifndef _MIPS_SETJMP_H_ -#define _MIPS_SETJMP_H_ - -#define _JBLEN 83 /* size, in longs, of a jmp_buf */ - -#endif /* !_MIPS_SETJMP_H_ */ diff --git a/sys/arch/mips/include/signal.h b/sys/arch/mips/include/signal.h deleted file mode 100644 index fab90e369a3..00000000000 --- a/sys/arch/mips/include/signal.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $OpenBSD: signal.h,v 1.2 1999/01/27 04:10:03 imp 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. - * - * @(#)signal.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_SIGNAL_H_ -#define _MIPS_SIGNAL_H_ - -/* - * Machine-dependent signal definitions - */ - -typedef int sig_atomic_t; - -#ifndef _ANSI_SOURCE -/* - * Information pushed on stack when a signal is delivered. - * This is used by the kernel to restore state following - * execution of the signal handler. It is also made available - * to the handler to allow it to restore state properly if - * a non-standard exit is performed. - */ -struct sigcontext { - int sc_onstack; /* sigstack state to restore */ - int sc_mask; /* signal mask to restore */ - int sc_pc; /* pc at time of signal */ - int sc_regs[32]; /* processor regs 0 to 31 */ - int mullo, mulhi; /* mullo and mulhi registers... */ - int sc_fpused; /* fp has been used */ - int sc_fpregs[33]; /* fp regs 0 to 31 and csr */ - int sc_fpc_eir; /* floating point exception instruction reg */ - int xxx[8]; /* XXX reserved */ -}; - -#endif /* !_ANSI_SOURCE */ -#endif /* !_MIPS_SIGNAL_H_ */ diff --git a/sys/arch/mips/include/spinlock.h b/sys/arch/mips/include/spinlock.h deleted file mode 100644 index 11e7ae5597b..00000000000 --- a/sys/arch/mips/include/spinlock.h +++ /dev/null @@ -1,10 +0,0 @@ -/* $OpenBSD: spinlock.h,v 1.3 1999/01/27 04:46:06 imp Exp $ */ - -#ifndef _MIPS_SPINLOCK_H_ -#define _MIPS_SPINLOCK_H_ - -#define _SPINLOCK_UNLOCKED (0) -#define _SPINLOCK_LOCKED (1) -typedef int _spinlock_lock_t; - -#endif /* !_MIPS_SPINLOCK_H_ */ diff --git a/sys/arch/mips/include/stdarg.h b/sys/arch/mips/include/stdarg.h deleted file mode 100644 index dc8485fee4a..00000000000 --- a/sys/arch/mips/include/stdarg.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $OpenBSD: stdarg.h,v 1.2 1999/01/27 04:46:06 imp Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_STDARG_H_ -#define _MIPS_STDARG_H_ - -#include <machine/ansi.h> - -typedef _BSD_VA_LIST_ va_list; - -#define __va_promote(type) \ - (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) - -#define va_start(ap, last) \ - (ap = ((char *)&(last) + __va_promote(last))) - -#ifdef _KERNEL -#define va_arg(ap, type) \ - ((type *)(ap += sizeof(type)))[-1] -#else -#define va_arg(ap, type) \ - ((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \ - sizeof(type) > sizeof(int) ? \ - (-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \ - (abort(), 0)))[-1] -#endif - -#define va_end(ap) ((void) 0) - -#endif /* !_MIPS_STDARG_H_ */ diff --git a/sys/arch/mips/include/trap.h b/sys/arch/mips/include/trap.h deleted file mode 100644 index 7f32e5e4b18..00000000000 --- a/sys/arch/mips/include/trap.h +++ /dev/null @@ -1,73 +0,0 @@ -/* $OpenBSD: trap.h,v 1.3 1999/01/27 04:46:06 imp Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: trap.h 1.1 90/07/09 - * from: @(#)trap.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _MIPS_TRAP_H_ -#define _MIPS_TRAP_H_ - -/* - * Trap codes also known in trap.c for name strings. - * Used for indexing so modify with care. - */ - -#define T_INT 0 /* Interrupt pending */ -#define T_TLB_MOD 1 /* TLB modified fault */ -#define T_TLB_LD_MISS 2 /* TLB miss on load or ifetch */ -#define T_TLB_ST_MISS 3 /* TLB miss on a store */ -#define T_ADDR_ERR_LD 4 /* Address error on a load or ifetch */ -#define T_ADDR_ERR_ST 5 /* Address error on a store */ -#define T_BUS_ERR_IFETCH 6 /* Bus error on an ifetch */ -#define T_BUS_ERR_LD_ST 7 /* Bus error on a load or store */ -#define T_SYSCALL 8 /* System call */ -#define T_BREAK 9 /* Breakpoint */ -#define T_RES_INST 10 /* Reserved instruction exception */ -#define T_COP_UNUSABLE 11 /* Coprocessor unusable */ -#define T_OVFLOW 12 /* Arithmetic overflow */ -#define T_TRAP 13 /* Trap instruction */ -#define T_VCEI 14 /* Virtual coherency instruction */ -#define T_FPE 15 /* Floating point exception */ -#define T_WATCH 23 /* Watch address reference */ -#define T_VCED 31 /* Virtual coherency data */ - -#define T_USER 0x20 /* user-mode flag or'ed with type */ - -#endif /* !_MIPS_TRAP_H_ */ diff --git a/sys/arch/mips/include/types.h b/sys/arch/mips/include/types.h deleted file mode 100644 index cd29b7572fc..00000000000 --- a/sys/arch/mips/include/types.h +++ /dev/null @@ -1,90 +0,0 @@ -/* $OpenBSD: types.h,v 1.7 1999/07/07 23:16:41 art 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. - * - * @(#)types.h 8.3 (Berkeley) 1/5/94 - */ - -#ifndef _MIPS_TYPES_H_ -#define _MIPS_TYPES_H_ - -#include <sys/cdefs.h> - -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -typedef struct _physadr { - int r[1]; -} *physadr; - -typedef struct label_t { - int val[12]; -} label_t; -#endif - -typedef unsigned long vm_offset_t; -typedef unsigned long vm_size_t; - -typedef unsigned long vaddr_t; -typedef unsigned long paddr_t; -typedef unsigned long vsize_t; -typedef unsigned long psize_t; - -/* - * Basic integral types. Omit the typedef if - * not possible for a machine/compiler combination. - */ -#define __BIT_TYPES_DEFINED__ -typedef __signed char int8_t; -typedef unsigned char u_int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short u_int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int u_int32_t; -typedef unsigned int uint32_t; -/* LONGLONG */ -typedef long long int64_t; -/* LONGLONG */ -typedef unsigned long long u_int64_t; -/* LONGLONG */ -typedef unsigned long long uint64_t; - -typedef int32_t register_t; - -#define __SWAP_BROKEN -#define __FORK_BRAINDAMAGE - -#endif /* _MIPS_TYPES_H_ */ diff --git a/sys/arch/mips/include/varargs.h b/sys/arch/mips/include/varargs.h deleted file mode 100644 index 92c2e9a24a4..00000000000 --- a/sys/arch/mips/include/varargs.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $OpenBSD: varargs.h,v 1.3 1999/01/27 04:46:06 imp Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * 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. - * - * @(#)varargs.h 8.2 (Berkeley) 3/22/94 - */ - -#ifndef _MIPS_VARARGS_H_ -#define _MIPS_VARARGS_H_ - -#include <machine/stdarg.h> - -#define va_dcl int va_alist; ... - -#undef va_start -#define va_start(ap) \ - ap = (char *)&va_alist - -#endif /* !_MIPS_VARARGS_H_ */ diff --git a/sys/arch/mips/include/vmparam.h b/sys/arch/mips/include/vmparam.h deleted file mode 100644 index f56fff906ed..00000000000 --- a/sys/arch/mips/include/vmparam.h +++ /dev/null @@ -1,152 +0,0 @@ -/* $OpenBSD: vmparam.h,v 1.5 2001/05/05 20:56:43 art Exp $ */ -/* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: vmparam.h 1.16 91/01/18 - * @(#)vmparam.h 8.2 (Berkeley) 4/22/94 - */ - -#ifndef _MIPS_VMPARAM_H_ -#define _MIPS_VMPARAM_H_ - -/* - * Machine dependent constants mips processors. - */ -/* - * USRTEXT is the start of the user text/data space, while USRSTACK - * is the top (end) of the user stack. - */ -#define USRTEXT 0x00400000 -#define USRSTACK 0x80000000 /* Start of user stack */ - -/* - * Virtual memory related constants, all in bytes - */ -#ifndef MAXTSIZ -#define MAXTSIZ (24*1024*1024) /* max text size */ -#endif -#ifndef DFLDSIZ -#define DFLDSIZ (64*1024*1024) /* initial data size limit */ -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (256*1024*1024) /* max data size */ -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (1024*1024) /* initial stack size limit */ -#endif -#ifndef MAXSSIZ -#define MAXSSIZ MAXDSIZ /* max stack size */ -#endif - -/* - * Default sizes of swap allocation chunks (see dmap.h). - * The actual values may be changed in vminit() based on MAXDSIZ. - * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. - * DMMIN should be at least ctod(1) so that vtod() works. - * vminit() insures this. - */ -#define DMMIN 32 /* smallest swap allocation */ -#define DMMAX 4096 /* largest potential swap allocation */ - -/* - * Sizes of the system and user portions of the system page table. - */ -/* SYSPTSIZE IS SILLY; (really number of buffers for I/O) */ -#define SYSPTSIZE 1228 -#define USRPTSIZE 1024 - -/* - * PTEs for mapping user space into the kernel for phyio operations. - * 16 pte's are enough to cover 8 disks * MAXBSIZE. - */ -#ifndef USRIOSIZE -#define USRIOSIZE 32 -#endif - -/* - * PTEs for system V style shared memory. - * This is basically slop for kmempt which we actually allocate (malloc) from. - */ -#ifndef SHMMAXPGS -#define SHMMAXPGS 1024 /* 4mb */ -#endif - -/* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* - * A swapped in process is given a small amount of core without being bothered - * by the page replacement algorithm. Basically this says that if you are - * swapped in you deserve some resources. We protect the last SAFERSS - * pages against paging and will just swap you out rather than paging you. - */ -#define SAFERSS 4 /* nominal ``small'' resident set size - protected against replacement */ -/* - * Mach derived constants - */ - -/* user/kernel map constants */ -#define VM_MIN_ADDRESS ((vm_offset_t)0x00000000) -#define VM_MAXUSER_ADDRESS ((vm_offset_t)0x80000000) -#define VM_MAX_ADDRESS ((vm_offset_t)0x80000000) -#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xC0000000) -#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFFFFC000) - -#define MACHINE_NONCONTIG /* VM <=> pmap interface modifier */ - -/* virtual sizes (bytes) for various kernel submaps */ -#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) -#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) - -struct vm_map; - -vm_offset_t kmem_alloc_upage __P((struct vm_map *, vm_size_t)); -vm_offset_t vtophys __P((vm_offset_t, vm_size_t)); - -#endif /* !_MIPS_VMPARAM_H_ */ diff --git a/sys/arch/mips/mips/arcbios.c b/sys/arch/mips/mips/arcbios.c deleted file mode 100644 index 051da1e5586..00000000000 --- a/sys/arch/mips/mips/arcbios.c +++ /dev/null @@ -1,340 +0,0 @@ -/* $OpenBSD: arcbios.c,v 1.3 1998/06/06 06:33:33 mickey Exp $ */ -/*- - * Copyright (c) 1996 M. Warner Losh. All rights reserved. - * Copyright (c) 1996, 1997, 1998 Per Fogelstrom. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. 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/proc.h> -#include <sys/user.h> -#include <lib/libkern/libkern.h> -#include <machine/pte.h> -#include <machine/cpu.h> -#include <machine/memconf.h> -#include <machine/param.h> -#include <mips/mips/arcbios.h> -#include <mips/archtype.h> - -arc_param_blk_t *bios_base = ArcBiosBase; - -extern int system_type; /* Mother board type */ -extern int physmem; /* Total physical memory size */ - -int Bios_Read __P((int, char *, int, int *)); -int Bios_Write __P((int, char *, int, int *)); -int Bios_Open __P((char *, int, u_int *)); -int Bios_Close __P((u_int)); -arc_mem_t *Bios_GetMemoryDescriptor __P((arc_mem_t *)); -arc_sid_t *Bios_GetSystemId __P((void)); -arc_config_t *Bios_GetChild __P((arc_config_t *)); -arc_dsp_stat_t *Bios_GetDisplayStatus __P((int)); - -static void bios_configure_memory __P((void)); -static int get_system_type __P((void)); - -char buf[100]; /*XXX*/ -arc_dsp_stat_t displayinfo; /* Save area for display status info. */ - -static struct systypes { - char *sys_vend; /* Vendor ID if name is ambigous */ - char *sys_name; /* May be left NULL if name is sufficient */ - int sys_type; -} sys_types[] = { - { NULL, "PICA-61", ACER_PICA_61 }, - { NULL, "NEC-R94", ACER_PICA_61 }, - { NULL, "DESKTECH-TYNE", DESKSTATION_TYNE }, - { NULL, "DESKTECH-ARCStation I", DESKSTATION_RPC44 }, - { NULL, "Microsoft-Jazz", MAGNUM }, - { NULL, "RM200PCI", SNI_RM200 }, - { NULL, "SGI-IP17", SGI_CRIMSON }, - { NULL, "SGI-IP19", SGI_ONYX }, - { NULL, "SGI-IP20", SGI_INDIGO }, - { NULL, "SGI-IP21", SGI_POWER }, - { NULL, "SGI-IP22", SGI_INDY }, - { NULL, "SGI-IP25", SGI_POWER10 }, - { NULL, "SGI-IP26", SGI_POWERI }, - { NULL, "SGI-IP32", SGI_O2 }, -}; - -#define KNOWNSYSTEMS (sizeof(sys_types) / sizeof(struct systypes)) - -/* - * ARC Bios trampoline code. - */ -#define ARC_Call(Name,Offset) \ -__asm__("\n" \ -" .text\n" \ -" .ent " #Name "\n" \ -" .align 3\n" \ -" .set noreorder\n" \ -" .globl " #Name "\n" \ -#Name":\n" \ -" lw $2, 0x80001020\n"\ -" lw $2," #Offset "($2)\n"\ -" jr $2\n" \ -" nop\n" \ -" .end " #Name "\n" ); - -ARC_Call(Bios_Load, 0x00); -ARC_Call(Bios_Invoke, 0x04); -ARC_Call(Bios_Execute, 0x08); -ARC_Call(Bios_Halt, 0x0c); -ARC_Call(Bios_PowerDown, 0x10); -ARC_Call(Bios_Restart, 0x14); -ARC_Call(Bios_Reboot, 0x18); -ARC_Call(Bios_EnterInteractiveMode, 0x1c); -ARC_Call(Bios_Unused1, 0x20); -ARC_Call(Bios_GetPeer, 0x24); -ARC_Call(Bios_GetChild, 0x28); -ARC_Call(Bios_GetParent, 0x2c); -ARC_Call(Bios_GetConfigurationData, 0x30); -ARC_Call(Bios_AddChild, 0x34); -ARC_Call(Bios_DeleteComponent, 0x38); -ARC_Call(Bios_GetComponent, 0x3c); -ARC_Call(Bios_SaveConfiguration, 0x40); -ARC_Call(Bios_GetSystemId, 0x44); -ARC_Call(Bios_GetMemoryDescriptor, 0x48); -ARC_Call(Bios_Unused2, 0x4c); -ARC_Call(Bios_GetTime, 0x50); -ARC_Call(Bios_GetRelativeTime, 0x54); -ARC_Call(Bios_GetDirectoryEntry, 0x58); -ARC_Call(Bios_Open, 0x5c); -ARC_Call(Bios_Close, 0x60); -ARC_Call(Bios_Read, 0x64); -ARC_Call(Bios_GetReadStatus, 0x68); -ARC_Call(Bios_Write, 0x6c); -ARC_Call(Bios_Seek, 0x70); -ARC_Call(Bios_Mount, 0x74); -ARC_Call(Bios_GetEnvironmentVariable, 0x78); -ARC_Call(Bios_SetEnvironmentVariable, 0x7c); -ARC_Call(Bios_GetFileInformation, 0x80); -ARC_Call(Bios_SetFileInformation, 0x84); -ARC_Call(Bios_FlushAllCaches, 0x88); -ARC_Call(Bios_TestUnicodeCharacter, 0x8c); -ARC_Call(Bios_GetDisplayStatus, 0x90); - -/* - * Simple getchar/putchar interface. - */ - -int -bios_getchar() -{ - char buf[4]; - int cnt; - - if(Bios_Read(0, &buf[0], 1, &cnt) != 0) - return(-1); - return(buf[0] & 255); -} - -void -bios_putchar(c) -char c; -{ - char buf[4]; - int cnt; - - if(c == '\n') { - buf[0] = '\r'; - buf[1] = c; - cnt = 2; - if(displayinfo.CursorYPosition < displayinfo.CursorMaxYPosition) - displayinfo.CursorYPosition++; - } - else { - buf[0] = c; - cnt = 1; - } - Bios_Write(1, &buf[0], cnt, &cnt); -} - -void -bios_putstring(s) -char *s; -{ - while(*s) { - bios_putchar(*s++); - } -} - -/* - * Get memory descriptor for the memory configuration and - * create a layout database used by pmap init to set up - * the memory system. Note that kernel option "MACHINE_NONCONTIG" - * must be set for systems with non contigous physical memory. - * - * Concatenate obvious adjecent segments. - */ -static void -bios_configure_memory() -{ - arc_mem_t *descr = 0; - struct mem_descriptor *m; - vm_offset_t seg_start, seg_end; - int i; - - descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr); - while(descr != 0) { - - seg_start = descr->BasePage * 4096; - seg_end = seg_start + descr->PageCount * 4096; - - switch(descr->Type) { - case BadMemory: /* Have no use for theese */ - break; - -#if 0 - case ExeceptionBlock: - case SystemParameterBlock: - case FirmwareTemporary: - case FirmwarePermanent: -#endif - case FreeMemory: - case FreeContigous: - physmem += descr->PageCount * 4096; - m = 0; - for( i = 0; i < MAXMEMSEGS; i++) { - if(mem_layout[i].mem_size == 0) { - if(m == 0) - m = &mem_layout[i]; /* free */ - } - else if(seg_end == mem_layout[i].mem_start) { - m = &mem_layout[i]; - m->mem_start = seg_start; - m->mem_size += seg_end - seg_start; - } - else if(mem_layout[i].mem_start + - mem_layout[i].mem_size == seg_start) { - m = &mem_layout[i]; - m->mem_size += seg_end - seg_start; - } - } - if(m && m->mem_size == 0) { - m->mem_start = seg_start; - m->mem_size = seg_end - seg_start; - } - break; - - case LoadedProgram: /* This is the loaded kernel */ - physmem += descr->PageCount * 4096; - break; - - default: /* Unknown type, leave it alone... */ - break; - } - descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr); - } - -#if 0 - for( i = 0; i < MAXMEMSEGS; i++) { - if(mem_layout[i].mem_size) { - sprintf(buf, "MEM %d, 0x%x, 0x%x\n",i, - mem_layout[i].mem_start, - mem_layout[i].mem_size); - bios_putstring(buf); - } - } -#endif -} - -/* - * Find out system type. - */ -static int -get_system_type() -{ - arc_config_t *cf; - arc_sid_t *sid; - int i; - - if((bios_base->magic != ARC_PARAM_BLK_MAGIC) && - (bios_base->magic != ARC_PARAM_BLK_MAGIC_BUG)) { - return(-1); /* This is not an ARC system */ - } - - sid = (arc_sid_t *)Bios_GetSystemId(); - cf = (arc_config_t *)Bios_GetChild(NULL); - if(cf) { - for(i = 0; i < KNOWNSYSTEMS; i++) { - if(strcmp(sys_types[i].sys_name, cf->id) != 0) - continue; - if(sys_types[i].sys_vend && - strncmp(sys_types[i].sys_vend, sid->vendor, 8) != 0) - continue; - return(sys_types[i].sys_type); /* Found it. */ - } - } - - bios_putstring("UNIDENTIFIED ARC SYSTEM `"); - if(cf) - bios_putstring(cf->id); - else - bios_putstring("????????"); - bios_putstring("' VENDOR `"); - sid->vendor[8] = 0; - bios_putstring(sid->vendor); - bios_putstring("'. Please contact OpenBSD (www.openbsd.org).\n"); - while(1); -} - -/* - * Incomplete version of bios_ident - */ -void -bios_ident() -{ - system_type = get_system_type(); - if(system_type < 0) { - return; - } - bios_configure_memory(); -#ifdef arc - displayinfo = *(arc_dsp_stat_t *)Bios_GetDisplayStatus(1); -#endif -} - -/* - * Return geometry of the display. Used by pccons.c to set up the - * display configuration. - */ -void -bios_display_info(xpos, ypos, xsize, ysize) - int *xpos; - int *ypos; - int *xsize; - int *ysize; -{ -#ifdef arc - *xpos = displayinfo.CursorXPosition; - *ypos = displayinfo.CursorYPosition; - *xsize = displayinfo.CursorMaxXPosition; - *ysize = displayinfo.CursorMaxYPosition; -#endif -} - diff --git a/sys/arch/mips/mips/arcbios.h b/sys/arch/mips/mips/arcbios.h deleted file mode 100644 index f002ea13fbf..00000000000 --- a/sys/arch/mips/mips/arcbios.h +++ /dev/null @@ -1,352 +0,0 @@ -/* $OpenBSD: arcbios.h,v 1.1 1998/01/29 15:06:22 pefo Exp $ */ -/*- - * Copyright (c) 1996 M. Warner Losh. 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. 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/types.h> - -typedef struct arc_sid -{ - char vendor[8]; - char prodid[8]; -} arc_sid_t; - -typedef enum arc_config_class -{ - arc_SystemClass, - arc_ProcessorClass, - arc_CacheClass, - arc_AdapterClass, - arc_ControllerClass, - arc_PeripheralClass, - arc_MemoryClass -} arc_config_class_t; - -typedef enum arc_config_type -{ - arc_System, - - arc_CentralProcessor, - arc_FloatingPointProcessor, - - arc_PrimaryIcache, - arc_PrimaryDcache, - arc_SecondaryIcache, - arc_SecondaryDcache, - arc_SecondaryCache, - - arc_EisaAdapter, /* Eisa adapter */ - arc_TcAdapter, /* Turbochannel adapter */ - arc_ScsiAdapter, /* SCSI adapter */ - arc_DtiAdapter, /* AccessBus adapter */ - arc_MultiFunctionAdapter, - - arc_DiskController, - arc_TapeController, - arc_CdromController, - arc_WormController, - arc_SerialController, - arc_NetworkController, - arc_DisplayController, - arc_ParallelController, - arc_PointerController, - arc_KeyboardController, - arc_AudioController, - arc_OtherController, /* denotes a controller not otherwise defined */ - - arc_DiskPeripheral, - arc_FloppyDiskPeripheral, - arc_TapePeripheral, - arc_ModemPeripheral, - arc_MonitorPeripheral, - arc_PrinterPeripheral, - arc_PointerPeripheral, - arc_KeyboardPeripheral, - arc_TerminalPeripheral, - arc_OtherPeripheral, /* denotes a peripheral not otherwise defined */ - arc_LinePeripheral, - arc_NetworkPeripheral, - - arc_SystemMemory -} arc_config_type_t; - -typedef u_char arc_dev_flags_t; - -/* Wonder how this is aligned... */ -typedef struct arc_config -{ - arc_config_class_t class; /* Likely these three all */ - arc_config_type_t type; /* need to be uchar to make */ - arc_dev_flags_t flags; /* the alignment right */ - u_int16_t version; - u_int16_t revision; - u_int32_t key; - u_int32_t affinity_mask; - u_int32_t config_data_len; - u_int32_t id_len; - char *id; -} arc_config_t; - -typedef enum arc_status -{ - arc_ESUCCESS, /* Success */ - arc_E2BIG, /* Arg list too long */ - arc_EACCES, /* No such file or directory */ - arc_EAGAIN, /* Try again */ - arc_EBADF, /* Bad file number */ - arc_EBUSY, /* Device or resource busy */ - arc_EFAULT, /* Bad address */ - arc_EINVAL, /* Invalid argument */ - arc_EIO, /* I/O error */ - arc_EISDIR, /* Is a directory */ - arc_EMFILE, /* Too many open files */ - arc_EMLINK, /* Too many links */ - arc_ENAMETOOLONG, /* File name too long */ - arc_ENODEV, /* No such device */ - arc_ENOENT, /* No such file or directory */ - arc_ENOEXEC, /* Exec format error */ - arc_ENOMEM, /* Out of memory */ - arc_ENOSPC, /* No space left on device */ - arc_ENOTDIR, /* Not a directory */ - arc_ENOTTY, /* Not a typewriter */ - arc_ENXIO, /* No such device or address */ - arc_EROFS, /* Read-only file system */ -} arc_status_t; - -/* - * Oops! Arc systems and SGI's have different order of types. - */ -#ifdef arc -typedef enum { - ExeceptionBlock, SystemParameterBlock, FreeMemory, - BadMemory, LoadedProgram, FirmwareTemporary, - FirmwarePermanent, FreeContigous -} MEMORYTYPE; -#endif - -#ifdef sgi -typedef enum { - ExeceptionBlock, SystemParameterBlock, FreeContigous, - FreeMemory, BadMemory, LoadedProgram, - FirmwareTemporary, FirmwarePermanent, -} MEMORYTYPE; -#endif - -typedef struct arc_mem { - MEMORYTYPE Type; /* Memory chunk type */ - u_int32_t BasePage; /* Page no, first page */ - u_int32_t PageCount; /* Number of pages */ -} arc_mem_t; - -typedef caddr_t arc_time_t; /* XXX */ - -typedef struct arc_dsp_stat { - u_int16_t CursorXPosition; - u_int16_t CursorYPosition; - u_int16_t CursorMaxXPosition; - u_int16_t CursorMaxYPosition; - u_char ForegroundColor; - u_char BackgroundColor; - u_char HighIntensity; - u_char Underscored; - u_char ReverseVideo; -} arc_dsp_stat_t; - -typedef caddr_t arc_dirent_t; /* XXX */ -typedef u_int32_t arc_open_mode_t; /* XXX */ -typedef u_int32_t arc_seek_mode_t; /* XXX */ -typedef u_int32_t arc_mount_t; /* XXX */ - -typedef struct arc_calls -{ - arc_status_t (*load)( /* Load 1 */ - char *, /* Image to load */ - u_int32_t, /* top address */ - u_int32_t *, /* Entry address */ - u_int32_t *); /* Low address */ - - arc_status_t (*invoke)( /* Invoke 2 */ - u_int32_t, /* Entry Address */ - u_int32_t, /* Stack Address */ - u_int32_t, /* Argc */ - char **, /* argv */ - char **); /* envp */ - - arc_status_t (*execute)( /* Execute 3 */ - char *, /* Image path */ - u_int32_t, /* Argc */ - char **, /* argv */ - char **); /* envp */ - - volatile void (*halt)(void); /* Halt 4 */ - - volatile void (*power_down)(void); /* PowerDown 5 */ - - volatile void (*restart)(void); /* Restart 6 */ - - volatile void (*reboot)(void); /* Reboot 7 */ - - volatile void (*enter_interactive_mode)(void); /* EnterInteractiveMode 8 */ - - volatile void (*return_from_main)(void); /* ReturnFromMain 9 */ - - arc_config_t *(*get_peer)( /* GetPeer 10 */ - arc_config_t *); /* Component */ - - arc_config_t *(*get_child)( /* GetChild 11 */ - arc_config_t *); /* Component */ - - arc_config_t *(*get_parent)( /* GetParent 12 */ - arc_config_t *); /* Component */ - - arc_status_t (*get_config_data)( /* GetConfigurationData 13 */ - caddr_t, /* Configuration Data */ - arc_config_t *); /* Component */ - - arc_config_t *(*add_child)( /* AddChild 14 */ - arc_config_t *, /* Component */ - arc_config_t *); /* New Component */ - - arc_status_t (*delete_component)( /* DeleteComponent 15 */ - arc_config_t *); /* Component */ - - arc_config_t *(*get_component)( /* GetComponent 16 */ - char *); /* Path */ - - arc_status_t (*save_config)(void); /* SaveConfiguration 17 */ - - arc_sid_t *(*get_system_id)(void); /* GetSystemId 18 */ - - arc_mem_t *(*get_memory_descriptor)( /* GetMemoryDescriptor 19 */ - arc_mem_t *); /* MemoryDescriptor */ - -#ifdef arc - void (*signal)( /* Signal 20 */ - u_int32_t, /* Signal number */ -/**/ caddr_t); /* Handler */ -#else - void *unused; -#endif - - arc_time_t *(*get_time)(void); /* GetTime 21 */ - - u_int32_t (*get_relative_time)(void); /* GetRelativeTime 22 */ - - arc_status_t (*get_dir_entry)( /* GetDirectoryEntry 23 */ - u_int32_t, /* FileId */ - arc_dirent_t *, /* Directory entry */ - u_int32_t, /* Length */ - u_int32_t *); /* Count */ - - arc_status_t (*open)( /* Open 24 */ - char *, /* Path */ - arc_open_mode_t, /* Open mode */ - u_int32_t *); /* FileId */ - - arc_status_t (*close)( /* Close 25 */ - u_int32_t); /* FileId */ - - arc_status_t (*read)( /* Read 26 */ - u_int32_t, /* FileId */ - caddr_t, /* Buffer */ - u_int32_t, /* Length */ - u_int32_t *); /* Count */ - - arc_status_t (*get_read_status)( /* GetReadStatus 27 */ - u_int32_t); /* FileId */ - - arc_status_t (*write)( /* Write 28 */ - u_int32_t, /* FileId */ - caddr_t, /* Buffer */ - u_int32_t, /* Length */ - u_int32_t *); /* Count */ - - arc_status_t (*seek)( /* Seek 29 */ - u_int32_t, /* FileId */ - int64_t *, /* Offset */ - arc_seek_mode_t); /* Mode */ - - arc_status_t (*mount)( /* Mount 30 */ - char *, /* Path */ - arc_mount_t); /* Operation */ - - char *(*getenv)( /* GetEnvironmentVariable 31 */ - char *); /* Variable */ - - arc_status_t (*putenv)( /* SetEnvironmentVariable 32 */ - char *, /* Variable */ - char *); /* Value */ - - arc_status_t (*get_file_info)(void); /* GetFileInformation 33 */ - - arc_status_t (*set_file_info)(void); /* SetFileInformation 34 */ - - void (*flush_all_caches)(void); /* FlushAllCaches 35 */ - -#ifdef arc - arc_status_t (*test_unicode)( /* TestUnicodeCharacter 36 */ - u_int32_t, /* FileId */ - u_int16_t); /* UnicodeCharacter */ - - arc_dsp_stat_t *(*get_display_status)( /* GetDisplayStatus 37 */ - u_int32_t); /* FileId */ -#endif -} arc_calls_t; - -#define ARC_PARAM_BLK_MAGIC 0x53435241 -#define ARC_PARAM_BLK_MAGIC_BUG 0x41524353 /* This is wrong... but req */ - -typedef struct arc_param_blk -{ - u_int32_t magic; /* Magic Number */ - u_int32_t length; /* Length of parameter block */ - u_int16_t version; /* ?? */ - u_int16_t revision; /* ?? */ -/**/ caddr_t restart_block; /* ?? */ -/**/ caddr_t debug_block; /* Debugging info -- unused */ -/**/ caddr_t general_exp_vect; /* ?? */ -/**/ caddr_t tlb_miss_exp_vect; /* ?? */ - u_int32_t firmware_length; /* Size of Firmware jumptable in bytes */ - arc_calls_t *firmware_vect; /* Firmware jumptable */ - u_int32_t vendor_length; /* Size of Vendor specific jumptable */ -/**/ caddr_t vendor_vect; /* Vendor specific jumptable */ - u_int32_t adapter_count; /* ?? */ - u_int32_t adapter0_type; /* ?? */ - u_int32_t adapter0_length; /* ?? */ -/**/ caddr_t adapter0_vect; /* ?? */ -} arc_param_blk_t; - -#define ArcBiosBase ((arc_param_blk_t *) 0x80001000) -#define ArcBios (ArcBiosBase->firmware_vect) - - -int bios_getchar __P((void)); -void bios_putchar __P((char)); -void bios_putstring __P((char *)); -void bios_ident __P((void)); -void bios_display_info __P((int *, int *, int *, int *)); - diff --git a/sys/arch/mips/mips/clock.c b/sys/arch/mips/mips/clock.c deleted file mode 100644 index 867a67c2a21..00000000000 --- a/sys/arch/mips/mips/clock.c +++ /dev/null @@ -1,388 +0,0 @@ -/* $OpenBSD: clock.c,v 1.7 2000/02/04 17:09:06 imp Exp $ */ -/* - * Copyright (c) 1997 Per Fogelstrom. - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: clock.c 1.18 91/01/21 - * - * from: @(#)clock.c 8.1 (Berkeley) 6/10/93 - * $Id: clock.c,v 1.7 2000/02/04 17:09:06 imp Exp $ - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <machine/autoconf.h> -#include <machine/cpu.h> -#include <mips/dev/clockvar.h> -#include <mips/archtype.h> - -#ifdef arc -#include <dev/isa/isavar.h> -#include <arc/isa/isa_machdep.h> -#endif - -int clock_started = 0; - -/* Definition of the driver for autoconfig. */ -static int clockmatch __P((struct device *, void *, void *)); -static void clockattach __P((struct device *, struct device *, void *)); - -void delay __P((int)); - -struct cfdriver clock_cd = { - NULL, "clock", DV_DULL, NULL, 0 -}; - -#ifdef arc -struct cfattach clock_isa_ca = { - sizeof(struct clock_softc), clockmatch, clockattach -}; - -struct cfattach clock_pica_ca = { - sizeof(struct clock_softc), clockmatch, clockattach -}; - -struct cfattach clock_algor_ca = { - sizeof(struct clock_softc), clockmatch, clockattach -}; -static int int5_dummy __P((unsigned mask, struct clockframe *cf)); -#endif - -#ifdef sgi -struct cfattach clock_indy_ca = { - sizeof(struct clock_softc), clockmatch, clockattach -}; -#endif - -void md_clk_attach __P((struct device *, struct device *, void *)); -int clockintr __P((void *)); - -#define SECMIN ((unsigned)60) /* seconds per minute */ -#define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */ -#define SECDAY ((unsigned)(24*SECHOUR)) /* seconds per day */ -#define SECYR ((unsigned)(365*SECDAY)) /* seconds per common year */ - -#define LEAPYEAR(year) (((year) % 4) == 0) - -static int -clockmatch(parent, cfdata, aux) - struct device *parent; - void *cfdata; - void *aux; -{ - struct cfdata *cf; - struct confargs *ca; -#ifdef arc - struct isa_attach_args *ia = aux; -#endif - - cf = cfdata; - ca = aux; - /* See how many clocks this system has */ - switch (system_type) { - -#ifdef arc - case ACER_PICA_61: - case MAGNUM: - /* make sure that we're looking for this type of device. */ - if (!BUS_MATCHNAME(ca, "dallas_rtc")) - return (0); - - break; - - case DESKSTATION_RPC44: - case DESKSTATION_TYNE: - ia->ia_iosize = 0x10; - ia->ia_msize = 0; - /* FALLTHROUGH */ - case ALGOR_P4032: - case ALGOR_P5064: - break; - -#endif - -#ifdef sgi - case SGI_INDY: - break; -#endif - default: - panic("clockmatch unknown CPU"); - } - - if (cf->cf_unit >= 1) - return (0); - - return (1); -} - -static void -clockattach(parent, self, aux) - struct device *parent; - struct device *self; - void *aux; -{ - struct isa_attach_args *ia; - - ia = aux; - md_clk_attach(parent, self, aux); - - switch (system_type) { - -#ifdef arc - case ACER_PICA_61: - case MAGNUM: - case ALGOR_P4032: - case ALGOR_P5064: - BUS_INTR_ESTABLISH((struct confargs *)aux, - (intr_handler_t)hardclock, self); - set_intr(SOFT_INT_MASK_0 << 7, int5_dummy, 7); - break; - - case DESKSTATION_RPC44: - case DESKSTATION_TYNE: - (void)isa_intr_establish(ia->ia_ic, - 0, 1, 3, clockintr, 0, "clock"); - set_intr(SOFT_INT_MASK_0 << 7, int5_dummy, 7); - break; -#endif - -#ifdef sgi - case SGI_INDY: - BUS_INTR_ESTABLISH((struct confargs *)aux, - (intr_handler_t)hardclock, self); - break; -#endif - - default: - panic("clockattach: it didn't get here. really."); - } - - printf("\n"); -} - -#ifdef arc -/* - * This code is a stub to take care of the unused int 5 in arc's. - * We may in the future use this for high precision timing... - */ -static int -int5_dummy(mask, cf) - unsigned mask; - struct clockframe *cf; -{ - R4K_SetCOMPARE(0); /* Shut up counter int's for a while */ - return(~0); -} -#endif - -/* - * Wait "n" microseconds. This doesn't belong here. XXX. - */ -void -delay(n) - int n; -{ - DELAY(n); -} - -/* - * Mips machine independent clock routines. - */ - -/* - * Start the real-time and statistics clocks. Leave stathz 0 since there - * are no other timers available. - */ -void -cpu_initclocks() -{ - extern int tickadj; - struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0]; - - - /* Assume 100 Hz */ - hz = 100; - - /* Start the clock. */ - (*csc->sc_init)(csc); - - /* Recalculate theese if clock init changed hz */ - tick = 1000000 / hz; /* number of micro-seconds between interrupts */ - tickadj = 240000 / (60 * hz); /* can adjust 240ms in 60s */ - - clock_started++; -} - -/* - * We assume newhz is either stathz or profhz, and that neither will - * change after being set up above. Could recalculate intervals here - * but that would be a drag. - */ -void -setstatclockrate(newhz) - int newhz; -{ -} - -/* - * This code is defunct after 2099. - * Will Unix still be here then?? - */ -static short dayyr[12] = { - 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 -}; - -/* - * Initialize the time of day register, based on the time base which - * is, e.g. from a filesystem. Base provides the time to within six - * months, and the time of year clock (if any) provides the rest. - */ -void -inittodr(base) - time_t base; -{ - struct tod_time c; - struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0]; - register int days, yr; - long deltat; - int badbase; - - if (base < 5*SECYR) { - printf("WARNING: preposterous time in file system"); - /* read the system clock anyway */ - base = 6*SECYR + 186*SECDAY + SECDAY/2; - badbase = 1; - } else - badbase = 0; - - /* Read RTC chip registers */ - (*csc->sc_get)(csc, base, &c); - - csc->sc_initted = 1; - - /* simple sanity checks */ - if (c.year < 70 || c.mon < 1 || c.mon > 12 || c.day < 1 || - c.day > 31 || c.hour > 23 || c.min > 59 || c.sec > 59) { - /* - * Believe the time in the file system for lack of - * anything better, resetting the TODR. - */ - time.tv_sec = base; - if (!badbase) { - printf("WARNING: preposterous clock chip time\n"); - resettodr(); - } - goto bad; - } - days = 0; - for (yr = 70; yr < c.year; yr++) - days += LEAPYEAR(yr) ? 366 : 365; - days += dayyr[c.mon - 1] + c.day - 1; - if (LEAPYEAR(yr) && c.mon > 2) - days++; - /* now have days since Jan 1, 1970; the rest is easy... */ - time.tv_sec = days * SECDAY + c.hour * 3600 + c.min * 60 + c.sec; - - if (!badbase) { - /* - * See if we gained/lost two or more days; - * if so, assume something is amiss. - */ - deltat = time.tv_sec - base; - if (deltat < 0) - deltat = -deltat; - if (deltat < 2 * SECDAY) - return; - printf("WARNING: clock %s %d days", - time.tv_sec < base ? "lost" : "gained", deltat / SECDAY); - } -bad: - printf(" -- CHECK AND RESET THE DATE!\n"); -} - -/* - * Reset the TODR based on the time value; used when the TODR has a - * preposterous value and also when the time is reset by the stime - * system call. - * Also called when the TODR goes past TODRZERO + 100*(SECYEAR+2*SECDAY) - * (e.g. on Jan 2 just after midnight) to wrap the TODR around. - */ -void -resettodr() -{ - struct tod_time c; - struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0]; - register int t, t2; - - if(!csc->sc_initted) - return; - - /* compute the day of week. 1 is Sunday*/ - t2 = time.tv_sec / SECDAY; - c.dow = (t2 + 5) % 7; /* 1/1/1970 was thursday */ - - /* compute the year */ - t2 = time.tv_sec / SECDAY; - c.year = 69; - while (t2 >= 0) { /* whittle off years */ - t = t2; - c.year++; - t2 -= LEAPYEAR(c.year) ? 366 : 365; - } - - /* t = month + day; separate */ - t2 = LEAPYEAR(c.year); - for (c.mon = 1; c.mon < 12; c.mon++) - if (t < dayyr[c.mon] + (t2 && c.mon > 1)) - break; - - c.day = t - dayyr[c.mon - 1] + 1; - if (t2 && c.mon > 2) - c.day--; - - /* the rest is easy */ - t = time.tv_sec % SECDAY; - c.hour = t / 3600; - t %= 3600; - c.min = t / 60; - c.sec = t % 60; - - (*csc->sc_set)(csc, &c); -} diff --git a/sys/arch/mips/mips/cpu.c b/sys/arch/mips/mips/cpu.c deleted file mode 100644 index 07bba02540c..00000000000 --- a/sys/arch/mips/mips/cpu.c +++ /dev/null @@ -1,208 +0,0 @@ -/* $OpenBSD: cpu.c,v 1.5 1998/10/15 21:30:15 imp Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/user.h> -#include <sys/device.h> - -#include <machine/pte.h> -#include <machine/cpu.h> -#include <machine/autoconf.h> - - -/* Definition of the driver for autoconfig. */ -static int cpumatch(struct device *, void *, void *); -static void cpuattach(struct device *, struct device *, void *); - -struct cfattach cpu_ca = { - sizeof(struct device), cpumatch, cpuattach -}; -struct cfdriver cpu_cd = { - NULL, "cpu", DV_DULL, NULL, 0 -}; - -static int -cpumatch(parent, cfdata, aux) - struct device *parent; - void *cfdata; - void *aux; -{ - struct confargs *ca = aux; - - /* make sure that we're looking for a CPU. */ - if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) - return (0); - - return (1); -} - -static void -cpuattach(parent, dev, aux) - struct device *parent; - struct device *dev; - void *aux; -{ - - printf(": "); - - switch(cpu_id.cpu.cp_imp) { - - case MIPS_R2000: - printf("MIPS R2000 CPU"); - break; - case MIPS_R3000: - printf("MIPS R3000 CPU"); - break; - case MIPS_R6000: - printf("MIPS R6000 CPU"); - break; - case MIPS_R4000: - if(CpuPrimaryInstCacheSize == 16384) - printf("MIPS R4400 CPU"); - else - printf("MIPS R4000 CPU"); - break; - case MIPS_R3LSI: - printf("LSI Logic R3000 derivate"); - break; - case MIPS_R6000A: - printf("MIPS R6000A CPU"); - break; - case MIPS_R3IDT: - printf("IDT R3000 derivate"); - break; - case MIPS_R10000: - printf("MIPS R10000 CPU"); - break; - case MIPS_R4200: - printf("NEC VR4200 CPU (ICE)"); - break; - case MIPS_R4300: - printf("NEC VR4300 CPU"); - break; - case MIPS_R4100: - printf("NEC VR41xx CPU"); - break; - case MIPS_R8000: - printf("MIPS R8000 Blackbird/TFP CPU"); - break; - case MIPS_R4600: - printf("QED R4600 Orion CPU"); - break; - case MIPS_R4700: - printf("QED R4700 Orion CPU"); - break; - case MIPS_R3TOSH: - printf("Toshiba R3000 based CPU"); - break; - case MIPS_RM52X0: - printf("QED RM52X0 CPU"); - break; - default: - printf("Unknown CPU type (0x%x)",cpu_id.cpu.cp_imp); - break; - } - printf(" Rev. %d.%d with ", cpu_id.cpu.cp_majrev, cpu_id.cpu.cp_minrev); - - - switch(fpu_id.cpu.cp_imp) { - - case MIPS_SOFT: - printf("Software emulation float"); - break; - case MIPS_R2360: - printf("MIPS R2360 FPC"); - break; - case MIPS_R2010: - printf("MIPS R2010 FPC"); - break; - case MIPS_R3010: - printf("MIPS R3010 FPC"); - break; - case MIPS_R6010: - printf("MIPS R6010 FPC"); - break; - case MIPS_R4010: - printf("MIPS R4010 FPC"); - break; - case MIPS_R31LSI: - printf("FPC"); - break; - case MIPS_R10010: - printf("MIPS R10000 FPU"); - break; - case MIPS_R4210: - printf("NEC VR4200 FPC (ICE)"); - break; - case MIPS_R8000: - printf("MIPS R8000 Blackbird/TFP"); - break; - case MIPS_R4600: - printf("QED R4600 Orion FPC"); - break; - case MIPS_R4700: - printf("QED R4700 Orion FPC"); - break; - case MIPS_R3TOSH: - printf("Toshiba R3000 based FPC"); - break; - case MIPS_R5000: - printf("MIPS R5000 based FPC"); - break; - case MIPS_RM52X0: - printf("QED RM52X0 FPC"); - break; - case MIPS_UNKF1: - default: - printf("Unknown FPU type (0x%x)", fpu_id.cpu.cp_imp); - break; - } - printf(" Rev. %d.%d", fpu_id.cpu.cp_majrev, fpu_id.cpu.cp_minrev); - printf("\n"); - - printf("Primary cache size: %dkb Instruction, %dkb Data.", - CpuPrimaryInstCacheSize / 1024, - CpuPrimaryDataCacheSize / 1024); - if(CpuTwoWayCache) - printf(" Two way set associative.\n"); - else - printf(" Direct mapped.\n"); - - if(l2cache_is_snooping) - printf("Missing L2 cache or Snooping L2 cache.\n"); - else - printf("No Snooping L2 cache!\n"); -} diff --git a/sys/arch/mips/mips/cpu_ecoff.c b/sys/arch/mips/mips/cpu_ecoff.c deleted file mode 100644 index 26ce856d67c..00000000000 --- a/sys/arch/mips/mips/cpu_ecoff.c +++ /dev/null @@ -1,92 +0,0 @@ -/* $OpenBSD: cpu_ecoff.c,v 1.3 1998/10/15 21:30:15 imp 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 <machine/reg.h> - -#if defined(_KERN_DO_ECOFF) -#include <sys/exec_ecoff.h> - -void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *, - u_long, register_t *)); -void -cpu_exec_ecoff_setregs(p, pack, stack, retval) - struct proc *p; - struct exec_package *pack; - u_long stack; - register_t *retval; -{ - struct ecoff_aouthdr *eap; - - setregs(p, pack, stack, retval); - eap = (struct ecoff_aouthdr *) - ((caddr_t)pack->ep_hdr + sizeof(struct ecoff_filehdr)); - p->p_md.md_regs[GP] = eap->ea_gp_value; -} - -/* - * cpu_exec_ecoff_hook(): - * cpu-dependent ECOFF format hook for execve(). - * - * Do any machine-dependent diddling of the exec package when doing ECOFF. - * - */ -int -cpu_exec_ecoff_hook(p, epp) - struct proc *p; - struct exec_package *epp; -{ -#ifdef COMPAT_ULTRIX - extern struct emul emul_ultrix; - - epp->ep_emul = &emul_ultrix; -#endif - return 0; -} - -#endif /* _KERN_DO_ECOFF */ diff --git a/sys/arch/mips/mips/db_disasm.c b/sys/arch/mips/mips/db_disasm.c deleted file mode 100644 index 583d13abe82..00000000000 --- a/sys/arch/mips/mips/db_disasm.c +++ /dev/null @@ -1,406 +0,0 @@ -/* $OpenBSD: db_disasm.c,v 1.1 1998/03/16 09:03:24 pefo Exp $ */ -/*- - * Copyright (c) 1991, 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. - * - * from: @(#)kadb.c 8.1 (Berkeley) 6/10/93 - * $Id: db_disasm.c,v 1.1 1998/03/16 09:03:24 pefo Exp $ - */ - -#include <sys/param.h> -#include <vm/vm_param.h> -#include <sys/systm.h> - -#include <machine/mips_opcode.h> -#include <machine/db_machdep.h> -#include <ddb/db_interface.h> -#include <ddb/db_output.h> - -static char *op_name[64] = { -/* 0 */ "spec", "bcond","j", "jal", "beq", "bne", "blez", "bgtz", -/* 8 */ "addi", "addiu","slti", "sltiu","andi", "ori", "xori", "lui", -/*16 */ "cop0", "cop1", "cop2", "cop3", "beql", "bnel", "blezl","bgtzl", -/*24 */ "daddi","daddiu","ldl", "ldr", "op34", "op35", "op36", "op37", -/*32 */ "lb", "lh", "lwl", "lw", "lbu", "lhu", "lwr", "lwu", -/*40 */ "sb", "sh", "swl", "sw", "sdl", "sdr", "swr", "cache", -/*48 */ "ll", "lwc1", "lwc2", "lwc3", "lld", "ldc1", "ldc2", "ld", -/*56 */ "sc", "swc1", "swc2", "swc3", "scd", "sdc1", "sdc2", "sd" -}; - -static char *spec_name[64] = { -/* 0 */ "sll", "spec01","srl", "sra", "sllv", "spec05","srlv","srav", -/* 8 */ "jr", "jalr", "spec12","spec13","syscall","break","spec16","sync", -/*16 */ "mfhi", "mthi", "mflo", "mtlo", "dsllv","spec25","dsrlv","dsrav", -/*24 */ "mult", "multu","div", "divu", "dmult","dmultu","ddiv","ddivu", -/*32 */ "add", "addu", "sub", "subu", "and", "or", "xor", "nor", -/*40 */ "spec50","spec51","slt","sltu", "dadd","daddu","dsub","dsubu", -/*48 */ "tge","tgeu","tlt","tltu","teq","spec65","tne","spec67", -/*56 */ "dsll","spec71","dsrl","dsra","dsll32","spec75","dsrl32","dsra32" -}; - -static char *bcond_name[32] = { -/* 0 */ "bltz", "bgez", "bltzl", "bgezl", "?", "?", "?", "?", -/* 8 */ "tgei", "tgeiu", "tlti", "tltiu", "teqi", "?", "tnei", "?", -/*16 */ "bltzal", "bgezal", "bltzall", "bgezall", "?", "?", "?", "?", -/*24 */ "?", "?", "?", "?", "?", "?", "?", "?", -}; - -static char *cop1_name[64] = { -/* 0 */ "fadd", "fsub", "fmpy", "fdiv", "fsqrt","fabs", "fmov", "fneg", -/* 8 */ "fop08","fop09","fop0a","fop0b","fop0c","fop0d","fop0e","fop0f", -/*16 */ "fop10","fop11","fop12","fop13","fop14","fop15","fop16","fop17", -/*24 */ "fop18","fop19","fop1a","fop1b","fop1c","fop1d","fop1e","fop1f", -/*32 */ "fcvts","fcvtd","fcvte","fop23","fcvtw","fop25","fop26","fop27", -/*40 */ "fop28","fop29","fop2a","fop2b","fop2c","fop2d","fop2e","fop2f", -/*48 */ "fcmp.f","fcmp.un","fcmp.eq","fcmp.ueq","fcmp.olt","fcmp.ult", - "fcmp.ole","fcmp.ule", -/*56 */ "fcmp.sf","fcmp.ngle","fcmp.seq","fcmp.ngl","fcmp.lt","fcmp.nge", - "fcmp.le","fcmp.ngt" -}; - -static char *fmt_name[16] = { - "s", "d", "e", "fmt3", - "w", "fmt5", "fmt6", "fmt7", - "fmt8", "fmt9", "fmta", "fmtb", - "fmtc", "fmtd", "fmte", "fmtf" -}; - -static char *reg_name[32] = { - "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra" -}; - -static char *c0_opname[64] = { - "c0op00","tlbr", "tlbwi", "c0op03","c0op04","c0op05","tlbwr", "c0op07", - "tlbp", "c0op11","c0op12","c0op13","c0op14","c0op15","c0op16","c0op17", - "rfe", "c0op21","c0op22","c0op23","c0op24","c0op25","c0op26","c0op27", - "eret","c0op31","c0op32","c0op33","c0op34","c0op35","c0op36","c0op37", - "c0op40","c0op41","c0op42","c0op43","c0op44","c0op45","c0op46","c0op47", - "c0op50","c0op51","c0op52","c0op53","c0op54","c0op55","c0op56","c0op57", - "c0op60","c0op61","c0op62","c0op63","c0op64","c0op65","c0op66","c0op67", - "c0op70","c0op71","c0op72","c0op73","c0op74","c0op75","c0op77","c0op77", -}; - -static char *c0_reg[32] = { - "index","random","tlblo0","tlblo1","context","tlbmask","wired","c0r7", - "badvaddr","count","tlbhi","c0r11","sr","cause","epc", "prid", - "config","lladr","watchlo","watchhi","xcontext","c0r21","c0r22","c0r23", - "c0r24","c0r25","ecc","cacheerr","taglo","taghi","errepc","c0r31" -}; - -static int md_printins __P((int ins, int mdbdot)); - -db_addr_t -db_disasm(loc, altfmt) - db_addr_t loc; - boolean_t altfmt; - -{ - return (md_printins(*(int*)loc, loc)); -} - -/* ARGSUSED */ -static int -md_printins(int ins, int mdbdot) -{ - InstFmt i; - int delay = 0; - - i.word = ins; - - switch (i.JType.op) { - case OP_SPECIAL: - if (i.word == 0) { - db_printf("nop"); - break; - } - if (i.RType.func == OP_ADDU && i.RType.rt == 0) { - db_printf("move\t%s,%s", - reg_name[i.RType.rd], - reg_name[i.RType.rs]); - break; - } - db_printf("%s", spec_name[i.RType.func]); - switch (i.RType.func) { - case OP_SLL: - case OP_SRL: - case OP_SRA: - case OP_DSLL: - case OP_DSRL: - case OP_DSRA: - case OP_DSLL32: - case OP_DSRL32: - case OP_DSRA32: - db_printf("\t%s,%s,%d", - reg_name[i.RType.rd], - reg_name[i.RType.rt], - i.RType.shamt); - break; - - case OP_SLLV: - case OP_SRLV: - case OP_SRAV: - case OP_DSLLV: - case OP_DSRLV: - case OP_DSRAV: - db_printf("\t%s,%s,%s", - reg_name[i.RType.rd], - reg_name[i.RType.rt], - reg_name[i.RType.rs]); - break; - - case OP_MFHI: - case OP_MFLO: - db_printf("\t%s", reg_name[i.RType.rd]); - break; - - case OP_JR: - case OP_JALR: - delay = 1; - /* FALLTHROUGH */ - case OP_MTLO: - case OP_MTHI: - db_printf("\t%s", reg_name[i.RType.rs]); - break; - - case OP_MULT: - case OP_MULTU: - case OP_DMULT: - case OP_DMULTU: - case OP_DIV: - case OP_DIVU: - case OP_DDIV: - case OP_DDIVU: - db_printf("\t%s,%s", - reg_name[i.RType.rs], - reg_name[i.RType.rt]); - break; - - case OP_SYSCALL: - case OP_SYNC: - break; - - case OP_BREAK: - db_printf("\t%d", (i.RType.rs << 5) | i.RType.rt); - break; - - default: - db_printf("\t%s,%s,%s", - reg_name[i.RType.rd], - reg_name[i.RType.rs], - reg_name[i.RType.rt]); - }; - break; - - case OP_BCOND: - db_printf("%s\t%s,", bcond_name[i.IType.rt], - reg_name[i.IType.rs]); - goto pr_displ; - - case OP_BLEZ: - case OP_BLEZL: - case OP_BGTZ: - case OP_BGTZL: - db_printf("%s\t%s,", op_name[i.IType.op], - reg_name[i.IType.rs]); - goto pr_displ; - - case OP_BEQ: - case OP_BEQL: - if (i.IType.rs == 0 && i.IType.rt == 0) { - db_printf("b\t"); - goto pr_displ; - } - /* FALLTHROUGH */ - case OP_BNE: - case OP_BNEL: - db_printf("%s\t%s,%s,", op_name[i.IType.op], - reg_name[i.IType.rs], - reg_name[i.IType.rt]); - pr_displ: - delay = 1; - db_printf("0x%08x", mdbdot + 4 + ((short)i.IType.imm << 2)); - break; - - case OP_COP0: - switch (i.RType.rs) { - case OP_BCx: - case OP_BCy: - db_printf("bc0%c\t", - "ft"[i.RType.rt & COPz_BC_TF_MASK]); - goto pr_displ; - - case OP_MT: - db_printf("mtc0\t%s,%s", - reg_name[i.RType.rt], - c0_reg[i.RType.rd]); - break; - - case OP_DMT: - db_printf("dmtc0\t%s,%s", - reg_name[i.RType.rt], - c0_reg[i.RType.rd]); - break; - - case OP_MF: - db_printf("mfc0\t%s,%s", - reg_name[i.RType.rt], - c0_reg[i.RType.rd]); - break; - - case OP_DMF: - db_printf("dmfc0\t%s,%s", - reg_name[i.RType.rt], - c0_reg[i.RType.rd]); - break; - - default: - db_printf("%s", c0_opname[i.FRType.func]); - }; - break; - - case OP_COP1: - switch (i.RType.rs) { - case OP_BCx: - case OP_BCy: - db_printf("bc1%c\t", - "ft"[i.RType.rt & COPz_BC_TF_MASK]); - goto pr_displ; - - case OP_MT: - db_printf("mtc1\t%s,f%d", - reg_name[i.RType.rt], - i.RType.rd); - break; - - case OP_MF: - db_printf("mfc1\t%s,f%d", - reg_name[i.RType.rt], - i.RType.rd); - break; - - case OP_CT: - db_printf("ctc1\t%s,f%d", - reg_name[i.RType.rt], - i.RType.rd); - break; - - case OP_CF: - db_printf("cfc1\t%s,f%d", - reg_name[i.RType.rt], - i.RType.rd); - break; - - default: - db_printf("%s.%s\tf%d,f%d,f%d", - cop1_name[i.FRType.func], - fmt_name[i.FRType.fmt], - i.FRType.fd, i.FRType.fs, i.FRType.ft); - }; - break; - - case OP_J: - case OP_JAL: - db_printf("%s\t", op_name[i.JType.op]); - db_printf("0x%8x",(mdbdot & 0xF0000000) | (i.JType.target << 2)); - delay = 1; - break; - - case OP_LWC1: - case OP_SWC1: - db_printf("%s\tf%d,", op_name[i.IType.op], - i.IType.rt); - goto loadstore; - - case OP_LB: - case OP_LH: - case OP_LW: - case OP_LD: - case OP_LBU: - case OP_LHU: - case OP_LWU: - case OP_SB: - case OP_SH: - case OP_SW: - case OP_SD: - db_printf("%s\t%s,", op_name[i.IType.op], - reg_name[i.IType.rt]); - loadstore: - db_printf("%d(%s)", (short)i.IType.imm, - reg_name[i.IType.rs]); - break; - - case OP_ORI: - case OP_XORI: - if (i.IType.rs == 0) { - db_printf("li\t%s,0x%x", - reg_name[i.IType.rt], - i.IType.imm); - break; - } - /* FALLTHROUGH */ - case OP_ANDI: - db_printf("%s\t%s,%s,0x%x", op_name[i.IType.op], - reg_name[i.IType.rt], - reg_name[i.IType.rs], - i.IType.imm); - break; - - case OP_LUI: - db_printf("%s\t%s,0x%x", op_name[i.IType.op], - reg_name[i.IType.rt], - i.IType.imm); - break; - - case OP_ADDI: - case OP_DADDI: - case OP_ADDIU: - case OP_DADDIU: - if (i.IType.rs == 0) { - db_printf("li\t%s,%d", - reg_name[i.IType.rt], - (short)i.IType.imm); - break; - } - /* FALLTHROUGH */ - default: - db_printf("%s\t%s,%s,%d", op_name[i.IType.op], - reg_name[i.IType.rt], - reg_name[i.IType.rs], - (short)i.IType.imm); - } - return(delay); -} diff --git a/sys/arch/mips/mips/db_machdep.c b/sys/arch/mips/mips/db_machdep.c deleted file mode 100644 index a9af867ea44..00000000000 --- a/sys/arch/mips/mips/db_machdep.c +++ /dev/null @@ -1,302 +0,0 @@ -/* $OpenBSD: db_machdep.c,v 1.3 1998/10/15 21:30:15 imp Exp $ */ - -/* - * Copyright (c) 1998 Per Fogelstrom, Opsycon AB - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom, Opsycon AB, Sweden. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <dev/cons.h> - -#include <mips/db_machdep.h> -#include <machine/mips_opcode.h> - -#include <ddb/db_sym.h> -#include <ddb/db_extern.h> -#include <ddb/db_access.h> -#include <ddb/db_output.h> -#include <ddb/db_variables.h> -#include <ddb/db_interface.h> - -u_int MipsEmulateBranch __P((int *, int, int, u_int)); -void stacktrace_subr __P((int *, int (*)(const char*, ...))); - -int kdbpeek __P((int)); -void kdbpoke __P((int, int)); -int kdb_trap __P((int, struct trap_frame *)); - -int db_active = 0; -db_regs_t ddb_regs; - -struct db_variable db_regs[] = { - { "at", (long *)&ddb_regs.reg[AST], FCN_NULL }, - { "v0", (long *)&ddb_regs.reg[V0], FCN_NULL }, - { "v1", (long *)&ddb_regs.reg[V1], FCN_NULL }, - { "a0", (long *)&ddb_regs.reg[A0], FCN_NULL }, - { "a1", (long *)&ddb_regs.reg[A1], FCN_NULL }, - { "a2", (long *)&ddb_regs.reg[A2], FCN_NULL }, - { "a3", (long *)&ddb_regs.reg[A3], FCN_NULL }, - { "t0", (long *)&ddb_regs.reg[T0], FCN_NULL }, - { "t1", (long *)&ddb_regs.reg[T1], FCN_NULL }, - { "t2", (long *)&ddb_regs.reg[T2], FCN_NULL }, - { "t3", (long *)&ddb_regs.reg[T3], FCN_NULL }, - { "t4", (long *)&ddb_regs.reg[T4], FCN_NULL }, - { "t5", (long *)&ddb_regs.reg[T5], FCN_NULL }, - { "t6", (long *)&ddb_regs.reg[T6], FCN_NULL }, - { "t7", (long *)&ddb_regs.reg[T7], FCN_NULL }, - { "s0", (long *)&ddb_regs.reg[S0], FCN_NULL }, - { "s1", (long *)&ddb_regs.reg[S1], FCN_NULL }, - { "s2", (long *)&ddb_regs.reg[S2], FCN_NULL }, - { "s3", (long *)&ddb_regs.reg[S3], FCN_NULL }, - { "s4", (long *)&ddb_regs.reg[S4], FCN_NULL }, - { "s5", (long *)&ddb_regs.reg[S5], FCN_NULL }, - { "s6", (long *)&ddb_regs.reg[S6], FCN_NULL }, - { "s7", (long *)&ddb_regs.reg[S7], FCN_NULL }, - { "t8", (long *)&ddb_regs.reg[T8], FCN_NULL }, - { "t9", (long *)&ddb_regs.reg[T9], FCN_NULL }, - { "k0", (long *)&ddb_regs.reg[K0], FCN_NULL }, - { "k1", (long *)&ddb_regs.reg[K1], FCN_NULL }, - { "gp", (long *)&ddb_regs.reg[GP], FCN_NULL }, - { "sp", (long *)&ddb_regs.reg[SP], FCN_NULL }, - { "s8", (long *)&ddb_regs.reg[S8], FCN_NULL }, - { "ra", (long *)&ddb_regs.reg[RA], FCN_NULL }, - { "sr", (long *)&ddb_regs.reg[SR], FCN_NULL }, - { "lo", (long *)&ddb_regs.reg[MULLO], FCN_NULL }, - { "hi", (long *)&ddb_regs.reg[MULHI], FCN_NULL }, - { "bad", (long *)&ddb_regs.reg[BADVADDR],FCN_NULL }, - { "cs", (long *)&ddb_regs.reg[CAUSE], FCN_NULL }, - { "pc", (long *)&ddb_regs.reg[PC], FCN_NULL }, -}; -struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); - - -int -kdb_trap(type, t_frame) - int type; - struct trap_frame *t_frame; -{ - switch(type) { - case T_BREAK: /* breakpoint */ - if(db_get_value((t_frame)->reg[PC], sizeof(int), FALSE) == BREAK_SOVER) { - (t_frame)->reg[PC] += BKPT_SIZE; - } - break; - case -1: - break; - default: -#if notyet - if(db_recover != 0) { - db_error("Caught exception in ddb.\n"); - /*NOTREACHED*/ - } - return(FALSE); /* NOT handled */ -#endif - } - - ddb_regs = *t_frame; - - db_active++; - cnpollc(TRUE); - db_trap(type, 0); - cnpollc(FALSE); - db_active--; - - *t_frame = ddb_regs; - return(TRUE); -} -void -db_read_bytes(addr, size, data) - vm_offset_t addr; - size_t size; - char *data; -{ - while(size >= sizeof(int)) { - *((int *)data)++ = kdbpeek(addr); - addr += sizeof(int); - size -= sizeof(int); - } - - if(size) { - int res; - char *p = (char *)&res; - res = kdbpeek(addr); - while(size--) { - *data++ = *p++; - } - } -} - -void -db_write_bytes(addr, size, data) - vm_offset_t addr; - size_t size; - char *data; -{ - vm_offset_t ptr = addr; - size_t len = size; - - while(len >= sizeof(int)) { - kdbpoke(ptr, *((int *)data)++); - ptr += sizeof(int); - len -= sizeof(int); - } - - if(len) { - int res; - char *p = (char *)&res; - res = kdbpeek(ptr); - while(len--) { - *data++ = *p++; - } - kdbpoke(ptr, res); - } - if(addr < VM_MIN_KERNEL_ADDRESS) { - R4K_HitFlushDCache(addr, size); - R4K_FlushICache(PHYS_TO_CACHED(addr & 0xffff), size); - } -} - -void -db_stack_trace_cmd(addr, have_addr, count, modif) - db_expr_t addr; - boolean_t have_addr; - db_expr_t count; - char *modif; -{ - stacktrace_subr(ddb_regs.reg, db_printf); -} - -/* - * To do a single step ddb needs to know the next address - * that we will get to. It means that we need to find out - * both the address for a branch taken and for not taken, NOT! :-) - * MipsEmulateBranch will do the job to find out _exactly_ which - * address we will end up at so the 'dual bp' method is not - * requiered. - */ -db_addr_t -next_instr_address(db_addr_t pc, boolean_t bd) -{ - db_addr_t next; - - next = (db_addr_t)MipsEmulateBranch(ddb_regs.reg, pc, 0, 0); - return(next); -} - - -/* - * Decode instruction and figure out type. - */ -int -db_inst_type(ins) - int ins; -{ - InstFmt inst; - int ityp = 0; - - inst.word = ins; - switch ((int)inst.JType.op) { - case OP_SPECIAL: - switch ((int)inst.RType.func) { - case OP_JR: - ityp = IT_BRANCH; - break; - case OP_JALR: - case OP_SYSCALL: - ityp = IT_CALL; - break; - } - break; - - case OP_BCOND: - switch ((int)inst.IType.rt) { - case OP_BLTZ: - case OP_BLTZL: - case OP_BGEZ: - case OP_BGEZL: - ityp = IT_BRANCH; - break; - - case OP_BLTZAL: - case OP_BLTZALL: - case OP_BGEZAL: - case OP_BGEZALL: - ityp = IT_CALL; - break; - } - break; - - case OP_JAL: - ityp = IT_CALL; - break; - - case OP_J: - case OP_BEQ: - case OP_BEQL: - case OP_BNE: - case OP_BNEL: - case OP_BLEZ: - case OP_BLEZL: - case OP_BGTZ: - case OP_BGTZL: - ityp = IT_BRANCH; - break; - - case OP_COP1: - switch (inst.RType.rs) { - case OP_BCx: - case OP_BCy: - ityp = IT_BRANCH; - break; - } - break; - - case OP_LB: - case OP_LH: - case OP_LW: - case OP_LD: - case OP_LBU: - case OP_LHU: - case OP_LWU: - case OP_LWC1: - ityp = IT_LOAD; - break; - - case OP_SB: - case OP_SH: - case OP_SW: - case OP_SD: - case OP_SWC1: - ityp = IT_STORE; - break; - } - return (ityp); -} diff --git a/sys/arch/mips/mips/disksubr.c b/sys/arch/mips/mips/disksubr.c deleted file mode 100644 index 78ddf1239bb..00000000000 --- a/sys/arch/mips/mips/disksubr.c +++ /dev/null @@ -1,550 +0,0 @@ -/* $OpenBSD: disksubr.c,v 1.11 2000/10/18 21:00:37 mickey Exp $ */ -/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ - -/* - * Copyright (c) 1996 Theo de Raadt - * 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/device.h> -#include <sys/disklabel.h> -#include <sys/syslog.h> -#include <sys/disk.h> - -#define b_cylin b_resid - -#define BOOT_MAGIC 0xAA55 -#define BOOT_MAGIC_OFF (DOSPARTOFF+NDOSPART*sizeof(struct dos_partition)) - -void -dk_establish(dk, dev) - struct disk *dk; - struct device *dev; -{ -} - -/* - * Attempt to read a disk label from a device - * using the indicated strategy routine. - * The label must be partly set up before this: - * secpercyl, secsize and anything required for a block i/o read - * operation in the driver's strategy/start routines - * must be filled in before calling us. - * - * If dos partition table requested, attempt to load it and - * find disklabel inside a DOS partition. Also, if bad block - * table needed, attempt to extract it as well. Return buffer - * for use in signalling errors if requested. - * - * We would like to check if each MBR has a valid BOOT_MAGIC, but - * we cannot because it doesn't always exist. So.. we assume the - * MBR is valid. - * - * Returns null on success and an error string on failure. - */ -char * -readdisklabel(dev, strat, lp, osdep, spoofonly) - dev_t dev; - void (*strat) __P((struct buf *)); - struct disklabel *lp; - struct cpu_disklabel *osdep; - int spoofonly; -{ - struct dos_partition *dp = osdep->dosparts, *dp2; - struct dkbad *bdp = &DKBAD(osdep); - struct buf *bp = NULL; - struct disklabel *dlp; - char *msg = NULL, *cp; - int dospartoff, cyl, i, ourpart = -1; - - /* minimal requirements for archtypal disk label */ - if (lp->d_secsize == 0) - lp->d_secsize = DEV_BSIZE; - if (lp->d_secperunit == 0) - lp->d_secperunit = 0x1fffffff; - if (lp->d_secpercyl == 0) { - msg = "invalid geometry"; - goto done; - } - lp->d_npartitions = RAW_PART + 1; - for (i = 0; i < RAW_PART; i++) { - lp->d_partitions[i].p_size = 0; - lp->d_partitions[i].p_offset = 0; - } - if (lp->d_partitions[i].p_size == 0) - lp->d_partitions[i].p_size = 0x1fffffff; - lp->d_partitions[i].p_offset = 0; - - /* get a buffer and initialize it */ - bp = geteblk((int)lp->d_secsize); - bp->b_dev = dev; - - /* do dos partitions in the process of getting disklabel? */ - dospartoff = 0; - cyl = LABELSECTOR / lp->d_secpercyl; - if (dp) { - daddr_t part_blkno = DOSBBSECTOR; - unsigned long extoff = 0; - int wander = 1, n = 0, loop = 0; - - /* - * Read dos partition table, follow extended partitions. - * Map the partitions to disklabel entries i-p - */ - while (wander && n < 8 && loop < 8) { - loop++; - wander = 0; - - /* read boot record */ - bp->b_blkno = part_blkno; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - bp->b_cylin = part_blkno / lp->d_secpercyl; - (*strat)(bp); - - /* if successful, wander through dos partition table */ - if (biowait(bp)) { - msg = "dos partition I/O error"; - goto done; - } - bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp)); - - if (ourpart == -1) { - /* Search for our MBR partition */ - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; - i++, dp2++) - if (get_le(&dp2->dp_size) && - dp2->dp_typ == DOSPTYP_OPENBSD) - ourpart = i; - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; - i++, dp2++) - if (get_le(&dp2->dp_size) && - dp2->dp_typ == DOSPTYP_FREEBSD) - ourpart = i; - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; - i++, dp2++) - if (get_le(&dp2->dp_size) && - dp2->dp_typ == DOSPTYP_NETBSD) - ourpart = i; - if (ourpart == -1) - goto donot; - /* - * This is our MBR partition. need sector address - * for SCSI/IDE, cylinder for ESDI/ST506/RLL - */ - dp2 = &dp[ourpart]; - dospartoff = get_le(&dp2->dp_start) + part_blkno; - cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect); - - /* XXX build a temporary disklabel */ - lp->d_partitions[0].p_size = get_le(&dp2->dp_size); - lp->d_partitions[0].p_offset = - get_le(&dp2->dp_start) + part_blkno; - if (lp->d_ntracks == 0) - lp->d_ntracks = dp2->dp_ehd + 1; - if (lp->d_nsectors == 0) - lp->d_nsectors = DPSECT(dp2->dp_esect); - if (lp->d_secpercyl == 0) - lp->d_secpercyl = lp->d_ntracks * - lp->d_nsectors; - } -donot: - /* - * In case the disklabel read below fails, we want to - * provide a fake label in i-p. - */ - for (dp2=dp, i=0; i < NDOSPART && n < 8; i++, dp2++) { - struct partition *pp = &lp->d_partitions[8+n]; - - if (dp2->dp_typ == DOSPTYP_OPENBSD) - continue; - if (get_le(&dp2->dp_size) > lp->d_secperunit) - continue; - if (get_le(&dp2->dp_size)) - pp->p_size = get_le(&dp2->dp_size); - if (get_le(&dp2->dp_start)) - pp->p_offset = - get_le(&dp2->dp_start) + part_blkno; - - switch (dp2->dp_typ) { - case DOSPTYP_UNUSED: - for (cp = (char *)dp2; - cp < (char *)(dp2 + 1); cp++) - if (*cp) - break; - /* - * Was it all zeroes? If so, it is - * an unused entry that we don't - * want to show. - */ - if (cp == (char *)(dp2 + 1)) - continue; - lp->d_partitions[8 + n++].p_fstype = - FS_UNUSED; - break; - - case DOSPTYP_LINUX: - pp->p_fstype = FS_EXT2FS; - n++; - break; - - case DOSPTYP_FAT12: - case DOSPTYP_FAT16S: - case DOSPTYP_FAT16B: - case DOSPTYP_FAT32: - case DOSPTYP_FAT32L: - case DOSPTYP_FAT16L: - pp->p_fstype = FS_MSDOS; - n++; - break; - case DOSPTYP_EXTEND: - case DOSPTYP_EXTENDL: - part_blkno = get_le(&dp2->dp_start) + extoff; - if (!extoff) - extoff = get_le(&dp2->dp_start); - wander = 1; - break; - default: - pp->p_fstype = FS_OTHER; - n++; - break; - } - } - } - lp->d_bbsize = 8192; - lp->d_sbsize = 64*1024; /* XXX ? */ - lp->d_npartitions = MAXPARTITIONS; - } - - /* don't read the on-disk label if we are in spoofed-only mode */ - if (spoofonly) - goto done; - - /* next, dig out disk label */ - bp->b_blkno = dospartoff + LABELSECTOR; - bp->b_cylin = cyl; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - (*strat)(bp); - - /* if successful, locate disk label within block and validate */ - if (biowait(bp)) { - /* XXX we return the faked label built so far */ - msg = "disk label I/O error"; - goto done; - } - for (dlp = (struct disklabel *)bp->b_data; - dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp)); - dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { - if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) { - if (msg == NULL) - msg = "no disk label"; - } else if (dlp->d_npartitions > MAXPARTITIONS || - dkcksum(dlp) != 0) - msg = "disk label corrupted"; - else { - *lp = *dlp; - msg = NULL; - break; - } - } - - if (msg) { -#if defined(CD9660) - if (iso_disklabelspoof(dev, strat, lp) == 0) - msg = NULL; -#endif - goto done; - } - - /* obtain bad sector table if requested and present */ - if (bdp && (lp->d_flags & D_BADSECT)) { - struct dkbad *db; - - i = 0; - do { - /* read a bad sector table */ - bp->b_flags = B_BUSY | B_READ; - bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i; - if (lp->d_secsize > DEV_BSIZE) - bp->b_blkno *= lp->d_secsize / DEV_BSIZE; - else - bp->b_blkno /= DEV_BSIZE / lp->d_secsize; - bp->b_bcount = lp->d_secsize; - bp->b_cylin = lp->d_ncylinders - 1; - (*strat)(bp); - - /* if successful, validate, otherwise try another */ - if (biowait(bp)) { - msg = "bad sector table I/O error"; - } else { - db = (struct dkbad *)(bp->b_data); -#define DKBAD_MAGIC 0x4321 - if (db->bt_mbz == 0 - && db->bt_flag == DKBAD_MAGIC) { - msg = NULL; - *bdp = *db; - break; - } else - msg = "bad sector table corrupted"; - } - } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 && - i < lp->d_nsectors); - } - -done: - if (bp) { - bp->b_flags |= B_INVAL; - brelse(bp); - } - return (msg); -} - -/* - * Check new disk label for sensibility - * before setting it. - */ -int -setdisklabel(olp, nlp, openmask, osdep) - struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; -{ - int i; - struct partition *opp, *npp; - - /* sanity clause */ - if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 || - (nlp->d_secsize % DEV_BSIZE) != 0) - return(EINVAL); - - /* special case to allow disklabel to be invalidated */ - if (nlp->d_magic == 0xffffffff) { - *olp = *nlp; - return (0); - } - - if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC || - dkcksum(nlp) != 0) - return (EINVAL); - - /* XXX missing check if other dos partitions will be overwritten */ - - while (openmask != 0) { - i = ffs(openmask) - 1; - 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. - * XXX cannot handle OpenBSD partitions in extended partitions! - */ -int -writedisklabel(dev, strat, lp, osdep) - dev_t dev; - void (*strat) __P((struct buf *)); - struct disklabel *lp; - struct cpu_disklabel *osdep; -{ - struct dos_partition *dp = osdep->dosparts, *dp2; - struct buf *bp; - struct disklabel *dlp; - int error, dospartoff, cyl, i; - int ourpart = -1; - - /* get a buffer and initialize it */ - bp = geteblk((int)lp->d_secsize); - bp->b_dev = dev; - - /* do dos partitions in the process of getting disklabel? */ - dospartoff = 0; - cyl = LABELSECTOR / lp->d_secpercyl; - if (dp) { - /* read master boot record */ - bp->b_blkno = DOSBBSECTOR; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - bp->b_cylin = DOSBBSECTOR / lp->d_secpercyl; - (*strat)(bp); - - if ((error = biowait(bp)) != 0) - goto done; - - /* XXX how do we check veracity/bounds of this? */ - bcopy(bp->b_data + DOSPARTOFF, dp, - NDOSPART * sizeof(*dp)); - - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == DOSPTYP_OPENBSD) - ourpart = i; - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == DOSPTYP_FREEBSD) - ourpart = i; - for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == DOSPTYP_NETBSD) - ourpart = i; - - if (ourpart != -1) { - dp2 = &dp[ourpart]; - - /* - * need sector address for SCSI/IDE, - * cylinder for ESDI/ST506/RLL - */ - dospartoff = get_le(&dp2->dp_start); - cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect); - } - } - - /* next, dig out disk label */ - bp->b_blkno = dospartoff + LABELSECTOR; - bp->b_cylin = cyl; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - (*strat)(bp); - - /* if successful, locate disk label within block and validate */ - if ((error = biowait(bp)) != 0) - goto done; - for (dlp = (struct disklabel *)bp->b_data; - dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp)); - dlp = (struct disklabel *)((char *)dlp + sizeof(long))) { - if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC && - dkcksum(dlp) == 0) { - *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE; - (*strat)(bp); - error = biowait(bp); - goto done; - } - } - - /* Write it in the regular place. */ - *(struct disklabel *)bp->b_data = *lp; - bp->b_flags = B_BUSY | B_WRITE; - (*strat)(bp); - error = biowait(bp); - goto done; - -done: - bp->b_flags |= B_INVAL; - brelse(bp); - return (error); -} - -/* - * 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(bp, lp, osdep, wlabel) - struct buf *bp; - struct disklabel *lp; - struct cpu_disklabel *osdep; - int wlabel; -{ -#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) - struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); - int labelsector = blockpersec(lp->d_partitions[RAW_PART].p_offset, lp) + - LABELSECTOR; - int sz = howmany(bp->b_bcount, DEV_BSIZE); - - /* avoid division by zero */ - if (lp->d_secpercyl == 0) { - bp->b_error = EINVAL; - goto bad; - } - - if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) { - sz = blockpersec(p->p_size, lp) - bp->b_blkno; - if (sz == 0) { - /* If exactly at end of disk, return EOF. */ - bp->b_resid = bp->b_bcount; - goto done; - } - if (sz < 0) { - /* If past end of disk, return EINVAL. */ - bp->b_error = EINVAL; - goto bad; - } - /* Otherwise, truncate request. */ - bp->b_bcount = sz << DEV_BSHIFT; - } - - /* Overwriting disk label? */ - if (bp->b_blkno + blockpersec(p->p_offset, lp) <= labelsector && -#if LABELSECTOR != 0 - bp->b_blkno + blockpersec(p->p_offset, lp) + sz > labelsector && -#endif - (bp->b_flags & B_READ) == 0 && !wlabel) { - bp->b_error = EROFS; - goto bad; - } - - /* calculate cylinder for disksort to order transfers with */ - bp->b_cylin = (bp->b_blkno + blockpersec(p->p_offset, lp)) / - lp->d_secpercyl; - return (1); - -bad: - bp->b_flags |= B_ERROR; -done: - return (0); -} diff --git a/sys/arch/mips/mips/fp.S b/sys/arch/mips/mips/fp.S deleted file mode 100644 index e258fbf9d12..00000000000 --- a/sys/arch/mips/mips/fp.S +++ /dev/null @@ -1,3612 +0,0 @@ -/* $OpenBSD: fp.S,v 1.2 1998/03/16 09:03:31 pefo Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)fp.s 8.1 (Berkeley) 6/10/93 - * $Id: fp.S,v 1.2 1998/03/16 09:03:31 pefo Exp $ - */ - -/* - * Standard header stuff. - */ - -#include <machine/regdef.h> -#include <machine/asm.h> -#include <machine/regnum.h> -#include <machine/cpu.h> - -#include "assym.h" - -#define SEXP_INF 0xff -#define DEXP_INF 0x7ff -#define SEXP_BIAS 127 -#define DEXP_BIAS 1023 -#define SEXP_MIN -126 -#define DEXP_MIN -1022 -#define SEXP_MAX 127 -#define DEXP_MAX 1023 -#define WEXP_MAX 30 /* maximum unbiased exponent for int */ -#define WEXP_MIN -1 /* minimum unbiased exponent for int */ -#define SFRAC_BITS 23 -#define DFRAC_BITS 52 -#define SIMPL_ONE 0x00800000 -#define DIMPL_ONE 0x00100000 -#define SLEAD_ZEROS 31 - 23 -#define DLEAD_ZEROS 31 - 20 -#define STICKYBIT 1 -#define GUARDBIT 0x80000000 -#define SSIGNAL_NAN 0x00400000 -#define DSIGNAL_NAN 0x00080000 -#define SQUIET_NAN 0x003fffff -#define DQUIET_NAN0 0x0007ffff -#define DQUIET_NAN1 0xffffffff -#define INT_MIN 0x80000000 -#define INT_MAX 0x7fffffff - -#define COND_UNORDERED 0x1 -#define COND_EQUAL 0x2 -#define COND_LESS 0x4 -#define COND_SIGNAL 0x8 - -/*---------------------------------------------------------------------------- - * - * MipsEmulateFP -- - * - * Emulate unimplemented floating point operations. - * This routine should only be called by MipsFPInterrupt(). - * - * MipsEmulateFP(instr) - * unsigned instr; - * - * Results: - * None. - * - * Side effects: - * Floating point registers are modified according to instruction. - * - *---------------------------------------------------------------------------- - */ -NON_LEAF(MipsEmulateFP, STAND_FRAME_SIZE, ra) - subu sp, sp, STAND_FRAME_SIZE - sw ra, STAND_RA_OFFSET(sp) -/* - * Decode the FMT field (bits 24-21) and FUNCTION field (bits 5-0). - */ - srl v0, a0, 21 - 2 # get FMT field - and v0, v0, 0xF << 2 # mask FMT field - and v1, a0, 0x3F # mask FUNC field - sll v1, v1, 5 # align for table lookup - bgt v0, 4 << 2, ill # illegal format - - or v1, v1, v0 - cfc1 a1, FPC_CSR # get exception register - lw a3, func_fmt_tbl(v1) # switch on FUNC & FMT - and a1, a1, ~FPC_EXCEPTION_UNIMPL # clear exception - ctc1 a1, FPC_CSR - j a3 - - .rdata -func_fmt_tbl: - .word add_s # 0 - .word add_d # 0 - .word ill # 0 - .word ill # 0 - .word ill # 0 - .word ill # 0 - .word ill # 0 - .word ill # 0 - .word sub_s # 1 - .word sub_d # 1 - .word ill # 1 - .word ill # 1 - .word ill # 1 - .word ill # 1 - .word ill # 1 - .word ill # 1 - .word mul_s # 2 - .word mul_d # 2 - .word ill # 2 - .word ill # 2 - .word ill # 2 - .word ill # 2 - .word ill # 2 - .word ill # 2 - .word div_s # 3 - .word div_d # 3 - .word ill # 3 - .word ill # 3 - .word ill # 3 - .word ill # 3 - .word ill # 3 - .word ill # 3 - .word ill # 4 - .word ill # 4 - .word ill # 4 - .word ill # 4 - .word ill # 4 - .word ill # 4 - .word ill # 4 - .word ill # 4 - .word abs_s # 5 - .word abs_d # 5 - .word ill # 5 - .word ill # 5 - .word ill # 5 - .word ill # 5 - .word ill # 5 - .word ill # 5 - .word mov_s # 6 - .word mov_d # 6 - .word ill # 6 - .word ill # 6 - .word ill # 6 - .word ill # 6 - .word ill # 6 - .word ill # 6 - .word neg_s # 7 - .word neg_d # 7 - .word ill # 7 - .word ill # 7 - .word ill # 7 - .word ill # 7 - .word ill # 7 - .word ill # 7 - .word ill # 8 - .word ill # 8 - .word ill # 8 - .word ill # 8 - .word ill # 8 - .word ill # 8 - .word ill # 8 - .word ill # 8 - .word ill # 9 - .word ill # 9 - .word ill # 9 - .word ill # 9 - .word ill # 9 - .word ill # 9 - .word ill # 9 - .word ill # 9 - .word ill # 10 - .word ill # 10 - .word ill # 10 - .word ill # 10 - .word ill # 10 - .word ill # 10 - .word ill # 10 - .word ill # 10 - .word ill # 11 - .word ill # 11 - .word ill # 11 - .word ill # 11 - .word ill # 11 - .word ill # 11 - .word ill # 11 - .word ill # 11 - .word ill # 12 - .word ill # 12 - .word ill # 12 - .word ill # 12 - .word ill # 12 - .word ill # 12 - .word ill # 12 - .word ill # 12 - .word ill # 13 - .word ill # 13 - .word ill # 13 - .word ill # 13 - .word ill # 13 - .word ill # 13 - .word ill # 13 - .word ill # 13 - .word ill # 14 - .word ill # 14 - .word ill # 14 - .word ill # 14 - .word ill # 14 - .word ill # 14 - .word ill # 14 - .word ill # 14 - .word ill # 15 - .word ill # 15 - .word ill # 15 - .word ill # 15 - .word ill # 15 - .word ill # 15 - .word ill # 15 - .word ill # 15 - .word ill # 16 - .word ill # 16 - .word ill # 16 - .word ill # 16 - .word ill # 16 - .word ill # 16 - .word ill # 16 - .word ill # 16 - .word ill # 17 - .word ill # 17 - .word ill # 17 - .word ill # 17 - .word ill # 17 - .word ill # 17 - .word ill # 17 - .word ill # 17 - .word ill # 18 - .word ill # 18 - .word ill # 18 - .word ill # 18 - .word ill # 18 - .word ill # 18 - .word ill # 18 - .word ill # 18 - .word ill # 19 - .word ill # 19 - .word ill # 19 - .word ill # 19 - .word ill # 19 - .word ill # 19 - .word ill # 19 - .word ill # 19 - .word ill # 20 - .word ill # 20 - .word ill # 20 - .word ill # 20 - .word ill # 20 - .word ill # 20 - .word ill # 20 - .word ill # 20 - .word ill # 21 - .word ill # 21 - .word ill # 21 - .word ill # 21 - .word ill # 21 - .word ill # 21 - .word ill # 21 - .word ill # 21 - .word ill # 22 - .word ill # 22 - .word ill # 22 - .word ill # 22 - .word ill # 22 - .word ill # 22 - .word ill # 22 - .word ill # 22 - .word ill # 23 - .word ill # 23 - .word ill # 23 - .word ill # 23 - .word ill # 23 - .word ill # 23 - .word ill # 23 - .word ill # 23 - .word ill # 24 - .word ill # 24 - .word ill # 24 - .word ill # 24 - .word ill # 24 - .word ill # 24 - .word ill # 24 - .word ill # 24 - .word ill # 25 - .word ill # 25 - .word ill # 25 - .word ill # 25 - .word ill # 25 - .word ill # 25 - .word ill # 25 - .word ill # 25 - .word ill # 26 - .word ill # 26 - .word ill # 26 - .word ill # 26 - .word ill # 26 - .word ill # 26 - .word ill # 26 - .word ill # 26 - .word ill # 27 - .word ill # 27 - .word ill # 27 - .word ill # 27 - .word ill # 27 - .word ill # 27 - .word ill # 27 - .word ill # 27 - .word ill # 28 - .word ill # 28 - .word ill # 28 - .word ill # 28 - .word ill # 28 - .word ill # 28 - .word ill # 28 - .word ill # 28 - .word ill # 29 - .word ill # 29 - .word ill # 29 - .word ill # 29 - .word ill # 29 - .word ill # 29 - .word ill # 29 - .word ill # 29 - .word ill # 30 - .word ill # 30 - .word ill # 30 - .word ill # 30 - .word ill # 30 - .word ill # 30 - .word ill # 30 - .word ill # 30 - .word ill # 31 - .word ill # 31 - .word ill # 31 - .word ill # 31 - .word ill # 31 - .word ill # 31 - .word ill # 31 - .word ill # 31 - .word ill # 32 - .word cvt_s_d # 32 - .word ill # 32 - .word ill # 32 - .word cvt_s_w # 32 - .word ill # 32 - .word ill # 32 - .word ill # 32 - .word cvt_d_s # 33 - .word ill # 33 - .word ill # 33 - .word ill # 33 - .word cvt_d_w # 33 - .word ill # 33 - .word ill # 33 - .word ill # 33 - .word ill # 34 - .word ill # 34 - .word ill # 34 - .word ill # 34 - .word ill # 34 - .word ill # 34 - .word ill # 34 - .word ill # 34 - .word ill # 35 - .word ill # 35 - .word ill # 35 - .word ill # 35 - .word ill # 35 - .word ill # 35 - .word ill # 35 - .word ill # 35 - .word cvt_w_s # 36 - .word cvt_w_d # 36 - .word ill # 36 - .word ill # 36 - .word ill # 36 - .word ill # 36 - .word ill # 36 - .word ill # 36 - .word ill # 37 - .word ill # 37 - .word ill # 37 - .word ill # 37 - .word ill # 37 - .word ill # 37 - .word ill # 37 - .word ill # 37 - .word ill # 38 - .word ill # 38 - .word ill # 38 - .word ill # 38 - .word ill # 38 - .word ill # 38 - .word ill # 38 - .word ill # 38 - .word ill # 39 - .word ill # 39 - .word ill # 39 - .word ill # 39 - .word ill # 39 - .word ill # 39 - .word ill # 39 - .word ill # 39 - .word ill # 40 - .word ill # 40 - .word ill # 40 - .word ill # 40 - .word ill # 40 - .word ill # 40 - .word ill # 40 - .word ill # 40 - .word ill # 41 - .word ill # 41 - .word ill # 41 - .word ill # 41 - .word ill # 41 - .word ill # 41 - .word ill # 41 - .word ill # 41 - .word ill # 42 - .word ill # 42 - .word ill # 42 - .word ill # 42 - .word ill # 42 - .word ill # 42 - .word ill # 42 - .word ill # 42 - .word ill # 43 - .word ill # 43 - .word ill # 43 - .word ill # 43 - .word ill # 43 - .word ill # 43 - .word ill # 43 - .word ill # 43 - .word ill # 44 - .word ill # 44 - .word ill # 44 - .word ill # 44 - .word ill # 44 - .word ill # 44 - .word ill # 44 - .word ill # 44 - .word ill # 45 - .word ill # 45 - .word ill # 45 - .word ill # 45 - .word ill # 45 - .word ill # 45 - .word ill # 45 - .word ill # 45 - .word ill # 46 - .word ill # 46 - .word ill # 46 - .word ill # 46 - .word ill # 46 - .word ill # 46 - .word ill # 46 - .word ill # 46 - .word ill # 47 - .word ill # 47 - .word ill # 47 - .word ill # 47 - .word ill # 47 - .word ill # 47 - .word ill # 47 - .word ill # 47 - .word cmp_s # 48 - .word cmp_d # 48 - .word ill # 48 - .word ill # 48 - .word ill # 48 - .word ill # 48 - .word ill # 48 - .word ill # 48 - .word cmp_s # 49 - .word cmp_d # 49 - .word ill # 49 - .word ill # 49 - .word ill # 49 - .word ill # 49 - .word ill # 49 - .word ill # 49 - .word cmp_s # 50 - .word cmp_d # 50 - .word ill # 50 - .word ill # 50 - .word ill # 50 - .word ill # 50 - .word ill # 50 - .word ill # 50 - .word cmp_s # 51 - .word cmp_d # 51 - .word ill # 51 - .word ill # 51 - .word ill # 51 - .word ill # 51 - .word ill # 51 - .word ill # 51 - .word cmp_s # 52 - .word cmp_d # 52 - .word ill # 52 - .word ill # 52 - .word ill # 52 - .word ill # 52 - .word ill # 52 - .word ill # 52 - .word cmp_s # 53 - .word cmp_d # 53 - .word ill # 53 - .word ill # 53 - .word ill # 53 - .word ill # 53 - .word ill # 53 - .word ill # 53 - .word cmp_s # 54 - .word cmp_d # 54 - .word ill # 54 - .word ill # 54 - .word ill # 54 - .word ill # 54 - .word ill # 54 - .word ill # 54 - .word cmp_s # 55 - .word cmp_d # 55 - .word ill # 55 - .word ill # 55 - .word ill # 55 - .word ill # 55 - .word ill # 55 - .word ill # 55 - .word cmp_s # 56 - .word cmp_d # 56 - .word ill # 56 - .word ill # 56 - .word ill # 56 - .word ill # 56 - .word ill # 56 - .word ill # 56 - .word cmp_s # 57 - .word cmp_d # 57 - .word ill # 57 - .word ill # 57 - .word ill # 57 - .word ill # 57 - .word ill # 57 - .word ill # 57 - .word cmp_s # 58 - .word cmp_d # 58 - .word ill # 58 - .word ill # 58 - .word ill # 58 - .word ill # 58 - .word ill # 58 - .word ill # 58 - .word cmp_s # 59 - .word cmp_d # 59 - .word ill # 59 - .word ill # 59 - .word ill # 59 - .word ill # 59 - .word ill # 59 - .word ill # 59 - .word cmp_s # 60 - .word cmp_d # 60 - .word ill # 60 - .word ill # 60 - .word ill # 60 - .word ill # 60 - .word ill # 60 - .word ill # 60 - .word cmp_s # 61 - .word cmp_d # 61 - .word ill # 61 - .word ill # 61 - .word ill # 61 - .word ill # 61 - .word ill # 61 - .word ill # 61 - .word cmp_s # 62 - .word cmp_d # 62 - .word ill # 62 - .word ill # 62 - .word ill # 62 - .word ill # 62 - .word ill # 62 - .word ill # 62 - .word cmp_s # 63 - .word cmp_d # 63 - .word ill # 63 - .word ill # 63 - .word ill # 63 - .word ill # 63 - .word ill # 63 - .word ill # 63 - .text - -/* - * Single precision subtract. - */ -sub_s: - jal get_ft_fs_s - xor t4, t4, 1 # negate FT sign bit - b add_sub_s -/* - * Single precision add. - */ -add_s: - jal get_ft_fs_s -add_sub_s: - bne t1, SEXP_INF, 1f # is FS an infinity? - bne t5, SEXP_INF, result_fs_s # if FT is not inf, result=FS - bne t2, zero, result_fs_s # if FS is NAN, result is FS - bne t6, zero, result_ft_s # if FT is NAN, result is FT - bne t0, t4, invalid_s # both infinities same sign? - b result_fs_s # result is in FS -1: - beq t5, SEXP_INF, result_ft_s # if FT is inf, result=FT - bne t1, zero, 4f # is FS a denormalized num? - beq t2, zero, 3f # is FS zero? - bne t5, zero, 2f # is FT a denormalized num? - beq t6, zero, result_fs_s # FT is zero, result=FS - jal renorm_fs_s - jal renorm_ft_s - b 5f -2: - jal renorm_fs_s - subu t5, t5, SEXP_BIAS # unbias FT exponent - or t6, t6, SIMPL_ONE # set implied one bit - b 5f -3: - bne t5, zero, result_ft_s # if FT != 0, result=FT - bne t6, zero, result_ft_s - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - bne v0, FPC_ROUND_RM, 1f # round to -infinity? - or t0, t0, t4 # compute result sign - b result_fs_s -1: - and t0, t0, t4 # compute result sign - b result_fs_s -4: - bne t5, zero, 2f # is FT a denormalized num? - beq t6, zero, result_fs_s # FT is zero, result=FS - subu t1, t1, SEXP_BIAS # unbias FS exponent - or t2, t2, SIMPL_ONE # set implied one bit - jal renorm_ft_s - b 5f -2: - subu t1, t1, SEXP_BIAS # unbias FS exponent - or t2, t2, SIMPL_ONE # set implied one bit - subu t5, t5, SEXP_BIAS # unbias FT exponent - or t6, t6, SIMPL_ONE # set implied one bit -/* - * Perform the addition. - */ -5: - move t8, zero # no shifted bits (sticky reg) - beq t1, t5, 4f # no shift needed - subu v0, t1, t5 # v0 = difference of exponents - move v1, v0 # v1 = abs(difference) - bge v0, zero, 1f - negu v1 -1: - ble v1, SFRAC_BITS+2, 2f # is difference too great? - li t8, STICKYBIT # set the sticky bit - bge v0, zero, 1f # check which exp is larger - move t1, t5 # result exp is FTs - move t2, zero # FSs fraction shifted is zero - b 4f -1: - move t6, zero # FTs fraction shifted is zero - b 4f -2: - li t9, 32 # compute 32 - abs(exp diff) - subu t9, t9, v1 - bgt v0, zero, 3f # if FS > FT, shift FTs frac - move t1, t5 # FT > FS, result exp is FTs - sll t8, t2, t9 # save bits shifted out - srl t2, t2, v1 # shift FSs fraction - b 4f -3: - sll t8, t6, t9 # save bits shifted out - srl t6, t6, v1 # shift FTs fraction -4: - bne t0, t4, 1f # if signs differ, subtract - addu t2, t2, t6 # add fractions - b norm_s -1: - blt t2, t6, 3f # subtract larger from smaller - bne t2, t6, 2f # if same, result=0 - move t1, zero # result=0 - move t2, zero - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - bne v0, FPC_ROUND_RM, 1f # round to -infinity? - or t0, t0, t4 # compute result sign - b result_fs_s -1: - and t0, t0, t4 # compute result sign - b result_fs_s -2: - sltu t9, zero, t8 # compute t2:zero - t6:t8 - subu t8, zero, t8 - subu t2, t2, t6 # subtract fractions - subu t2, t2, t9 # subtract barrow - b norm_s -3: - move t0, t4 # sign of result = FTs - sltu t9, zero, t8 # compute t6:zero - t2:t8 - subu t8, zero, t8 - subu t2, t6, t2 # subtract fractions - subu t2, t2, t9 # subtract barrow - b norm_s - -/* - * Double precision subtract. - */ -sub_d: - jal get_ft_fs_d - xor t4, t4, 1 # negate sign bit - b add_sub_d -/* - * Double precision add. - */ -add_d: - jal get_ft_fs_d -add_sub_d: - bne t1, DEXP_INF, 1f # is FS an infinity? - bne t5, DEXP_INF, result_fs_d # if FT is not inf, result=FS - bne t2, zero, result_fs_d # if FS is NAN, result is FS - bne t3, zero, result_fs_d - bne t6, zero, result_ft_d # if FT is NAN, result is FT - bne t7, zero, result_ft_d - bne t0, t4, invalid_d # both infinities same sign? - b result_fs_d # result is in FS -1: - beq t5, DEXP_INF, result_ft_d # if FT is inf, result=FT - bne t1, zero, 4f # is FS a denormalized num? - bne t2, zero, 1f # is FS zero? - beq t3, zero, 3f -1: - bne t5, zero, 2f # is FT a denormalized num? - bne t6, zero, 1f - beq t7, zero, result_fs_d # FT is zero, result=FS -1: - jal renorm_fs_d - jal renorm_ft_d - b 5f -2: - jal renorm_fs_d - subu t5, t5, DEXP_BIAS # unbias FT exponent - or t6, t6, DIMPL_ONE # set implied one bit - b 5f -3: - bne t5, zero, result_ft_d # if FT != 0, result=FT - bne t6, zero, result_ft_d - bne t7, zero, result_ft_d - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - bne v0, FPC_ROUND_RM, 1f # round to -infinity? - or t0, t0, t4 # compute result sign - b result_fs_d -1: - and t0, t0, t4 # compute result sign - b result_fs_d -4: - bne t5, zero, 2f # is FT a denormalized num? - bne t6, zero, 1f - beq t7, zero, result_fs_d # FT is zero, result=FS -1: - subu t1, t1, DEXP_BIAS # unbias FS exponent - or t2, t2, DIMPL_ONE # set implied one bit - jal renorm_ft_d - b 5f -2: - subu t1, t1, DEXP_BIAS # unbias FS exponent - or t2, t2, DIMPL_ONE # set implied one bit - subu t5, t5, DEXP_BIAS # unbias FT exponent - or t6, t6, DIMPL_ONE # set implied one bit -/* - * Perform the addition. - */ -5: - move t8, zero # no shifted bits (sticky reg) - beq t1, t5, 4f # no shift needed - subu v0, t1, t5 # v0 = difference of exponents - move v1, v0 # v1 = abs(difference) - bge v0, zero, 1f - negu v1 -1: - ble v1, DFRAC_BITS+2, 2f # is difference too great? - li t8, STICKYBIT # set the sticky bit - bge v0, zero, 1f # check which exp is larger - move t1, t5 # result exp is FTs - move t2, zero # FSs fraction shifted is zero - move t3, zero - b 4f -1: - move t6, zero # FTs fraction shifted is zero - move t7, zero - b 4f -2: - li t9, 32 - bge v0, zero, 3f # if FS > FT, shift FTs frac - move t1, t5 # FT > FS, result exp is FTs - blt v1, t9, 1f # shift right by < 32? - subu v1, v1, t9 - subu t9, t9, v1 - sll t8, t2, t9 # save bits shifted out - sltu t9, zero, t3 # dont lose any one bits - or t8, t8, t9 # save sticky bit - srl t3, t2, v1 # shift FSs fraction - move t2, zero - b 4f -1: - subu t9, t9, v1 - sll t8, t3, t9 # save bits shifted out - srl t3, t3, v1 # shift FSs fraction - sll t9, t2, t9 # save bits shifted out of t2 - or t3, t3, t9 # and put into t3 - srl t2, t2, v1 - b 4f -3: - blt v1, t9, 1f # shift right by < 32? - subu v1, v1, t9 - subu t9, t9, v1 - sll t8, t6, t9 # save bits shifted out - srl t7, t6, v1 # shift FTs fraction - move t6, zero - b 4f -1: - subu t9, t9, v1 - sll t8, t7, t9 # save bits shifted out - srl t7, t7, v1 # shift FTs fraction - sll t9, t6, t9 # save bits shifted out of t2 - or t7, t7, t9 # and put into t3 - srl t6, t6, v1 -4: - bne t0, t4, 1f # if signs differ, subtract - addu t3, t3, t7 # add fractions - sltu t9, t3, t7 # compute carry - addu t2, t2, t6 # add fractions - addu t2, t2, t9 # add carry - b norm_d -1: - blt t2, t6, 3f # subtract larger from smaller - bne t2, t6, 2f - bltu t3, t7, 3f - bne t3, t7, 2f # if same, result=0 - move t1, zero # result=0 - move t2, zero - move t3, zero - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - bne v0, FPC_ROUND_RM, 1f # round to -infinity? - or t0, t0, t4 # compute result sign - b result_fs_d -1: - and t0, t0, t4 # compute result sign - b result_fs_d -2: - beq t8, zero, 1f # compute t2:t3:zero - t6:t7:t8 - subu t8, zero, t8 - sltu v0, t3, 1 # compute barrow out - subu t3, t3, 1 # subtract barrow - subu t2, t2, v0 -1: - sltu v0, t3, t7 - subu t3, t3, t7 # subtract fractions - subu t2, t2, t6 # subtract fractions - subu t2, t2, v0 # subtract barrow - b norm_d -3: - move t0, t4 # sign of result = FTs - beq t8, zero, 1f # compute t6:t7:zero - t2:t3:t8 - subu t8, zero, t8 - sltu v0, t7, 1 # compute barrow out - subu t7, t7, 1 # subtract barrow - subu t6, t6, v0 -1: - sltu v0, t7, t3 - subu t3, t7, t3 # subtract fractions - subu t2, t6, t2 # subtract fractions - subu t2, t2, v0 # subtract barrow - b norm_d - -/* - * Single precision multiply. - */ -mul_s: - jal get_ft_fs_s - xor t0, t0, t4 # compute sign of result - move t4, t0 - bne t1, SEXP_INF, 2f # is FS an infinity? - bne t2, zero, result_fs_s # if FS is a NAN, result=FS - bne t5, SEXP_INF, 1f # FS is inf, is FT an infinity? - bne t6, zero, result_ft_s # if FT is a NAN, result=FT - b result_fs_s # result is infinity -1: - bne t5, zero, result_fs_s # inf * zero? if no, result=FS - bne t6, zero, result_fs_s - b invalid_s # infinity * zero is invalid -2: - bne t5, SEXP_INF, 1f # FS != inf, is FT an infinity? - bne t1, zero, result_ft_s # zero * inf? if no, result=FT - bne t2, zero, result_ft_s - bne t6, zero, result_ft_s # if FT is a NAN, result=FT - b invalid_s # zero * infinity is invalid -1: - bne t1, zero, 1f # is FS zero? - beq t2, zero, result_fs_s # result is zero - jal renorm_fs_s - b 2f -1: - subu t1, t1, SEXP_BIAS # unbias FS exponent - or t2, t2, SIMPL_ONE # set implied one bit -2: - bne t5, zero, 1f # is FT zero? - beq t6, zero, result_ft_s # result is zero - jal renorm_ft_s - b 2f -1: - subu t5, t5, SEXP_BIAS # unbias FT exponent - or t6, t6, SIMPL_ONE # set implied one bit -2: - addu t1, t1, t5 # compute result exponent - addu t1, t1, 9 # account for binary point - multu t2, t6 # multiply fractions - mflo t8 - mfhi t2 - b norm_s - -/* - * Double precision multiply. - */ -mul_d: - jal get_ft_fs_d - xor t0, t0, t4 # compute sign of result - move t4, t0 - bne t1, DEXP_INF, 2f # is FS an infinity? - bne t2, zero, result_fs_d # if FS is a NAN, result=FS - bne t3, zero, result_fs_d - bne t5, DEXP_INF, 1f # FS is inf, is FT an infinity? - bne t6, zero, result_ft_d # if FT is a NAN, result=FT - bne t7, zero, result_ft_d - b result_fs_d # result is infinity -1: - bne t5, zero, result_fs_d # inf * zero? if no, result=FS - bne t6, zero, result_fs_d - bne t7, zero, result_fs_d - b invalid_d # infinity * zero is invalid -2: - bne t5, DEXP_INF, 1f # FS != inf, is FT an infinity? - bne t1, zero, result_ft_d # zero * inf? if no, result=FT - bne t2, zero, result_ft_d # if FS is a NAN, result=FS - bne t3, zero, result_ft_d - bne t6, zero, result_ft_d # if FT is a NAN, result=FT - bne t7, zero, result_ft_d - b invalid_d # zero * infinity is invalid -1: - bne t1, zero, 2f # is FS zero? - bne t2, zero, 1f - beq t3, zero, result_fs_d # result is zero -1: - jal renorm_fs_d - b 3f -2: - subu t1, t1, DEXP_BIAS # unbias FS exponent - or t2, t2, DIMPL_ONE # set implied one bit -3: - bne t5, zero, 2f # is FT zero? - bne t6, zero, 1f - beq t7, zero, result_ft_d # result is zero -1: - jal renorm_ft_d - b 3f -2: - subu t5, t5, DEXP_BIAS # unbias FT exponent - or t6, t6, DIMPL_ONE # set implied one bit -3: - addu t1, t1, t5 # compute result exponent - addu t1, t1, 12 # ??? - multu t3, t7 # multiply fractions (low * low) - move t4, t2 # free up t2,t3 for result - move t5, t3 - mflo a3 # save low order bits - mfhi t8 - not v0, t8 - multu t4, t7 # multiply FS(high) * FT(low) - mflo v1 - mfhi t3 # init low result - sltu v0, v0, v1 # compute carry - addu t8, v1 - multu t5, t6 # multiply FS(low) * FT(high) - addu t3, t3, v0 # add carry - not v0, t8 - mflo v1 - mfhi t2 - sltu v0, v0, v1 - addu t8, v1 - multu t4, t6 # multiply FS(high) * FT(high) - addu t3, v0 - not v1, t3 - sltu v1, v1, t2 - addu t3, t2 - not v0, t3 - mfhi t2 - addu t2, v1 - mflo v1 - sltu v0, v0, v1 - addu t2, v0 - addu t3, v1 - sltu a3, zero, a3 # reduce t8,a3 to just t8 - or t8, a3 - b norm_d - -/* - * Single precision divide. - */ -div_s: - jal get_ft_fs_s - xor t0, t0, t4 # compute sign of result - move t4, t0 - bne t1, SEXP_INF, 1f # is FS an infinity? - bne t2, zero, result_fs_s # if FS is NAN, result is FS - bne t5, SEXP_INF, result_fs_s # is FT an infinity? - bne t6, zero, result_ft_s # if FT is NAN, result is FT - b invalid_s # infinity/infinity is invalid -1: - bne t5, SEXP_INF, 1f # is FT an infinity? - bne t6, zero, result_ft_s # if FT is NAN, result is FT - move t1, zero # x / infinity is zero - move t2, zero - b result_fs_s -1: - bne t1, zero, 2f # is FS zero? - bne t2, zero, 1f - bne t5, zero, result_fs_s # FS=zero, is FT zero? - beq t6, zero, invalid_s # 0 / 0 - b result_fs_s # result = zero -1: - jal renorm_fs_s - b 3f -2: - subu t1, t1, SEXP_BIAS # unbias FS exponent - or t2, t2, SIMPL_ONE # set implied one bit -3: - bne t5, zero, 2f # is FT zero? - bne t6, zero, 1f - or a1, a1, FPC_EXCEPTION_DIV0 | FPC_STICKY_DIV0 - and v0, a1, FPC_ENABLE_DIV0 # trap enabled? - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # save exceptions - li t1, SEXP_INF # result is infinity - move t2, zero - b result_fs_s -1: - jal renorm_ft_s - b 3f -2: - subu t5, t5, SEXP_BIAS # unbias FT exponent - or t6, t6, SIMPL_ONE # set implied one bit -3: - subu t1, t1, t5 # compute exponent - subu t1, t1, 3 # compensate for result position - li v0, SFRAC_BITS+3 # number of bits to divide - move t8, t2 # init dividend - move t2, zero # init result -1: - bltu t8, t6, 3f # is dividend >= divisor? -2: - subu t8, t8, t6 # subtract divisor from dividend - or t2, t2, 1 # remember that we did - bne t8, zero, 3f # if not done, continue - sll t2, t2, v0 # shift result to final position - b norm_s -3: - sll t8, t8, 1 # shift dividend - sll t2, t2, 1 # shift result - subu v0, v0, 1 # are we done? - bne v0, zero, 1b # no, continue - b norm_s - -/* - * Double precision divide. - */ -div_d: - jal get_ft_fs_d - xor t0, t0, t4 # compute sign of result - move t4, t0 - bne t1, DEXP_INF, 1f # is FS an infinity? - bne t2, zero, result_fs_d # if FS is NAN, result is FS - bne t3, zero, result_fs_d - bne t5, DEXP_INF, result_fs_d # is FT an infinity? - bne t6, zero, result_ft_d # if FT is NAN, result is FT - bne t7, zero, result_ft_d - b invalid_d # infinity/infinity is invalid -1: - bne t5, DEXP_INF, 1f # is FT an infinity? - bne t6, zero, result_ft_d # if FT is NAN, result is FT - bne t7, zero, result_ft_d - move t1, zero # x / infinity is zero - move t2, zero - move t3, zero - b result_fs_d -1: - bne t1, zero, 2f # is FS zero? - bne t2, zero, 1f - bne t3, zero, 1f - bne t5, zero, result_fs_d # FS=zero, is FT zero? - bne t6, zero, result_fs_d - beq t7, zero, invalid_d # 0 / 0 - b result_fs_d # result = zero -1: - jal renorm_fs_d - b 3f -2: - subu t1, t1, DEXP_BIAS # unbias FS exponent - or t2, t2, DIMPL_ONE # set implied one bit -3: - bne t5, zero, 2f # is FT zero? - bne t6, zero, 1f - bne t7, zero, 1f - or a1, a1, FPC_EXCEPTION_DIV0 | FPC_STICKY_DIV0 - and v0, a1, FPC_ENABLE_DIV0 # trap enabled? - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # Save exceptions - li t1, DEXP_INF # result is infinity - move t2, zero - move t3, zero - b result_fs_d -1: - jal renorm_ft_d - b 3f -2: - subu t5, t5, DEXP_BIAS # unbias FT exponent - or t6, t6, DIMPL_ONE # set implied one bit -3: - subu t1, t1, t5 # compute exponent - subu t1, t1, 3 # compensate for result position - li v0, DFRAC_BITS+3 # number of bits to divide - move t8, t2 # init dividend - move t9, t3 - move t2, zero # init result - move t3, zero -1: - bltu t8, t6, 3f # is dividend >= divisor? - bne t8, t6, 2f - bltu t9, t7, 3f -2: - sltu v1, t9, t7 # subtract divisor from dividend - subu t9, t9, t7 - subu t8, t8, t6 - subu t8, t8, v1 - or t3, t3, 1 # remember that we did - bne t8, zero, 3f # if not done, continue - bne t9, zero, 3f - li v1, 32 # shift result to final position - blt v0, v1, 2f # shift < 32 bits? - subu v0, v0, v1 # shift by > 32 bits - sll t2, t3, v0 # shift upper part - move t3, zero - b norm_d -2: - subu v1, v1, v0 # shift by < 32 bits - sll t2, t2, v0 # shift upper part - srl t9, t3, v1 # save bits shifted out - or t2, t2, t9 # and put into upper part - sll t3, t3, v0 - b norm_d -3: - sll t8, t8, 1 # shift dividend - srl v1, t9, 31 # save bit shifted out - or t8, t8, v1 # and put into upper part - sll t9, t9, 1 - sll t2, t2, 1 # shift result - srl v1, t3, 31 # save bit shifted out - or t2, t2, v1 # and put into upper part - sll t3, t3, 1 - subu v0, v0, 1 # are we done? - bne v0, zero, 1b # no, continue - sltu v0, zero, t9 # be sure to save any one bits - or t8, t8, v0 # from the lower remainder - b norm_d - -/* - * Single precision absolute value. - */ -abs_s: - jal get_fs_s - move t0, zero # set sign positive - b result_fs_s - -/* - * Double precision absolute value. - */ -abs_d: - jal get_fs_d - move t0, zero # set sign positive - b result_fs_d - -/* - * Single precision move. - */ -mov_s: - jal get_fs_s - b result_fs_s - -/* - * Double precision move. - */ -mov_d: - jal get_fs_d - b result_fs_d - -/* - * Single precision negate. - */ -neg_s: - jal get_fs_s - xor t0, t0, 1 # reverse sign - b result_fs_s - -/* - * Double precision negate. - */ -neg_d: - jal get_fs_d - xor t0, t0, 1 # reverse sign - b result_fs_d - -/* - * Convert double to single. - */ -cvt_s_d: - jal get_fs_d - bne t1, DEXP_INF, 1f # is FS an infinity? - li t1, SEXP_INF # convert to single - sll t2, t2, 3 # convert D fraction to S - srl t8, t3, 32 - 3 - or t2, t2, t8 - b result_fs_s -1: - bne t1, zero, 2f # is FS zero? - bne t2, zero, 1f - beq t3, zero, result_fs_s # result=0 -1: - jal renorm_fs_d - subu t1, t1, 3 # correct exp for shift below - b 3f -2: - subu t1, t1, DEXP_BIAS # unbias exponent - or t2, t2, DIMPL_ONE # add implied one bit -3: - sll t2, t2, 3 # convert D fraction to S - srl t8, t3, 32 - 3 - or t2, t2, t8 - sll t8, t3, 3 - b norm_noshift_s - -/* - * Convert integer to single. - */ -cvt_s_w: - jal get_fs_int - bne t2, zero, 1f # check for zero - move t1, zero - b result_fs_s -/* - * Find out how many leading zero bits are in t2 and put in t9. - */ -1: - move v0, t2 - move t9, zero - srl v1, v0, 16 - bne v1, zero, 1f - addu t9, 16 - sll v0, 16 -1: - srl v1, v0, 24 - bne v1, zero, 1f - addu t9, 8 - sll v0, 8 -1: - srl v1, v0, 28 - bne v1, zero, 1f - addu t9, 4 - sll v0, 4 -1: - srl v1, v0, 30 - bne v1, zero, 1f - addu t9, 2 - sll v0, 2 -1: - srl v1, v0, 31 - bne v1, zero, 1f - addu t9, 1 -/* - * Now shift t2 the correct number of bits. - */ -1: - subu t9, t9, SLEAD_ZEROS # dont count leading zeros - li t1, 23 # init exponent - subu t1, t1, t9 # compute exponent - beq t9, zero, 1f - li v0, 32 - blt t9, zero, 2f # if shift < 0, shift right - subu v0, v0, t9 - sll t2, t2, t9 # shift left -1: - add t1, t1, SEXP_BIAS # bias exponent - and t2, t2, ~SIMPL_ONE # clear implied one bit - b result_fs_s -2: - negu t9 # shift right by t9 - subu v0, v0, t9 - sll t8, t2, v0 # save bits shifted out - srl t2, t2, t9 - b norm_noshift_s - -/* - * Convert single to double. - */ -cvt_d_s: - jal get_fs_s - move t3, zero - bne t1, SEXP_INF, 1f # is FS an infinity? - li t1, DEXP_INF # convert to double - b result_fs_d -1: - bne t1, zero, 2f # is FS denormalized or zero? - beq t2, zero, result_fs_d # is FS zero? - jal renorm_fs_s - move t8, zero - b norm_d -2: - addu t1, t1, DEXP_BIAS - SEXP_BIAS # bias exponent correctly - sll t3, t2, 32 - 3 # convert S fraction to D - srl t2, t2, 3 - b result_fs_d - -/* - * Convert integer to double. - */ -cvt_d_w: - jal get_fs_int - bne t2, zero, 1f # check for zero - move t1, zero # result=0 - move t3, zero - b result_fs_d -/* - * Find out how many leading zero bits are in t2 and put in t9. - */ -1: - move v0, t2 - move t9, zero - srl v1, v0, 16 - bne v1, zero, 1f - addu t9, 16 - sll v0, 16 -1: - srl v1, v0, 24 - bne v1, zero, 1f - addu t9, 8 - sll v0, 8 -1: - srl v1, v0, 28 - bne v1, zero, 1f - addu t9, 4 - sll v0, 4 -1: - srl v1, v0, 30 - bne v1, zero, 1f - addu t9, 2 - sll v0, 2 -1: - srl v1, v0, 31 - bne v1, zero, 1f - addu t9, 1 -/* - * Now shift t2 the correct number of bits. - */ -1: - subu t9, t9, DLEAD_ZEROS # dont count leading zeros - li t1, DEXP_BIAS + 20 # init exponent - subu t1, t1, t9 # compute exponent - beq t9, zero, 1f - li v0, 32 - blt t9, zero, 2f # if shift < 0, shift right - subu v0, v0, t9 - sll t2, t2, t9 # shift left -1: - and t2, t2, ~DIMPL_ONE # clear implied one bit - move t3, zero - b result_fs_d -2: - negu t9 # shift right by t9 - subu v0, v0, t9 - sll t3, t2, v0 - srl t2, t2, t9 - and t2, t2, ~DIMPL_ONE # clear implied one bit - b result_fs_d - -/* - * Convert single to integer. - */ -cvt_w_s: - jal get_fs_s - bne t1, SEXP_INF, 1f # is FS an infinity? - bne t2, zero, invalid_w # invalid conversion -1: - bne t1, zero, 1f # is FS zero? - beq t2, zero, result_fs_w # result is zero - move t2, zero # result is an inexact zero - b inexact_w -1: - subu t1, t1, SEXP_BIAS # unbias exponent - or t2, t2, SIMPL_ONE # add implied one bit - sll t3, t2, 32 - 3 # convert S fraction to D - srl t2, t2, 3 - b cvt_w - -/* - * Convert double to integer. - */ -cvt_w_d: - jal get_fs_d - bne t1, DEXP_INF, 1f # is FS an infinity? - bne t2, zero, invalid_w # invalid conversion - bne t3, zero, invalid_w # invalid conversion -1: - bne t1, zero, 2f # is FS zero? - bne t2, zero, 1f - beq t3, zero, result_fs_w # result is zero -1: - move t2, zero # result is an inexact zero - b inexact_w -2: - subu t1, t1, DEXP_BIAS # unbias exponent - or t2, t2, DIMPL_ONE # add implied one bit -cvt_w: - blt t1, WEXP_MIN, underflow_w # is exponent too small? - li v0, WEXP_MAX+1 - bgt t1, v0, overflow_w # is exponent too large? - bne t1, v0, 1f # special check for INT_MIN - beq t0, zero, overflow_w # if positive, overflow - bne t2, DIMPL_ONE, overflow_w - bne t3, zero, overflow_w - li t2, INT_MIN # result is INT_MIN - b result_fs_w -1: - subu v0, t1, 20 # compute amount to shift - beq v0, zero, 2f # is shift needed? - li v1, 32 - blt v0, zero, 1f # if shift < 0, shift right - subu v1, v1, v0 # shift left - sll t2, t2, v0 - srl t9, t3, v1 # save bits shifted out of t3 - or t2, t2, t9 # and put into t2 - sll t3, t3, v0 # shift FSs fraction - b 2f -1: - negu v0 # shift right by v0 - subu v1, v1, v0 - sll t8, t3, v1 # save bits shifted out - sltu t8, zero, t8 # dont lose any ones - srl t3, t3, v0 # shift FSs fraction - or t3, t3, t8 - sll t9, t2, v1 # save bits shifted out of t2 - or t3, t3, t9 # and put into t3 - srl t2, t2, v0 -/* - * round result (t0 is sign, t2 is integer part, t3 is fractional part). - */ -2: - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - beq v0, FPC_ROUND_RN, 3f # round to nearest - beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate) - beq v0, FPC_ROUND_RP, 1f # round to +infinity - beq t0, zero, 5f # if sign is positive, truncate - b 2f -1: - bne t0, zero, 5f # if sign is negative, truncate -2: - beq t3, zero, 5f # if no fraction bits, continue - addu t2, t2, 1 # add rounding bit - blt t2, zero, overflow_w # overflow? - b 5f -3: - li v0, GUARDBIT # load guard bit for rounding - addu v0, v0, t3 # add remainder - sltu v1, v0, t3 # compute carry out - beq v1, zero, 4f # if no carry, continue - addu t2, t2, 1 # add carry to result - blt t2, zero, overflow_w # overflow? -4: - bne v0, zero, 5f # if rounded remainder is zero - and t2, t2, ~1 # clear LSB (round to nearest) -5: - beq t0, zero, 1f # result positive? - negu t2 # convert to negative integer -1: - beq t3, zero, result_fs_w # is result exact? -/* - * Handle inexact exception. - */ -inexact_w: - or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT - and v0, a1, FPC_ENABLE_INEXACT - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # save exceptions - b result_fs_w - -/* - * Conversions to integer which overflow will trap (if enabled), - * or generate an inexact trap (if enabled), - * or generate an invalid exception. - */ -overflow_w: - or a1, a1, FPC_EXCEPTION_OVERFLOW | FPC_STICKY_OVERFLOW - and v0, a1, FPC_ENABLE_OVERFLOW - bne v0, zero, fpe_trap - and v0, a1, FPC_ENABLE_INEXACT - bne v0, zero, inexact_w # inexact traps enabled? - b invalid_w - -/* - * Conversions to integer which underflow will trap (if enabled), - * or generate an inexact trap (if enabled), - * or generate an invalid exception. - */ -underflow_w: - or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW - and v0, a1, FPC_ENABLE_UNDERFLOW - bne v0, zero, fpe_trap - and v0, a1, FPC_ENABLE_INEXACT - bne v0, zero, inexact_w # inexact traps enabled? - b invalid_w - -/* - * Compare single. - */ -cmp_s: - jal get_cmp_s - bne t1, SEXP_INF, 1f # is FS an infinity? - bne t2, zero, unordered # FS is a NAN -1: - bne t5, SEXP_INF, 2f # is FT an infinity? - bne t6, zero, unordered # FT is a NAN -2: - sll t1, t1, 23 # reassemble exp & frac - or t1, t1, t2 - sll t5, t5, 23 # reassemble exp & frac - or t5, t5, t6 - beq t0, zero, 1f # is FS positive? - negu t1 -1: - beq t4, zero, 1f # is FT positive? - negu t5 -1: - li v0, COND_LESS - blt t1, t5, test_cond # is FS < FT? - li v0, COND_EQUAL - beq t1, t5, test_cond # is FS == FT? - move v0, zero # FS > FT - b test_cond - -/* - * Compare double. - */ -cmp_d: - jal get_cmp_d - bne t1, DEXP_INF, 1f # is FS an infinity? - bne t2, zero, unordered - bne t3, zero, unordered # FS is a NAN -1: - bne t5, DEXP_INF, 2f # is FT an infinity? - bne t6, zero, unordered - bne t7, zero, unordered # FT is a NAN -2: - sll t1, t1, 20 # reassemble exp & frac - or t1, t1, t2 - sll t5, t5, 20 # reassemble exp & frac - or t5, t5, t6 - beq t0, zero, 1f # is FS positive? - not t3 # negate t1,t3 - not t1 - addu t3, t3, 1 - seq v0, t3, zero # compute carry - addu t1, t1, v0 -1: - beq t4, zero, 1f # is FT positive? - not t7 # negate t5,t7 - not t5 - addu t7, t7, 1 - seq v0, t7, zero # compute carry - addu t5, t5, v0 -1: - li v0, COND_LESS - blt t1, t5, test_cond # is FS(MSW) < FT(MSW)? - move v0, zero - bne t1, t5, test_cond # is FS(MSW) > FT(MSW)? - li v0, COND_LESS - bltu t3, t7, test_cond # is FS(LSW) < FT(LSW)? - li v0, COND_EQUAL - beq t3, t7, test_cond # is FS(LSW) == FT(LSW)? - move v0, zero # FS > FT -test_cond: - and v0, v0, a0 # condition match instruction? -set_cond: - bne v0, zero, 1f - and a1, a1, ~FPC_COND_BIT # clear condition bit - b 2f -1: - or a1, a1, FPC_COND_BIT # set condition bit -2: - ctc1 a1, FPC_CSR # save condition bit - b done - -unordered: - and v0, a0, COND_UNORDERED # this cmp match unordered? - bne v0, zero, 1f - and a1, a1, ~FPC_COND_BIT # clear condition bit - b 2f -1: - or a1, a1, FPC_COND_BIT # set condition bit -2: - and v0, a0, COND_SIGNAL - beq v0, zero, 1f # is this a signaling cmp? - or a1, a1, FPC_EXCEPTION_INVALID | FPC_STICKY_INVALID - and v0, a1, FPC_ENABLE_INVALID - bne v0, zero, fpe_trap -1: - ctc1 a1, FPC_CSR # save condition bit - b done - -/* - * Determine the amount to shift the fraction in order to restore the - * normalized position. After that, round and handle exceptions. - */ -norm_s: - move v0, t2 - move t9, zero # t9 = num of leading zeros - bne t2, zero, 1f - move v0, t8 - addu t9, 32 -1: - srl v1, v0, 16 - bne v1, zero, 1f - addu t9, 16 - sll v0, 16 -1: - srl v1, v0, 24 - bne v1, zero, 1f - addu t9, 8 - sll v0, 8 -1: - srl v1, v0, 28 - bne v1, zero, 1f - addu t9, 4 - sll v0, 4 -1: - srl v1, v0, 30 - bne v1, zero, 1f - addu t9, 2 - sll v0, 2 -1: - srl v1, v0, 31 - bne v1, zero, 1f - addu t9, 1 -/* - * Now shift t2,t8 the correct number of bits. - */ -1: - subu t9, t9, SLEAD_ZEROS # dont count leading zeros - subu t1, t1, t9 # adjust the exponent - beq t9, zero, norm_noshift_s - li v1, 32 - blt t9, zero, 1f # if shift < 0, shift right - subu v1, v1, t9 - sll t2, t2, t9 # shift t2,t8 left - srl v0, t8, v1 # save bits shifted out - or t2, t2, v0 - sll t8, t8, t9 - b norm_noshift_s -1: - negu t9 # shift t2,t8 right by t9 - subu v1, v1, t9 - sll v0, t8, v1 # save bits shifted out - sltu v0, zero, v0 # be sure to save any one bits - srl t8, t8, t9 - or t8, t8, v0 - sll v0, t2, v1 # save bits shifted out - or t8, t8, v0 - srl t2, t2, t9 -norm_noshift_s: - move t5, t1 # save unrounded exponent - move t6, t2 # save unrounded fraction - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - beq v0, FPC_ROUND_RN, 3f # round to nearest - beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate) - beq v0, FPC_ROUND_RP, 1f # round to +infinity - beq t0, zero, 5f # if sign is positive, truncate - b 2f -1: - bne t0, zero, 5f # if sign is negative, truncate -2: - beq t8, zero, 5f # if exact, continue - addu t2, t2, 1 # add rounding bit - bne t2, SIMPL_ONE<<1, 5f # need to adjust exponent? - addu t1, t1, 1 # adjust exponent - srl t2, t2, 1 # renormalize fraction - b 5f -3: - li v0, GUARDBIT # load guard bit for rounding - addu v0, v0, t8 # add remainder - sltu v1, v0, t8 # compute carry out - beq v1, zero, 4f # if no carry, continue - addu t2, t2, 1 # add carry to result - bne t2, SIMPL_ONE<<1, 4f # need to adjust exponent? - addu t1, t1, 1 # adjust exponent - srl t2, t2, 1 # renormalize fraction -4: - bne v0, zero, 5f # if rounded remainder is zero - and t2, t2, ~1 # clear LSB (round to nearest) -5: - bgt t1, SEXP_MAX, overflow_s # overflow? - blt t1, SEXP_MIN, underflow_s # underflow? - bne t8, zero, inexact_s # is result inexact? - addu t1, t1, SEXP_BIAS # bias exponent - and t2, t2, ~SIMPL_ONE # clear implied one bit - b result_fs_s - -/* - * Handle inexact exception. - */ -inexact_s: - addu t1, t1, SEXP_BIAS # bias exponent - and t2, t2, ~SIMPL_ONE # clear implied one bit -inexact_nobias_s: - jal set_fd_s # save result - or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT - and v0, a1, FPC_ENABLE_INEXACT - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # save exceptions - b done - -/* - * Overflow will trap (if enabled), - * or generate an inexact trap (if enabled), - * or generate an infinity. - */ -overflow_s: - or a1, a1, FPC_EXCEPTION_OVERFLOW | FPC_STICKY_OVERFLOW - and v0, a1, FPC_ENABLE_OVERFLOW - beq v0, zero, 1f - subu t1, t1, 192 # bias exponent - and t2, t2, ~SIMPL_ONE # clear implied one bit - jal set_fd_s # save result - b fpe_trap -1: - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - beq v0, FPC_ROUND_RN, 3f # round to nearest - beq v0, FPC_ROUND_RZ, 1f # round to zero (truncate) - beq v0, FPC_ROUND_RP, 2f # round to +infinity - bne t0, zero, 3f -1: - li t1, SEXP_MAX # result is max finite - li t2, 0x007fffff - b inexact_s -2: - bne t0, zero, 1b -3: - li t1, SEXP_MAX + 1 # result is infinity - move t2, zero - b inexact_s - -/* - * In this implementation, "tininess" is detected "after rounding" and - * "loss of accuracy" is detected as "an inexact result". - */ -underflow_s: - and v0, a1, FPC_ENABLE_UNDERFLOW - beq v0, zero, 1f -/* - * Underflow is enabled so compute the result and trap. - */ - addu t1, t1, 192 # bias exponent - and t2, t2, ~SIMPL_ONE # clear implied one bit - jal set_fd_s # save result - or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW - b fpe_trap -/* - * Underflow is not enabled so compute the result, - * signal inexact result (if it is) and trap (if enabled). - */ -1: - move t1, t5 # get unrounded exponent - move t2, t6 # get unrounded fraction - li t9, SEXP_MIN # compute shift amount - subu t9, t9, t1 # shift t2,t8 right by t9 - blt t9, SFRAC_BITS+2, 3f # shift all the bits out? - move t1, zero # result is inexact zero - move t2, zero - or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW -/* - * Now round the zero result. - * Only need to worry about rounding to +- infinity when the sign matches. - */ - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - beq v0, FPC_ROUND_RN, inexact_nobias_s # round to nearest - beq v0, FPC_ROUND_RZ, inexact_nobias_s # round to zero - beq v0, FPC_ROUND_RP, 1f # round to +infinity - beq t0, zero, inexact_nobias_s # if sign is positive, truncate - b 2f -1: - bne t0, zero, inexact_nobias_s # if sign is negative, truncate -2: - addu t2, t2, 1 # add rounding bit - b inexact_nobias_s -3: - li v1, 32 - subu v1, v1, t9 - sltu v0, zero, t8 # be sure to save any one bits - sll t8, t2, v1 # save bits shifted out - or t8, t8, v0 # include sticky bits - srl t2, t2, t9 -/* - * Now round the denormalized result. - */ - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - beq v0, FPC_ROUND_RN, 3f # round to nearest - beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate) - beq v0, FPC_ROUND_RP, 1f # round to +infinity - beq t0, zero, 5f # if sign is positive, truncate - b 2f -1: - bne t0, zero, 5f # if sign is negative, truncate -2: - beq t8, zero, 5f # if exact, continue - addu t2, t2, 1 # add rounding bit - b 5f -3: - li v0, GUARDBIT # load guard bit for rounding - addu v0, v0, t8 # add remainder - sltu v1, v0, t8 # compute carry out - beq v1, zero, 4f # if no carry, continue - addu t2, t2, 1 # add carry to result -4: - bne v0, zero, 5f # if rounded remainder is zero - and t2, t2, ~1 # clear LSB (round to nearest) -5: - move t1, zero # denorm or zero exponent - jal set_fd_s # save result - beq t8, zero, done # check for exact result - or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW - or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT - and v0, a1, FPC_ENABLE_INEXACT - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # save exceptions - b done - -/* - * Determine the amount to shift the fraction in order to restore the - * normalized position. After that, round and handle exceptions. - */ -norm_d: - move v0, t2 - move t9, zero # t9 = num of leading zeros - bne t2, zero, 1f - move v0, t3 - addu t9, 32 - bne t3, zero, 1f - move v0, t8 - addu t9, 32 -1: - srl v1, v0, 16 - bne v1, zero, 1f - addu t9, 16 - sll v0, 16 -1: - srl v1, v0, 24 - bne v1, zero, 1f - addu t9, 8 - sll v0, 8 -1: - srl v1, v0, 28 - bne v1, zero, 1f - addu t9, 4 - sll v0, 4 -1: - srl v1, v0, 30 - bne v1, zero, 1f - addu t9, 2 - sll v0, 2 -1: - srl v1, v0, 31 - bne v1, zero, 1f - addu t9, 1 -/* - * Now shift t2,t3,t8 the correct number of bits. - */ -1: - subu t9, t9, DLEAD_ZEROS # dont count leading zeros - subu t1, t1, t9 # adjust the exponent - beq t9, zero, norm_noshift_d - li v1, 32 - blt t9, zero, 2f # if shift < 0, shift right - blt t9, v1, 1f # shift by < 32? - subu t9, t9, v1 # shift by >= 32 - subu v1, v1, t9 - sll t2, t3, t9 # shift left by t9 - srl v0, t8, v1 # save bits shifted out - or t2, t2, v0 - sll t3, t8, t9 - move t8, zero - b norm_noshift_d -1: - subu v1, v1, t9 - sll t2, t2, t9 # shift left by t9 - srl v0, t3, v1 # save bits shifted out - or t2, t2, v0 - sll t3, t3, t9 - srl v0, t8, v1 # save bits shifted out - or t3, t3, v0 - sll t8, t8, t9 - b norm_noshift_d -2: - negu t9 # shift right by t9 - subu v1, v1, t9 # (known to be < 32 bits) - sll v0, t8, v1 # save bits shifted out - sltu v0, zero, v0 # be sure to save any one bits - srl t8, t8, t9 - or t8, t8, v0 - sll v0, t3, v1 # save bits shifted out - or t8, t8, v0 - srl t3, t3, t9 - sll v0, t2, v1 # save bits shifted out - or t3, t3, v0 - srl t2, t2, t9 -norm_noshift_d: - move t5, t1 # save unrounded exponent - move t6, t2 # save unrounded fraction (MS) - move t7, t3 # save unrounded fraction (LS) - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - beq v0, FPC_ROUND_RN, 3f # round to nearest - beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate) - beq v0, FPC_ROUND_RP, 1f # round to +infinity - beq t0, zero, 5f # if sign is positive, truncate - b 2f -1: - bne t0, zero, 5f # if sign is negative, truncate -2: - beq t8, zero, 5f # if exact, continue - addu t3, t3, 1 # add rounding bit - bne t3, zero, 5f # branch if no carry - addu t2, t2, 1 # add carry - bne t2, DIMPL_ONE<<1, 5f # need to adjust exponent? - addu t1, t1, 1 # adjust exponent - srl t2, t2, 1 # renormalize fraction - b 5f -3: - li v0, GUARDBIT # load guard bit for rounding - addu v0, v0, t8 # add remainder - sltu v1, v0, t8 # compute carry out - beq v1, zero, 4f # branch if no carry - addu t3, t3, 1 # add carry - bne t3, zero, 4f # branch if no carry - addu t2, t2, 1 # add carry to result - bne t2, DIMPL_ONE<<1, 4f # need to adjust exponent? - addu t1, t1, 1 # adjust exponent - srl t2, t2, 1 # renormalize fraction -4: - bne v0, zero, 5f # if rounded remainder is zero - and t3, t3, ~1 # clear LSB (round to nearest) -5: - bgt t1, DEXP_MAX, overflow_d # overflow? - blt t1, DEXP_MIN, underflow_d # underflow? - bne t8, zero, inexact_d # is result inexact? - addu t1, t1, DEXP_BIAS # bias exponent - and t2, t2, ~DIMPL_ONE # clear implied one bit - b result_fs_d - -/* - * Handle inexact exception. - */ -inexact_d: - addu t1, t1, DEXP_BIAS # bias exponent - and t2, t2, ~DIMPL_ONE # clear implied one bit -inexact_nobias_d: - jal set_fd_d # save result - or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT - and v0, a1, FPC_ENABLE_INEXACT - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # save exceptions - b done - -/* - * Overflow will trap (if enabled), - * or generate an inexact trap (if enabled), - * or generate an infinity. - */ -overflow_d: - or a1, a1, FPC_EXCEPTION_OVERFLOW | FPC_STICKY_OVERFLOW - and v0, a1, FPC_ENABLE_OVERFLOW - beq v0, zero, 1f - subu t1, t1, 1536 # bias exponent - and t2, t2, ~DIMPL_ONE # clear implied one bit - jal set_fd_d # save result - b fpe_trap -1: - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - beq v0, FPC_ROUND_RN, 3f # round to nearest - beq v0, FPC_ROUND_RZ, 1f # round to zero (truncate) - beq v0, FPC_ROUND_RP, 2f # round to +infinity - bne t0, zero, 3f -1: - li t1, DEXP_MAX # result is max finite - li t2, 0x000fffff - li t3, 0xffffffff - b inexact_d -2: - bne t0, zero, 1b -3: - li t1, DEXP_MAX + 1 # result is infinity - move t2, zero - move t3, zero - b inexact_d - -/* - * In this implementation, "tininess" is detected "after rounding" and - * "loss of accuracy" is detected as "an inexact result". - */ -underflow_d: - and v0, a1, FPC_ENABLE_UNDERFLOW - beq v0, zero, 1f -/* - * Underflow is enabled so compute the result and trap. - */ - addu t1, t1, 1536 # bias exponent - and t2, t2, ~DIMPL_ONE # clear implied one bit - jal set_fd_d # save result - or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW - b fpe_trap -/* - * Underflow is not enabled so compute the result, - * signal inexact result (if it is) and trap (if enabled). - */ -1: - move t1, t5 # get unrounded exponent - move t2, t6 # get unrounded fraction (MS) - move t3, t7 # get unrounded fraction (LS) - li t9, DEXP_MIN # compute shift amount - subu t9, t9, t1 # shift t2,t8 right by t9 - blt t9, DFRAC_BITS+2, 3f # shift all the bits out? - move t1, zero # result is inexact zero - move t2, zero - move t3, zero - or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW -/* - * Now round the zero result. - * Only need to worry about rounding to +- infinity when the sign matches. - */ - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - beq v0, FPC_ROUND_RN, inexact_nobias_d # round to nearest - beq v0, FPC_ROUND_RZ, inexact_nobias_d # round to zero - beq v0, FPC_ROUND_RP, 1f # round to +infinity - beq t0, zero, inexact_nobias_d # if sign is positive, truncate - b 2f -1: - bne t0, zero, inexact_nobias_d # if sign is negative, truncate -2: - addu t3, t3, 1 # add rounding bit - b inexact_nobias_d -3: - li v1, 32 - blt t9, v1, 1f # shift by < 32? - subu t9, t9, v1 # shift right by >= 32 - subu v1, v1, t9 - sltu v0, zero, t8 # be sure to save any one bits - sll t8, t2, v1 # save bits shifted out - or t8, t8, v0 # include sticky bits - srl t3, t2, t9 - move t2, zero - b 2f -1: - subu v1, v1, t9 # shift right by t9 - sltu v0, zero, t8 # be sure to save any one bits - sll t8, t3, v1 # save bits shifted out - or t8, t8, v0 # include sticky bits - srl t3, t3, t9 - sll v0, t2, v1 # save bits shifted out - or t3, t3, v0 - srl t2, t2, t9 -/* - * Now round the denormalized result. - */ -2: - and v0, a1, FPC_ROUNDING_BITS # get rounding mode - beq v0, FPC_ROUND_RN, 3f # round to nearest - beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate) - beq v0, FPC_ROUND_RP, 1f # round to +infinity - beq t0, zero, 5f # if sign is positive, truncate - b 2f -1: - bne t0, zero, 5f # if sign is negative, truncate -2: - beq t8, zero, 5f # if exact, continue - addu t3, t3, 1 # add rounding bit - bne t3, zero, 5f # if no carry, continue - addu t2, t2, 1 # add carry - b 5f -3: - li v0, GUARDBIT # load guard bit for rounding - addu v0, v0, t8 # add remainder - sltu v1, v0, t8 # compute carry out - beq v1, zero, 4f # if no carry, continue - addu t3, t3, 1 # add rounding bit - bne t3, zero, 4f # if no carry, continue - addu t2, t2, 1 # add carry -4: - bne v0, zero, 5f # if rounded remainder is zero - and t3, t3, ~1 # clear LSB (round to nearest) -5: - move t1, zero # denorm or zero exponent - jal set_fd_d # save result - beq t8, zero, done # check for exact result - or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW - or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT - and v0, a1, FPC_ENABLE_INEXACT - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # save exceptions - b done - -/* - * Signal an invalid operation if the trap is enabled; otherwise, - * the result is a quiet NAN. - */ -invalid_s: # trap invalid operation - or a1, a1, FPC_EXCEPTION_INVALID | FPC_STICKY_INVALID - and v0, a1, FPC_ENABLE_INVALID - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # save exceptions - move t0, zero # result is a quiet NAN - li t1, SEXP_INF - li t2, SQUIET_NAN - jal set_fd_s # save result (in t0,t1,t2) - b done - -/* - * Signal an invalid operation if the trap is enabled; otherwise, - * the result is a quiet NAN. - */ -invalid_d: # trap invalid operation - or a1, a1, FPC_EXCEPTION_INVALID | FPC_STICKY_INVALID - and v0, a1, FPC_ENABLE_INVALID - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # save exceptions - move t0, zero # result is a quiet NAN - li t1, DEXP_INF - li t2, DQUIET_NAN0 - li t3, DQUIET_NAN1 - jal set_fd_d # save result (in t0,t1,t2,t3) - b done - -/* - * Signal an invalid operation if the trap is enabled; otherwise, - * the result is INT_MAX or INT_MIN. - */ -invalid_w: # trap invalid operation - or a1, a1, FPC_EXCEPTION_INVALID | FPC_STICKY_INVALID - and v0, a1, FPC_ENABLE_INVALID - bne v0, zero, fpe_trap - ctc1 a1, FPC_CSR # save exceptions - bne t0, zero, 1f - li t2, INT_MAX # result is INT_MAX - b result_fs_w -1: - li t2, INT_MIN # result is INT_MIN - b result_fs_w - -/* - * Trap if the hardware should have handled this case. - */ -fpe_trap: - move a2, a1 # code = FP CSR - ctc1 a1, FPC_CSR # save exceptions - break 0 - -/* - * Send an illegal instruction signal to the current process. - */ -ill: - ctc1 a1, FPC_CSR # save exceptions - move a2, a0 # code = FP instruction - break 0 - -result_ft_s: - move t0, t4 # result is FT - move t1, t5 - move t2, t6 -result_fs_s: # result is FS - jal set_fd_s # save result (in t0,t1,t2) - b done - -result_fs_w: - jal set_fd_word # save result (in t2) - b done - -result_ft_d: - move t0, t4 # result is FT - move t1, t5 - move t2, t6 - move t3, t7 -result_fs_d: # result is FS - jal set_fd_d # save result (in t0,t1,t2,t3) - -done: - lw ra, STAND_RA_OFFSET(sp) - addu sp, sp, STAND_FRAME_SIZE - j ra -END(MipsEmulateFP) - -/*---------------------------------------------------------------------------- - * get_fs_int -- - * - * Read (integer) the FS register (bits 15-11). - * This is an internal routine used by MipsEmulateFP only. - * - * Results: - * t0 contains the sign - * t2 contains the fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(get_fs_int) - srl a3, a0, 12 - 2 # get FS field (even regs only) - and a3, a3, 0xF << 2 # mask FS field - lw a3, get_fs_int_tbl(a3) # switch on register number - j a3 - - .rdata -get_fs_int_tbl: - .word get_fs_int_f0 - .word get_fs_int_f2 - .word get_fs_int_f4 - .word get_fs_int_f6 - .word get_fs_int_f8 - .word get_fs_int_f10 - .word get_fs_int_f12 - .word get_fs_int_f14 - .word get_fs_int_f16 - .word get_fs_int_f18 - .word get_fs_int_f20 - .word get_fs_int_f22 - .word get_fs_int_f24 - .word get_fs_int_f26 - .word get_fs_int_f28 - .word get_fs_int_f30 - .text - -get_fs_int_f0: - mfc1 t2, $f0 - b get_fs_int_done -get_fs_int_f2: - mfc1 t2, $f2 - b get_fs_int_done -get_fs_int_f4: - mfc1 t2, $f4 - b get_fs_int_done -get_fs_int_f6: - mfc1 t2, $f6 - b get_fs_int_done -get_fs_int_f8: - mfc1 t2, $f8 - b get_fs_int_done -get_fs_int_f10: - mfc1 t2, $f10 - b get_fs_int_done -get_fs_int_f12: - mfc1 t2, $f12 - b get_fs_int_done -get_fs_int_f14: - mfc1 t2, $f14 - b get_fs_int_done -get_fs_int_f16: - mfc1 t2, $f16 - b get_fs_int_done -get_fs_int_f18: - mfc1 t2, $f18 - b get_fs_int_done -get_fs_int_f20: - mfc1 t2, $f20 - b get_fs_int_done -get_fs_int_f22: - mfc1 t2, $f22 - b get_fs_int_done -get_fs_int_f24: - mfc1 t2, $f24 - b get_fs_int_done -get_fs_int_f26: - mfc1 t2, $f26 - b get_fs_int_done -get_fs_int_f28: - mfc1 t2, $f28 - b get_fs_int_done -get_fs_int_f30: - mfc1 t2, $f30 -get_fs_int_done: - srl t0, t2, 31 # init the sign bit - bge t2, zero, 1f - negu t2 -1: - j ra -END(get_fs_int) - -/*---------------------------------------------------------------------------- - * get_ft_fs_s -- - * - * Read (single precision) the FT register (bits 20-16) and - * the FS register (bits 15-11) and break up into fields. - * This is an internal routine used by MipsEmulateFP only. - * - * Results: - * t0 contains the FS sign - * t1 contains the FS (biased) exponent - * t2 contains the FS fraction - * t4 contains the FT sign - * t5 contains the FT (biased) exponent - * t6 contains the FT fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(get_ft_fs_s) - srl a3, a0, 17 - 2 # get FT field (even regs only) - and a3, a3, 0xF << 2 # mask FT field - lw a3, get_ft_s_tbl(a3) # switch on register number - j a3 - - .rdata -get_ft_s_tbl: - .word get_ft_s_f0 - .word get_ft_s_f2 - .word get_ft_s_f4 - .word get_ft_s_f6 - .word get_ft_s_f8 - .word get_ft_s_f10 - .word get_ft_s_f12 - .word get_ft_s_f14 - .word get_ft_s_f16 - .word get_ft_s_f18 - .word get_ft_s_f20 - .word get_ft_s_f22 - .word get_ft_s_f24 - .word get_ft_s_f26 - .word get_ft_s_f28 - .word get_ft_s_f30 - .text - -get_ft_s_f0: - mfc1 t4, $f0 - b get_ft_s_done -get_ft_s_f2: - mfc1 t4, $f2 - b get_ft_s_done -get_ft_s_f4: - mfc1 t4, $f4 - b get_ft_s_done -get_ft_s_f6: - mfc1 t4, $f6 - b get_ft_s_done -get_ft_s_f8: - mfc1 t4, $f8 - b get_ft_s_done -get_ft_s_f10: - mfc1 t4, $f10 - b get_ft_s_done -get_ft_s_f12: - mfc1 t4, $f12 - b get_ft_s_done -get_ft_s_f14: - mfc1 t4, $f14 - b get_ft_s_done -get_ft_s_f16: - mfc1 t4, $f16 - b get_ft_s_done -get_ft_s_f18: - mfc1 t4, $f18 - b get_ft_s_done -get_ft_s_f20: - mfc1 t4, $f20 - b get_ft_s_done -get_ft_s_f22: - mfc1 t4, $f22 - b get_ft_s_done -get_ft_s_f24: - mfc1 t4, $f24 - b get_ft_s_done -get_ft_s_f26: - mfc1 t4, $f26 - b get_ft_s_done -get_ft_s_f28: - mfc1 t4, $f28 - b get_ft_s_done -get_ft_s_f30: - mfc1 t4, $f30 -get_ft_s_done: - srl t5, t4, 23 # get exponent - and t5, t5, 0xFF - and t6, t4, 0x7FFFFF # get fraction - srl t4, t4, 31 # get sign - bne t5, SEXP_INF, 1f # is it a signaling NAN? - and v0, t6, SSIGNAL_NAN - bne v0, zero, invalid_s -1: - /* fall through to get FS */ - -/*---------------------------------------------------------------------------- - * get_fs_s -- - * - * Read (single precision) the FS register (bits 15-11) and - * break up into fields. - * This is an internal routine used by MipsEmulateFP only. - * - * Results: - * t0 contains the sign - * t1 contains the (biased) exponent - * t2 contains the fraction - * - *---------------------------------------------------------------------------- - */ -ALEAF(get_fs_s) - srl a3, a0, 12 - 2 # get FS field (even regs only) - and a3, a3, 0xF << 2 # mask FS field - lw a3, get_fs_s_tbl(a3) # switch on register number - j a3 - - .rdata -get_fs_s_tbl: - .word get_fs_s_f0 - .word get_fs_s_f2 - .word get_fs_s_f4 - .word get_fs_s_f6 - .word get_fs_s_f8 - .word get_fs_s_f10 - .word get_fs_s_f12 - .word get_fs_s_f14 - .word get_fs_s_f16 - .word get_fs_s_f18 - .word get_fs_s_f20 - .word get_fs_s_f22 - .word get_fs_s_f24 - .word get_fs_s_f26 - .word get_fs_s_f28 - .word get_fs_s_f30 - .text - -get_fs_s_f0: - mfc1 t0, $f0 - b get_fs_s_done -get_fs_s_f2: - mfc1 t0, $f2 - b get_fs_s_done -get_fs_s_f4: - mfc1 t0, $f4 - b get_fs_s_done -get_fs_s_f6: - mfc1 t0, $f6 - b get_fs_s_done -get_fs_s_f8: - mfc1 t0, $f8 - b get_fs_s_done -get_fs_s_f10: - mfc1 t0, $f10 - b get_fs_s_done -get_fs_s_f12: - mfc1 t0, $f12 - b get_fs_s_done -get_fs_s_f14: - mfc1 t0, $f14 - b get_fs_s_done -get_fs_s_f16: - mfc1 t0, $f16 - b get_fs_s_done -get_fs_s_f18: - mfc1 t0, $f18 - b get_fs_s_done -get_fs_s_f20: - mfc1 t0, $f20 - b get_fs_s_done -get_fs_s_f22: - mfc1 t0, $f22 - b get_fs_s_done -get_fs_s_f24: - mfc1 t0, $f24 - b get_fs_s_done -get_fs_s_f26: - mfc1 t0, $f26 - b get_fs_s_done -get_fs_s_f28: - mfc1 t0, $f28 - b get_fs_s_done -get_fs_s_f30: - mfc1 t0, $f30 -get_fs_s_done: - srl t1, t0, 23 # get exponent - and t1, t1, 0xFF - and t2, t0, 0x7FFFFF # get fraction - srl t0, t0, 31 # get sign - bne t1, SEXP_INF, 1f # is it a signaling NAN? - and v0, t2, SSIGNAL_NAN - bne v0, zero, invalid_s -1: - j ra -END(get_ft_fs_s) - -/*---------------------------------------------------------------------------- - * get_ft_fs_d -- - * - * Read (double precision) the FT register (bits 20-16) and - * the FS register (bits 15-11) and break up into fields. - * This is an internal routine used by MipsEmulateFP only. - * - * Results: - * t0 contains the FS sign - * t1 contains the FS (biased) exponent - * t2 contains the FS fraction - * t3 contains the FS remaining fraction - * t4 contains the FT sign - * t5 contains the FT (biased) exponent - * t6 contains the FT fraction - * t7 contains the FT remaining fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(get_ft_fs_d) - srl a3, a0, 17 - 2 # get FT field (even regs only) - and a3, a3, 0xF << 2 # mask FT field - lw a3, get_ft_d_tbl(a3) # switch on register number - j a3 - - .rdata -get_ft_d_tbl: - .word get_ft_d_f0 - .word get_ft_d_f2 - .word get_ft_d_f4 - .word get_ft_d_f6 - .word get_ft_d_f8 - .word get_ft_d_f10 - .word get_ft_d_f12 - .word get_ft_d_f14 - .word get_ft_d_f16 - .word get_ft_d_f18 - .word get_ft_d_f20 - .word get_ft_d_f22 - .word get_ft_d_f24 - .word get_ft_d_f26 - .word get_ft_d_f28 - .word get_ft_d_f30 - .text - -get_ft_d_f0: - mfc1 t7, $f0 - mfc1 t4, $f1 - b get_ft_d_done -get_ft_d_f2: - mfc1 t7, $f2 - mfc1 t4, $f3 - b get_ft_d_done -get_ft_d_f4: - mfc1 t7, $f4 - mfc1 t4, $f5 - b get_ft_d_done -get_ft_d_f6: - mfc1 t7, $f6 - mfc1 t4, $f7 - b get_ft_d_done -get_ft_d_f8: - mfc1 t7, $f8 - mfc1 t4, $f9 - b get_ft_d_done -get_ft_d_f10: - mfc1 t7, $f10 - mfc1 t4, $f11 - b get_ft_d_done -get_ft_d_f12: - mfc1 t7, $f12 - mfc1 t4, $f13 - b get_ft_d_done -get_ft_d_f14: - mfc1 t7, $f14 - mfc1 t4, $f15 - b get_ft_d_done -get_ft_d_f16: - mfc1 t7, $f16 - mfc1 t4, $f17 - b get_ft_d_done -get_ft_d_f18: - mfc1 t7, $f18 - mfc1 t4, $f19 - b get_ft_d_done -get_ft_d_f20: - mfc1 t7, $f20 - mfc1 t4, $f21 - b get_ft_d_done -get_ft_d_f22: - mfc1 t7, $f22 - mfc1 t4, $f23 - b get_ft_d_done -get_ft_d_f24: - mfc1 t7, $f24 - mfc1 t4, $f25 - b get_ft_d_done -get_ft_d_f26: - mfc1 t7, $f26 - mfc1 t4, $f27 - b get_ft_d_done -get_ft_d_f28: - mfc1 t7, $f28 - mfc1 t4, $f29 - b get_ft_d_done -get_ft_d_f30: - mfc1 t7, $f30 - mfc1 t4, $f31 -get_ft_d_done: - srl t5, t4, 20 # get exponent - and t5, t5, 0x7FF - and t6, t4, 0xFFFFF # get fraction - srl t4, t4, 31 # get sign - bne t5, DEXP_INF, 1f # is it a signaling NAN? - and v0, t6, DSIGNAL_NAN - bne v0, zero, invalid_d -1: - /* fall through to get FS */ - -/*---------------------------------------------------------------------------- - * get_fs_d -- - * - * Read (double precision) the FS register (bits 15-11) and - * break up into fields. - * This is an internal routine used by MipsEmulateFP only. - * - * Results: - * t0 contains the sign - * t1 contains the (biased) exponent - * t2 contains the fraction - * t3 contains the remaining fraction - * - *---------------------------------------------------------------------------- - */ -ALEAF(get_fs_d) - srl a3, a0, 12 - 2 # get FS field (even regs only) - and a3, a3, 0xF << 2 # mask FS field - lw a3, get_fs_d_tbl(a3) # switch on register number - j a3 - - .rdata -get_fs_d_tbl: - .word get_fs_d_f0 - .word get_fs_d_f2 - .word get_fs_d_f4 - .word get_fs_d_f6 - .word get_fs_d_f8 - .word get_fs_d_f10 - .word get_fs_d_f12 - .word get_fs_d_f14 - .word get_fs_d_f16 - .word get_fs_d_f18 - .word get_fs_d_f20 - .word get_fs_d_f22 - .word get_fs_d_f24 - .word get_fs_d_f26 - .word get_fs_d_f28 - .word get_fs_d_f30 - .text - -get_fs_d_f0: - mfc1 t3, $f0 - mfc1 t0, $f1 - b get_fs_d_done -get_fs_d_f2: - mfc1 t3, $f2 - mfc1 t0, $f3 - b get_fs_d_done -get_fs_d_f4: - mfc1 t3, $f4 - mfc1 t0, $f5 - b get_fs_d_done -get_fs_d_f6: - mfc1 t3, $f6 - mfc1 t0, $f7 - b get_fs_d_done -get_fs_d_f8: - mfc1 t3, $f8 - mfc1 t0, $f9 - b get_fs_d_done -get_fs_d_f10: - mfc1 t3, $f10 - mfc1 t0, $f11 - b get_fs_d_done -get_fs_d_f12: - mfc1 t3, $f12 - mfc1 t0, $f13 - b get_fs_d_done -get_fs_d_f14: - mfc1 t3, $f14 - mfc1 t0, $f15 - b get_fs_d_done -get_fs_d_f16: - mfc1 t3, $f16 - mfc1 t0, $f17 - b get_fs_d_done -get_fs_d_f18: - mfc1 t3, $f18 - mfc1 t0, $f19 - b get_fs_d_done -get_fs_d_f20: - mfc1 t3, $f20 - mfc1 t0, $f21 - b get_fs_d_done -get_fs_d_f22: - mfc1 t3, $f22 - mfc1 t0, $f23 - b get_fs_d_done -get_fs_d_f24: - mfc1 t3, $f24 - mfc1 t0, $f25 - b get_fs_d_done -get_fs_d_f26: - mfc1 t3, $f26 - mfc1 t0, $f27 - b get_fs_d_done -get_fs_d_f28: - mfc1 t3, $f28 - mfc1 t0, $f29 - b get_fs_d_done -get_fs_d_f30: - mfc1 t3, $f30 - mfc1 t0, $f31 -get_fs_d_done: - srl t1, t0, 20 # get exponent - and t1, t1, 0x7FF - and t2, t0, 0xFFFFF # get fraction - srl t0, t0, 31 # get sign - bne t1, DEXP_INF, 1f # is it a signaling NAN? - and v0, t2, DSIGNAL_NAN - bne v0, zero, invalid_d -1: - j ra -END(get_ft_fs_d) - -/*---------------------------------------------------------------------------- - * get_cmp_s -- - * - * Read (single precision) the FS register (bits 15-11) and - * the FT register (bits 20-16) and break up into fields. - * This is an internal routine used by MipsEmulateFP only. - * - * Results: - * t0 contains the sign - * t1 contains the (biased) exponent - * t2 contains the fraction - * t4 contains the sign - * t5 contains the (biased) exponent - * t6 contains the fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(get_cmp_s) - srl a3, a0, 12 - 2 # get FS field (even regs only) - and a3, a3, 0xF << 2 # mask FS field - lw a3, cmp_fs_s_tbl(a3) # switch on register number - j a3 - - .rdata -cmp_fs_s_tbl: - .word cmp_fs_s_f0 - .word cmp_fs_s_f2 - .word cmp_fs_s_f4 - .word cmp_fs_s_f6 - .word cmp_fs_s_f8 - .word cmp_fs_s_f10 - .word cmp_fs_s_f12 - .word cmp_fs_s_f14 - .word cmp_fs_s_f16 - .word cmp_fs_s_f18 - .word cmp_fs_s_f20 - .word cmp_fs_s_f22 - .word cmp_fs_s_f24 - .word cmp_fs_s_f26 - .word cmp_fs_s_f28 - .word cmp_fs_s_f30 - .text - -cmp_fs_s_f0: - mfc1 t0, $f0 - b cmp_fs_s_done -cmp_fs_s_f2: - mfc1 t0, $f2 - b cmp_fs_s_done -cmp_fs_s_f4: - mfc1 t0, $f4 - b cmp_fs_s_done -cmp_fs_s_f6: - mfc1 t0, $f6 - b cmp_fs_s_done -cmp_fs_s_f8: - mfc1 t0, $f8 - b cmp_fs_s_done -cmp_fs_s_f10: - mfc1 t0, $f10 - b cmp_fs_s_done -cmp_fs_s_f12: - mfc1 t0, $f12 - b cmp_fs_s_done -cmp_fs_s_f14: - mfc1 t0, $f14 - b cmp_fs_s_done -cmp_fs_s_f16: - mfc1 t0, $f16 - b cmp_fs_s_done -cmp_fs_s_f18: - mfc1 t0, $f18 - b cmp_fs_s_done -cmp_fs_s_f20: - mfc1 t0, $f20 - b cmp_fs_s_done -cmp_fs_s_f22: - mfc1 t0, $f22 - b cmp_fs_s_done -cmp_fs_s_f24: - mfc1 t0, $f24 - b cmp_fs_s_done -cmp_fs_s_f26: - mfc1 t0, $f26 - b cmp_fs_s_done -cmp_fs_s_f28: - mfc1 t0, $f28 - b cmp_fs_s_done -cmp_fs_s_f30: - mfc1 t0, $f30 -cmp_fs_s_done: - srl t1, t0, 23 # get exponent - and t1, t1, 0xFF - and t2, t0, 0x7FFFFF # get fraction - srl t0, t0, 31 # get sign - - srl a3, a0, 17 - 2 # get FT field (even regs only) - and a3, a3, 0xF << 2 # mask FT field - lw a3, cmp_ft_s_tbl(a3) # switch on register number - j a3 - - .rdata -cmp_ft_s_tbl: - .word cmp_ft_s_f0 - .word cmp_ft_s_f2 - .word cmp_ft_s_f4 - .word cmp_ft_s_f6 - .word cmp_ft_s_f8 - .word cmp_ft_s_f10 - .word cmp_ft_s_f12 - .word cmp_ft_s_f14 - .word cmp_ft_s_f16 - .word cmp_ft_s_f18 - .word cmp_ft_s_f20 - .word cmp_ft_s_f22 - .word cmp_ft_s_f24 - .word cmp_ft_s_f26 - .word cmp_ft_s_f28 - .word cmp_ft_s_f30 - .text - -cmp_ft_s_f0: - mfc1 t4, $f0 - b cmp_ft_s_done -cmp_ft_s_f2: - mfc1 t4, $f2 - b cmp_ft_s_done -cmp_ft_s_f4: - mfc1 t4, $f4 - b cmp_ft_s_done -cmp_ft_s_f6: - mfc1 t4, $f6 - b cmp_ft_s_done -cmp_ft_s_f8: - mfc1 t4, $f8 - b cmp_ft_s_done -cmp_ft_s_f10: - mfc1 t4, $f10 - b cmp_ft_s_done -cmp_ft_s_f12: - mfc1 t4, $f12 - b cmp_ft_s_done -cmp_ft_s_f14: - mfc1 t4, $f14 - b cmp_ft_s_done -cmp_ft_s_f16: - mfc1 t4, $f16 - b cmp_ft_s_done -cmp_ft_s_f18: - mfc1 t4, $f18 - b cmp_ft_s_done -cmp_ft_s_f20: - mfc1 t4, $f20 - b cmp_ft_s_done -cmp_ft_s_f22: - mfc1 t4, $f22 - b cmp_ft_s_done -cmp_ft_s_f24: - mfc1 t4, $f24 - b cmp_ft_s_done -cmp_ft_s_f26: - mfc1 t4, $f26 - b cmp_ft_s_done -cmp_ft_s_f28: - mfc1 t4, $f28 - b cmp_ft_s_done -cmp_ft_s_f30: - mfc1 t4, $f30 -cmp_ft_s_done: - srl t5, t4, 23 # get exponent - and t5, t5, 0xFF - and t6, t4, 0x7FFFFF # get fraction - srl t4, t4, 31 # get sign - j ra -END(get_cmp_s) - -/*---------------------------------------------------------------------------- - * get_cmp_d -- - * - * Read (double precision) the FS register (bits 15-11) and - * the FT register (bits 20-16) and break up into fields. - * This is an internal routine used by MipsEmulateFP only. - * - * Results: - * t0 contains the sign - * t1 contains the (biased) exponent - * t2 contains the fraction - * t3 contains the remaining fraction - * t4 contains the sign - * t5 contains the (biased) exponent - * t6 contains the fraction - * t7 contains the remaining fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(get_cmp_d) - srl a3, a0, 12 - 2 # get FS field (even regs only) - and a3, a3, 0xF << 2 # mask FS field - lw a3, cmp_fs_d_tbl(a3) # switch on register number - j a3 - - .rdata -cmp_fs_d_tbl: - .word cmp_fs_d_f0 - .word cmp_fs_d_f2 - .word cmp_fs_d_f4 - .word cmp_fs_d_f6 - .word cmp_fs_d_f8 - .word cmp_fs_d_f10 - .word cmp_fs_d_f12 - .word cmp_fs_d_f14 - .word cmp_fs_d_f16 - .word cmp_fs_d_f18 - .word cmp_fs_d_f20 - .word cmp_fs_d_f22 - .word cmp_fs_d_f24 - .word cmp_fs_d_f26 - .word cmp_fs_d_f28 - .word cmp_fs_d_f30 - .text - -cmp_fs_d_f0: - mfc1 t3, $f0 - mfc1 t0, $f1 - b cmp_fs_d_done -cmp_fs_d_f2: - mfc1 t3, $f2 - mfc1 t0, $f3 - b cmp_fs_d_done -cmp_fs_d_f4: - mfc1 t3, $f4 - mfc1 t0, $f5 - b cmp_fs_d_done -cmp_fs_d_f6: - mfc1 t3, $f6 - mfc1 t0, $f7 - b cmp_fs_d_done -cmp_fs_d_f8: - mfc1 t3, $f8 - mfc1 t0, $f9 - b cmp_fs_d_done -cmp_fs_d_f10: - mfc1 t3, $f10 - mfc1 t0, $f11 - b cmp_fs_d_done -cmp_fs_d_f12: - mfc1 t3, $f12 - mfc1 t0, $f13 - b cmp_fs_d_done -cmp_fs_d_f14: - mfc1 t3, $f14 - mfc1 t0, $f15 - b cmp_fs_d_done -cmp_fs_d_f16: - mfc1 t3, $f16 - mfc1 t0, $f17 - b cmp_fs_d_done -cmp_fs_d_f18: - mfc1 t3, $f18 - mfc1 t0, $f19 - b cmp_fs_d_done -cmp_fs_d_f20: - mfc1 t3, $f20 - mfc1 t0, $f21 - b cmp_fs_d_done -cmp_fs_d_f22: - mfc1 t3, $f22 - mfc1 t0, $f23 - b cmp_fs_d_done -cmp_fs_d_f24: - mfc1 t3, $f24 - mfc1 t0, $f25 - b cmp_fs_d_done -cmp_fs_d_f26: - mfc1 t3, $f26 - mfc1 t0, $f27 - b cmp_fs_d_done -cmp_fs_d_f28: - mfc1 t3, $f28 - mfc1 t0, $f29 - b cmp_fs_d_done -cmp_fs_d_f30: - mfc1 t3, $f30 - mfc1 t0, $f31 -cmp_fs_d_done: - srl t1, t0, 20 # get exponent - and t1, t1, 0x7FF - and t2, t0, 0xFFFFF # get fraction - srl t0, t0, 31 # get sign - - srl a3, a0, 17 - 2 # get FT field (even regs only) - and a3, a3, 0xF << 2 # mask FT field - lw a3, cmp_ft_d_tbl(a3) # switch on register number - j a3 - - .rdata -cmp_ft_d_tbl: - .word cmp_ft_d_f0 - .word cmp_ft_d_f2 - .word cmp_ft_d_f4 - .word cmp_ft_d_f6 - .word cmp_ft_d_f8 - .word cmp_ft_d_f10 - .word cmp_ft_d_f12 - .word cmp_ft_d_f14 - .word cmp_ft_d_f16 - .word cmp_ft_d_f18 - .word cmp_ft_d_f20 - .word cmp_ft_d_f22 - .word cmp_ft_d_f24 - .word cmp_ft_d_f26 - .word cmp_ft_d_f28 - .word cmp_ft_d_f30 - .text - -cmp_ft_d_f0: - mfc1 t7, $f0 - mfc1 t4, $f1 - b cmp_ft_d_done -cmp_ft_d_f2: - mfc1 t7, $f2 - mfc1 t4, $f3 - b cmp_ft_d_done -cmp_ft_d_f4: - mfc1 t7, $f4 - mfc1 t4, $f5 - b cmp_ft_d_done -cmp_ft_d_f6: - mfc1 t7, $f6 - mfc1 t4, $f7 - b cmp_ft_d_done -cmp_ft_d_f8: - mfc1 t7, $f8 - mfc1 t4, $f9 - b cmp_ft_d_done -cmp_ft_d_f10: - mfc1 t7, $f10 - mfc1 t4, $f11 - b cmp_ft_d_done -cmp_ft_d_f12: - mfc1 t7, $f12 - mfc1 t4, $f13 - b cmp_ft_d_done -cmp_ft_d_f14: - mfc1 t7, $f14 - mfc1 t4, $f15 - b cmp_ft_d_done -cmp_ft_d_f16: - mfc1 t7, $f16 - mfc1 t4, $f17 - b cmp_ft_d_done -cmp_ft_d_f18: - mfc1 t7, $f18 - mfc1 t4, $f19 - b cmp_ft_d_done -cmp_ft_d_f20: - mfc1 t7, $f20 - mfc1 t4, $f21 - b cmp_ft_d_done -cmp_ft_d_f22: - mfc1 t7, $f22 - mfc1 t4, $f23 - b cmp_ft_d_done -cmp_ft_d_f24: - mfc1 t7, $f24 - mfc1 t4, $f25 - b cmp_ft_d_done -cmp_ft_d_f26: - mfc1 t7, $f26 - mfc1 t4, $f27 - b cmp_ft_d_done -cmp_ft_d_f28: - mfc1 t7, $f28 - mfc1 t4, $f29 - b cmp_ft_d_done -cmp_ft_d_f30: - mfc1 t7, $f30 - mfc1 t4, $f31 -cmp_ft_d_done: - srl t5, t4, 20 # get exponent - and t5, t5, 0x7FF - and t6, t4, 0xFFFFF # get fraction - srl t4, t4, 31 # get sign - j ra -END(get_cmp_d) - -/*---------------------------------------------------------------------------- - * set_fd_s -- - * - * Write (single precision) the FD register (bits 10-6). - * This is an internal routine used by MipsEmulateFP only. - * - * Arguments: - * a0 contains the FP instruction - * t0 contains the sign - * t1 contains the (biased) exponent - * t2 contains the fraction - * - * set_fd_word -- - * - * Write (integer) the FD register (bits 10-6). - * This is an internal routine used by MipsEmulateFP only. - * - * Arguments: - * a0 contains the FP instruction - * t2 contains the integer - * - *---------------------------------------------------------------------------- - */ -LEAF(set_fd_s) - sll t0, t0, 31 # position sign - sll t1, t1, 23 # position exponent - or t2, t2, t0 - or t2, t2, t1 -ALEAF(set_fd_word) - srl a3, a0, 7 - 2 # get FD field (even regs only) - and a3, a3, 0xF << 2 # mask FT field - lw a3, set_fd_s_tbl(a3) # switch on register number - j a3 - - .rdata -set_fd_s_tbl: - .word set_fd_s_f0 - .word set_fd_s_f2 - .word set_fd_s_f4 - .word set_fd_s_f6 - .word set_fd_s_f8 - .word set_fd_s_f10 - .word set_fd_s_f12 - .word set_fd_s_f14 - .word set_fd_s_f16 - .word set_fd_s_f18 - .word set_fd_s_f20 - .word set_fd_s_f22 - .word set_fd_s_f24 - .word set_fd_s_f26 - .word set_fd_s_f28 - .word set_fd_s_f30 - .text - -set_fd_s_f0: - mtc1 t2, $f0 - j ra -set_fd_s_f2: - mtc1 t2, $f2 - j ra -set_fd_s_f4: - mtc1 t2, $f4 - j ra -set_fd_s_f6: - mtc1 t2, $f6 - j ra -set_fd_s_f8: - mtc1 t2, $f8 - j ra -set_fd_s_f10: - mtc1 t2, $f10 - j ra -set_fd_s_f12: - mtc1 t2, $f12 - j ra -set_fd_s_f14: - mtc1 t2, $f14 - j ra -set_fd_s_f16: - mtc1 t2, $f16 - j ra -set_fd_s_f18: - mtc1 t2, $f18 - j ra -set_fd_s_f20: - mtc1 t2, $f20 - j ra -set_fd_s_f22: - mtc1 t2, $f22 - j ra -set_fd_s_f24: - mtc1 t2, $f24 - j ra -set_fd_s_f26: - mtc1 t2, $f26 - j ra -set_fd_s_f28: - mtc1 t2, $f28 - j ra -set_fd_s_f30: - mtc1 t2, $f30 - j ra -END(set_fd_s) - -/*---------------------------------------------------------------------------- - * set_fd_d -- - * - * Write (double precision) the FT register (bits 10-6). - * This is an internal routine used by MipsEmulateFP only. - * - * Arguments: - * a0 contains the FP instruction - * t0 contains the sign - * t1 contains the (biased) exponent - * t2 contains the fraction - * t3 contains the remaining fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(set_fd_d) - sll t0, t0, 31 # set sign - sll t1, t1, 20 # set exponent - or t0, t0, t1 - or t0, t0, t2 # set fraction - srl a3, a0, 7 - 2 # get FD field (even regs only) - and a3, a3, 0xF << 2 # mask FD field - lw a3, set_fd_d_tbl(a3) # switch on register number - j a3 - - .rdata -set_fd_d_tbl: - .word set_fd_d_f0 - .word set_fd_d_f2 - .word set_fd_d_f4 - .word set_fd_d_f6 - .word set_fd_d_f8 - .word set_fd_d_f10 - .word set_fd_d_f12 - .word set_fd_d_f14 - .word set_fd_d_f16 - .word set_fd_d_f18 - .word set_fd_d_f20 - .word set_fd_d_f22 - .word set_fd_d_f24 - .word set_fd_d_f26 - .word set_fd_d_f28 - .word set_fd_d_f30 - .text - -set_fd_d_f0: - mtc1 t3, $f0 - mtc1 t0, $f1 - j ra -set_fd_d_f2: - mtc1 t3, $f2 - mtc1 t0, $f3 - j ra -set_fd_d_f4: - mtc1 t3, $f4 - mtc1 t0, $f5 - j ra -set_fd_d_f6: - mtc1 t3, $f6 - mtc1 t0, $f7 - j ra -set_fd_d_f8: - mtc1 t3, $f8 - mtc1 t0, $f9 - j ra -set_fd_d_f10: - mtc1 t3, $f10 - mtc1 t0, $f11 - j ra -set_fd_d_f12: - mtc1 t3, $f12 - mtc1 t0, $f13 - j ra -set_fd_d_f14: - mtc1 t3, $f14 - mtc1 t0, $f15 - j ra -set_fd_d_f16: - mtc1 t3, $f16 - mtc1 t0, $f17 - j ra -set_fd_d_f18: - mtc1 t3, $f18 - mtc1 t0, $f19 - j ra -set_fd_d_f20: - mtc1 t3, $f20 - mtc1 t0, $f21 - j ra -set_fd_d_f22: - mtc1 t3, $f22 - mtc1 t0, $f23 - j ra -set_fd_d_f24: - mtc1 t3, $f24 - mtc1 t0, $f25 - j ra -set_fd_d_f26: - mtc1 t3, $f26 - mtc1 t0, $f27 - j ra -set_fd_d_f28: - mtc1 t3, $f28 - mtc1 t0, $f29 - j ra -set_fd_d_f30: - mtc1 t3, $f30 - mtc1 t0, $f31 - j ra -END(set_fd_d) - -/*---------------------------------------------------------------------------- - * renorm_fs_s -- - * - * Results: - * t1 unbiased exponent - * t2 normalized fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(renorm_fs_s) -/* - * Find out how many leading zero bits are in t2 and put in t9. - */ - move v0, t2 - move t9, zero - srl v1, v0, 16 - bne v1, zero, 1f - addu t9, 16 - sll v0, 16 -1: - srl v1, v0, 24 - bne v1, zero, 1f - addu t9, 8 - sll v0, 8 -1: - srl v1, v0, 28 - bne v1, zero, 1f - addu t9, 4 - sll v0, 4 -1: - srl v1, v0, 30 - bne v1, zero, 1f - addu t9, 2 - sll v0, 2 -1: - srl v1, v0, 31 - bne v1, zero, 1f - addu t9, 1 -/* - * Now shift t2 the correct number of bits. - */ -1: - subu t9, t9, SLEAD_ZEROS # dont count normal leading zeros - li t1, SEXP_MIN - subu t1, t1, t9 # adjust exponent - sll t2, t2, t9 - j ra -END(renorm_fs_s) - -/*---------------------------------------------------------------------------- - * renorm_fs_d -- - * - * Results: - * t1 unbiased exponent - * t2,t3 normalized fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(renorm_fs_d) -/* - * Find out how many leading zero bits are in t2,t3 and put in t9. - */ - move v0, t2 - move t9, zero - bne t2, zero, 1f - move v0, t3 - addu t9, 32 -1: - srl v1, v0, 16 - bne v1, zero, 1f - addu t9, 16 - sll v0, 16 -1: - srl v1, v0, 24 - bne v1, zero, 1f - addu t9, 8 - sll v0, 8 -1: - srl v1, v0, 28 - bne v1, zero, 1f - addu t9, 4 - sll v0, 4 -1: - srl v1, v0, 30 - bne v1, zero, 1f - addu t9, 2 - sll v0, 2 -1: - srl v1, v0, 31 - bne v1, zero, 1f - addu t9, 1 -/* - * Now shift t2,t3 the correct number of bits. - */ -1: - subu t9, t9, DLEAD_ZEROS # dont count normal leading zeros - li t1, DEXP_MIN - subu t1, t1, t9 # adjust exponent - li v0, 32 - blt t9, v0, 1f - subu t9, t9, v0 # shift fraction left >= 32 bits - sll t2, t3, t9 - move t3, zero - j ra -1: - subu v0, v0, t9 # shift fraction left < 32 bits - sll t2, t2, t9 - srl v1, t3, v0 - or t2, t2, v1 - sll t3, t3, t9 - j ra -END(renorm_fs_d) - -/*---------------------------------------------------------------------------- - * renorm_ft_s -- - * - * Results: - * t5 unbiased exponent - * t6 normalized fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(renorm_ft_s) -/* - * Find out how many leading zero bits are in t6 and put in t9. - */ - move v0, t6 - move t9, zero - srl v1, v0, 16 - bne v1, zero, 1f - addu t9, 16 - sll v0, 16 -1: - srl v1, v0, 24 - bne v1, zero, 1f - addu t9, 8 - sll v0, 8 -1: - srl v1, v0, 28 - bne v1, zero, 1f - addu t9, 4 - sll v0, 4 -1: - srl v1, v0, 30 - bne v1, zero, 1f - addu t9, 2 - sll v0, 2 -1: - srl v1, v0, 31 - bne v1, zero, 1f - addu t9, 1 -/* - * Now shift t6 the correct number of bits. - */ -1: - subu t9, t9, SLEAD_ZEROS # dont count normal leading zeros - li t5, SEXP_MIN - subu t5, t5, t9 # adjust exponent - sll t6, t6, t9 - j ra -END(renorm_ft_s) - -/*---------------------------------------------------------------------------- - * renorm_ft_d -- - * - * Results: - * t5 unbiased exponent - * t6,t7 normalized fraction - * - *---------------------------------------------------------------------------- - */ -LEAF(renorm_ft_d) -/* - * Find out how many leading zero bits are in t6,t7 and put in t9. - */ - move v0, t6 - move t9, zero - bne t6, zero, 1f - move v0, t7 - addu t9, 32 -1: - srl v1, v0, 16 - bne v1, zero, 1f - addu t9, 16 - sll v0, 16 -1: - srl v1, v0, 24 - bne v1, zero, 1f - addu t9, 8 - sll v0, 8 -1: - srl v1, v0, 28 - bne v1, zero, 1f - addu t9, 4 - sll v0, 4 -1: - srl v1, v0, 30 - bne v1, zero, 1f - addu t9, 2 - sll v0, 2 -1: - srl v1, v0, 31 - bne v1, zero, 1f - addu t9, 1 -/* - * Now shift t6,t7 the correct number of bits. - */ -1: - subu t9, t9, DLEAD_ZEROS # dont count normal leading zeros - li t5, DEXP_MIN - subu t5, t5, t9 # adjust exponent - li v0, 32 - blt t9, v0, 1f - subu t9, t9, v0 # shift fraction left >= 32 bits - sll t6, t7, t9 - move t7, zero - j ra -1: - subu v0, v0, t9 # shift fraction left < 32 bits - sll t6, t6, t9 - srl v1, t7, v0 - or t6, t6, v1 - sll t7, t7, t9 - j ra -END(renorm_ft_d) diff --git a/sys/arch/mips/mips/mainbus.c b/sys/arch/mips/mips/mainbus.c deleted file mode 100644 index 7f2bc83a276..00000000000 --- a/sys/arch/mips/mips/mainbus.c +++ /dev/null @@ -1,194 +0,0 @@ -/* $OpenBSD: mainbus.c,v 1.4 1998/10/15 21:30:15 imp Exp $ */ - -/* - * Copyright (c) 1997 Per Fogelstrom. - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/reboot.h> - -#include <mips/archtype.h> -#include <machine/autoconf.h> - -struct mainbus_softc { - struct device sc_dv; - struct abus sc_bus; -}; - -/* Definition of the mainbus driver. */ -static int mbmatch __P((struct device *, void *, void *)); -static void mbattach __P((struct device *, struct device *, void *)); -static int mbprint __P((void *, const char *)); - -struct cfattach mainbus_ca = { - sizeof(struct device), mbmatch, mbattach -}; -struct cfdriver mainbus_cd = { - NULL, "mainbus", DV_DULL, NULL, 0 -}; - -void mb_intr_establish __P((struct confargs *, int (*)(void *), void *)); -void mb_intr_disestablish __P((struct confargs *)); -caddr_t mb_cvtaddr __P((struct confargs *)); -int mb_matchname __P((struct confargs *, char *)); - -static int -mbmatch(parent, cfdata, aux) - struct device *parent; - void *cfdata; - void *aux; -{ - struct cfdata *cf = cfdata; - - if (cf->cf_unit > 0) - return(0); - return(1); -} - -static void -mbattach(parent, self, aux) - struct device *parent; - struct device *self; - void *aux; -{ - struct mainbus_softc *sc = (struct mainbus_softc *)self; - struct confargs nca; - - printf("\n"); - - sc->sc_bus.ab_dv = (struct device *)sc; - sc->sc_bus.ab_type = BUS_MAIN; - sc->sc_bus.ab_intr_establish = mb_intr_establish; - sc->sc_bus.ab_intr_disestablish = mb_intr_disestablish; - sc->sc_bus.ab_cvtaddr = mb_cvtaddr; - sc->sc_bus.ab_matchname = mb_matchname; - - /* - * Try to find and attach all of the CPUs in the machine. - * ( Right now only one CPU so code is simple ) - */ - - nca.ca_name = "cpu"; - nca.ca_slot = 0; - nca.ca_offset = 0; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - -#ifdef arc - if (system_type == ACER_PICA_61 || - system_type == MAGNUM) { - nca.ca_name = "pica"; - nca.ca_slot = 0; - nca.ca_offset = 0; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - } - if (system_type == ALGOR_P4032 || - system_type == ALGOR_P5064) { - nca.ca_name = "algor"; - nca.ca_slot = 0; - nca.ca_offset = 0; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - } - - /* The following machines have a PCI bus */ - if (system_type == ALGOR_P4032 || - system_type == ALGOR_P5064) { - nca.ca_name = "pbcpcibr"; - nca.ca_slot = 0; - nca.ca_offset = 0; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - } - - /* The following machines have an ISA bus */ - if (system_type == ACER_PICA_61 || - system_type == DESKSTATION_TYNE || - system_type == DESKSTATION_RPC44) { - nca.ca_name = "isabr"; - nca.ca_slot = 0; - nca.ca_offset = 0; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - } -#endif - -#ifdef sgi - if (system_type == SGI_INDY) { - nca.ca_name = "indy"; - nca.ca_slot = 0; - nca.ca_offset = 0; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - } -#endif -} - -static int -mbprint(aux, pnp) - void *aux; - const char *pnp; -{ - if (pnp) - return (QUIET); - return (UNCONF); -} - -void -mb_intr_establish(ca, handler, val) - struct confargs *ca; - int (*handler) __P((void *)); - void *val; -{ - - panic("can never mb_intr_establish"); -} - -void -mb_intr_disestablish(ca) - struct confargs *ca; -{ - panic("can never mb_intr_disestablish"); -} - -caddr_t -mb_cvtaddr(ca) - struct confargs *ca; -{ - return (NULL); -} - -int -mb_matchname(ca, name) - struct confargs *ca; - char *name; -{ - return (strcmp(name, ca->ca_name) == 0); -} diff --git a/sys/arch/mips/mips/mem.c b/sys/arch/mips/mips/mem.c deleted file mode 100644 index 819fad7ceea..00000000000 --- a/sys/arch/mips/mips/mem.c +++ /dev/null @@ -1,201 +0,0 @@ -/* $OpenBSD: mem.c,v 1.6 2001/05/05 20:56:43 art Exp $ */ -/* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mem.c 8.3 (Berkeley) 1/12/94 - */ - -/* - * Memory special file - */ - -#include <sys/param.h> -#include <sys/conf.h> -#include <sys/buf.h> -#include <sys/proc.h> -#include <sys/user.h> -#include <sys/msgbuf.h> -#include <sys/systm.h> -#include <sys/uio.h> -#include <sys/malloc.h> - -#include <machine/pte.h> -#include <machine/cpu.h> - -#include <vm/vm.h> - -extern vm_offset_t avail_end; -caddr_t zeropage; - -int mmopen __P((dev_t, int, int)); -int mmclose __P((dev_t, int, int)); -int mmrw __P((dev_t, struct uio *uio, int)); -int mmmmap __P((dev_t, int, int)); -int mmioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); - -/*ARGSUSED*/ -int -mmopen(dev, flag, mode) - dev_t dev; - int flag, mode; -{ - - switch (minor(dev)) { - case 0: - case 1: - case 2: - case 12: - return (0); - default: - return (ENXIO); - } -} - -/*ARGSUSED*/ -int -mmclose(dev, flag, mode) - dev_t dev; - int flag, mode; -{ - return (0); -} - -/*ARGSUSED*/ -int -mmrw(dev, uio, flags) - dev_t dev; - struct uio *uio; - int flags; -{ - register vm_offset_t v; - register int c; - register struct iovec *iov; - int error = 0; - - while (uio->uio_resid > 0 && error == 0) { - iov = uio->uio_iov; - if (iov->iov_len == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - if (uio->uio_iovcnt < 0) - panic("mmrw"); - continue; - } - switch (minor(dev)) { - -/* minor device 0 is physical memory */ - case 0: - v = uio->uio_offset; - c = iov->iov_len; - if (v + c > ctob(physmem)) - return (EFAULT); - v += CACHED_MEMORY_ADDR; - error = uiomove((caddr_t)v, c, uio); - continue; - -/* minor device 1 is kernel memory */ - case 1: - v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); - if (v < CACHED_MEMORY_ADDR) - return (EFAULT); - if (v + c > PHYS_TO_CACHED(avail_end + - sizeof (struct msgbuf)) && - (v < KSEG2_ADDR || - !kernacc((caddr_t)v, c, - uio->uio_rw == UIO_READ ? B_READ : B_WRITE))) - return (EFAULT); - - error = uiomove((caddr_t)v, c, uio); - continue; - -/* minor device 2 is EOF/RATHOLE */ - case 2: - if (uio->uio_rw == UIO_WRITE) - uio->uio_resid = 0; - return (0); - -/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */ - case 12: - if (uio->uio_rw == UIO_WRITE) { - c = iov->iov_len; - break; - } - if (zeropage == NULL) { - zeropage = (caddr_t) - malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(zeropage, PAGE_SIZE); - } - c = min(iov->iov_len, PAGE_SIZE); - error = uiomove(zeropage, c, uio); - continue; - - default: - return (ENXIO); - } - if (error) - break; - iov->iov_base += c; - iov->iov_len -= c; - uio->uio_offset += c; - uio->uio_resid -= c; - } - return (error); -} - -/*ARGSUSED*/ -int -mmmmap(dev, off, prot) - dev_t dev; - int off, prot; -{ - return (-1); -} - -/*ARGSUSED*/ -int -mmioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; -{ - return (EOPNOTSUPP); -} diff --git a/sys/arch/mips/mips/minidebug.c b/sys/arch/mips/mips/minidebug.c deleted file mode 100644 index cb162bf2b06..00000000000 --- a/sys/arch/mips/mips/minidebug.c +++ /dev/null @@ -1,971 +0,0 @@ -/* $OpenBSD: minidebug.c,v 1.2 1998/03/16 09:03:36 pefo Exp $ */ -/*- - * Copyright (c) 1991, 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. - * - * from: @(#)kadb.c 8.1 (Berkeley) 6/10/93 - * $Id: minidebug.c,v 1.2 1998/03/16 09:03:36 pefo Exp $ - */ - -/* - * Define machine dependent primitives for mdb. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/user.h> -#include <dev/cons.h> -#include <machine/pte.h> -#include <vm/vm_prot.h> -#undef SP -#include <machine/cpu.h> -#include <machine/reg.h> -#include <machine/intr.h> -#include <machine/trap.h> -#include <machine/mips_opcode.h> - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - - -static char *op_name[64] = { -/* 0 */ "spec", "bcond","j", "jal", "beq", "bne", "blez", "bgtz", -/* 8 */ "addi", "addiu","slti", "sltiu","andi", "ori", "xori", "lui", -/*16 */ "cop0", "cop1", "cop2", "cop3", "beql", "bnel", "blezl","bgtzl", -/*24 */ "daddi","daddiu","ldl", "ldr", "op34", "op35", "op36", "op37", -/*32 */ "lb", "lh", "lwl", "lw", "lbu", "lhu", "lwr", "lwu", -/*40 */ "sb", "sh", "swl", "sw", "sdl", "sdr", "swr", "cache", -/*48 */ "ll", "lwc1", "lwc2", "lwc3", "lld", "ldc1", "ldc2", "ld", -/*56 */ "sc", "swc1", "swc2", "swc3", "scd", "sdc1", "sdc2", "sd" -}; - -static char *spec_name[64] = { -/* 0 */ "sll", "spec01","srl", "sra", "sllv", "spec05","srlv","srav", -/* 8 */ "jr", "jalr", "spec12","spec13","syscall","break","spec16","sync", -/*16 */ "mfhi", "mthi", "mflo", "mtlo", "dsllv","spec25","dsrlv","dsrav", -/*24 */ "mult", "multu","div", "divu", "dmult","dmultu","ddiv","ddivu", -/*32 */ "add", "addu", "sub", "subu", "and", "or", "xor", "nor", -/*40 */ "spec50","spec51","slt","sltu", "dadd","daddu","dsub","dsubu", -/*48 */ "tge","tgeu","tlt","tltu","teq","spec65","tne","spec67", -/*56 */ "dsll","spec71","dsrl","dsra","dsll32","spec75","dsrl32","dsra32" -}; - -static char *bcond_name[32] = { -/* 0 */ "bltz", "bgez", "bltzl", "bgezl", "?", "?", "?", "?", -/* 8 */ "tgei", "tgeiu", "tlti", "tltiu", "teqi", "?", "tnei", "?", -/*16 */ "bltzal", "bgezal", "bltzall", "bgezall", "?", "?", "?", "?", -/*24 */ "?", "?", "?", "?", "?", "?", "?", "?", -}; - -static char *cop1_name[64] = { -/* 0 */ "fadd", "fsub", "fmpy", "fdiv", "fsqrt","fabs", "fmov", "fneg", -/* 8 */ "fop08","fop09","fop0a","fop0b","fop0c","fop0d","fop0e","fop0f", -/*16 */ "fop10","fop11","fop12","fop13","fop14","fop15","fop16","fop17", -/*24 */ "fop18","fop19","fop1a","fop1b","fop1c","fop1d","fop1e","fop1f", -/*32 */ "fcvts","fcvtd","fcvte","fop23","fcvtw","fop25","fop26","fop27", -/*40 */ "fop28","fop29","fop2a","fop2b","fop2c","fop2d","fop2e","fop2f", -/*48 */ "fcmp.f","fcmp.un","fcmp.eq","fcmp.ueq","fcmp.olt","fcmp.ult", - "fcmp.ole","fcmp.ule", -/*56 */ "fcmp.sf","fcmp.ngle","fcmp.seq","fcmp.ngl","fcmp.lt","fcmp.nge", - "fcmp.le","fcmp.ngt" -}; - -static char *fmt_name[16] = { - "s", "d", "e", "fmt3", - "w", "fmt5", "fmt6", "fmt7", - "fmt8", "fmt9", "fmta", "fmtb", - "fmtc", "fmtd", "fmte", "fmtf" -}; - -static char *reg_name[32] = { - "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra" -}; - -static char *c0_opname[64] = { - "c0op00","tlbr", "tlbwi", "c0op03","c0op04","c0op05","tlbwr", "c0op07", - "tlbp", "c0op11","c0op12","c0op13","c0op14","c0op15","c0op16","c0op17", - "rfe", "c0op21","c0op22","c0op23","c0op24","c0op25","c0op26","c0op27", - "eret","c0op31","c0op32","c0op33","c0op34","c0op35","c0op36","c0op37", - "c0op40","c0op41","c0op42","c0op43","c0op44","c0op45","c0op46","c0op47", - "c0op50","c0op51","c0op52","c0op53","c0op54","c0op55","c0op56","c0op57", - "c0op60","c0op61","c0op62","c0op63","c0op64","c0op65","c0op66","c0op67", - "c0op70","c0op71","c0op72","c0op73","c0op74","c0op75","c0op77","c0op77", -}; - -static char *c0_reg[32] = { - "index","random","tlblo0","tlblo1","context","tlbmask","wired","c0r7", - "badvaddr","count","tlbhi","c0r11","sr","cause","epc", "prid", - "config","lladr","watchlo","watchhi","xcontext","c0r21","c0r22","c0r23", - "c0r24","c0r25","ecc","cacheerr","taglo","taghi","errepc","c0r31" -}; - -extern u_int mdbpeek __P((int)); -extern void mdbpoke __P((int, int)); -extern void cpu_setwatch __P((int, int)); -extern void trapDump __P((char *)); -extern void stacktrace __P((void)); -extern u_int MipsEmulateBranch __P((int *, int, int, u_int)); -extern char *trap_type[]; -extern int num_tlbentries; -static void arc_dump_tlb __P((int,int)); -static void prt_break __P((void)); -static int mdbprintins __P((int, int)); -static void mdbsetsstep __P((void)); -static int mdbclrsstep __P((int)); -static void print_regs __P((void)); -static void break_insert __P((void)); -static void break_restore __P((void)); -static int break_find __P((int)); - -struct pcb mdbpcb; -int mdbmkfault; - -#define MAXBRK 10 -struct brk { - int inst; - int addr; -} brk_tab[MAXBRK]; - -/* - * Mini debugger for kernel. - */ -static int -gethex(u_int *val, u_int dotval) -{ - u_int c; - - *val = 0; - while((c = cngetc()) != '\e' && c != '\n' && c != '\r') { - if(c >= '0' && c <= '9') { - *val = (*val << 4) + c - '0'; - cnputc(c); - } - else if(c >= 'a' && c <= 'f') { - *val = (*val << 4) + c - 'a' + 10; - cnputc(c); - } - else if(c == '\b') { - *val = *val >> 4; - printf("\b \b"); - } - else if(c == ',') { - cnputc(c); - return(c); - } - else if(c == '.') { - *val = dotval;; - cnputc(c); - } - } - if(c == '\r') - c = '\n'; - return(c); -} - -static -void dump(u_int *addr, u_int size) -{ - int cnt; - - cnt = 0; - - size = (size + 3) / 4; - while(size--) { - if((cnt++ & 3) == 0) - printf("\n%08x: ",(int)addr); - printf("%08x ",*addr++); - } -} - -static void -print_regs() -{ - printf("\n"); - printf("T0-7 %08x %08x %08x %08x %08x %08x %08x %08x\n", - mdbpcb.pcb_regs[T0],mdbpcb.pcb_regs[T1], - mdbpcb.pcb_regs[T2],mdbpcb.pcb_regs[T3], - mdbpcb.pcb_regs[T4],mdbpcb.pcb_regs[T5], - mdbpcb.pcb_regs[T6],mdbpcb.pcb_regs[T7]); - printf("T8-9 %08x %08x A0-4 %08x %08x %08x %08x\n", - mdbpcb.pcb_regs[T8],mdbpcb.pcb_regs[T9], - mdbpcb.pcb_regs[A0],mdbpcb.pcb_regs[A1], - mdbpcb.pcb_regs[A2],mdbpcb.pcb_regs[A3]); - printf("S0-7 %08x %08x %08x %08x %08x %08x %08x %08x\n", - mdbpcb.pcb_regs[S0],mdbpcb.pcb_regs[S1], - mdbpcb.pcb_regs[S2],mdbpcb.pcb_regs[S3], - mdbpcb.pcb_regs[S4],mdbpcb.pcb_regs[S5], - mdbpcb.pcb_regs[S6],mdbpcb.pcb_regs[S7]); - printf(" S8 %08x V0-1 %08x %08x GP %08x SP %08x\n", - mdbpcb.pcb_regs[S8],mdbpcb.pcb_regs[V0], - mdbpcb.pcb_regs[V1],mdbpcb.pcb_regs[GP], - mdbpcb.pcb_regs[SP]); - printf(" AT %08x PC %08x RA %08x SR %08x", - mdbpcb.pcb_regs[AST],mdbpcb.pcb_regs[PC], - mdbpcb.pcb_regs[RA],mdbpcb.pcb_regs[SR]); -} - -void -set_break(int va) -{ - int i; - - va = va & ~3; - for(i = 0; i < MAXBRK; i++) { - if(brk_tab[i].addr == 0) { - brk_tab[i].addr = va; - brk_tab[i].inst = *(u_int *)va; - return; - } - } - printf(" Break table full!!"); -} - -void -del_break(int va) -{ - int i; - - va = va & ~3; - for(i = 0; i < MAXBRK; i++) { - if(brk_tab[i].addr == va) { - brk_tab[i].addr = 0; - return; - } - } - printf(" Break to remove not found!!"); -} - -static void -break_insert() -{ - int i; - - for(i = 0; i < MAXBRK; i++) { - if(brk_tab[i].addr != 0) { - brk_tab[i].inst = *(u_int *)brk_tab[i].addr; - *(u_int *)brk_tab[i].addr = BREAK_BRKPT; - R4K_FlushDCache(brk_tab[i].addr,4); - R4K_FlushICache(brk_tab[i].addr,4); - } - } -} - -static void -break_restore() -{ - int i; - - for(i = 0; i < MAXBRK; i++) { - if(brk_tab[i].addr != 0) { - *(u_int *)brk_tab[i].addr = brk_tab[i].inst; - R4K_FlushDCache(brk_tab[i].addr,4); - R4K_FlushICache(brk_tab[i].addr,4); - } - } -} - -static int -break_find(va) - int va; -{ - int i; - - for(i = 0; i < MAXBRK; i++) { - if(brk_tab[i].addr == va) { - return(i); - } - } - return(-1); -} - -void -prt_break() -{ - int i; - - for(i = 0; i < MAXBRK; i++) { - if(brk_tab[i].addr != 0) { - printf("\n %08x\t", brk_tab[i].addr); - mdbprintins(brk_tab[i].inst, brk_tab[i].addr); - } - } -} - -int -mdb(int causeReg, int vadr, int p, int kernelmode) -{ - int c; - int newaddr; - int size; - int cause; -static int ssandrun; /* Single step and run flag (when cont at brk) */ - - splhigh(); - cause = (causeReg & CR_EXC_CODE) >> CR_EXC_CODE_SHIFT; - newaddr = (int)(mdbpcb.pcb_regs[PC]); - switch(cause) { - case T_BREAK: - if(*(int *)newaddr == BREAK_SOVER) { - break_restore(); - mdbpcb.pcb_regs[PC] += 4; - printf("\nStop break (panic)\n# "); - printf(" %08x\t",newaddr); - mdbprintins(*(int *)newaddr, newaddr); - printf("\n# "); - break; - } - if(*(int *)newaddr == BREAK_BRKPT) { - break_restore(); - printf("\rBRK %08x\t",newaddr); - if(mdbprintins(*(int *)newaddr, newaddr)) { - newaddr += 4; - printf("\n %08x\t",newaddr); - mdbprintins(*(int *)newaddr, newaddr); - } - printf("\n# "); - break; - } - if(mdbclrsstep(causeReg)) { - if(ssandrun) { /* Step over bp before free run */ - ssandrun = 0; - break_insert(); - return(TRUE); - } - printf("\r %08x\t",newaddr); - if(mdbprintins(*(int *)newaddr, newaddr)) { - newaddr += 4; - printf("\n %08x\t",newaddr); - mdbprintins(*(int *)newaddr, newaddr); - } - printf("\n# "); - } - break; - - default: - printf("\n-- %s --\n# ",trap_type[cause]); - } - ssandrun = 0; - break_restore(); - - while(1) { - c = cngetc(); - switch(c) { - case 'T': - trapDump("Debugger"); - break; - case 'b': - printf("break-"); - c = cngetc(); - switch(c) { - case 's': - printf("set at "); - c = gethex(&newaddr, newaddr); - if(c != '\e') { - set_break(newaddr); - } - break; - - case 'd': - printf("delete at "); - c = gethex(&newaddr, newaddr); - if(c != '\e') { - del_break(newaddr); - } - break; - - case 'p': - printf("print"); - prt_break(); - break; - } - break; - - case 'r': - print_regs(); - break; - - case 'I': - printf("Instruction at "); - c = gethex(&newaddr, newaddr); - while(c != '\e') { - printf("\n %08x\t",newaddr); - mdbprintins(*(int *)newaddr, newaddr); - newaddr += 4; - c = cngetc(); - } - break; - - case 'c': - printf("continue"); - if(break_find((int)(mdbpcb.pcb_regs[PC])) >= 0) { - ssandrun = 1; - mdbsetsstep(); - } - else { - break_insert(); - } - return(TRUE); - case 'S': - printf("Stack traceback:\n"); - stacktrace(); - return(TRUE); - case 's': - set_break(mdbpcb.pcb_regs[PC] + 8); - return(TRUE); - case ' ': - mdbsetsstep(); - return(TRUE); - - case 'd': - printf("dump "); - c = gethex(&newaddr, newaddr); - if(c == ',') { - c = gethex(&size,256); - } - else { - size = 16; - } - if(c == '\n' && newaddr != 0) { - dump((u_int *)newaddr, size); - newaddr += size; - } - break; - - case 'm': - printf("mod "); - c = gethex(&newaddr, newaddr); - while(c == ',') { - c = gethex(&size, 0); - if(c != '\e') - *((u_int *)newaddr)++ = size; - } - break; - - case 'i': - printf("in-"); - c = cngetc(); - switch(c) { - case 'b': - printf("byte "); - c = gethex(&newaddr, newaddr); - if(c == '\n') { - printf("= %02x", - *(u_char *)newaddr); - } - break; - case 'h': - printf("halfword "); - c = gethex(&newaddr, newaddr); - if(c == '\n') { - printf("= %04x", - *(u_short *)newaddr); - } - break; - case 'w': - printf("word "); - c = gethex(&newaddr, newaddr); - if(c == '\n') { - printf("= %08x", - *(u_int *)newaddr); - } - break; - } - break; - - case 'o': - printf("out-"); - c = cngetc(); - switch(c) { - case 'b': - printf("byte "); - c = gethex(&newaddr, newaddr); - if(c == ',') { - c = gethex(&size, 0); - if(c == '\n') { - *(u_char *)newaddr = size; - } - } - break; - case 'h': - printf("halfword "); - c = gethex(&newaddr, newaddr); - if(c == ',') { - c = gethex(&size, 0); - if(c == '\n') { - *(u_short *)newaddr = size; - } - } - break; - case 'w': - printf("word "); - c = gethex(&newaddr, newaddr); - if(c == ',') { - c = gethex(&size, 0); - if(c == '\n') { - *(u_int *)newaddr = size; - } - } - break; - } - break; - - case 't': - printf("tlb-dump\n"); - arc_dump_tlb(0,23); - (void)cngetc(); - arc_dump_tlb(24,47); - break; - - case 'f': - printf("flush-"); - c = cngetc(); - switch(c) { - case 't': - printf("tlb"); - R4K_TLBFlush(num_tlbentries); - break; - - case 'c': - printf("cache"); - R4K_FlushCache(); - break; - } - break; - - case 'w': - printf("watch "); - c = gethex(&newaddr, newaddr); - size = 3; - if(c == ',') { - c = cngetc(); - cnputc(c); - if(c == 'r') - size = 2; - else if(c == 'w') - size = 1; - else - size = 0; - } - cpu_setwatch(0, (newaddr & ~7) | size); - break; - - default: - cnputc('\a'); - break; - } - printf("\n# "); - } -} - -u_int mdb_ss_addr; -u_int mdb_ss_instr; - -static void -mdbsetsstep() -{ - register u_int va; - register int *locr0 = mdbpcb.pcb_regs; - - /* compute next address after current location */ - if(mdbpeek(locr0[PC]) != 0) { - va = MipsEmulateBranch(locr0, locr0[PC], 0, mdbpeek(locr0[PC])); - } - else { - va = locr0[PC] + 4; - } - if (mdb_ss_addr) { - printf("mdbsetsstep: breakpoint already set at %x (va %x)\n", - mdb_ss_addr, va); - return; - } - mdb_ss_addr = va; - - if ((int)va < 0) { - /* kernel address */ - mdb_ss_instr = mdbpeek(va); - mdbpoke(va, BREAK_SSTEP); - R4K_FlushDCache(va,4); - R4K_FlushICache(va,4); - return; - } -} - -static int -mdbclrsstep(int cr) -{ - register u_int pc, va; - u_int instr; - - /* fix pc if break instruction is in the delay slot */ - pc = mdbpcb.pcb_regs[PC]; - if (cr < 0) - pc += 4; - - /* check to be sure its the one we are expecting */ - va = mdb_ss_addr; - if (!va || va != pc) - return(FALSE); - - /* read break instruction */ - instr = mdbpeek(va); - if (instr != BREAK_SSTEP) - return(FALSE); - - if ((int)va < 0) { - /* kernel address */ - mdbpoke(va, mdb_ss_instr); - R4K_FlushDCache(va,4); - R4K_FlushICache(va,4); - mdb_ss_addr = 0; - return(TRUE); - } - - printf("can't clear break at %x\n", va); - mdb_ss_addr = 0; - return(FALSE); -} - - -/* ARGSUSED */ -static int -mdbprintins(int ins, int mdbdot) -{ - InstFmt i; - int delay = 0; - - i.word = ins; - - switch (i.JType.op) { - case OP_SPECIAL: - if (i.word == 0) { - printf("nop"); - break; - } - if (i.RType.func == OP_ADDU && i.RType.rt == 0) { - printf("move\t%s,%s", - reg_name[i.RType.rd], - reg_name[i.RType.rs]); - break; - } - printf("%s", spec_name[i.RType.func]); - switch (i.RType.func) { - case OP_SLL: - case OP_SRL: - case OP_SRA: - case OP_DSLL: - case OP_DSRL: - case OP_DSRA: - case OP_DSLL32: - case OP_DSRL32: - case OP_DSRA32: - printf("\t%s,%s,%d", - reg_name[i.RType.rd], - reg_name[i.RType.rt], - i.RType.shamt); - break; - - case OP_SLLV: - case OP_SRLV: - case OP_SRAV: - case OP_DSLLV: - case OP_DSRLV: - case OP_DSRAV: - printf("\t%s,%s,%s", - reg_name[i.RType.rd], - reg_name[i.RType.rt], - reg_name[i.RType.rs]); - break; - - case OP_MFHI: - case OP_MFLO: - printf("\t%s", reg_name[i.RType.rd]); - break; - - case OP_JR: - case OP_JALR: - delay = 1; - /* FALLTHROUGH */ - case OP_MTLO: - case OP_MTHI: - printf("\t%s", reg_name[i.RType.rs]); - break; - - case OP_MULT: - case OP_MULTU: - case OP_DMULT: - case OP_DMULTU: - case OP_DIV: - case OP_DIVU: - case OP_DDIV: - case OP_DDIVU: - printf("\t%s,%s", - reg_name[i.RType.rs], - reg_name[i.RType.rt]); - break; - - case OP_SYSCALL: - case OP_SYNC: - break; - - case OP_BREAK: - printf("\t%d", (i.RType.rs << 5) | i.RType.rt); - break; - - default: - printf("\t%s,%s,%s", - reg_name[i.RType.rd], - reg_name[i.RType.rs], - reg_name[i.RType.rt]); - }; - break; - - case OP_BCOND: - printf("%s\t%s,", bcond_name[i.IType.rt], - reg_name[i.IType.rs]); - goto pr_displ; - - case OP_BLEZ: - case OP_BLEZL: - case OP_BGTZ: - case OP_BGTZL: - printf("%s\t%s,", op_name[i.IType.op], - reg_name[i.IType.rs]); - goto pr_displ; - - case OP_BEQ: - case OP_BEQL: - if (i.IType.rs == 0 && i.IType.rt == 0) { - printf("b\t"); - goto pr_displ; - } - /* FALLTHROUGH */ - case OP_BNE: - case OP_BNEL: - printf("%s\t%s,%s,", op_name[i.IType.op], - reg_name[i.IType.rs], - reg_name[i.IType.rt]); - pr_displ: - delay = 1; - printf("0x%08x", mdbdot + 4 + ((short)i.IType.imm << 2)); - break; - - case OP_COP0: - switch (i.RType.rs) { - case OP_BCx: - case OP_BCy: - printf("bc0%c\t", - "ft"[i.RType.rt & COPz_BC_TF_MASK]); - goto pr_displ; - - case OP_MT: - printf("mtc0\t%s,%s", - reg_name[i.RType.rt], - c0_reg[i.RType.rd]); - break; - - case OP_DMT: - printf("dmtc0\t%s,%s", - reg_name[i.RType.rt], - c0_reg[i.RType.rd]); - break; - - case OP_MF: - printf("mfc0\t%s,%s", - reg_name[i.RType.rt], - c0_reg[i.RType.rd]); - break; - - case OP_DMF: - printf("dmfc0\t%s,%s", - reg_name[i.RType.rt], - c0_reg[i.RType.rd]); - break; - - default: - printf("%s", c0_opname[i.FRType.func]); - }; - break; - - case OP_COP1: - switch (i.RType.rs) { - case OP_BCx: - case OP_BCy: - printf("bc1%c\t", - "ft"[i.RType.rt & COPz_BC_TF_MASK]); - goto pr_displ; - - case OP_MT: - printf("mtc1\t%s,f%d", - reg_name[i.RType.rt], - i.RType.rd); - break; - - case OP_MF: - printf("mfc1\t%s,f%d", - reg_name[i.RType.rt], - i.RType.rd); - break; - - case OP_CT: - printf("ctc1\t%s,f%d", - reg_name[i.RType.rt], - i.RType.rd); - break; - - case OP_CF: - printf("cfc1\t%s,f%d", - reg_name[i.RType.rt], - i.RType.rd); - break; - - default: - printf("%s.%s\tf%d,f%d,f%d", - cop1_name[i.FRType.func], - fmt_name[i.FRType.fmt], - i.FRType.fd, i.FRType.fs, i.FRType.ft); - }; - break; - - case OP_J: - case OP_JAL: - printf("%s\t", op_name[i.JType.op]); - printf("0x%8x",(mdbdot & 0xF0000000) | (i.JType.target << 2)); - delay = 1; - break; - - case OP_LWC1: - case OP_SWC1: - printf("%s\tf%d,", op_name[i.IType.op], - i.IType.rt); - goto loadstore; - - case OP_LB: - case OP_LH: - case OP_LW: - case OP_LD: - case OP_LBU: - case OP_LHU: - case OP_LWU: - case OP_SB: - case OP_SH: - case OP_SW: - case OP_SD: - printf("%s\t%s,", op_name[i.IType.op], - reg_name[i.IType.rt]); - loadstore: - printf("%d(%s)", (short)i.IType.imm, - reg_name[i.IType.rs]); - break; - - case OP_ORI: - case OP_XORI: - if (i.IType.rs == 0) { - printf("li\t%s,0x%x", - reg_name[i.IType.rt], - i.IType.imm); - break; - } - /* FALLTHROUGH */ - case OP_ANDI: - printf("%s\t%s,%s,0x%x", op_name[i.IType.op], - reg_name[i.IType.rt], - reg_name[i.IType.rs], - i.IType.imm); - break; - - case OP_LUI: - printf("%s\t%s,0x%x", op_name[i.IType.op], - reg_name[i.IType.rt], - i.IType.imm); - break; - - case OP_ADDI: - case OP_DADDI: - case OP_ADDIU: - case OP_DADDIU: - if (i.IType.rs == 0) { - printf("li\t%s,%d", - reg_name[i.IType.rt], - (short)i.IType.imm); - break; - } - /* FALLTHROUGH */ - default: - printf("%s\t%s,%s,%d", op_name[i.IType.op], - reg_name[i.IType.rt], - reg_name[i.IType.rs], - (short)i.IType.imm); - } - return(delay); -} - - -/* - * Dump TLB contents. - */ -static void -arc_dump_tlb(int first,int last) -{ - int tlbno; - struct tlb tlb; - - tlbno = first; - - while(tlbno <= last) { - R4K_TLBRead(tlbno, &tlb); - if(tlb.tlb_lo0 & PG_V || tlb.tlb_lo1 & PG_V) { - printf("TLB %2d vad 0x%08x ", tlbno, tlb.tlb_hi); - } - else { - printf("TLB*%2d vad 0x%08x ", tlbno, tlb.tlb_hi); - } - printf("0=0x%08x ", pfn_to_vad(tlb.tlb_lo0)); - printf("%c", tlb.tlb_lo0 & PG_M ? 'M' : ' '); - printf("%c", tlb.tlb_lo0 & PG_G ? 'G' : ' '); - printf(" atr %x ", (tlb.tlb_lo0 >> 3) & 7); - printf("1=0x%08x ", pfn_to_vad(tlb.tlb_lo1)); - printf("%c", tlb.tlb_lo1 & PG_M ? 'M' : ' '); - printf("%c", tlb.tlb_lo1 & PG_G ? 'G' : ' '); - printf(" atr %x ", (tlb.tlb_lo1 >> 3) & 7); - printf(" sz=%x\n", tlb.tlb_mask); - - tlbno++; - } -} diff --git a/sys/arch/mips/mips/process_machdep.c b/sys/arch/mips/mips/process_machdep.c deleted file mode 100644 index 9a4cea16afb..00000000000 --- a/sys/arch/mips/mips/process_machdep.c +++ /dev/null @@ -1,116 +0,0 @@ -/* $OpenBSD: process_machdep.c,v 1.3 1998/10/15 21:30:15 imp Exp $ */ -/* - * Copyright (c) 1994 Adam Glass - * Copyright (c) 1993 The Regents of the University of California. - * Copyright (c) 1993 Jan-Simon Pendry - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Jan-Simon Pendry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: - * Id: procfs_i386.c,v 4.1 1993/12/17 10:47:45 jsp Rel - * - * $Id: process_machdep.c,v 1.3 1998/10/15 21:30:15 imp Exp $ - */ - -/* - * This file may seem a bit stylized, but that so that it's easier to port. - * Functions to be implemented here are: - * - * process_read_regs(proc, regs) - * Get the current user-visible register set from the process - * and copy it into the regs structure (<machine/reg.h>). - * The process is stopped at the time read_regs is called. - * - * process_write_regs(proc, regs) - * Update the current register set from the passed in regs - * structure. Take care to avoid clobbering special CPU - * registers or privileged bits in the PSL. - * The process is stopped at the time write_regs is called. - * - * process_sstep(proc) - * Arrange for the process to trap after executing a single instruction. - * - * process_set_pc(proc) - * Set the process's program counter. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/time.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/user.h> -#include <sys/vnode.h> -#include <sys/ptrace.h> -#include <machine/pte.h> -#include <machine/psl.h> -#include <machine/reg.h> - -extern void cpu_singlestep __P((struct proc *)); -int -process_read_regs(p, regs) - struct proc *p; - struct reg *regs; -{ - bcopy((caddr_t)p->p_md.md_regs, (caddr_t)regs, sizeof(struct reg)); - return (0); -} - -int -process_write_regs(p, regs) - struct proc *p; - struct reg *regs; -{ - bcopy((caddr_t)regs, (caddr_t)p->p_md.md_regs, sizeof(struct reg)); -/*XXX Clear to user set bits!! */ - return (0); -} - -int -process_sstep(p, sstep) - struct proc *p; -{ - if(sstep) - cpu_singlestep(p); - return (0); -} - -int -process_set_pc(p, addr) - struct proc *p; - caddr_t addr; -{ - p->p_md.md_regs[PC] = (int)addr; - return (0); -} - diff --git a/sys/arch/mips/mips/sys_machdep.c b/sys/arch/mips/mips/sys_machdep.c deleted file mode 100644 index 47bebbe491e..00000000000 --- a/sys/arch/mips/mips/sys_machdep.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: sys_machdep.c,v 1.3 2000/06/23 02:14:38 mickey Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sys_machdep.c 8.1 (Berkeley) 6/10/93 - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include <sys/time.h> -#include <sys/proc.h> -#include <sys/signalvar.h> -#include <sys/uio.h> -#include <sys/kernel.h> -#include <sys/mtio.h> -#include <sys/buf.h> - -#include <sys/mount.h> -#include <sys/syscallargs.h> - -int -sys_sysarch(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct sys_sysarch_args /* { - syscallarg(int) op; - syscallarg(char *) parms; - } */ *uap = v; - int error = 0; - - switch(SCARG(uap, op)) { - default: - error = EINVAL; - break; - } - return(error); -} diff --git a/sys/arch/mips/mips/vm_machdep.c b/sys/arch/mips/mips/vm_machdep.c deleted file mode 100644 index 071fea29571..00000000000 --- a/sys/arch/mips/mips/vm_machdep.c +++ /dev/null @@ -1,526 +0,0 @@ -/* $OpenBSD: vm_machdep.c,v 1.14 2001/06/08 08:09:04 art Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department and Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah Hdr: vm_machdep.c 1.21 91/04/06 - * - * from: @(#)vm_machdep.c 8.3 (Berkeley) 1/4/94 - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/signalvar.h> -#include <sys/malloc.h> -#include <sys/buf.h> -#include <sys/vnode.h> -#include <sys/user.h> -#include <sys/core.h> -#include <sys/exec.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> - -#include <machine/pte.h> -#include <machine/cpu.h> - -vm_offset_t kmem_alloc_wait_align __P((vm_map_t, vm_size_t, vm_size_t)); -static int vm_map_findspace_align __P((vm_map_t map, vm_offset_t, vm_size_t, - vm_offset_t *, vm_size_t)); -int vm_map_find_U __P((vm_map_t, vm_object_t, vm_offset_t, vm_offset_t *, - vm_size_t, boolean_t)); - -/* - * Finish a fork operation, with process p2 nearly set up. - * Copy and update the kernel stack and pcb, making the child - * ready to run, and marking it so that it can return differently - * than the parent. Returns 1 in the child process, 0 in the parent. - * We currently double-map the user area so that the stack is at the same - * address in each process; in the future we will probably relocate - * the frame pointers on the stack after copying. - */ -int -cpu_fork(p1, p2, stack, stacksize) - register struct proc *p1, *p2; - void *stack; - size_t stacksize; -{ - struct user *up = p2->p_addr; - pt_entry_t *pte; - int i; - extern struct proc *machFPCurProcPtr; - - p2->p_md.md_regs = up->u_pcb.pcb_regs; - p2->p_md.md_flags = p1->p_md.md_flags & MDP_FPUSED; - - /* - * Cache the PTEs for the user area in the machine dependent - * part of the proc struct so cpu_switch() can quickly map in - * the user struct and kernel stack. Note: if the virtual address - * translation changes (e.g. swapout) we have to update this. - */ - pte = kvtopte(up); - for (i = 0; i < UPAGES; i++) { - p2->p_md.md_upte[i] = pte->pt_entry & ~(PG_G | PG_RO | PG_WIRED); - pte++; - } - - /* - * Copy floating point state from the FP chip if this process - * has state stored there. - */ - if (p1 == machFPCurProcPtr) - MipsSaveCurFPState(p1); - - /* - * Copy pcb and stack from proc p1 to p2. - * We do this as cheaply as possible, copying only the active - * part of the stack. The stack and pcb need to agree; - */ - p2->p_addr->u_pcb = p1->p_addr->u_pcb; - /* cache segtab for ULTBMiss() */ - p2->p_addr->u_pcb.pcb_segtab = (void *)p2->p_vmspace->vm_map.pmap->pm_segtab; - -#ifdef notyet - /* - * If specified, give the child a different stack. - */ - if (stack != NULL) - /* XXX How??? */; -#endif - - /* - * Arrange for a non-local goto when the new process - * is started, to resume here, returning nonzero from setjmp. - */ -#ifdef DIAGNOSTIC - if (p1 != curproc && p1 != &proc0) - panic("cpu_fork: curproc"); -#endif - if (copykstack(up)) { - /* - * Return 1 in child. - */ - return (1); - } - return (0); -} - -/* - * Finish a swapin operation. - * We neded to update the cached PTEs for the user area in the - * machine dependent part of the proc structure. - */ -void -cpu_swapin(p) - register struct proc *p; -{ - register struct user *up = p->p_addr; - register pt_entry_t *pte; - register int i; - - /* - * Cache the PTEs for the user area in the machine dependent - * part of the proc struct so cpu_switch() can quickly map in - * the user struct and kernel stack. - */ - pte = kvtopte(up); - for (i = 0; i < UPAGES; i++) { - p->p_md.md_upte[i] = pte->pt_entry & ~(PG_G | PG_RO | PG_WIRED); - pte++; - } -} - -/* - * cpu_exit is called as the last action during exit. - * We release the address space and machine-dependent resources, - * including the memory for the user structure and kernel stack. - * Once finished, we call switch_exit, which switches to a temporary - * pcb and stack and never returns. We block memory allocation - * until switch_exit has made things safe again. - */ -void -cpu_exit(p) - struct proc *p; -{ - extern struct proc *machFPCurProcPtr; - - if (machFPCurProcPtr == p) - machFPCurProcPtr = (struct proc *)0; - - (void) splhigh(); - exit2(p); /* XXX - probably very wrong */ - switch_exit(); - /* NOTREACHED */ -} - -/* - * Dump the machine specific header information at the start of a core dump. - */ -int -cpu_coredump(p, vp, cred, chdr) - struct proc *p; - struct vnode *vp; - struct ucred *cred; - struct core *chdr; -{ - int error; - /*register struct user *up = p->p_addr;*/ - struct coreseg cseg; - extern struct proc *machFPCurProcPtr; - - CORE_SETMAGIC(*chdr, COREMAGIC, MID_MIPS, 0); - chdr->c_hdrsize = ALIGN(sizeof(*chdr)); - chdr->c_seghdrsize = ALIGN(sizeof(cseg)); - chdr->c_cpusize = sizeof (p -> p_addr -> u_pcb.pcb_regs); - - /* - * Copy floating point state from the FP chip if this process - * has state stored there. - */ - if (p == machFPCurProcPtr) - MipsSaveCurFPState(p); - - CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MIPS, CORE_CPU); - cseg.c_addr = 0; - cseg.c_size = chdr->c_cpusize; - - error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize, - (off_t)chdr->c_hdrsize, UIO_SYSSPACE, - IO_NODELOCKED|IO_UNIT, cred, NULL, p); - if (error) - return error; - - error = vn_rdwr(UIO_WRITE, vp, - (caddr_t)(&(p -> p_addr -> u_pcb.pcb_regs)), - (off_t)chdr -> c_cpusize, - (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), - UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, - cred, NULL, p); - - if (!error) - chdr->c_nseg++; - - return error; -} - -/* - * Move pages from one kernel virtual address to another. - * Both addresses are assumed to reside in the Sysmap. - */ -void -pagemove(from, to, size) - caddr_t from, to; - size_t size; -{ - pt_entry_t *fpte, *tpte; - -#ifdef DIAGNOSTIC - if ((size & PAGE_MASK) != 0) - panic("pagemove"); -#endif - fpte = kvtopte(from); - tpte = kvtopte(to); - if(((int)from & CpuCacheAliasMask) != ((int)to & CpuCacheAliasMask)) { - R4K_HitFlushDCache((vm_offset_t)from, size); - } - while (size > 0) { - R4K_TLBFlushAddr((vm_offset_t)from); - R4K_TLBUpdate((vm_offset_t)to, fpte->pt_entry); - *tpte++ = *fpte; - fpte->pt_entry = PG_NV | PG_G; - fpte++; - size -= NBPG; - from += NBPG; - to += NBPG; - } -} - -extern vm_map_t phys_map; - -/* - * Map an IO request into kernel virtual address space. Requests fall into - * one of five catagories: - * - * B_PHYS|B_UAREA: User u-area swap. - * Address is relative to start of u-area (p_addr). - * B_PHYS|B_PAGET: User page table swap. - * Address is a kernel VA in usrpt (Usrptmap). - * B_PHYS|B_DIRTY: Dirty page push. - * Address is a VA in proc2's address space. - * B_PHYS|B_PGIN: Kernel pagein of user pages. - * Address is VA in user's address space. - * B_PHYS: User "raw" IO request. - * Address is VA in user's address space. - * - * All requests are (re)mapped into kernel VA space via the phys_map - */ -void -vmapbuf(bp, len) - struct buf *bp; - vm_size_t len; -{ - register caddr_t addr; - register vm_size_t sz; - struct proc *p; - int off; - vm_offset_t kva; - register vm_offset_t pa; - - if ((bp->b_flags & B_PHYS) == 0) - panic("vmapbuf"); - addr = bp->b_saveaddr = bp->b_un.b_addr; - off = (int)addr & PGOFSET; - p = bp->b_proc; - sz = round_page(off + len); - kva = kmem_alloc_wait_align(phys_map, sz, (vm_size_t)addr & CpuCacheAliasMask); - bp->b_un.b_addr = (caddr_t) (kva + off); - sz = atop(sz); - while (sz--) { - if (pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map), - (vm_offset_t)addr, &pa) == FALSE) - panic("vmapbuf: null page frame"); - pmap_enter(vm_map_pmap(phys_map), kva, trunc_page(pa), - VM_PROT_READ|VM_PROT_WRITE, TRUE, 0); - addr += PAGE_SIZE; - kva += PAGE_SIZE; - } -} - -/* - * Free the io map PTEs associated with this IO operation. - * We also invalidate the TLB entries and restore the original b_addr. - */ -void -vunmapbuf(bp, len) - struct buf *bp; - vm_size_t len; -{ - register caddr_t addr = bp->b_un.b_addr; - register vm_size_t sz; - vm_offset_t kva; - - if ((bp->b_flags & B_PHYS) == 0) - panic("vunmapbuf"); - sz = round_page(len + ((int)addr & PGOFSET)); - kva = (vm_offset_t)((int)addr & ~PGOFSET); - kmem_free_wakeup(phys_map, kva, sz); - bp->b_un.b_addr = bp->b_saveaddr; - bp->b_saveaddr = NULL; -} - - -/* - * SAVE_HINT: - * - * Saves the specified entry as the hint for - * future lookups. Performs necessary interlocks. - */ -#define SAVE_HINT(map,value) \ - simple_lock(&(map)->hint_lock); \ - (map)->hint = (value); \ - simple_unlock(&(map)->hint_lock); - - -/* - * kmem_alloc_upage: - * - * Allocate pageable memory to the kernel's address map. - * map must be "kernel_map" below. - * (Currently only used when allocating U pages). - */ -vm_offset_t -kmem_alloc_upage(map, size) - vm_map_t map; - register vm_size_t size; -{ - vm_offset_t addr; - register int result; - - - size = round_page(size); - - addr = vm_map_min(map); - result = vm_map_find_U(map, NULL, (vm_offset_t) 0, - &addr, size, TRUE); - if (result != KERN_SUCCESS) { - return(0); - } - - return(addr); -} - -/* - * vm_map_find finds an unallocated region in the target address - * map with the given length aligned on U virtual address. - * The search is defined to be first-fit from the specified address; - * the region found is returned in the same parameter. - * - */ -int -vm_map_find_U(map, object, offset, addr, length, find_space) - vm_map_t map; - vm_object_t object; - vm_offset_t offset; - vm_offset_t *addr; /* IN/OUT */ - vm_size_t length; - boolean_t find_space; -{ - register vm_offset_t start; - int result; - - start = *addr; - vm_map_lock(map); - if (find_space) { - if (vm_map_findspace_align(map, start, length, addr, 0)) { - vm_map_unlock(map); - return (KERN_NO_SPACE); - } - start = *addr; - } - result = vm_map_insert(map, object, offset, start, start + length); - vm_map_unlock(map); - return (result); -} - -/* - * Find sufficient space for `length' bytes in the given map, starting at - * `start'. The map must be locked. Returns 0 on success, 1 on no space. - */ -static int -vm_map_findspace_align(map, start, length, addr, align) - vm_map_t map; - vm_offset_t start; - vm_size_t length; - vm_offset_t *addr; - vm_size_t align; -{ - register vm_map_entry_t entry, next; - register vm_offset_t end; - - if (start < map->min_offset) - start = map->min_offset; - if (start > map->max_offset) - return (1); - - /* - * Look for the first possible address; if there's already - * something at this address, we have to start after it. - */ - if (start == map->min_offset) { - if ((entry = map->first_free) != &map->header) - start = entry->end; - } else { - vm_map_entry_t tmp; - if (vm_map_lookup_entry(map, start, &tmp)) - start = tmp->end; - entry = tmp; - } - - /* - * Look through the rest of the map, trying to fit a new region in - * the gap between existing regions, or after the very last region. - */ - for (;; start = (entry = next)->end) { - /* - * Find the end of the proposed new region. Be sure we didn't - * go beyond the end of the map, or wrap around the address; - * if so, we lose. Otherwise, if this is the last entry, or - * if the proposed new region fits before the next entry, we - * win. - */ - start = ((start + NBPG -1) & ~(NBPG - 1)); /* Paranoia */ - if((start & CpuCacheAliasMask) <= align) { - start += align - (start & CpuCacheAliasMask); - } - else { - start = ((start + CpuCacheAliasMask) & ~CpuCacheAliasMask); - start += align; - } - - end = start + length; - if (end > map->max_offset || end < start) - return (1); - next = entry->next; - if (next == &map->header || next->start >= end) - break; - } - SAVE_HINT(map, entry); - *addr = start; - return (0); -} - -/* - * kmem_alloc_wait_align - * - * Allocates pageable memory from a sub-map of the kernel. If the submap - * has no room, the caller sleeps waiting for more memory in the submap. - * - */ -vm_offset_t -kmem_alloc_wait_align(map, size, align) - vm_map_t map; - vm_size_t size; - vm_size_t align; -{ - vm_offset_t addr; - - size = round_page(size); - - for (;;) { - /* - * To make this work for more than one map, - * use the map's lock to lock out sleepers/wakers. - */ - vm_map_lock(map); - if (vm_map_findspace_align(map, 0, size, &addr, align) == 0) - break; - /* no space now; see if we can ever get space */ - if (vm_map_max(map) - vm_map_min(map) < size) { - vm_map_unlock(map); - return (0); - } - assert_wait(map, TRUE); - vm_map_unlock(map); - thread_block("mKmwait"); - } - vm_map_insert(map, NULL, (vm_offset_t)0, addr, addr + size); - vm_map_unlock(map); - return (addr); -} |