diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 1998-01-28 13:46:39 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 1998-01-28 13:46:39 +0000 |
commit | f66efdaa0ee892ee683d1f77196728dd915db7c0 (patch) | |
tree | 95abaee36773f8e27e6f5cf217fa840b457f12c9 /sys | |
parent | fbd6c9ead48be65a615a557d3d9e610d26a02fb9 (diff) |
Moving around files for new mips arch layout
Diffstat (limited to 'sys')
64 files changed, 447 insertions, 10287 deletions
diff --git a/sys/arch/arc/TODO b/sys/arch/arc/TODO index 96aa0da08aa..2ccac3a01b5 100644 --- a/sys/arch/arc/TODO +++ b/sys/arch/arc/TODO @@ -9,15 +9,12 @@ InWork: Have a test version. The system hangs after a while. Not solved yet. o Boot. Standalone boot program instead of booting the kernel directly? - o sigsetjmp/siglongjmp missing.... - - o Add more videomodes to pccons driver. 50kHz and 64kHz monitors? -InWork: This seems to be hard. Need more info on the chip. - - o Find out why bitmap load to S3-928 flashes screen. + o Find out why bitmap load to S3-928 flashes screen. (X server) Know why (enable linear mode). Need S3 info. o Can we have 32 double registers? + o New dynamic loader... + Lots of other things..... diff --git a/sys/arch/arc/arc/arcbios.c b/sys/arch/arc/arc/arcbios.c deleted file mode 100644 index ac9f0fb4470..00000000000 --- a/sys/arch/arc/arc/arcbios.c +++ /dev/null @@ -1,364 +0,0 @@ -/* $OpenBSD: arcbios.c,v 1.8 1997/05/01 15:13:28 pefo Exp $ */ -/*- - * Copyright (c) 1996 M. Warner Losh. All rights reserved. - * 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. 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 <arc/arc/arcbios.h> -#include <arc/arc/arctype.h> - -arc_param_blk_t *bios_base = (arc_param_blk_t *) 0x80001000; - -extern int cputype; /* 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_cpu_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, "DESKTECH-TYNE", DESKSTATION_TYNE }, - { NULL, "DESKTECH-ARCStation I", DESKSTATION_RPC44 }, - { NULL, "Microsoft-Jazz", MAGNUM }, -}; - -#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; - - case ExeceptionBlock: - case SystemParameterBlock: - case FreeMemory: - case FirmwareTemporary: - case FirmwarePermanent: - 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_cpu_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() -{ - cputype = get_cpu_type(); - if(cputype < 0) { - return; - } - bios_configure_memory(); - displayinfo = *(arc_dsp_stat_t *)Bios_GetDisplayStatus(1); -} - -/* - * 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; -{ - *xpos = displayinfo.CursorXPosition; - *ypos = displayinfo.CursorYPosition; - *xsize = displayinfo.CursorMaxXPosition; - *ysize = displayinfo.CursorMaxYPosition; -} - -/* - * Load the incore miniroot into memory. This is used for - * Initial booting before we have any file system. CD-rom booting. - */ -int -bios_load_miniroot(path, where) - char *path; - caddr_t where; -{ - u_int file; - u_int count; - int i; - char s[32]; - -static char mrdefault[] = {"scsi(0)disk(0)rdisk(0)partition(1)\\miniroot" }; - - bios_putstring("Loading miniroot:"); - - if(path == 0) - path = mrdefault; - bios_putstring(path); - bios_putstring("\n"); - - if((i = Bios_Open(path,0,&file)) != arc_ESUCCESS) { - sprintf(s, "Error %d. Load failed!\n", i); - bios_putstring(s); - return(-1); - } - do { - - i = Bios_Read(file, where, 4096, &count); - bios_putstring("."); - where += count; - } while((i == 0) && (count != 0)); - - Bios_Close(file); - bios_putstring("\nLoaded.\n"); - return(0); -} - diff --git a/sys/arch/arc/arc/arcbios.h b/sys/arch/arc/arc/arcbios.h deleted file mode 100644 index 58b4d89f2c7..00000000000 --- a/sys/arch/arc/arc/arcbios.h +++ /dev/null @@ -1,339 +0,0 @@ -/* $OpenBSD: arcbios.h,v 1.4 1997/05/01 15:13:30 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; - -typedef enum { - ExeceptionBlock, - SystemParameterBlock, - FreeMemory, - BadMemory, - LoadedProgram, - FirmwareTemporary, - FirmwarePermanent, - FreeContigous -} MEMORYTYPE; - -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 */ - - void (*signal)( /* Signal 20 */ - u_int32_t, /* Signal number */ -/**/ caddr_t); /* Handler */ - - 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 */ - - 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 */ -} 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 *)); -int bios_load_miniroot __P((char *, caddr_t)); - diff --git a/sys/arch/arc/arc/arctype.h b/sys/arch/arc/arc/arctype.h deleted file mode 100644 index 76a11efdb8d..00000000000 --- a/sys/arch/arc/arc/arctype.h +++ /dev/null @@ -1,41 +0,0 @@ -/* $OpenBSD: arctype.h,v 1.4 1997/03/12 19:16:37 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. - * - */ -/* - * Mother board type byte of "systype" environment variable. - */ -#define ACER_PICA_61 0x1 /* Acer Labs Pica 61 */ -#define MAGNUM 0x2 /* Mips MAGNUM R4000 */ -#define DESKSTATION_RPC44 0x3 /* Deskstation xxx */ -#define DESKSTATION_TYNE 0x4 /* Deskstation xxx */ -#define NKK_AQUARIUS 0x5 /* NKK R4{67}00 PC */ -#define ALGOR_P4032 0x6 /* ALGORITHMICS P-4032 VR4300 */ diff --git a/sys/arch/arc/arc/clock.c b/sys/arch/arc/arc/clock.c deleted file mode 100644 index 4520fa2379b..00000000000 --- a/sys/arch/arc/arc/clock.c +++ /dev/null @@ -1,351 +0,0 @@ -/* $OpenBSD: clock.c,v 1.5 1997/04/19 17:19:39 pefo 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: clock.c 1.18 91/01/21 - * - * from: @(#)clock.c 8.1 (Berkeley) 6/10/93 - * $Id: clock.c,v 1.5 1997/04/19 17:19:39 pefo 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 <arc/arc/clockvar.h> -#include <arc/arc/arctype.h> - -#include <dev/isa/isavar.h> -#include <arc/isa/isa_machdep.h> - -extern int cputype; /* What kind of cpu we are running on */ - -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 *)); - -struct cfdriver clock_cd = { - NULL, "clock", DV_DULL, NULL, 0 -}; - -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 -}; - -void mcclock_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 = cfdata; - struct confargs *ca = aux; - - /* See how many clocks this system has */ - switch (cputype) { - - case ACER_PICA_61: - /* 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: - case ALGOR_P4032: - break; - - default: - panic("unknown CPU"); - } - - if (cf->cf_unit >= 1) - return (0); - - return (1); -} - -int -clockintr(cf) - void *cf; -{ - if(clock_started) - hardclock((struct clockframe *)cf); - return(1); -} - -static void -clockattach(parent, self, aux) - struct device *parent; - struct device *self; - void *aux; -{ - struct isa_attach_args *ia = aux; - - mcclock_attach(parent, self, aux); - - switch (cputype) { - - case ACER_PICA_61: - case ALGOR_P4032: - BUS_INTR_ESTABLISH((struct confargs *)aux, - (intr_handler_t)hardclock, self); - break; - - case DESKSTATION_RPC44: - case DESKSTATION_TYNE: - (void)isa_intr_establish(ia->ia_ic, - 0, 1, 3, clockintr, 0, "clock"); - break; - - default: - panic("clockattach: it didn't get here. really."); - } - - printf("\n"); -} - -/* - * Wait "n" microseconds. This doesn't belong here. XXX. - */ -void -delay(n) - int n; -{ - DELAY(n); -} - -/* - * Machine-dependent clock routines. - * - * Startrtclock restarts the real-time clock, which provides - * hardclock interrupts to kern_clock.c. - * - * Inittodr initializes the time of day hardware which provides - * date functions. Its primary function is to use some file - * system information in case the hardare clock lost state. - * - * Resettodr restores the time of day hardware after a time change. - */ - - -/* - * 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 -}; - -/* - * Initialze 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 */ - c.year = c.year+80; /* must be multiple of 4 because chip knows leap */ - 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; - c.year = c.year-80; /* must be multiple of 4 because chip knows leap */ - - (*csc->sc_set)(csc, &c); -} diff --git a/sys/arch/arc/arc/clock_mc.c b/sys/arch/arc/arc/clock_mc.c index 7515d07af3f..c8ce08742d5 100644 --- a/sys/arch/arc/arc/clock_mc.c +++ b/sys/arch/arc/arc/clock_mc.c @@ -1,5 +1,4 @@ -/* $OpenBSD: clock_mc.c,v 1.7 1997/04/19 17:19:40 pefo Exp $ */ -/* $NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp $ */ +/* $OpenBSD: clock_mc.c,v 1.8 1998/01/28 13:45:47 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -55,17 +54,20 @@ #include <dev/isa/isavar.h> #include <dev/ic/mc146818reg.h> -#include <arc/arc/clockvar.h> -#include <arc/arc/arctype.h> +#include <mips/archtype.h> + +#include <mips/dev/clockvar.h> + #include <arc/pica/pica.h> #include <arc/algor/algor.h> #include <arc/isa/isa_machdep.h> #include <arc/isa/timerreg.h> -extern u_int cputype; extern int cpu_int_mask; +extern int clock_started; -void mcclock_attach __P((struct device *parent, +int clockintr __P((void *cf)); +void md_clk_attach __P((struct device *parent, struct device *self, void *aux)); static void mcclock_init_pica __P((struct clock_softc *csc)); static void mcclock_init_tyne __P((struct clock_softc *csc)); @@ -105,7 +107,7 @@ static u_int mc_read_p4032 __P((struct clock_softc *csc, u_int reg)); static struct mcclockdata mcclockdata_p4032 = { mc_write_p4032, mc_read_p4032 }; void -mcclock_attach(parent, self, aux) +md_clk_attach(parent, self, aux) struct device *parent; struct device *self; void *aux; @@ -117,7 +119,7 @@ mcclock_attach(parent, self, aux) csc->sc_get = mcclock_get; csc->sc_set = mcclock_set; - switch (cputype) { + switch (system_type) { case ACER_PICA_61: csc->sc_init = mcclock_init_pica; @@ -163,6 +165,15 @@ mcclock_init_tyne(csc) isa_outb(TIMER_CNTR0, TIMER_DIV(hz) / 256); } +int +clockintr(cf) + void *cf; +{ + if(clock_started) + hardclock((struct clockframe *)cf); + return(1); +} + static void mcclock_init_p4032(csc) struct clock_softc *csc; @@ -202,7 +213,7 @@ mcclock_get(csc, base, ct) ct->day = regs[MC_DOM]; ct->mon = regs[MC_MONTH]; ct->year = regs[MC_YEAR]; - if(cputype == ALGOR_P4032) + if(system_type == ALGOR_P4032) ct->year -= 80; } @@ -227,7 +238,7 @@ printf("%d-%d-%d, %d:%d:%d\n", regs[MC_YEAR], regs[MC_MONTH], regs[MC_DOM], regs regs[MC_DOW] = ct->dow; regs[MC_DOM] = ct->day; regs[MC_MONTH] = ct->mon; - if(cputype == ALGOR_P4032) + if(system_type == ALGOR_P4032) regs[MC_YEAR] = ct->year + 80; else regs[MC_YEAR] = ct->year; diff --git a/sys/arch/arc/arc/clockvar.h b/sys/arch/arc/arc/clockvar.h deleted file mode 100644 index 9f4f677e9f1..00000000000 --- a/sys/arch/arc/arc/clockvar.h +++ /dev/null @@ -1,79 +0,0 @@ -/* $OpenBSD: clockvar.h,v 1.1 1996/06/24 09:07:20 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 *parent, struct device *self, - void *aux)); - void (*sc_init) __P((struct clock_softc *csc)); - void (*sc_get) __P((struct clock_softc *csc, time_t base, - struct tod_time *ct)); - void (*sc_set) __P((struct clock_softc *csc, struct tod_time *ct)); - - /* - * Private storage for particular clock types. - */ - void *sc_data; - - /* - * Has the time been initialized? - */ - int sc_initted; -}; diff --git a/sys/arch/arc/arc/conf.c b/sys/arch/arc/arc/conf.c index 59499900519..27ea5283f56 100644 --- a/sys/arch/arc/arc/conf.c +++ b/sys/arch/arc/arc/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.18 1997/11/23 05:21:54 mickey Exp $ */ +/* $OpenBSD: conf.c,v 1.19 1998/01/28 13:45:49 pefo Exp $ */ /* * Copyright (c) 1992, 1993 @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)conf.c 8.2 (Berkeley) 11/14/93 - * $Id: conf.c,v 1.18 1997/11/23 05:21:54 mickey Exp $ + * $Id: conf.c,v 1.19 1998/01/28 13:45:49 pefo Exp $ */ #include <sys/param.h> @@ -202,8 +202,6 @@ struct cdevsw cdevsw[] = int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]); -int mem_no = 2; /* major device number of memory special file */ - /* * Swapdev is a fake device implemented * in sw.c used only internally to get to swstrategy. diff --git a/sys/arch/arc/arc/cpu.c b/sys/arch/arc/arc/cpu.c deleted file mode 100644 index 78820f3d1b2..00000000000 --- a/sys/arch/arc/arc/cpu.c +++ /dev/null @@ -1,207 +0,0 @@ -/* $OpenBSD: cpu.c,v 1.9 1997/06/14 23:28:53 deraadt 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_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_RM5230: - printf("QED RM5230 based CPU"); - break; - case MIPS_UNKC2: - 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_RM5230: - printf("QED RM5230 based 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/arc/arc/cpu_exec.c b/sys/arch/arc/arc/cpu_exec.c deleted file mode 100644 index 8d7087e349d..00000000000 --- a/sys/arch/arc/arc/cpu_exec.c +++ /dev/null @@ -1,112 +0,0 @@ -/* $OpenBSD: cpu_exec.c,v 1.4 1997/04/19 17:19:41 pefo Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by Ralph - * Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)machdep.c 8.3 (Berkeley) 1/12/94 - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/malloc.h> -#include <sys/vnode.h> -#include <sys/exec.h> -#include <sys/resourcevar.h> -#include <vm/vm.h> - -#include <sys/exec_ecoff.h> -#include <machine/reg.h> - -#if defined(_KERN_DO_ECOFF) -void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *, - u_long, register_t *)); -#endif -/* - * cpu_exec_aout_makecmds(): - * cpu-dependent a.out format hook for execve(). - * - * Determine of the given exec package refers to something which we - * understand and, if so, set up the vmcmds for it. - * - */ -int -cpu_exec_aout_makecmds(p, epp) - struct proc *p; - struct exec_package *epp; -{ - return ENOEXEC; -} - - -#if defined(_KERN_DO_ECOFF) -void -cpu_exec_ecoff_setregs(p, pack, stack, retval) - struct proc *p; - struct exec_package *pack; - u_long stack; - register_t *retval; -{ - struct ecoff_aouthdr *eap; - - setregs(p, pack, stack, retval); - eap = (struct ecoff_aouthdr *) - ((caddr_t)pack->ep_hdr + sizeof(struct ecoff_filehdr)); - p->p_md.md_regs[GP] = eap->ea_gp_value; -} - -/* - * cpu_exec_ecoff_hook(): - * cpu-dependent ECOFF format hook for execve(). - * - * Do any machine-dependent diddling of the exec package when doing ECOFF. - * - */ -int -cpu_exec_ecoff_hook(p, epp) - struct proc *p; - struct exec_package *epp; -{ -#ifdef COMPAT_ULTRIX - extern struct emul emul_ultrix; -#endif - -#if defined(COMPAT_ULTRIX) - epp->ep_emul = &emul_ultrix; -#endif - return 0; -} - -#endif /* _KERN_DO_ECOFF */ diff --git a/sys/arch/arc/arc/disksubr.c b/sys/arch/arc/arc/disksubr.c deleted file mode 100644 index 3ced5c8d8b9..00000000000 --- a/sys/arch/arc/arc/disksubr.c +++ /dev/null @@ -1,523 +0,0 @@ -/* $OpenBSD: disksubr.c,v 1.20 1998/01/11 20:42:04 provos 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 stategy 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) - dev_t dev; - void (*strat) __P((struct buf *)); - register struct disklabel *lp; - struct cpu_disklabel *osdep; -{ - struct dos_partition *dp = osdep->dosparts, *dp2; - struct dkbad *bdp = &DKBAD(osdep); - struct buf *bp; - 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; - 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_386BSD) - 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_FAT16C: - case DOSPTYP_FAT32: - pp->p_fstype = FS_MSDOS; - n++; - break; - case DOSPTYP_EXTEND: - 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; - } - - /* 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: - bp->b_flags |= B_INVAL; - brelse(bp); - return (msg); -} - -/* - * Check new disk label for sensibility - * before setting it. - */ -int -setdisklabel(olp, nlp, openmask, osdep) - register struct disklabel *olp, *nlp; - u_long openmask; - struct cpu_disklabel *osdep; -{ - register i; - register 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 *)); - register 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_386BSD) - 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); - - 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/arc/arc/fp.S b/sys/arch/arc/arc/fp.S deleted file mode 100644 index af2470947a1..00000000000 --- a/sys/arch/arc/arc/fp.S +++ /dev/null @@ -1,3611 +0,0 @@ -/* $OpenBSD: fp.S,v 1.1 1996/06/24 09:07:20 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.1 1996/06/24 09:07:20 pefo Exp $ - */ - -/* - * Standard header stuff. - */ - -#include <machine/regdef.h> -#include <machine/asm.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 - -/*---------------------------------------------------------------------------- - * - * MachEmulateFP -- - * - * Emulate unimplemented floating point operations. - * This routine should only be called by MachFPInterrupt(). - * - * MachEmulateFP(instr) - * unsigned instr; - * - * Results: - * None. - * - * Side effects: - * Floating point registers are modified according to instruction. - * - *---------------------------------------------------------------------------- - */ -NON_LEAF(MachEmulateFP, 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(MachEmulateFP) - -/*---------------------------------------------------------------------------- - * get_fs_int -- - * - * Read (integer) the FS register (bits 15-11). - * This is an internal routine used by MachEmulateFP 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 MachEmulateFP 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 MachEmulateFP 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 MachEmulateFP 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 MachEmulateFP 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 MachEmulateFP 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 MachEmulateFP 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 MachEmulateFP 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 MachEmulateFP 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 MachEmulateFP 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/arc/arc/locore.S b/sys/arch/arc/arc/locore.S index d6a27529e40..5b7279d1ba6 100644 --- a/sys/arch/arc/arc/locore.S +++ b/sys/arch/arc/arc/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.12 1997/04/19 17:19:43 pefo Exp $ */ +/* $OpenBSD: locore.S,v 1.13 1998/01/28 13:45:54 pefo Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -50,7 +50,7 @@ * v 1.1 89/07/10 14:27:41 nelson Exp SPRITE (DECWRL) * * from: @(#)locore.s 8.5 (Berkeley) 1/4/94 - * $Id: locore.S,v 1.12 1997/04/19 17:19:43 pefo Exp $ + * $Id: locore.S,v 1.13 1998/01/28 13:45:54 pefo Exp $ */ /* @@ -928,8 +928,8 @@ END(_remque) * Don't check for invalid pte's here. We load them as well and * let the processor trap to load the correct value after service. */ - .globl MachTLBMiss -MachTLBMiss: + .globl MipsTLBMiss +MipsTLBMiss: .set noat dmfc0 k0, COP_0_BAD_VADDR # get the virtual address lw k1, UADDR+U_PCB_SEGTAB # get the current segment table @@ -960,14 +960,14 @@ MachTLBMiss: nop eret 1: - j MachTLBMissException + j MipsTLBMissException nop 2: j SlowFault nop - .globl MachTLBMissEnd -MachTLBMissEnd: + .globl MipsTLBMissEnd +MipsTLBMissEnd: .set at /* @@ -975,8 +975,8 @@ MachTLBMissEnd: * handle all execptions except RESET and TLBMiss. * NOTE: This code must be relocatable!!! */ - .globl MachException -MachException: + .globl MipsException +MipsException: /* * Find out what mode we came from and jump to the proper handler. */ @@ -1001,8 +1001,8 @@ MachException: j k0 # Jump to the function. nop .set at - .globl MachExceptionEnd -MachExceptionEnd: + .globl MipsExceptionEnd +MipsExceptionEnd: /* * We couldn't find a TLB entry. @@ -1013,7 +1013,7 @@ SlowFault: mfc0 k0, COP_0_STATUS_REG nop and k0, k0, SR_KSU_USER - bne k0, zero, MachUserGenException + bne k0, zero, MipsUserGenException nop .set at /* @@ -1022,7 +1022,7 @@ SlowFault: /*---------------------------------------------------------------------------- * - * MachKernGenException -- + * MipsKernGenException -- * * Handle an exception from kernel mode. * @@ -1047,7 +1047,7 @@ SlowFault: #define KERN_MULT_HI_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 8) #define KERN_EXC_FRAME_SIZE (STAND_FRAME_SIZE + KERN_REG_SIZE + 12) -NNON_LEAF(MachKernGenException, KERN_EXC_FRAME_SIZE, ra) +NNON_LEAF(MipsKernGenException, KERN_EXC_FRAME_SIZE, ra) .set noat #ifdef DEBUG la k0, mdbpcb # save registers for mdb @@ -1137,11 +1137,11 @@ NNON_LEAF(MachKernGenException, KERN_EXC_FRAME_SIZE, ra) addu sp, sp, KERN_EXC_FRAME_SIZE eret # exception. .set at -END(MachKernGenException) +END(MipsKernGenException) /*---------------------------------------------------------------------------- * - * MachUserGenException -- + * MipsUserGenException -- * * Handle an exception from user mode. * @@ -1153,7 +1153,7 @@ END(MachKernGenException) * *---------------------------------------------------------------------------- */ -NNON_LEAF(MachUserGenException, STAND_FRAME_SIZE, ra) +NNON_LEAF(MipsUserGenException, STAND_FRAME_SIZE, ra) .set noat .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE) /* @@ -1260,11 +1260,11 @@ NNON_LEAF(MachUserGenException, STAND_FRAME_SIZE, ra) lw ra, UADDR+U_PCB_REGS+(RA * 4) eret .set at -END(MachUserGenException) +END(MipsUserGenException) /*---------------------------------------------------------------------------- * - * MachKernIntr -- + * MipsKernIntr -- * * Handle an interrupt from kernel mode. * Interrupts use the standard kernel stack. @@ -1285,7 +1285,7 @@ END(MachUserGenException) #define KINTR_MULT_GP_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 12) #define KINTR_FRAME_SIZE (STAND_FRAME_SIZE + KERN_REG_SIZE + 16) -NNON_LEAF(MachKernIntr, KINTR_FRAME_SIZE, ra) +NNON_LEAF(MipsKernIntr, KINTR_FRAME_SIZE, ra) .set noat subu sp, sp, KINTR_FRAME_SIZE # allocate stack frame .mask 0x80000000, (STAND_RA_OFFSET - KINTR_FRAME_SIZE) @@ -1360,11 +1360,11 @@ NNON_LEAF(MachKernIntr, KINTR_FRAME_SIZE, ra) addu sp, sp, KINTR_FRAME_SIZE eret # interrupt. .set at -END(MachKernIntr) +END(MipsKernIntr) /*---------------------------------------------------------------------------- * - * MachUserIntr -- + * MipsUserIntr -- * * Handle an interrupt from user mode. * Note: we save minimal state in the u.u_pcb struct and use the standard @@ -1381,7 +1381,7 @@ END(MachKernIntr) * *---------------------------------------------------------------------------- */ -NNON_LEAF(MachUserIntr, STAND_FRAME_SIZE, ra) +NNON_LEAF(MipsUserIntr, STAND_FRAME_SIZE, ra) .set noat .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE) /* @@ -1539,11 +1539,11 @@ NNON_LEAF(MachUserIntr, STAND_FRAME_SIZE, ra) lw ra, UADDR+U_PCB_REGS+(RA * 4) eret .set at -END(MachUserIntr) +END(MipsUserIntr) /*---------------------------------------------------------------------------- * - * MachTLBInvalidException -- + * MipsTLBInvalidException -- * * Handle a TLB invalid exception from kernel mode in kernel space. * The BaddVAddr, Context, and EntryHi registers contain the failed @@ -1557,7 +1557,7 @@ END(MachUserIntr) * *---------------------------------------------------------------------------- */ -NLEAF(MachTLBInvalidException) +NLEAF(MipsTLBInvalidException) .set noat dmfc0 k0, COP_0_BAD_VADDR # get the fault address li k1, (VM_MIN_KERNEL_ADDRESS) # compute index @@ -1587,7 +1587,7 @@ NLEAF(MachTLBInvalidException) dsrl k0, k0, 34 dmtc0 k0, COP_0_TLB_LO0 # load PTE entry and k0, k0, PG_V # check for valid entry - beq k0, zero, MachKernGenException # PTE invalid + beq k0, zero, MipsKernGenException # PTE invalid lw k0, 4(k1) # get odd PTE entry dsll k0, k0, 34 dsrl k0, k0, 34 @@ -1614,7 +1614,7 @@ KernTLBIOdd: dsrl k0, k0, 34 dmtc0 k0, COP_0_TLB_LO1 # save PTE entry and k0, k0, PG_V # check for valid entry - beq k0, zero, MachKernGenException # PTE invalid + beq k0, zero, MipsKernGenException # PTE invalid lw k0, -4(k1) # get even PTE entry dsll k0, k0, 34 dsrl k0, k0, 34 @@ -1627,11 +1627,11 @@ KernTLBIOdd: nop nop eret -END(MachTLBInvalidException) +END(MipsTLBInvalidException) /*---------------------------------------------------------------------------- * - * MachTLBMissException -- + * MipsTLBMissException -- * * Handle a TLB miss exception from kernel mode in kernel space. * The BaddVAddr, Context, and EntryHi registers contain the failed @@ -1645,7 +1645,7 @@ END(MachTLBInvalidException) * *---------------------------------------------------------------------------- */ -NLEAF(MachTLBMissException) +NLEAF(MipsTLBMissException) .set noat dmfc0 k0, COP_0_BAD_VADDR # get the fault address li k1, (VM_MIN_KERNEL_ADDRESS) # compute index @@ -1678,7 +1678,7 @@ NLEAF(MachTLBMissException) sys_stk_chk: subu k0, sp, UADDR + 0x200 # check to see if we have a sltiu k0, UPAGES*NBPG - 0x200 # valid kernel stack - bne k0, zero, MachKernGenException # Go panic + bne k0, zero, MipsKernGenException # Go panic nop la a0, start - START_FRAME - 8 # set sp to a valid place @@ -1701,7 +1701,7 @@ sys_stk_chk: la sp, start - START_FRAME # set sp to a valid place PANIC("kernel stack overflow") .set at -END(MachTLBMissException) +END(MipsTLBMissException) /* * Set/clear software interrupt routines. @@ -1747,14 +1747,14 @@ END(clearsoftnet) * Set/change interrupt priority routines. */ -LEAF(MachEnableIntr) +LEAF(MipsEnableIntr) mfc0 v0, COP_0_STATUS_REG # read status register nop or v0, v0, SR_INT_ENAB mtc0 v0, COP_0_STATUS_REG # enable all interrupts j ra nop -END(MachEnableIntr) +END(MipsEnableIntr) LEAF(spl0) mfc0 v0, COP_0_STATUS_REG # read status register @@ -1784,7 +1784,7 @@ LEAF(splsoftnet) and v0, v0, (INT_MASK | SR_INT_ENAB) END(splsoftnet) -LEAF(Mach_spl0) +LEAF(Mips_spl0) mfc0 v0, COP_0_STATUS_REG # read status register li t0, ~(INT_MASK_0|SOFT_INT_MASK_1|SOFT_INT_MASK_0) and t0, t0, v0 @@ -1792,9 +1792,9 @@ LEAF(Mach_spl0) nop # 3 ins to disable j ra and v0, v0, (INT_MASK | SR_INT_ENAB) -END(Mach_spl0) +END(Mips_spl0) -LEAF(Mach_spl1) +LEAF(Mips_spl1) mfc0 v0, COP_0_STATUS_REG # read status register li t0, ~(INT_MASK_1|SOFT_INT_MASK_0|SOFT_INT_MASK_1) and t0, t0, v0 @@ -1802,9 +1802,9 @@ LEAF(Mach_spl1) nop # 3 ins to disable j ra and v0, v0, (INT_MASK | SR_INT_ENAB) -END(Mach_spl1) +END(Mips_spl1) -LEAF(Mach_spl2) +LEAF(Mips_spl2) mfc0 v0, COP_0_STATUS_REG # read status register li t0, ~(INT_MASK_2|SOFT_INT_MASK_1|SOFT_INT_MASK_0) and t0, t0, v0 @@ -1812,9 +1812,9 @@ LEAF(Mach_spl2) nop # 3 ins to disable j ra and v0, v0, (INT_MASK | SR_INT_ENAB) -END(Mach_spl2) +END(Mips_spl2) -LEAF(Mach_spl3) +LEAF(Mips_spl3) mfc0 v0, COP_0_STATUS_REG # read status register li t0, ~(INT_MASK_3|SOFT_INT_MASK_1|SOFT_INT_MASK_0) and t0, t0, v0 @@ -1822,9 +1822,9 @@ LEAF(Mach_spl3) nop # 3 ins to disable j ra and v0, v0, (INT_MASK | SR_INT_ENAB) -END(Mach_spl3) +END(Mips_spl3) -LEAF(Mach_spl4) +LEAF(Mips_spl4) mfc0 v0, COP_0_STATUS_REG # read status register li t0, ~(INT_MASK_4|SOFT_INT_MASK_1|SOFT_INT_MASK_0) and t0, t0, v0 @@ -1832,9 +1832,9 @@ LEAF(Mach_spl4) nop # 3 ins to disable j ra and v0, v0, (INT_MASK | SR_INT_ENAB) -END(Mach_spl4) +END(Mips_spl4) -LEAF(Mach_spl5) +LEAF(Mips_spl5) mfc0 v0, COP_0_STATUS_REG # read status register li t0, ~(INT_MASK_5|SOFT_INT_MASK_1|SOFT_INT_MASK_0) and t0, t0, v0 @@ -1842,7 +1842,7 @@ LEAF(Mach_spl5) nop # 3 ins to disable j ra and v0, v0, (INT_MASK | SR_INT_ENAB) -END(Mach_spl5) +END(Mips_spl5) /* * We define an alternate entry point after mcount is called so it @@ -2271,11 +2271,11 @@ END(R4K_TLBGetPID) /*---------------------------------------------------------------------------- * - * MachSwitchFPState -- + * MipsSwitchFPState -- * * Save the current state into 'from' and restore it from 'to'. * - * MachSwitchFPState(from, to) + * MipsSwitchFPState(from, to) * struct proc *from; * struct user *to; * @@ -2287,7 +2287,7 @@ END(R4K_TLBGetPID) * *---------------------------------------------------------------------------- */ -LEAF(MachSwitchFPState) +LEAF(MipsSwitchFPState) mfc0 t1, COP_0_STATUS_REG # Save old SR li t0, SR_COP_1_BIT # enable the coprocessor mtc0 t0, COP_0_STATUS_REG @@ -2387,15 +2387,15 @@ LEAF(MachSwitchFPState) mtc0 t1, COP_0_STATUS_REG # Restore the status register. j ra nop -END(MachSwitchFPState) +END(MipsSwitchFPState) /*---------------------------------------------------------------------------- * - * MachSaveCurFPState -- + * MipsSaveCurFPState -- * * Save the current floating point coprocessor state. * - * MachSaveCurFPState(p) + * MipsSaveCurFPState(p) * struct proc *p; * * Results: @@ -2406,7 +2406,7 @@ END(MachSwitchFPState) * *---------------------------------------------------------------------------- */ -LEAF(MachSaveCurFPState) +LEAF(MipsSaveCurFPState) lw a0, P_ADDR(a0) # get pointer to pcb for proc mfc0 t1, COP_0_STATUS_REG # Disable interrupts and li t0, SR_COP_1_BIT # enable the coprocessor @@ -2462,15 +2462,15 @@ LEAF(MachSaveCurFPState) mtc0 t1, COP_0_STATUS_REG # Restore the status register. j ra nop -END(MachSaveCurFPState) +END(MipsSaveCurFPState) /*---------------------------------------------------------------------------- * - * MachFPTrap -- + * MipsFPTrap -- * * Handle a floating point Trap. * - * MachFPTrap(statusReg, causeReg, pc) + * MipsFPTrap(statusReg, causeReg, pc) * unsigned statusReg; * unsigned causeReg; * unsigned pc; @@ -2483,7 +2483,7 @@ END(MachSaveCurFPState) * *---------------------------------------------------------------------------- */ -NON_LEAF(MachFPTrap, STAND_FRAME_SIZE, ra) +NON_LEAF(MipsFPTrap, STAND_FRAME_SIZE, ra) subu sp, sp, STAND_FRAME_SIZE mfc0 t0, COP_0_STATUS_REG sw ra, STAND_RA_OFFSET(sp) @@ -2515,7 +2515,7 @@ NON_LEAF(MachFPTrap, STAND_FRAME_SIZE, ra) li a0, UADDR+U_PCB_REGS # first arg is ptr to CPU registers move a1, a2 # second arg is instruction PC move a2, t1 # third arg is floating point CSR - jal MachEmulateBranch # compute PC after branch + jal MipsEmulateBranch # compute PC after branch move a3, zero # fourth arg is FALSE /* * Now load the floating-point instruction in the branch delay slot @@ -2526,7 +2526,7 @@ NON_LEAF(MachFPTrap, STAND_FRAME_SIZE, ra) lw a0, 4(a2) # a0 = coproc instruction /* * This is not in the branch delay slot so calculate the resulting - * PC (epc + 4) into v0 and continue to MachEmulateFP(). + * PC (epc + 4) into v0 and continue to MipsEmulateFP(). */ 1: lw a0, 0(a2) # a0 = coproc instruction @@ -2553,10 +2553,10 @@ NON_LEAF(MachFPTrap, STAND_FRAME_SIZE, ra) nop /* - * Finally, we can call MachEmulateFP() where a0 is the instruction to emulate. + * Finally, we can call MipsEmulateFP() where a0 is the instruction to emulate. */ 4: - jal MachEmulateFP + jal MipsEmulateFP nop /* @@ -2569,7 +2569,7 @@ FPReturn: mtc0 t0, COP_0_STATUS_REG j ra addu sp, sp, STAND_FRAME_SIZE -END(MachFPTrap) +END(MipsFPTrap) /*---------------------------------------------------------------------------- * diff --git a/sys/arch/arc/arc/machdep.c b/sys/arch/arc/arc/machdep.c index 73c78f42c1f..3a40637c822 100644 --- a/sys/arch/arc/arc/machdep.c +++ b/sys/arch/arc/arc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.29 1997/05/19 16:21:20 pefo Exp $ */ +/* $OpenBSD: machdep.c,v 1.30 1998/01/28 13:45:55 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 8.3 (Berkeley) 1/12/94 - * $Id: machdep.c,v 1.29 1997/05/19 16:21:20 pefo Exp $ + * $Id: machdep.c,v 1.30 1998/01/28 13:45:55 pefo Exp $ */ /* from: Utah Hdr: machdep.c 1.63 91/04/24 */ @@ -93,8 +93,8 @@ #include <dev/cons.h> -#include <arc/arc/arctype.h> -#include <arc/arc/arcbios.h> +#include <mips/archtype.h> +#include <mips/mips/arcbios.h> #include <arc/pica/pica.h> #include <arc/dti/desktech.h> #include <arc/algor/algor.h> @@ -131,7 +131,7 @@ int msgbufmapped = 0; /* set when safe to use msgbuf */ int physmem; /* max supported memory, changes to actual */ int cpucfg; /* Value of processor config register */ int l2cache_is_snooping; /* Set if L2 cache snoops uncached writes */ -int cputype; /* Mother board type */ +int system_type; /* Mother board type */ int num_tlbentries = 48; /* Size of the CPU tlb */ int ncpu = 1; /* At least one cpu in the system */ int CONADDR; /* Well, ain't it just plain stupid... */ @@ -142,14 +142,14 @@ char eth_hw_addr[6]; /* HW ether addr not stored elsewhere */ struct mem_descriptor mem_layout[MAXMEMSEGS]; -extern int Mach_spl0 __P((void)), Mach_spl1 __P((void)), Mach_spl2 __P((void)); -extern int Mach_spl3 __P((void)), Mach_spl4 __P((void)), Mach_spl5 __P((void)); -int (*Mach_splnet)(void) = splhigh; -int (*Mach_splbio)(void) = splhigh; -int (*Mach_splimp)(void) = splhigh; -int (*Mach_spltty)(void) = splhigh; -int (*Mach_splclock)(void) = splhigh; -int (*Mach_splstatclock)(void) = splhigh; +extern int Mips_spl0 __P((void)), Mips_spl1 __P((void)), Mips_spl2 __P((void)); +extern int Mips_spl3 __P((void)), Mips_spl4 __P((void)), Mips_spl5 __P((void)); +int (*Mips_splnet)(void) = splhigh; +int (*Mips_splbio)(void) = splhigh; +int (*Mips_splimp)(void) = splhigh; +int (*Mips_spltty)(void) = splhigh; +int (*Mips_splclock)(void) = splhigh; +int (*Mips_splstatclock)(void) = splhigh; void mips_init __P((int, char *[], char *[])); void initcpu __P((void)); @@ -192,8 +192,8 @@ mips_init(argc, argv, envv) caddr_t start; struct tlb tlb; extern char edata[], end[]; - extern char MachTLBMiss[], MachTLBMissEnd[]; - extern char MachException[], MachExceptionEnd[]; + extern char MipsTLBMiss[], MipsTLBMissEnd[]; + extern char MipsException[], MipsExceptionEnd[]; /* clear the BSS segment in OpenBSD code */ sysend = (caddr_t)mips_round_page(end); @@ -210,10 +210,10 @@ mips_init(argc, argv, envv) * entries as possible to do something useful :-). */ - switch (cputype) { + switch (system_type) { case ACER_PICA_61: /* ALI PICA 61 and MAGNUM is almost the */ case MAGNUM: /* Same kind of hardware. NEC goes here too */ - if(cputype == MAGNUM) { + if(system_type == MAGNUM) { strcpy(cpu_model, "MIPS Magnum"); } else { @@ -227,11 +227,11 @@ mips_init(argc, argv, envv) * Set up interrupt handling and I/O addresses. */ #if 0 /* XXX FIXME */ - Mach_splnet = Mach_spl1; - Mach_splbio = Mach_spl0; - Mach_splimp = Mach_spl1; - Mach_spltty = Mach_spl2; - Mach_splstatclock = Mach_spl3; + Mips_splnet = Mips_spl1; + Mips_splbio = Mips_spl0; + Mips_splimp = Mips_spl1; + Mips_spltty = Mips_spl2; + Mips_splstatclock = Mips_spl3; #endif break; @@ -249,12 +249,21 @@ mips_init(argc, argv, envv) CONADDR = 0; /* Don't screew the mouse... */ break; + case SNI_RM200: + strcpy(cpu_model, "Siemens Nixdorf RM200"); +#if 0 + arc_bus_io.bus_base = RM200_V_ISA_IO; + arc_bus_mem.bus_base = RM200_V_ISA_MEM; +#endif + CONADDR = 0; /* Don't screew the mouse... */ + break; + case -1: /* Not identified as an ARC system. We have a couple */ /* of other options. Systems not having an ARC Bios */ /* Make this more fancy when more comes in here */ environment = envv; - cputype = ALGOR_P4032; + system_type = ALGOR_P4032; strcpy(cpu_model, "Algorithmics P-4032"); arc_bus_io.bus_sparse1 = 2; arc_bus_io.bus_sparse2 = 1; @@ -356,7 +365,7 @@ mips_init(argc, argv, envv) R4K_TLBFlush(num_tlbentries); R4K_SetWIRED(VMWIRED_ENTRIES); - switch (cputype) { + switch (system_type) { case ACER_PICA_61: case MAGNUM: tlb_init_pica(); @@ -371,6 +380,10 @@ mips_init(argc, argv, envv) case ALGOR_P4032: break; + + case SNI_RM200: + /*XXX*/ + break; } /* @@ -417,12 +430,12 @@ mips_init(argc, argv, envv) /* * Copy down exception vector code. */ - if (MachTLBMissEnd - MachTLBMiss > 0x80) + if (MipsTLBMissEnd - MipsTLBMiss > 0x80) panic("startup: TLB code too large"); - bcopy(MachTLBMiss, (char *)TLB_MISS_EXC_VEC, - MachTLBMissEnd - MachTLBMiss); - bcopy(MachException, (char *)GEN_EXC_VEC, - MachExceptionEnd - MachException); + bcopy(MipsTLBMiss, (char *)TLB_MISS_EXC_VEC, + MipsTLBMissEnd - MipsTLBMiss); + bcopy(MipsException, (char *)GEN_EXC_VEC, + MipsExceptionEnd - MipsException); /* * Clear out the I and D caches. @@ -980,7 +993,7 @@ sendsig(catcher, sig, mask, code, type, val) /* if FPU has current state, save it first */ if (p == machFPCurProcPtr) - MachSaveCurFPState(p); + MipsSaveCurFPState(p); bcopy((caddr_t)&p->p_md.md_regs[F0], (caddr_t)ksc.sc_fpregs, sizeof(ksc.sc_fpregs)); } @@ -1141,9 +1154,13 @@ boot(howto) if (howto & RB_DUMP) dumpsys(); printf("System restart.\n"); - delay(2000000); - (void)kbc_8042sysreset(); /* Try this first */ - delay(100000); /* Give it a chance */ +#if NPC > 0 + /* This is only done on systems with pccons driver */ + if(system_type != ALGOR_P4032) { + (void)kbc_8042sysreset(); /* Try this first */ + delay(100000); /* Give it a chance */ + } +#endif __asm__(" li $2, 0xbfc00000; jr $2; nop\n"); while(1); /* Forever */ } @@ -1261,7 +1278,7 @@ void initcpu() { - switch(cputype) { + switch(system_type) { case ACER_PICA_61: /* * Disable all interrupts. New masks will be set up diff --git a/sys/arch/arc/arc/mainbus.c b/sys/arch/arc/arc/mainbus.c deleted file mode 100644 index ffc636175da..00000000000 --- a/sys/arch/arc/arc/mainbus.c +++ /dev/null @@ -1,192 +0,0 @@ -/* $OpenBSD: mainbus.c,v 1.6 1997/04/19 17:19:45 pefo Exp $ */ - -/* - * 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 <arc/arc/arctype.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; - - /* - * Only one mainbus, but some people are stupid... - */ - if (cf->cf_unit > 0) - return(0); - - /* - * That one mainbus is always here. - */ - 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; - extern int cputype; - - 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); - - if (cputype == ACER_PICA_61) { - /* we have a PICA bus! */ - nca.ca_name = "pica"; - nca.ca_slot = 0; - nca.ca_offset = 0; - nca.ca_bus = &sc->sc_bus; - config_found(self, &nca, mbprint); - } - else if (cputype == ALGOR_P4032) { - /* we have an ALGOR bus! :-) */ - 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 (cputype == ALGOR_P4032) { - 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 (cputype == ACER_PICA_61 || - cputype == DESKSTATION_TYNE || - cputype == 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); - } -} - -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/arc/arc/mem.c b/sys/arch/arc/arc/mem.c deleted file mode 100644 index 15207b8bff2..00000000000 --- a/sys/arch/arc/arc/mem.c +++ /dev/null @@ -1,182 +0,0 @@ -/* $OpenBSD: mem.c,v 1.3 1997/04/19 17:19:45 pefo 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)); - -/*ARGSUSED*/ -int -mmopen(dev, flag, mode) - dev_t dev; - int flag, mode; -{ - - return (0); -} - -/*ARGSUSED*/ -int -mmclose(dev, flag, mode) - dev_t dev; - int flag, mode; -{ - - return (0); -} - -/*ARGSUSED*/ -int -mmrw(dev, uio, flags) - dev_t dev; - struct uio *uio; - int flags; -{ - register vm_offset_t v; - register int c; - register struct iovec *iov; - int error = 0; - - while (uio->uio_resid > 0 && error == 0) { - iov = uio->uio_iov; - if (iov->iov_len == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - if (uio->uio_iovcnt < 0) - panic("mmrw"); - continue; - } - switch (minor(dev)) { - -/* minor device 0 is physical memory */ - case 0: - v = uio->uio_offset; - c = iov->iov_len; - if (v + c > ctob(physmem)) - return (EFAULT); - v += CACHED_MEMORY_ADDR; - error = uiomove((caddr_t)v, c, uio); - continue; - -/* minor device 1 is kernel memory */ - case 1: - v = uio->uio_offset; - c = min(iov->iov_len, MAXPHYS); - if (v < CACHED_MEMORY_ADDR) - return (EFAULT); - if (v + c > PHYS_TO_CACHED(avail_end + - sizeof (struct msgbuf)) && - (v < KSEG2_ADDR || - !kernacc((caddr_t)v, c, - uio->uio_rw == UIO_READ ? B_READ : B_WRITE))) - return (EFAULT); - - error = uiomove((caddr_t)v, c, uio); - continue; - -/* minor device 2 is EOF/RATHOLE */ - case 2: - if (uio->uio_rw == UIO_WRITE) - uio->uio_resid = 0; - return (0); - -/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */ - case 12: - if (uio->uio_rw == UIO_WRITE) { - c = iov->iov_len; - break; - } - if (zeropage == NULL) { - zeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(zeropage, CLBYTES); - } - c = min(iov->iov_len, CLBYTES); - error = uiomove(zeropage, c, uio); - continue; - - default: - return (ENXIO); - } - if (error) - break; - iov->iov_base += c; - iov->iov_len -= c; - uio->uio_offset += c; - uio->uio_resid -= c; - } - return (error); -} - -/*ARGSUSED*/ -int -mmmmap(dev, off, prot) - dev_t dev; - int off, prot; -{ - - return (EOPNOTSUPP); -} diff --git a/sys/arch/arc/arc/minidebug.c b/sys/arch/arc/arc/minidebug.c deleted file mode 100644 index 565f6c930f2..00000000000 --- a/sys/arch/arc/arc/minidebug.c +++ /dev/null @@ -1,953 +0,0 @@ -/* $OpenBSD: minidebug.c,v 1.5 1997/04/19 17:19:46 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.5 1997/04/19 17:19:46 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 trapDump __P((char *)); -extern void stacktrace __P((void)); -extern u_int MachEmulateBranch __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; - - 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 = MachEmulateBranch(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/arc/arc/process_machdep.c b/sys/arch/arc/arc/process_machdep.c deleted file mode 100644 index 494bcf769fd..00000000000 --- a/sys/arch/arc/arc/process_machdep.c +++ /dev/null @@ -1,116 +0,0 @@ -/* $OpenBSD: process_machdep.c,v 1.2 1997/04/19 17:19:47 pefo Exp $ */ -/* - * Copyright (c) 1994 Adam Glass - * Copyright (c) 1993 The Regents of the University of California. - * Copyright (c) 1993 Jan-Simon Pendry - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Jan-Simon Pendry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: - * Id: procfs_i386.c,v 4.1 1993/12/17 10:47:45 jsp Rel - * - * $Id: process_machdep.c,v 1.2 1997/04/19 17:19:47 pefo 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/arc/arc/sys_machdep.c b/sys/arch/arc/arc/sys_machdep.c deleted file mode 100644 index 9ed89e266d4..00000000000 --- a/sys/arch/arc/arc/sys_machdep.c +++ /dev/null @@ -1,130 +0,0 @@ -/* $OpenBSD: sys_machdep.c,v 1.3 1997/04/19 17:19:47 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. - * - * @(#)sys_machdep.c 8.1 (Berkeley) 6/10/93 - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/ioctl.h> -#include <sys/file.h> -#include <sys/time.h> -#include <sys/proc.h> -#include <sys/uio.h> -#include <sys/kernel.h> -#include <sys/mtio.h> -#include <sys/buf.h> -#include <sys/trace.h> - -#include <sys/mount.h> -#include <sys/syscallargs.h> - -#ifdef TRACE -int nvualarm; - -vtrace(p, uap, retval) - struct proc *p; - register struct vtrace_args /* { - syscallarg(int) request; - syscallarg(int) value; - } */ *uap; - register_t *retval; -{ - int vdoualarm(); - - switch (SCARG(uap, request)) { - - case VTR_DISABLE: /* disable a trace point */ - case VTR_ENABLE: /* enable a trace point */ - if (SCARG(uap, value) < 0 || SCARG(uap, value) >= TR_NFLAGS) - return (EINVAL); - *retval = traceflags[SCARG(uap, value)]; - traceflags[SCARG(uap, value)] = SCARG(uap, request); - break; - - case VTR_VALUE: /* return a trace point setting */ - if (SCARG(uap, value) < 0 || SCARG(uap, value) >= TR_NFLAGS) - return (EINVAL); - *retval = traceflags[SCARG(uap, value)]; - break; - - case VTR_UALARM: /* set a real-time ualarm, less than 1 min */ - if (SCARG(uap, value) <= 0 || SCARG(uap, value) > 60 * hz || - nvualarm > 5) - return (EINVAL); - nvualarm++; - timeout(vdoualarm, (caddr_t)p->p_pid, SCARG(uap, value)); - break; - - case VTR_STAMP: - trace(TR_STAMP, SCARG(uap, value), p->p_pid); - break; - } - return (0); -} - -vdoualarm(arg) - int arg; -{ - register struct proc *p; - - p = pfind(arg); - if (p) - psignal(p, 16); - nvualarm--; -} -#endif - -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/arc/arc/trap.c b/sys/arch/arc/arc/trap.c index 49a8a58bdeb..68e26d9969d 100644 --- a/sys/arch/arc/arc/trap.c +++ b/sys/arch/arc/arc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.12 1997/07/23 07:00:39 denny Exp $ */ +/* $OpenBSD: trap.c,v 1.13 1998/01/28 13:46:00 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ * from: Utah Hdr: trap.c 1.32 91/04/06 * * from: @(#)trap.c 8.5 (Berkeley) 1/11/94 - * $Id: trap.c,v 1.12 1997/07/23 07:00:39 denny Exp $ + * $Id: trap.c,v 1.13 1998/01/28 13:46:00 pefo Exp $ */ #include "ppp.h" @@ -75,91 +75,91 @@ #include <vm/vm_page.h> #include <arc/pica/pica.h> -#include <arc/arc/arctype.h> +#include <mips/archtype.h> #include <sys/cdefs.h> #include <sys/syslog.h> struct proc *machFPCurProcPtr; /* pointer to last proc to use FP */ -extern void MachKernGenException __P((void)); -extern void MachUserGenException __P((void)); -extern void MachKernIntr __P((void)); -extern void MachUserIntr __P((void)); -extern void MachTLBModException __P((void)); -extern void MachTLBInvalidException __P((void)); +extern void MipsKernGenException __P((void)); +extern void MipsUserGenException __P((void)); +extern void MipsKernIntr __P((void)); +extern void MipsUserIntr __P((void)); +extern void MipsTLBModException __P((void)); +extern void MipsTLBInvalidException __P((void)); void (*machExceptionTable[])(void) = { /* * The kernel exception handlers. */ - MachKernIntr, /* external interrupt */ - MachKernGenException, /* TLB modification */ - MachTLBInvalidException, /* TLB miss (load or instr. fetch) */ - MachTLBInvalidException, /* TLB miss (store) */ - MachKernGenException, /* address error (load or I-fetch) */ - MachKernGenException, /* address error (store) */ - MachKernGenException, /* bus error (I-fetch) */ - MachKernGenException, /* bus error (load or store) */ - MachKernGenException, /* system call */ - MachKernGenException, /* breakpoint */ - MachKernGenException, /* reserved instruction */ - MachKernGenException, /* coprocessor unusable */ - MachKernGenException, /* arithmetic overflow */ - MachKernGenException, /* trap exception */ - MachKernGenException, /* viritual coherence exception inst */ - MachKernGenException, /* floating point exception */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* watch exception */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* reserved */ - MachKernGenException, /* viritual coherence exception data */ + MipsKernIntr, /* external interrupt */ + MipsKernGenException, /* TLB modification */ + MipsTLBInvalidException, /* TLB miss (load or instr. fetch) */ + MipsTLBInvalidException, /* TLB miss (store) */ + MipsKernGenException, /* address error (load or I-fetch) */ + MipsKernGenException, /* address error (store) */ + MipsKernGenException, /* bus error (I-fetch) */ + MipsKernGenException, /* bus error (load or store) */ + MipsKernGenException, /* system call */ + MipsKernGenException, /* breakpoint */ + MipsKernGenException, /* reserved instruction */ + MipsKernGenException, /* coprocessor unusable */ + MipsKernGenException, /* arithmetic overflow */ + MipsKernGenException, /* trap exception */ + MipsKernGenException, /* viritual coherence exception inst */ + MipsKernGenException, /* floating point exception */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* watch exception */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* reserved */ + MipsKernGenException, /* viritual coherence exception data */ /* * The user exception handlers. */ - MachUserIntr, /* 0 */ - MachUserGenException, /* 1 */ - MachUserGenException, /* 2 */ - MachUserGenException, /* 3 */ - MachUserGenException, /* 4 */ - MachUserGenException, /* 5 */ - MachUserGenException, /* 6 */ - MachUserGenException, /* 7 */ - MachUserGenException, /* 8 */ - MachUserGenException, /* 9 */ - MachUserGenException, /* 10 */ - MachUserGenException, /* 11 */ - MachUserGenException, /* 12 */ - MachUserGenException, /* 13 */ - MachUserGenException, /* 14 */ - MachUserGenException, /* 15 */ - MachUserGenException, /* 16 */ - MachUserGenException, /* 17 */ - MachUserGenException, /* 18 */ - MachUserGenException, /* 19 */ - MachUserGenException, /* 20 */ - MachUserGenException, /* 21 */ - MachUserGenException, /* 22 */ - MachUserGenException, /* 23 */ - MachUserGenException, /* 24 */ - MachUserGenException, /* 25 */ - MachUserGenException, /* 26 */ - MachUserGenException, /* 27 */ - MachUserGenException, /* 28 */ - MachUserGenException, /* 29 */ - MachUserGenException, /* 20 */ - MachUserGenException, /* 31 */ + MipsUserIntr, /* 0 */ + MipsUserGenException, /* 1 */ + MipsUserGenException, /* 2 */ + MipsUserGenException, /* 3 */ + MipsUserGenException, /* 4 */ + MipsUserGenException, /* 5 */ + MipsUserGenException, /* 6 */ + MipsUserGenException, /* 7 */ + MipsUserGenException, /* 8 */ + MipsUserGenException, /* 9 */ + MipsUserGenException, /* 10 */ + MipsUserGenException, /* 11 */ + MipsUserGenException, /* 12 */ + MipsUserGenException, /* 13 */ + MipsUserGenException, /* 14 */ + MipsUserGenException, /* 15 */ + MipsUserGenException, /* 16 */ + MipsUserGenException, /* 17 */ + MipsUserGenException, /* 18 */ + MipsUserGenException, /* 19 */ + MipsUserGenException, /* 20 */ + MipsUserGenException, /* 21 */ + MipsUserGenException, /* 22 */ + MipsUserGenException, /* 23 */ + MipsUserGenException, /* 24 */ + MipsUserGenException, /* 25 */ + MipsUserGenException, /* 26 */ + MipsUserGenException, /* 27 */ + MipsUserGenException, /* 28 */ + MipsUserGenException, /* 29 */ + MipsUserGenException, /* 20 */ + MipsUserGenException, /* 31 */ }; char *trap_type[] = { @@ -225,16 +225,15 @@ void logstacktrace __P((int, int, int, int)); /* extern functions printed by name in stack backtraces */ extern void idle __P((void)); -extern void MachTLBMiss __P((void)); +extern void MipsTLBMiss __P((void)); extern u_int mdbpeek __P((int)); extern int mdb __P((u_int, u_int, struct proc *, int)); #endif /* DEBUG */ extern const struct callback *callv; extern u_long intrcnt[]; -extern u_int cputype; -extern void MachSwitchFPState __P((struct proc *, int *)); -extern void MachFPTrap __P((u_int, u_int, u_int)); +extern void MipsSwitchFPState __P((struct proc *, int *)); +extern void MipsFPTrap __P((u_int, u_int, u_int)); extern void arpintr __P((void)); extern void ipintr __P((void)); extern void pppintr __P((void)); @@ -243,11 +242,11 @@ u_int trap __P((u_int, u_int, u_int, u_int, u_int)); void interrupt __P((u_int, u_int, u_int, u_int, u_int)); void softintr __P((u_int, u_int)); int cpu_singlestep __P((struct proc *)); -u_int MachEmulateBranch __P((int *, int, int, u_int)); +u_int MipsEmulateBranch __P((int *, int, int, u_int)); /* * Handle an exception. - * Called from MachKernGenException() or MachUserGenException() + * Called from MipsKernGenException() or MipsUserGenException() * when a processor trap occurs. * In the case of a kernel trap, we return the pc where to resume if * ((struct pcb *)UADDR)->pcb_onfault is set, otherwise, return old pc. @@ -481,7 +480,7 @@ trap(statusReg, causeReg, vadr, pc, args) cnt.v_syscall++; /* compute next PC after syscall instruction */ if ((int)causeReg < 0) - locr0[PC] = MachEmulateBranch(locr0, pc, 0, 0); + locr0[PC] = MipsEmulateBranch(locr0, pc, 0, 0); else locr0[PC] += 4; callp = p->p_emul->e_sysent; @@ -716,7 +715,7 @@ trap(statusReg, causeReg, vadr, pc, args) typ = ILL_ILLOPC; break; } - MachSwitchFPState(machFPCurProcPtr, p->p_md.md_regs); + MipsSwitchFPState(machFPCurProcPtr, p->p_md.md_regs); machFPCurProcPtr = p; p->p_md.md_regs[PS] |= SR_COP_1_BIT; p->p_md.md_flags |= MDP_FPUSED; @@ -732,7 +731,7 @@ trap(statusReg, causeReg, vadr, pc, args) #endif case T_FPE+T_USER: - MachFPTrap(statusReg, causeReg, pc); + MipsFPTrap(statusReg, causeReg, pc); goto out; case T_OVFLOW+T_USER: @@ -842,7 +841,7 @@ out: /* * Handle an interrupt. - * Called from MachKernIntr() or MachUserIntr() + * Called from MipsKernIntr() or MipsUserIntr() * Note: curproc might be NULL. */ void @@ -972,7 +971,7 @@ set_intr(mask, int_hand, prio) /* * Update external interrupt mask but don't enable clock. */ - switch(cputype) { + switch(system_type) { case ACER_PICA_61: case MAGNUM: out32(R4030_SYS_EXT_IMASK, cpu_int_mask & (~INT_MASK_4 >> 10)); @@ -988,7 +987,7 @@ set_intr(mask, int_hand, prio) } /* - * This is called from MachUserIntr() if astpending is set. + * This is called from MipsUserIntr() if astpending is set. * This is very similar to the tail of trap(). */ void @@ -1098,7 +1097,7 @@ arc_errintr() * Return the resulting PC as if the branch was executed. */ unsigned -MachEmulateBranch(regsPtr, instPC, fpcCSR, instptr) +MipsEmulateBranch(regsPtr, instPC, fpcCSR, instptr) int *regsPtr; int instPC; int fpcCSR; @@ -1159,7 +1158,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, instptr) break; default: - panic("MachEmulateBranch: Bad branch cond"); + panic("MipsEmulateBranch: Bad branch cond"); } break; @@ -1259,7 +1258,7 @@ cpu_singlestep(p) /* compute next address after current location */ if(curinstr != 0) { - va = MachEmulateBranch(locr0, locr0[PC], locr0[FSR], curinstr); + va = MipsEmulateBranch(locr0, locr0[PC], locr0[FSR], curinstr); } else { va = locr0[PC] + 4; @@ -1378,10 +1377,10 @@ specialframe: } /* Backtraces should contine through interrupts from kernel mode */ - if (pc >= (unsigned)MachKernIntr && pc < (unsigned)MachUserIntr) { + if (pc >= (unsigned)MipsKernIntr && pc < (unsigned)MipsUserIntr) { /* NOTE: the offsets depend on the code in locore.s */ - (*printfn)("MachKernIntr+%x: (%x, %x ,%x) -------\n", - pc-(unsigned)MachKernIntr, a0, a1, a2); + (*printfn)("MipsKernIntr+%x: (%x, %x ,%x) -------\n", + pc-(unsigned)MipsKernIntr, a0, a1, a2); a0 = mdbpeek(sp + 36); a1 = mdbpeek(sp + 40); a2 = mdbpeek(sp + 44); @@ -1404,14 +1403,14 @@ specialframe: * have a preceding "j ra" at the tail of the preceding function. * Depends on relative ordering of functions in locore. */ - if (pcBetween(MachKernGenException, MachUserGenException)) - subr = (unsigned) MachKernGenException; - else if (pcBetween(MachUserGenException,MachKernIntr)) - subr = (unsigned) MachUserGenException; - else if (pcBetween(MachKernIntr, MachUserIntr)) - subr = (unsigned) MachKernIntr; - else if (pcBetween(MachUserIntr, MachTLBInvalidException)) - subr = (unsigned) MachUserIntr; + if (pcBetween(MipsKernGenException, MipsUserGenException)) + subr = (unsigned) MipsKernGenException; + else if (pcBetween(MipsUserGenException,MipsKernIntr)) + subr = (unsigned) MipsUserGenException; + else if (pcBetween(MipsKernIntr, MipsUserIntr)) + subr = (unsigned) MipsKernIntr; + else if (pcBetween(MipsUserIntr, MipsTLBInvalidException)) + subr = (unsigned) MipsUserIntr; else if (pcBetween(splx, wbflush)) subr = (unsigned) splx; else if (pcBetween(cpu_switch, fuword)) @@ -1421,7 +1420,7 @@ specialframe: ra = 0; goto done; } - else if (pc >= (unsigned)MachTLBMiss && pc < (unsigned)setsoftclock) { + else if (pc >= (unsigned)MipsTLBMiss && pc < (unsigned)setsoftclock) { (*printfn)("<<locore>>"); goto done; } @@ -1574,10 +1573,10 @@ finish: static struct { void *addr; char *name;} names[] = { Name(interrupt), Name(trap), - Name(MachKernGenException), - Name(MachUserGenException), - Name(MachKernIntr), - Name(MachUserIntr), + Name(MipsKernGenException), + Name(MipsUserGenException), + Name(MipsKernIntr), + Name(MipsUserIntr), Name(splx), Name(idle), Name(cpu_switch), diff --git a/sys/arch/arc/arc/vm_machdep.c b/sys/arch/arc/arc/vm_machdep.c index 8b52468f036..247d27630a7 100644 --- a/sys/arch/arc/arc/vm_machdep.c +++ b/sys/arch/arc/arc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.6 1997/11/10 00:39:10 niklas Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.7 1998/01/28 13:46:00 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ * from: Utah Hdr: vm_machdep.c 1.21 91/04/06 * * from: @(#)vm_machdep.c 8.3 (Berkeley) 1/4/94 - * $Id: vm_machdep.c,v 1.6 1997/11/10 00:39:10 niklas Exp $ + * $Id: vm_machdep.c,v 1.7 1998/01/28 13:46:00 pefo Exp $ */ #include <sys/param.h> @@ -103,7 +103,7 @@ cpu_fork(p1, p2) * has state stored there. */ if (p1 == machFPCurProcPtr) - MachSaveCurFPState(p1); + MipsSaveCurFPState(p1); /* * Copy pcb and stack from proc p1 to p2. @@ -206,7 +206,7 @@ cpu_coredump(p, vp, cred, chdr) * has state stored there. */ if (p == machFPCurProcPtr) - MachSaveCurFPState(p); + MipsSaveCurFPState(p); CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MIPS, CORE_CPU); cseg.c_addr = 0; diff --git a/sys/arch/arc/conf/GENERIC b/sys/arch/arc/conf/GENERIC index 3155c8ed6f4..57c1d054877 100644 --- a/sys/arch/arc/conf/GENERIC +++ b/sys/arch/arc/conf/GENERIC @@ -1,9 +1,9 @@ -# $OpenBSD: GENERIC,v 1.23 1997/11/11 20:17:46 niklas Exp $ +# $OpenBSD: GENERIC,v 1.24 1998/01/28 13:46:01 pefo Exp $ # # Generic configuration file for MIPS R4x00 ARC Systems # -machine arc +machine arc mips maxusers 32 diff --git a/sys/arch/arc/conf/Makefile.arc b/sys/arch/arc/conf/Makefile.arc index 7a52c5d757e..4f4ced253cc 100644 --- a/sys/arch/arc/conf/Makefile.arc +++ b/sys/arch/arc/conf/Makefile.arc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.arc,v 1.9 1997/09/15 02:40:26 deraadt Exp $ +# $OpenBSD: Makefile.arc,v 1.10 1998/01/28 13:46:02 pefo Exp $ # @(#)Makefile.arc 8.2 (Berkeley) 2/16/94 # @@ -34,6 +34,7 @@ TOUCH?= touch -f -c # source tree is located via $S relative to the compilation directory S= ../../../.. ARC= ../.. +MIPS= ../../../mips INCLUDES= -I. -I$S/arch -I$S CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Darc @@ -124,13 +125,13 @@ symbols.sort: ${ARC}/arc/symbols.raw grep -v '^#' ${ARC}/arc/symbols.raw \ | sed 's/^ //' | sort -u > symbols.sort -locore.o: ${ARC}/arc/locore.S ${ARC}/include/asm.h \ - ${ARC}/include/cpu.h ${ARC}/include/reg.h assym.h +locore.o: ${ARC}/arc/locore.S ${MIPS}/include/asm.h \ + ${MIPS}/include/cpu.h ${MIPS}/include/reg.h assym.h ${NORMAL_S} -mips3 ${ARC}/arc/locore.S -fp.o: ${ARC}/arc/fp.S ${ARC}/include/asm.h \ - ${ARC}/include/cpu.h ${ARC}/include/reg.h assym.h - ${NORMAL_S} -mips3 ${ARC}/arc/fp.S +fp.o: ${MIPS}/mips/fp.S ${MIPS}/include/asm.h \ + ${ARC}/include/cpu.h ${MIPS}/include/reg.h assym.h + ${NORMAL_S} -mips3 ${MIPS}/mips/fp.S # the following are necessary because the files depend on the types of # cpu's included in the system configuration diff --git a/sys/arch/arc/conf/RAMDISK b/sys/arch/arc/conf/RAMDISK index 0c24354f712..6e71f4edade 100644 --- a/sys/arch/arc/conf/RAMDISK +++ b/sys/arch/arc/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.6 1997/08/01 11:31:23 deraadt Exp $ +# $OpenBSD: RAMDISK,v 1.7 1998/01/28 13:46:03 pefo Exp $ # # Generic configuration file for MIPS R4x00 ARC Systems # @@ -72,6 +72,8 @@ cpu* at mainbus0 pica* at mainbus0 # ACER Pica systems local bus. isabr* at mainbus0 # ISA Bus bridge (std ISA bus). +algor* at mainbus0 # P4032 PCI Bridge. +pbcpcibr* at mainbus0 # PCI Bus bridge. #### PICA bus devices @@ -89,6 +91,13 @@ fd* at fdc? drive ? asc0 at pica? scsibus* at asc? +#### Algor bus devices + +clock0 at algor? +com0 at algor? +com1 at algor? +lpt0 at algor? + #### ISA Bus. isa* at isabr? @@ -117,6 +126,15 @@ ed2 at isa? port 0x300 iomem 0xcc000 irq 10 # btl0 at isa? port 0x330 irq ? drq ? scsibus* at btl? +#### PCI Bus + +pci* at pbcpcibr? + +de* at pci? dev ? function ? +ncr* at pci? dev ? function ? +scsibus* at ncr? + + #### SCSI Bus devices sd* at scsibus? target ? lun ? @@ -137,7 +155,7 @@ pseudo-device ppp 2 # serial-line PPP ports #pseudo-device pty 64 # pseudo ptys #pseudo-device tb 1 # tablet line discipline #pseudo-device vnd 4 # paging to files -#pseudo-device ccd 4 # concatenated disk devices +#pseudo-device ccd 4 # concatenated disk devices pseudo-device rd 1 # Ram disk. # RAMDISK stuff diff --git a/sys/arch/arc/conf/files.arc b/sys/arch/arc/conf/files.arc index 493e741141a..d215e6bc1f2 100644 --- a/sys/arch/arc/conf/files.arc +++ b/sys/arch/arc/conf/files.arc @@ -1,4 +1,4 @@ -# $OpenBSD: files.arc,v 1.16 1997/12/27 12:13:13 niklas Exp $ +# $OpenBSD: files.arc,v 1.17 1998/01/28 13:46:03 pefo Exp $ # # maxpartitions must be first item in files.${ARCH} # @@ -10,19 +10,13 @@ maxusers 2 8 64 file arch/arc/arc/autoconf.c file arch/arc/arc/conf.c -file arch/arc/arc/cpu_exec.c -file arch/arc/arc/disksubr.c file arch/arc/dev/dma.c file arch/arc/arc/machdep.c -file arch/arc/arc/minidebug.c -file arch/arc/arc/mem.c file arch/arc/arc/pmap.c -file arch/arc/arc/process_machdep.c -file arch/arc/arc/sys_machdep.c file arch/arc/arc/trap.c file arch/arc/arc/vm_machdep.c -file arch/arc/arc/arcbios.c +file arch/mips/mips/arcbios.c # # Machine-independent ATAPI drivers @@ -36,12 +30,12 @@ major { acd = 5 } define mainbus {} device mainbus attach mainbus at root -file arch/arc/arc/mainbus.c mainbus +file arch/mips/mips/mainbus.c mainbus # Our CPU configurator device cpu attach cpu at mainbus # not optional -file arch/arc/arc/cpu.c cpu +file arch/mips/mips/cpu.c cpu # # PICA bus autoconfiguration devices @@ -108,7 +102,6 @@ device clock attach clock at pica with clock_pica attach clock at isa with clock_isa attach clock at algor with clock_algor -file arch/arc/arc/clock.c clock & (clock_isa | clock_pica | clock_algor) needs-flag file arch/arc/arc/clock_mc.c clock & (clock_isa | clock_pica | clock_algor) needs-flag # Console driver on PC-style graphics diff --git a/sys/arch/arc/dev/asc.c b/sys/arch/arc/dev/asc.c index 2a515e7a28f..5ab32e0f1ca 100644 --- a/sys/arch/arc/dev/asc.c +++ b/sys/arch/arc/dev/asc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asc.c,v 1.6 1997/08/01 23:39:23 deraadt Exp $ */ +/* $OpenBSD: asc.c,v 1.7 1998/01/28 13:46:04 pefo Exp $ */ /* $NetBSD: asc.c,v 1.10 1994/12/05 19:11:12 dean Exp $ */ /*- @@ -138,16 +138,17 @@ #include <machine/cpu.h> #include <machine/autoconf.h> +#include <mips/archtype.h> + #include <arc/dev/dma.h> #include <arc/dev/scsi.h> #include <arc/dev/ascreg.h> #include <arc/pica/pica.h> -#include <arc/arc/arctype.h> #define readback(a) { register int foo; foo = (a); } -extern int cputype; +extern int system_type; /* * In 4ns ticks. @@ -533,7 +534,7 @@ ascattach(parent, self, aux) * 1) how to do dma * 2) timing based on chip clock frequency */ - switch (cputype) { + switch (system_type) { case ACER_PICA_61: bufsiz = 63 * 1024; /*XXX check if code handles 0 as 64k */ asc->dma = &asc->__dma; @@ -545,7 +546,7 @@ ascattach(parent, self, aux) /* * Now for timing. The pica has a 25Mhz */ - switch (cputype) { + switch (system_type) { case ACER_PICA_61: asc->min_period = ASC_MIN_PERIOD25; asc->max_period = ASC_MAX_PERIOD25; diff --git a/sys/arch/arc/dev/pccons.c b/sys/arch/arc/dev/pccons.c index 58a057f54da..55308d76511 100644 --- a/sys/arch/arc/dev/pccons.c +++ b/sys/arch/arc/dev/pccons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pccons.c,v 1.15 1997/05/19 16:01:07 pefo Exp $ */ +/* $OpenBSD: pccons.c,v 1.16 1998/01/28 13:46:05 pefo Exp $ */ /* $NetBSD: pccons.c,v 1.89 1995/05/04 19:35:20 cgd Exp $ */ /*- @@ -71,8 +71,10 @@ #include <machine/autoconf.h> #include <machine/display.h> #include <machine/pccons.h> -#include <arc/arc/arctype.h> -#include <arc/arc/arcbios.h> + +#include <mips/archtype.h> +#include <arch/mips/mips/arcbios.h> + #include <arc/pica/pica.h> #include <arc/dti/desktech.h> @@ -80,7 +82,7 @@ #include <arc/isa/isa_machdep.h> #include <machine/kbdreg.h> -extern int cputype; +extern int system_type; #define XFREE86_BUG_COMPAT @@ -579,7 +581,7 @@ pcattach(parent, self, aux) printf(": %s\n", vs.color ? "color" : "mono"); do_async_update(1); - switch(cputype) { + switch(system_type) { case ACER_PICA_61: BUS_INTR_ESTABLISH(ca, pcintr, (void *)(long)sc); break; @@ -858,7 +860,7 @@ pccnprobe(cp) /* initialize required fields */ cp->cn_dev = makedev(maj, 0); - if(cputype == ALGOR_P4032) { + if(system_type == ALGOR_P4032) { cp->cn_pri = CN_DEAD; /* XXX For now... */ } else { @@ -876,7 +878,7 @@ pccninit(cp) * For now, don't screw with it. */ /* crtat = 0; */ - switch(cputype) { + switch(system_type) { case ACER_PICA_61: mono_base += PICA_V_LOCAL_VIDEO_CTRL; @@ -888,14 +890,15 @@ pccninit(cp) break; case DESKSTATION_TYNE: - mono_base += TYNE_V_ISA_IO; - mono_buf += TYNE_V_ISA_MEM; - cga_base += TYNE_V_ISA_IO; - cga_buf += TYNE_V_ISA_MEM; - kbd_cmdp = TYNE_V_ISA_IO + 0x64; - kbd_datap = TYNE_V_ISA_IO + 0x60; - outb(TYNE_V_ISA_IO + 0x3ce, 6); /* Correct video mode */ - outb(TYNE_V_ISA_IO + 0x3cf, inb(TYNE_V_ISA_IO + 0x3cf) | 0xc); + mono_base += arc_bus_io.bus_base; + mono_buf += arc_bus_mem.bus_base; + cga_base += arc_bus_io.bus_base; + cga_buf += arc_bus_mem.bus_base; + kbd_cmdp = arc_bus_io.bus_base + 0x64; + kbd_datap = arc_bus_io.bus_base + 0x60; + outb(arc_bus_io.bus_base + 0x3ce, 6); /* Correct video mode */ + outb(arc_bus_io.bus_base + 0x3cf, + inb(arc_bus_io.bus_base + 0x3cf) | 0xc); kbc_put8042cmd(CMDBYTE); /* Want XT codes.. */ break; @@ -908,6 +911,15 @@ pccninit(cp) kbd_datap = arc_bus_io.bus_base + 0x60; kbc_put8042cmd(CMDBYTE); /* Want XT codes.. */ break; + + case SNI_RM200: + mono_base += arc_bus_io.bus_base; + mono_buf += arc_bus_mem.bus_base; + cga_base += arc_bus_io.bus_base; + cga_buf += arc_bus_mem.bus_base; + kbd_cmdp = arc_bus_io.bus_base + 0x64; + kbd_datap = arc_bus_io.bus_base + 0x60; + break; } } @@ -1896,7 +1908,7 @@ pcmmap(dev, offset, nprot) int nprot; { - switch(cputype) { + switch(system_type) { case ACER_PICA_61: if (offset >= 0xa0000 && offset < 0xc0000) diff --git a/sys/arch/arc/dti/btl.c b/sys/arch/arc/dti/btl.c index 823758b33f3..7721241efa8 100644 --- a/sys/arch/arc/dti/btl.c +++ b/sys/arch/arc/dti/btl.c @@ -69,7 +69,7 @@ #include <dev/isa/isavar.h> #include <arc/dti/btlreg.h> -#include <arc/arc/arctype.h> /* XXX for cpu types */ +#include <mips/archtype.h> /* XXX for cpu types */ #ifndef DDB #define Debugger() panic("should call debugger here (bt742a.c)") @@ -100,11 +100,11 @@ struct bt_mbx { struct bt_mbx_in *tmbi; /* Target Mail Box in */ }; -extern int cputype; /* XXX */ +extern int system_type; /* XXX */ -#define KVTOPHYS(x) ((cputype == DESKSTATION_TYNE) ? \ +#define KVTOPHYS(x) ((system_type == DESKSTATION_TYNE) ? \ (((int)(x) & 0x7fffff) | 0x800000) : ((int)(x))) -#define PHYSTOKV(x) ((cputype == DESKSTATION_TYNE) ? \ +#define PHYSTOKV(x) ((system_type == DESKSTATION_TYNE) ? \ (((int)(x) & 0x7fffff) | TYNE_V_BOUNCE) : ((int)(x))) #include "aha.h" @@ -391,7 +391,7 @@ btattach(parent, self, aux) /* * create mbox area */ - if (cputype == DESKSTATION_TYNE) { + if (system_type == DESKSTATION_TYNE) { bouncebase = TYNE_V_BOUNCE; bouncesize = TYNE_S_BOUNCE; } else { diff --git a/sys/arch/arc/include/ansi.h b/sys/arch/arc/include/ansi.h index 9bc77c35c23..db58e5e7792 100644 --- a/sys/arch/arc/include/ansi.h +++ b/sys/arch/arc/include/ansi.h @@ -1,77 +1,5 @@ -/* $OpenBSD: ansi.h,v 1.4 1997/07/07 05:56:35 millert Exp $ */ -/* $NetBSD: ansi.h,v 1.5 1994/10/26 21:09:33 cgd Exp $ */ +/* $OpenBSD: ansi.h,v 1.5 1998/01/28 13:46:08 pefo 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 - */ +/* Use Mips generic include file */ -#ifndef _ANSI_H_ -#define _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_RUNE_T_ int /* rune_t */ - -#endif /* _ANSI_H_ */ +#include <mips/ansi.h> diff --git a/sys/arch/arc/include/asm.h b/sys/arch/arc/include/asm.h index bd2fdeea297..d768eed6956 100644 --- a/sys/arch/arc/include/asm.h +++ b/sys/arch/arc/include/asm.h @@ -1,206 +1,5 @@ -/* $OpenBSD: asm.h,v 1.6 1997/05/11 16:23:42 pefo Exp $ */ +/* $OpenBSD: asm.h,v 1.7 1998/01/28 13:46:09 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. - */ +/* Use Mips generic include file */ -#ifndef _MACHASMDEFS -#define _MACHASMDEFS - -#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 - */ -#ifdef MIPSEL -#define LWLO lwl -#define LWHI lwr -#define SWLO swl -#define SWHI swr -#endif -#ifdef 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 - -#define STAND_FRAME_SIZE 24 -#define STAND_RA_OFFSET 20 - -/* - * 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 /* _MACHASMDEFS */ +#include <mips/asm.h> diff --git a/sys/arch/arc/include/cdefs.h b/sys/arch/arc/include/cdefs.h index d60f7476119..1b2aa7463a9 100644 --- a/sys/arch/arc/include/cdefs.h +++ b/sys/arch/arc/include/cdefs.h @@ -1,39 +1,5 @@ -/* $OpenBSD: cdefs.h,v 1.1 1996/06/24 09:07:17 pefo Exp $ */ -/* $NetBSD: cdefs.h,v 1.3 1995/05/03 06:04:54 mellon Exp $ */ +/* $OpenBSD: cdefs.h,v 1.2 1998/01/28 13:46:10 pefo 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. - */ +/* Use Mips generic include file */ -#ifndef _MACHINE_CDEFS_H_ -#define _MACHINE_CDEFS_H_ - -#define _C_LABEL(x) _STRING(x) - -#define __indr_references(sym,msg) /* nothing */ -#define __warn_references(sym,msg) /* nothing */ - -#endif /* !_MACHINE_CDEFS_H_ */ +#include <mips/cdefs.h> diff --git a/sys/arch/arc/include/cpu.h b/sys/arch/arc/include/cpu.h index b8994e12922..e97f1c9d1b4 100644 --- a/sys/arch/arc/include/cpu.h +++ b/sys/arch/arc/include/cpu.h @@ -1,445 +1,5 @@ -/* $OpenBSD: cpu.h,v 1.8 1997/04/19 17:19:56 pefo Exp $ */ +/* $OpenBSD: cpu.h,v 1.9 1998/01/28 13:46:10 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 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 - */ +/* Use Mips generic include file */ -#ifndef _CPU_H_ -#define _CPU_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) - -#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 0x7f00 -#define INT_MASK_5 0x8000 /* Not used (on chip timer) */ -#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 0x7c00 -#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_TLB_HI $10 -#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_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)) - -/* - * 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 - -/* - * Kernel virtual address for user page table entries - * (i.e., the address for the context register). - */ -#define VMPTE_BASE 0xFF800000 - -#endif /* _KERNEL */ - -/* - * 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 */ - -/* - * 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_UNKC2 0x0c /* 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_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_RM5230 0x28 /* QED RM5230 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 RM5230 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)); -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 MachSaveCurFPState __P((struct proc *)); -#ifdef DEBUG -void mdbpanic __P((void)); -#endif - -#endif - -/* - * Enable realtime clock (always enabled). - */ -#define enablertclock() - -#endif /* _CPU_H_ */ +#include <mips/cpu.h> diff --git a/sys/arch/arc/include/dlfcn.h b/sys/arch/arc/include/dlfcn.h index 33ebe265ddc..f6c31713664 100644 --- a/sys/arch/arc/include/dlfcn.h +++ b/sys/arch/arc/include/dlfcn.h @@ -1,42 +1,5 @@ -/* $OpenBSD: dlfcn.h,v 1.1 1996/10/06 19:59:57 pefo Exp $ */ +/* $OpenBSD: dlfcn.h,v 1.2 1998/01/28 13:46:11 pefo Exp $ */ -/* - * Copyright (c) 1996 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ +/* Use Mips generic include file */ -#ifndef _DLFCN_H -#define _DLFCN_H 1 - -/* - * This is a dummy file. Empty until libdl has been done. - */ - -#endif /* _DLFCN_H */ +#include <mips/dlfcn.h> diff --git a/sys/arch/arc/include/ecoff.h b/sys/arch/arc/include/ecoff.h index 53a443c2938..54e7da74449 100644 --- a/sys/arch/arc/include/ecoff.h +++ b/sys/arch/arc/include/ecoff.h @@ -1,94 +1,5 @@ -/* $OpenBSD: ecoff.h,v 1.3 1996/10/02 21:47:53 pefo Exp $ */ -/* $NetBSD: ecoff.h,v 1.4 1995/06/16 02:07:33 mellon Exp $ */ +/* $OpenBSD: ecoff.h,v 1.4 1998/01/28 13:46:11 pefo Exp $ */ -/* - * Copyright (c) 1994 Adam Glass - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Adam Glass. - * 4. The name of the Author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL Adam Glass BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#define ECOFF_LDPGSZ 4096 - -#define ECOFF_PAD - -#define ECOFF_MACHDEP \ - u_long ea_gprmask; \ - u_long ea_cprmask[4]; \ - u_long ea_gp_value - -#define ECOFF_MAGIC_MIPSEL 0x0162 -#define ECOFF_BADMAG(ex) ((ex)->f.f_magic != ECOFF_MAGIC_MIPSEL) - -#define ECOFF_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16) - -struct ecoff_symhdr { - int16_t sh_magic; - int16_t sh_vstamp; - int32_t sh_linemax; - int32_t sh_densenummax; - int32_t sh_procmax; - int32_t sh_lsymmax; - int32_t sh_optsymmax; - int32_t sh_auxxymmax; - int32_t sh_lstrmax; - int32_t sh_estrmax; - int32_t sh_fdmax; - int32_t sh_rfdmax; - int32_t sh_esymmax; - long sh_linesize; - long sh_lineoff; - long sh_densenumoff; - long sh_procoff; - long sh_lsymoff; - long sh_optsymoff; - long sh_auxsymoff; - long sh_lstroff; - long sh_estroff; - long sh_fdoff; - long sh_rfdoff; - long sh_esymoff; -}; -/* Some day they will make up their minds.... */ -#define esymMax sh_esymmax -#define cbExtOffset sh_esymoff -#define cbSsExtOffset sh_estroff - -struct ecoff_extsym { - long es_value; - int es_strindex; - unsigned es_type:6; - unsigned es_class:5; - unsigned :1; - unsigned es_symauxindex:20; - unsigned es_jmptbl:1; - unsigned es_cmain:1; - unsigned es_weakext:1; - unsigned :29; - int es_indexfld; -}; +/* Use Mips generic include file */ +#include <mips/ecoff.h> diff --git a/sys/arch/arc/include/elf_abi.h b/sys/arch/arc/include/elf_abi.h index 4290c15563a..64ae3cddc2b 100644 --- a/sys/arch/arc/include/elf_abi.h +++ b/sys/arch/arc/include/elf_abi.h @@ -1,58 +1,5 @@ -/* $OpenBSD: elf_abi.h,v 1.2 1996/12/11 05:55:34 imp Exp $ */ +/* $OpenBSD: elf_abi.h,v 1.3 1998/01/28 13:46:12 pefo Exp $ */ -/* - * Copyright (c) 1996 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ +/* Use Mips generic include file */ -/* 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) +#include <mips/elf_abi.h> diff --git a/sys/arch/arc/include/float.h b/sys/arch/arc/include/float.h index 674f280736e..0196b10f37a 100644 --- a/sys/arch/arc/include/float.h +++ b/sys/arch/arc/include/float.h @@ -1,81 +1,5 @@ -/* $OpenBSD: float.h,v 1.3 1997/08/01 21:35:26 deraadt Exp $ */ -/* $NetBSD: float.h,v 1.7 1995/06/20 20:45:50 jtc Exp $ */ +/* $OpenBSD: float.h,v 1.4 1998/01/28 13:46:13 pefo 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 - */ +/* Use Mips generic include file */ -#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_ */ +#include <mips/float.h> diff --git a/sys/arch/arc/include/ieeefp.h b/sys/arch/arc/include/ieeefp.h index 898094c474a..16d15693847 100644 --- a/sys/arch/arc/include/ieeefp.h +++ b/sys/arch/arc/include/ieeefp.h @@ -1,25 +1,5 @@ -/* $OpenBSD: ieeefp.h,v 1.1 1996/06/24 09:07:17 pefo Exp $ */ +/* $OpenBSD: ieeefp.h,v 1.2 1998/01/28 13:46:14 pefo Exp $ */ -/* - * Written by J.T. Conklin, Apr 11, 1995 - * Public domain. - */ +/* Use Mips generic include file */ -#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_ */ +#include <mips/ieeefp.h> diff --git a/sys/arch/arc/include/intr.h b/sys/arch/arc/include/intr.h index 1d5cf50c665..2d080522d6c 100644 --- a/sys/arch/arc/include/intr.h +++ b/sys/arch/arc/include/intr.h @@ -71,104 +71,6 @@ void set_intr __P((int, int(*)(u_int, struct clockframe *), int)); volatile int cpl, ipending, astpending; int imask[7]; -#if 0 -extern void Xspllower __P((void)); - -static __inline int splraise __P((int)); -static __inline int spllower __P((int)); -static __inline void splx __P((int)); -static __inline void softintr __P((int)); - -/* - * Add a mask to cpl, and return the old value of cpl. - */ -static __inline int -splraise(ncpl) - register int ncpl; -{ - register int ocpl = cpl; - - cpl = ocpl | ncpl; - return (ocpl); -} - -/* - * Restore a value to cpl (unmasking interrupts). If any unmasked - * interrupts are pending, call Xspllower() to process them. - */ -static __inline void -splx(ncpl) - register int ncpl; -{ - - cpl = ncpl; - if (ipending & ~ncpl) - Xspllower(); -} - -/* - * Same as splx(), but we return the old value of spl, for the - * benefit of some splsoftclock() callers. - */ -static __inline int -spllower(ncpl) - register int ncpl; -{ - register int ocpl = cpl; - - cpl = ncpl; - if (ipending & ~ncpl) - Xspllower(); - return (ocpl); -} -#endif - -/* - * Hardware interrupt masks - */ -#if 0 -#define splbio() splraise(imask[IPL_BIO]) -#define splnet() splraise(imask[IPL_NET]) -#define spltty() splraise(imask[IPL_TTY]) -#define splclock() splraise(imask[IPL_CLOCK]) -#define splimp() splraise(imask[IPL_IMP]) -#define splstatclock() splclock() - -/* - * Software interrupt masks - * - * NOTE: splsoftclock() is used by hardclock() to lower the priority from - * clock to softclock before it calls softclock(). - */ -#define splsoftclock() spllower(SIR_CLOCKMASK) -#define splsoftnet() splraise(SIR_NETMASK) -#define splsofttty() splraise(SIR_TTYMASK) - -/* - * Miscellaneous - */ -#define splhigh() splraise(-1) -#define spl0() spllower(0) - -/* - * Software interrupt registration - * - * We hand-code this to ensure that it's atomic. - */ -static __inline void -softintr(mask) - register int mask; -{ - - __asm __volatile("orl %0,_ipending" : : "ir" (mask)); -} - -#define setsoftast() (astpending = 1) -#define setsoftclock() softintr(1 << SIR_CLOCK) -#define setsoftnet() softintr(1 << SIR_NET) -#define setsofttty() softintr(1 << SIR_TTY) -#endif - #endif /* _LOCORE */ #endif /* _ARC_INTR_H_ */ diff --git a/sys/arch/arc/include/kcore.h b/sys/arch/arc/include/kcore.h index ce62986fe0e..52131fd69b6 100644 --- a/sys/arch/arc/include/kcore.h +++ b/sys/arch/arc/include/kcore.h @@ -1,45 +1,5 @@ -/* $OpenBSD: kcore.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ -/* $NetBSD: kcore.h,v 1.1 1996/03/10 21:55:18 leo Exp $ */ +/* $OpenBSD: kcore.h,v 1.2 1998/01/28 13:46:15 pefo 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. - */ +/* Use Mips generic include file */ -#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_ */ +#include <mips/kcore.h> diff --git a/sys/arch/arc/include/kdbparam.h b/sys/arch/arc/include/kdbparam.h index 511ab733778..91bf9d081aa 100644 --- a/sys/arch/arc/include/kdbparam.h +++ b/sys/arch/arc/include/kdbparam.h @@ -1,75 +1,5 @@ -/* $OpenBSD: kdbparam.h,v 1.1 1996/06/24 09:07:17 pefo Exp $ */ -/* $NetBSD: kdbparam.h,v 1.4 1994/10/26 21:09:42 cgd Exp $ */ +/* $OpenBSD: kdbparam.h,v 1.2 1998/01/28 13:46:16 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. - * - * @(#)kdbparam.h 8.1 (Berkeley) 6/10/93 - */ +/* Use Mips generic include file */ -/* - * 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)); +#include <mips/kdbparam.h> diff --git a/sys/arch/arc/include/limits.h b/sys/arch/arc/include/limits.h index 63f5ea45202..641a7aaf265 100644 --- a/sys/arch/arc/include/limits.h +++ b/sys/arch/arc/include/limits.h @@ -1,106 +1,5 @@ -/* $OpenBSD: limits.h,v 1.2 1997/07/24 14:48:46 deraadt Exp $ */ -/* $NetBSD: limits.h,v 1.8 1995/03/28 18:19:16 jtc Exp $ */ +/* $OpenBSD: limits.h,v 1.3 1998/01/28 13:46:17 pefo 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 - */ +/* Use Mips generic include file */ -#ifndef _MACHINE_LIMITS_H_ -#define _MACHINE_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 */ - -/* 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 */ - -#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 /* _MACHINE_LIMITS_H_ */ +#include <mips/limits.h> diff --git a/sys/arch/arc/include/link.h b/sys/arch/arc/include/link.h index 39e137ff191..0f67c7222de 100644 --- a/sys/arch/arc/include/link.h +++ b/sys/arch/arc/include/link.h @@ -1,125 +1,5 @@ -/* $OpenBSD: link.h,v 1.2 1996/12/11 05:55:35 imp Exp $ */ +/* $OpenBSD: link.h,v 1.3 1998/01/28 13:46:18 pefo Exp $ */ -/* - * Copyright (c) 1996 Per Fogelstrom - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed under OpenBSD by - * Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ +/* Use Mips generic include file */ -#ifndef _LINK_H -#define _LINK_H 1 - -#include <elf_abi.h> -#include <machine/elf_abi.h> - -/* - * Debug rendezvous struct. Pointer to this is set up in the - * target code pointed by the DT_MIPS_RLD_MAP tag. If it is - * defined. - */ - -struct r_debug { - int r_version; /* Protocol version. */ - struct link_map *r_map; /* Head of list of loaded objects. */ - - /* This is the address of a function internal to the run-time linker, - that will always be called when the linker begins to map in a - library or unmap it, and again when the mapping change is complete. - The debugger can set a breakpoint at this address if it wants to - notice shared object mapping changes. */ - Elf32_Addr r_brk; - enum { - /* This state value describes the mapping change taking place when - the `r_brk' address is called. */ - RT_CONSISTENT, /* Mapping change is complete. */ - RT_ADD, /* Adding a new object. */ - RT_DELETE, /* Removing an object mapping. */ - } r_state; - - Elf32_Addr r_ldbase; /* Base address the linker is loaded at. */ - }; - -/* This symbol refers to the "dynamic structure" in the `.dynamic' section - of whatever module refers to `_DYNAMIC'. So, to find its own - `struct r_debug', a program could do: - for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL) - if (dyn->d_tag == DT_MIPS_RLD_MAP) r_debug = (struct r_debug) dyn->d_un.d_ptr; - */ - -extern Elf32_Dyn _DYNAMIC[]; - - -/* Structure describing a loaded shared object. The `l_next' and `l_prev' - members form a chain of all the shared objects loaded at startup. - - These data structures exist in space used by the run-time dynamic linker; - modifying them may have disastrous results. */ - -struct link_map - { - /* These first few members are part of the protocol with the debugger. - This is the same format used in SVR4. */ - - Elf32_Addr l_addr; /* Base address shared object is loaded at. */ - Elf32_Addr l_offs; /* Offset */ - char *l_name; /* Absolute file name object was found in. */ - Elf32_Dyn *l_ld; /* Dynamic section of the shared object. */ - struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ - - /* All following members are internal to the dynamic linker. - They may change without notice. */ - - const char *l_libname; /* Name requested (before search). */ - - /* Indexed pointers to dynamic section. */ - Elf32_Dyn *l_info[DT_NUM + DT_PROCNUM]; - - const Elf32_Phdr *l_phdr; /* Pointer to program header table in core. */ - Elf32_Word l_phnum; /* Number of program header entries. */ - Elf32_Addr l_entry; /* Entry point location. */ - - /* Symbol hash table. */ - Elf32_Word l_nbuckets; - const Elf32_Word *l_buckets, *l_chain; - - unsigned int l_opencount; /* Reference count for dlopen/dlclose. */ - enum /* Where this object came from. */ - { - lt_executable, /* The main executable program. */ - lt_interpreter, /* The interpreter: the dynamic linker. */ - lt_library, /* Library needed by main executable. */ - lt_loaded, /* Extra run-time loaded shared object. */ - } l_type:2; - unsigned int l_deps_loaded:1; /* Nonzero if DT_NEEDED items loaded. */ - unsigned int l_relocated:1; /* Nonzero if object's relocations done. */ - unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */ - unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */ - }; - -#endif /* _LINK_H */ +#include <mips/link.h> diff --git a/sys/arch/arc/include/memconf.h b/sys/arch/arc/include/memconf.h index 3064c1a04cd..3a6171bc8ad 100644 --- a/sys/arch/arc/include/memconf.h +++ b/sys/arch/arc/include/memconf.h @@ -1,50 +1,5 @@ -/* $OpenBSD: memconf.h,v 1.2 1996/09/14 15:58:26 pefo Exp $ */ +/* $OpenBSD: memconf.h,v 1.3 1998/01/28 13:46:18 pefo Exp $ */ -/* - * Copyright (c) 1996 Per Fogelstrom - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Per Fogelstrom. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ +/* Use Mips generic include file */ -/* - * Memory config list used by pmap_bootstrap. - */ - -#ifndef _MEMCONF_H_ -#define _MEMCONF_H_ - -struct mem_descriptor { - vm_offset_t mem_start; - u_int mem_size; -}; - -#ifdef _KERNEL -#define MAXMEMSEGS 16 -extern struct mem_descriptor mem_layout[]; -#endif - -#endif +#include <mips/memconf.h> diff --git a/sys/arch/arc/include/mips_opcode.h b/sys/arch/arc/include/mips_opcode.h index 5af5668d88c..dbe46558fd0 100644 --- a/sys/arch/arc/include/mips_opcode.h +++ b/sys/arch/arc/include/mips_opcode.h @@ -1,260 +1,5 @@ -/* $OpenBSD: mips_opcode.h,v 1.1 1996/06/24 09:07:17 pefo Exp $ */ +/* $OpenBSD: mips_opcode.h,v 1.2 1998/01/28 13:46:19 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: @(#)mips_opcode.h 8.1 (Berkeley) 6/10/93 - */ +/* Use Mips generic include file */ -/* - * Define the instruction formats and opcode values for the - * MIPS instruction set. - */ - -/* - * Define the instruction formats. - */ -typedef union { - unsigned word; - -#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 +#include <mips/mips_opcode.h> diff --git a/sys/arch/arc/include/param.h b/sys/arch/arc/include/param.h index 98c21b7f2ff..228ef65091f 100644 --- a/sys/arch/arc/include/param.h +++ b/sys/arch/arc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.9 1997/04/30 09:54:15 niklas Exp $ */ +/* $OpenBSD: param.h,v 1.10 1998/01/28 13:46:20 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -41,10 +41,16 @@ * from: @(#)param.h 8.1 (Berkeley) 6/10/93 */ -#ifndef _ARC_PARAM_H_ -#define _ARC_PARAM_H_ +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ -#include <machine/intr.h> +#ifdef _KERNEL +#ifdef _LOCORE +#include <machine/psl.h> +#else +#include <machine/cpu.h> +#endif +#endif /* * Machine dependent constants for ARC BIOS MIPS machines: @@ -57,7 +63,6 @@ #define _MACHINE arc #define MACHINE_ARCH "mips" #define _MACHINE_ARCH mips -#define MID_MACHINE MID_PMAX /* XXX Bogus, but needed for now... */ /* * Round p (pointer or byte index) up to a correctly-aligned value for all @@ -149,7 +154,7 @@ #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) /* - * Mach derived conversion macros + * Conversion macros */ #define mips_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) #define mips_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) @@ -158,14 +163,14 @@ #ifdef _KERNEL #ifndef _LOCORE -extern int (*Mach_splnet)(void), (*Mach_splbio)(void), (*Mach_splimp)(void), - (*Mach_spltty)(void), (*Mach_splclock)(void), (*Mach_splstatclock)(void); -#define splnet() ((*Mach_splnet)()) -#define splbio() ((*Mach_splbio)()) -#define splimp() ((*Mach_splimp)()) -#define spltty() ((*Mach_spltty)()) -#define splclock() ((*Mach_splclock)()) -#define splstatclock() ((*Mach_splstatclock)()) +extern int (*Mips_splnet)(void), (*Mips_splbio)(void), (*Mips_splimp)(void), + (*Mips_spltty)(void), (*Mips_splclock)(void), (*Mips_splstatclock)(void); +#define splnet() ((*Mips_splnet)()) +#define splbio() ((*Mips_splbio)()) +#define splimp() ((*Mips_splimp)()) +#define spltty() ((*Mips_spltty)()) +#define splclock() ((*Mips_splclock)()) +#define splstatclock() ((*Mips_splstatclock)()) int splhigh __P((void)); int splx __P((int)); @@ -184,4 +189,4 @@ void delay __P((int)); #define DELAY(n) { register int N = (n); while (--N > 0); } #endif /* !_KERNEL */ -#endif /* _ARC_PARAM_H_ */ +#endif /* _MACHINE_PARAM_H_ */ diff --git a/sys/arch/arc/include/pcb.h b/sys/arch/arc/include/pcb.h index 871e651335b..23b9d6673f1 100644 --- a/sys/arch/arc/include/pcb.h +++ b/sys/arch/arc/include/pcb.h @@ -1,61 +1,5 @@ -/* $OpenBSD: pcb.h,v 1.2 1996/07/30 20:24:26 pefo Exp $ */ +/* $OpenBSD: pcb.h,v 1.3 1998/01/28 13:46:21 pefo 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 - */ +/* Use Mips generic include file */ -/* - * ARC 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 PICA, there is nothing to add. - */ -struct md_coredump { - long md_pad[8]; -}; +#include <mips/pcb.h> diff --git a/sys/arch/arc/include/pio.h b/sys/arch/arc/include/pio.h index 17a7fe63560..2518883df87 100644 --- a/sys/arch/arc/include/pio.h +++ b/sys/arch/arc/include/pio.h @@ -1,56 +1,5 @@ -/* $OpenBSD: pio.h,v 1.3 1997/04/19 17:19:58 pefo Exp $ */ +/* $OpenBSD: pio.h,v 1.4 1998/01/28 13:46:21 pefo 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. - */ +/* Use Mips generic include file */ -#ifndef _ARC_PIO_H_ -#define _ARC_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 /*_ARC_PIO_H_*/ +#include <mips/pio.h> diff --git a/sys/arch/arc/include/pmap.h b/sys/arch/arc/include/pmap.h index 45ebf633f54..b8ed772f22c 100644 --- a/sys/arch/arc/include/pmap.h +++ b/sys/arch/arc/include/pmap.h @@ -1,120 +1,5 @@ -/* $OpenBSD: pmap.h,v 1.3 1997/04/19 17:19:58 pefo Exp $ */ +/* $OpenBSD: pmap.h,v 1.4 1998/01/28 13:46:22 pefo 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 - */ +/* Use Mips generic include file */ -#ifndef _PMAP_MACHINE_ -#define _PMAP_MACHINE_ - -/* - * The user address space is 2Gb (0x0 - 0x80000000). - * User programs are laid out in memory as follows: - * address - * USRTEXT 0x00001000 - * USRDATA USRTEXT + text_size - * 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 /* _PMAP_MACHINE_ */ +#include <mips/pmap.h> diff --git a/sys/arch/arc/include/proc.h b/sys/arch/arc/include/proc.h index 2db639d145b..6e067e0e8fb 100644 --- a/sys/arch/arc/include/proc.h +++ b/sys/arch/arc/include/proc.h @@ -1,54 +1,5 @@ -/* $OpenBSD: proc.h,v 1.2 1996/07/30 20:24:27 pefo Exp $ */ -/* $NetBSD: proc.h,v 1.4 1994/10/26 21:09:52 cgd Exp $ */ +/* $OpenBSD: proc.h,v 1.3 1998/01/28 13:46:23 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. - * - * @(#)proc.h 8.1 (Berkeley) 6/10/93 - */ +/* Use Mips generic include file */ -/* - * 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 */ +#include <mips/proc.h> diff --git a/sys/arch/arc/include/profile.h b/sys/arch/arc/include/profile.h index b2e28b0d700..f5bbda39494 100644 --- a/sys/arch/arc/include/profile.h +++ b/sys/arch/arc/include/profile.h @@ -1,84 +1,5 @@ -/* $OpenBSD: profile.h,v 1.3 1997/05/11 16:24:13 pefo Exp $ */ +/* $OpenBSD: profile.h,v 1.4 1998/01/28 13:46:23 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: @(#)profile.h 8.1 (Berkeley) 6/10/93 - */ +/* Use Mips generic include file */ -#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 */ +#include <mips/profile.h> diff --git a/sys/arch/arc/include/psl.h b/sys/arch/arc/include/psl.h index e1109ebbb54..a9da8c2cab8 100644 --- a/sys/arch/arc/include/psl.h +++ b/sys/arch/arc/include/psl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: psl.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ +/* $OpenBSD: psl.h,v 1.2 1998/01/28 13:46:25 pefo Exp $ */ /* * Copyright (c) 1992, 1993 @@ -67,3 +67,7 @@ #define USERMODE(ps) (((ps) & SR_KSU_MASK) == SR_KSU_USER) #define BASEPRI(ps) (((ps) & (INT_MASK | SR_INT_ENA_PREV)) \ == (INT_MASK | SR_INT_ENA_PREV)) + +#ifdef _KERNEL +#include <machine/intr.h> +#endif diff --git a/sys/arch/arc/include/pte.h b/sys/arch/arc/include/pte.h index 6e2fdabbbd9..db6ece9363b 100644 --- a/sys/arch/arc/include/pte.h +++ b/sys/arch/arc/include/pte.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pte.h,v 1.3 1997/01/22 22:41:15 pefo Exp $ */ +/* $OpenBSD: pte.h,v 1.4 1998/01/28 13:46:25 pefo Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -79,7 +79,7 @@ struct tlb { typedef union pt_entry { unsigned int pt_entry; /* for copying, etc. */ struct pte pt_pte; /* for getting to bits by name */ -} pt_entry_t; /* Mach page table entry */ +} pt_entry_t; /* Mips page table entry */ #endif /* _LOCORE */ #define PT_ENTRY_NULL ((pt_entry_t *) 0) diff --git a/sys/arch/arc/include/ptrace.h b/sys/arch/arc/include/ptrace.h index 987d48b285b..4494ed41a62 100644 --- a/sys/arch/arc/include/ptrace.h +++ b/sys/arch/arc/include/ptrace.h @@ -1,45 +1,5 @@ -/* $OpenBSD: ptrace.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ +/* $OpenBSD: ptrace.h,v 1.2 1998/01/28 13:46:26 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: @(#)ptrace.h 8.1 (Berkeley) 6/10/93 - */ +/* Use Mips generic include file */ -/* - * Machine dependent trace commands. - * - */ - -#define PT_GETREGS (PT_FIRSTMACH+0) -#define PT_SETREGS (PT_FIRSTMACH+1) -#define PT_STEP (PT_FIRSTMACH+2) +#include <mips/ptrace.h> diff --git a/sys/arch/arc/include/reg.h b/sys/arch/arc/include/reg.h index d1a7a2b76e1..c2a9c0d20d1 100644 --- a/sys/arch/arc/include/reg.h +++ b/sys/arch/arc/include/reg.h @@ -1,62 +1,5 @@ -/* $OpenBSD: reg.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ -/* $NetBSD: reg.h,v 1.6 1995/12/20 02:00:27 jonathan Exp $ */ +/* $OpenBSD: reg.h,v 1.2 1998/01/28 13:46:27 pefo 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 - */ +/* Use Mips generic include file */ -#ifndef _MACHINE_REG_H_ -#define _MACHINE_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 /*_MACHINE_REG_H_*/ +#include <mips/reg.h> diff --git a/sys/arch/arc/include/regdef.h b/sys/arch/arc/include/regdef.h index def7c6ef1a1..c80fb40f16f 100644 --- a/sys/arch/arc/include/regdef.h +++ b/sys/arch/arc/include/regdef.h @@ -1,74 +1,5 @@ -/* $OpenBSD: regdef.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ -/* $NetBSD: regdef.h,v 1.4 1994/10/26 21:09:58 cgd Exp $ */ +/* $OpenBSD: regdef.h,v 1.2 1998/01/28 13:46:28 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. 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 - */ +/* Use Mips generic include file */ -#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 */ +#include <mips/regdef.h> diff --git a/sys/arch/arc/include/regnum.h b/sys/arch/arc/include/regnum.h index b0cc92e6d9b..0dd3d50181c 100644 --- a/sys/arch/arc/include/regnum.h +++ b/sys/arch/arc/include/regnum.h @@ -1,136 +1,5 @@ -/* $OpenBSD: regnum.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ -/* $NetBSD: reg.h,v 1.5 1995/01/18 06:40:12 mellon Exp $ */ +/* $OpenBSD: regnum.h,v 1.2 1998/01/28 13:46:29 pefo 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 - */ +/* Use Mips generic include file */ -/* - * Location of the users' stored - * 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 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 +#include <mips/regnum.h> diff --git a/sys/arch/arc/include/reloc.h b/sys/arch/arc/include/reloc.h index 48d74df6751..928d1c8ed72 100644 --- a/sys/arch/arc/include/reloc.h +++ b/sys/arch/arc/include/reloc.h @@ -1,38 +1,5 @@ -/* $OpenBSD: reloc.h,v 1.2 1996/07/30 20:24:28 pefo Exp $ */ +/* $OpenBSD: reloc.h,v 1.3 1998/01/28 13:46:30 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 - */ +/* Use Mips generic include file */ +#include <mips/reloc.h> diff --git a/sys/arch/arc/include/setjmp.h b/sys/arch/arc/include/setjmp.h index 0c31feea29b..4f456c11d0e 100644 --- a/sys/arch/arc/include/setjmp.h +++ b/sys/arch/arc/include/setjmp.h @@ -1,8 +1,5 @@ -/* $OpenBSD: setjmp.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ -/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:37:05 cgd Exp $ */ +/* $OpenBSD: setjmp.h,v 1.2 1998/01/28 13:46:32 pefo Exp $ */ -/* - * machine/setjmp.h: machine dependent setjmp-related information. - */ +/* Use Mips generic include file */ -#define _JBLEN 83 /* size, in longs, of a jmp_buf */ +#include <mips/setjmp.h> diff --git a/sys/arch/arc/include/signal.h b/sys/arch/arc/include/signal.h index 8051144c5a3..28ac725a8c1 100644 --- a/sys/arch/arc/include/signal.h +++ b/sys/arch/arc/include/signal.h @@ -1,68 +1,5 @@ -/* $OpenBSD: signal.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ -/* $NetBSD: signal.h,v 1.6 1995/01/18 06:42:01 mellon Exp $ */ +/* $OpenBSD: signal.h,v 1.2 1998/01/28 13:46:33 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. - * - * @(#)signal.h 8.1 (Berkeley) 6/10/93 - */ +/* Use Mips generic include file */ -/* - * 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 */ +#include <mips/signal.h> diff --git a/sys/arch/arc/include/stdarg.h b/sys/arch/arc/include/stdarg.h index ac6cd07e268..dc6f04224b8 100644 --- a/sys/arch/arc/include/stdarg.h +++ b/sys/arch/arc/include/stdarg.h @@ -1,65 +1,5 @@ -/* $OpenBSD: stdarg.h,v 1.2 1996/07/30 20:24:29 pefo Exp $ */ -/* $NetBSD: stdarg.h,v 1.7 1995/03/28 18:19:28 jtc Exp $ */ +/* $OpenBSD: stdarg.h,v 1.3 1998/01/28 13:46:34 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. - * - * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 - */ +/* Use Mips generic include file */ -#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_ */ +#include <mips/stdarg.h> diff --git a/sys/arch/arc/include/trap.h b/sys/arch/arc/include/trap.h index b134df761f0..f01ccd08c76 100644 --- a/sys/arch/arc/include/trap.h +++ b/sys/arch/arc/include/trap.h @@ -1,68 +1,5 @@ -/* $OpenBSD: trap.h,v 1.1 1996/06/24 09:07:18 pefo Exp $ */ +/* $OpenBSD: trap.h,v 1.2 1998/01/28 13:46:35 pefo 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 - */ +/* Use Mips generic include file */ -/* - * Trap codes - * also known in trap.c for name strings - */ - -#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 /* Viritual coherency instruction */ -#define T_FPE 15 /* Floating point exception */ -#define T_WATCH 23 /* Watch address reference */ -#define T_VCED 31 /* Viritual coherency data */ - -#define T_USER 0x20 /* user-mode flag or'ed with type */ +#include <mips/trap.h> diff --git a/sys/arch/arc/include/types.h b/sys/arch/arc/include/types.h index 22a3669e7e4..98d59fbe530 100644 --- a/sys/arch/arc/include/types.h +++ b/sys/arch/arc/include/types.h @@ -1,81 +1,5 @@ -/* $OpenBSD: types.h,v 1.2 1997/04/19 17:19:59 pefo Exp $ */ -/* $NetBSD: types.h,v 1.10 1995/07/06 03:39:43 cgd Exp $ */ +/* $OpenBSD: types.h,v 1.3 1998/01/28 13:46:36 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. - * - * @(#)types.h 8.3 (Berkeley) 1/5/94 - */ +/* Use Mips generic include file */ -#ifndef _MACHTYPES_H_ -#define _MACHTYPES_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; - -/* - * 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 short int16_t; -typedef unsigned short u_int16_t; -typedef int int32_t; -typedef unsigned int u_int32_t; -/* LONGLONG */ -typedef long long int64_t; -/* LONGLONG */ -typedef unsigned long long u_int64_t; - -typedef int32_t register_t; - -#define __SWAP_BROKEN -#define __FORK_BRAINDAMAGE - -#endif /* _MACHTYPES_H_ */ +#include <mips/types.h> diff --git a/sys/arch/arc/isa/isabus.c b/sys/arch/arc/isa/isabus.c index 1439c36d0c4..36c3fb38abc 100644 --- a/sys/arch/arc/isa/isabus.c +++ b/sys/arch/arc/isa/isabus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isabus.c,v 1.11 1997/04/19 17:20:01 pefo Exp $ */ +/* $OpenBSD: isabus.c,v 1.12 1998/01/28 13:46:37 pefo Exp $ */ /* $NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp $ */ /*- @@ -102,7 +102,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <machine/autoconf.h> #include <machine/intr.h> -#include <arc/arc/arctype.h> +#include <mips/archtype.h> #include <arc/pica/pica.h> #include <dev/isa/isareg.h> @@ -141,7 +141,7 @@ int isabr_iointr __P((unsigned int, struct clockframe *)); void isabr_initicu __P((void)); void intr_calculatemasks __P((void)); -extern int cputype; +extern int system_type; int @@ -174,7 +174,7 @@ isabrattach(parent, self, aux) isabr_initicu(); /* set up interrupt handlers */ - switch(cputype) { + switch(system_type) { case ACER_PICA_61: set_intr(INT_MASK_2, isabr_iointr, 3); break; @@ -185,7 +185,7 @@ isabrattach(parent, self, aux) set_intr(INT_MASK_2, isabr_iointr, 2); break; default: - panic("isabrattach: unkown cputype!"); + panic("isabrattach: unkown system_type!"); } /*XXX we may remove the abus part of the softc struct... */ @@ -391,7 +391,7 @@ isabr_iointr(mask, cf) int o_imen; char vector; - switch(cputype) { + switch(system_type) { case ACER_PICA_61: isa_vector = in32(R4030_SYS_ISA_VECTOR) & (ICU_LEN - 1); break; diff --git a/sys/arch/arc/pica/picabus.c b/sys/arch/arc/pica/picabus.c index 8eeb8187920..8c54ceda7e7 100644 --- a/sys/arch/arc/pica/picabus.c +++ b/sys/arch/arc/pica/picabus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: picabus.c,v 1.7 1997/05/24 18:36:26 pefo Exp $ */ +/* $OpenBSD: picabus.c,v 1.8 1998/01/28 13:46:38 pefo Exp $ */ /* $NetBSD: tc.c,v 1.2 1995/03/08 00:39:05 cgd Exp $ */ /* @@ -41,8 +41,8 @@ #include <machine/pio.h> #include <machine/autoconf.h> +#include <mips/archtype.h> #include <arc/pica/pica.h> -#include <arc/arc/arctype.h> #include <arc/dev/dma.h> struct pica_softc { @@ -70,7 +70,7 @@ int pica_matchname __P((struct confargs *, char *)); int pica_iointr __P((unsigned int, struct clockframe *)); int pica_clkintr __P((unsigned int, struct clockframe *)); -extern int cputype; +extern int system_type; /* * Interrupt dispatch table. @@ -156,7 +156,7 @@ picamatch(parent, cfdata, aux) /* Make sure that unit exists. */ if (cf->cf_unit != 0 || - cputype > npica_cpu_devs || pica_cpu_devs[cputype] == NULL) + system_type > npica_cpu_devs || pica_cpu_devs[system_type] == NULL) return (0); return (1); @@ -175,7 +175,7 @@ picaattach(parent, self, aux) printf("\n"); /* keep our CPU device description handy */ - sc->sc_devs = pica_cpu_devs[cputype]; + sc->sc_devs = pica_cpu_devs[system_type]; /* set up interrupt handlers */ set_intr(INT_MASK_1, pica_iointr, 2); |