diff --git a/include/PR/os.h b/include/PR/os.h index 2ce02f9..1326963 100644 --- a/include/PR/os.h +++ b/include/PR/os.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include diff --git a/include/PR/os_gio.h b/include/PR/os_gio.h deleted file mode 100644 index 9d45bc9..0000000 --- a/include/PR/os_gio.h +++ /dev/null @@ -1,81 +0,0 @@ - -/*==================================================================== - * os_gio.h - * - * Copyright 1995, Silicon Graphics, Inc. - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, - * Inc.; the contents of this file may not be disclosed to third - * parties, copied or duplicated in any form, in whole or in part, - * without the prior written permission of Silicon Graphics, Inc. - * - * RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to - * restrictions as set forth in subdivision (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS - * 252.227-7013, and/or in similar or successor clauses in the FAR, - * DOD or NASA FAR Supplement. Unpublished - rights reserved under the - * Copyright Laws of the United States. - *====================================================================*/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_gio.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:08 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_GIO_H_ -#define _OS_GIO_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Type definitions - * - */ - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -/************************************************************************** - * - * Global definitions - * - */ - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/************************************************************************** - * - * Macro definitions - * - */ - -/************************************************************************** - * - * Extern variables - * - */ - -/************************************************************************** - * - * Function prototypes - * - */ - -#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_GIO_H_ */ diff --git a/include/PR/os_internal.h b/include/PR/os_internal.h index 6a2c731..80795de 100644 --- a/include/PR/os_internal.h +++ b/include/PR/os_internal.h @@ -35,7 +35,6 @@ extern "C" { #include "os_internal_si.h" #include "os_internal_rsp.h" #include "os_internal_error.h" -#include "os_internal_gio.h" #include "os_internal_thread.h" #include "os_internal_debug.h" #include "os_internal_host.h" diff --git a/include/PR/os_internal_gio.h b/include/PR/os_internal_gio.h deleted file mode 100644 index 3a6d8d8..0000000 --- a/include/PR/os_internal_gio.h +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1995, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -/*---------------------------------------------------------------------* - Copyright (C) 1998 Nintendo. (Originated by SGI) - - $RCSfile: os_internal_gio.h,v $ - $Revision: 1.1 $ - $Date: 1998/10/09 08:01:11 $ - *---------------------------------------------------------------------*/ - -#ifndef _OS_INTERNAL_GIO_H_ -#define _OS_INTERNAL_GIO_H_ - -#ifdef _LANGUAGE_C_PLUS_PLUS -extern "C" { -#endif - -#include - -#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - -/* Development board functions */ - -extern void __osGIOInit(s32); -extern void __osGIOInterrupt(s32); -extern void __osGIORawInterrupt(s32); - -#endif /* _LANGUAGE_C */ - -#ifdef _LANGUAGE_C_PLUS_PLUS -} -#endif - -#endif /* !_OS_INTERNAL_GIO_H */ diff --git a/include/PR/os_system.h b/include/PR/os_system.h index 20e6f13..05cee4e 100644 --- a/include/PR/os_system.h +++ b/include/PR/os_system.h @@ -98,7 +98,6 @@ extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */ */ extern void osInitialize(void); -extern void osExit(void); extern u32 osGetMemSize(void); /* pre-NMI */ diff --git a/src/debug/threadprofile.c b/src/debug/threadprofile.c index 55f1353..58ed7af 100644 --- a/src/debug/threadprofile.c +++ b/src/debug/threadprofile.c @@ -1,3 +1,4 @@ +#ifndef _FINALROM #include "osint_debug.h" #include "PRinternal/macros.h" @@ -20,3 +21,4 @@ void osThreadProfileCallback(OSThread* osthread) { __osThprofCount++; __osThprofLastTimer = now_time; } +#endif diff --git a/src/debug/threadprofileclear.c b/src/debug/threadprofileclear.c index 42788f8..849ba30 100644 --- a/src/debug/threadprofileclear.c +++ b/src/debug/threadprofileclear.c @@ -1,3 +1,4 @@ +#ifndef _FINALROM #include "osint_debug.h" void osThreadProfileClear(OSId id) { @@ -9,3 +10,4 @@ void osThreadProfileClear(OSId id) { __osRestoreInt(saveMask); } +#endif diff --git a/src/debug/threadprofileinit.c b/src/debug/threadprofileinit.c index 7fef229..4c80d7b 100644 --- a/src/debug/threadprofileinit.c +++ b/src/debug/threadprofileinit.c @@ -1,3 +1,4 @@ +#ifndef _FINALROM #include "osint_debug.h" void osThreadProfileInit(void) { @@ -14,3 +15,4 @@ void osThreadProfileInit(void) { osThreadProfileClear(i); } } +#endif diff --git a/src/debug/threadprofilereadcount.c b/src/debug/threadprofilereadcount.c index 3237987..9bb5683 100644 --- a/src/debug/threadprofilereadcount.c +++ b/src/debug/threadprofilereadcount.c @@ -1,3 +1,4 @@ +#ifndef _FINALROM #include "osint_debug.h" u32 osThreadProfileReadCount(OSId id) { @@ -37,3 +38,4 @@ u32 osThreadProfileReadCountTh(OSThread* thread) { } return thprof[id].count; } +#endif diff --git a/src/debug/threadprofilereadtime.c b/src/debug/threadprofilereadtime.c index 9930cac..53125a6 100644 --- a/src/debug/threadprofilereadtime.c +++ b/src/debug/threadprofilereadtime.c @@ -1,3 +1,4 @@ +#ifndef _FINALROM #include "osint_debug.h" OSTime osThreadProfileReadTime(OSId id) { @@ -49,3 +50,4 @@ OSTime osThreadProfileReadTimeTh(OSThread* thread) { } return thprof[id].time + adjust; } +#endif diff --git a/src/debug/threadprofilestart.c b/src/debug/threadprofilestart.c index 3ef8fa7..683a298 100644 --- a/src/debug/threadprofilestart.c +++ b/src/debug/threadprofilestart.c @@ -1,4 +1,5 @@ #include "osint_debug.h" +#ifndef _FINALROM void osThreadProfileStart(void) { register u32 saveMask; @@ -20,3 +21,4 @@ void osThreadProfileStart(void) { __osThprofFunc = osThreadProfileCallback; __osRestoreInt(saveMask); } +#endif diff --git a/src/debug/threadprofilestop.c b/src/debug/threadprofilestop.c index 7cc20e7..4a30f14 100644 --- a/src/debug/threadprofilestop.c +++ b/src/debug/threadprofilestop.c @@ -1,4 +1,5 @@ #include "osint_debug.h" +#ifndef _FINALROM void osThreadProfileStop(void) { register u32 saveMask; @@ -36,3 +37,4 @@ void osThreadProfileStop(void) { } __osRestoreInt(saveMask); } +#endif diff --git a/src/error/error.c b/src/error/error.c deleted file mode 100644 index f4b5e8d..0000000 --- a/src/error/error.c +++ /dev/null @@ -1,30 +0,0 @@ -// This file was removed in 2.0J -#include "stdarg.h" -#include "PR/os_internal.h" -#include "PR/ultralog.h" -#include "PR/ultraerror.h" -#include "PRinternal/macros.h" - -void __osLogWrite(OSLog* log, s16 code, s16 numArgs, va_list argPtr); -static void __osDefaultHandler(s16 code, s16 numArgs, ...); - -static u32 errorLogData[19] ALIGNED(0x8); -static OSLog errorLog ALIGNED(0x8) = { - OS_ERROR_MAGIC, // magic - sizeof(errorLogData), // len - errorLogData, // base - 0, // startCount - 0, // writeOffset -}; - -OSErrorHandler __osErrorHandler = __osDefaultHandler; - -static void __osDefaultHandler(s16 code, s16 numArgs, ...) { - va_list argPtr; - va_start(argPtr, numArgs); - - __osLogWrite(&errorLog, code, numArgs, argPtr); - osFlushLog(&errorLog); - - va_end(argPtr); -} diff --git a/src/error/errorasm.s b/src/error/errorasm.s index c41cf6d..13870bd 100644 --- a/src/error/errorasm.s +++ b/src/error/errorasm.s @@ -6,26 +6,9 @@ #include "PR/os_version.h" LEAF(__osError) -#if BUILD_VERSION < VERSION_J - lw t0, __osErrorHandler - beqz t0, 1f - jr t0 -#elif BUILD_VERSION < VERSION_K - lw t0, __kmc_pt_mode - bnez t0, _kmc_mode - - lw t0, __osErrorHandler - beqz t0, 1f - jr t0 -_kmc_mode: - lw t0, __kmcErrorHandler - beqz t0, 1f - jr t0 -#else lw t0, __osCommonHandler beqz t0, 1f jr t0 -#endif 1: j ra END(__osError) diff --git a/src/gio/giointerrupt.c b/src/gio/giointerrupt.c deleted file mode 100644 index 121c5d8..0000000 --- a/src/gio/giointerrupt.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "PR/os_internal.h" -#include "PRinternal/piint.h" - -void __osGIOInterrupt(s32 value) { - __osPiGetAccess(); - __osGIORawInterrupt(value); - __osPiRelAccess(); -} diff --git a/src/gio/giorawinterrupt.c b/src/gio/giorawinterrupt.c deleted file mode 100644 index e36f5de..0000000 --- a/src/gio/giorawinterrupt.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "PR/os_internal.h" -#include "PR/rcp.h" -#include "PRinternal/piint.h" - -void __osGIORawInterrupt(s32 value) { - register u32 stat; - - WAIT_ON_IOBUSY(stat); - - IO_WRITE(GIO_GIO_INTR_REG, value); - - WAIT_ON_IOBUSY(stat); -} diff --git a/src/gt/dumpturbo.c b/src/gt/dumpturbo.c index 08893f1..e8e3598 100644 --- a/src/gt/dumpturbo.c +++ b/src/gt/dumpturbo.c @@ -16,6 +16,8 @@ * */ +#ifndef _FINALROM + #include #include #include "PRinternal/macros.h" @@ -220,3 +222,4 @@ void gtDumpTurbo(OSTask* tp, u8 flags) { * */ } +#endif diff --git a/src/gu/dump_gbi.c b/src/gu/dump_gbi.c deleted file mode 100644 index 0121e9e..0000000 --- a/src/gu/dump_gbi.c +++ /dev/null @@ -1,271 +0,0 @@ - -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - *************************************************************************/ - -/* - * Interpret Task with GBI display list and dump it for debugging. - */ - -/************************************************** - * - * guDumpGbiDL no longer supported - * applications should use guParseGbiDL with the - * GU_PARSEGBI_DUMPONLY flag set. - * - **************************************************/ - -#if 0 - -#include "ultra64.h" -#include "bstring.h" - -#undef PRINTF -#define PRINTF osSyncPrintf - -#define DL_STACKSIZE 11 -static u32 *Gp[DL_STACKSIZE]; - -#define TX_MAX 100 -static u32 textures[TX_MAX]; -static u32 numtextures; - -static u32 segment_base[16]; -static u32 dotextures = TRUE; -static int dl_depth = 0; - - -/* - * dump a DMA-type display list command. - */ -static void -dump_dma(u32 *bufp) -{ - u32 addr, - *data; - u8 seg_id; - u16 len; - char op, - b0; - - op = ((*bufp & 0xff000000) >> 24); - - /* - * DMA op addressing is all the same: - */ - seg_id = (u8) ((bufp[1] & 0x0f000000) >> 24); - addr = segment_base[seg_id] + (bufp[1] & 0x00ffffff); - - - addr = (u32) osPhysicalToVirtual(addr); - - len = (u16) (bufp[0] & 0x0000ffff); - - PRINTF(">%08x\n-%08x\n", bufp[0], bufp[1]); - if (op == (char) G_DL) { - b0 = (char) ((bufp[0] & 0x00ff0000) >> 16); - ++dl_depth; - if (dl_depth > (DL_STACKSIZE - 1)) { - PRINTF("***** Error, max levels of display lists exceeded\n"); - return; - } - Gp[dl_depth] = (u32 *) addr; - PRINTF("@ %08x\n",(int)Gp[dl_depth]&0x7fffffff); - } else { - PRINTF("& %08x\n", (int)addr&0x7fffffff); - data = (u32 *) addr; - while(len>0) { - PRINTF("+%08x\n", *data); - data++; - len -= 4; - } - PRINTF("@ %08x\n",(int)(Gp[dl_depth] + (sizeof(Gfx) >> 2))&0x7fffffff); - } -} - -/* - * dump a IMM-type display list command. - */ -static void -dump_imm(u32 *bufp) -{ - char op, - b0; - - op = ((*bufp & 0xff000000) >> 24); - - PRINTF(">%08x\n-%08x\n", bufp[0], bufp[1]); - if (op == (char) G_ENDDL) { - dl_depth--; - if (dl_depth >= 0) { - PRINTF("@ %08x\n",(int)(Gp[dl_depth] + (sizeof(Gfx) >> 2))&0x7fffffff); - } - } - if (op == (char) G_MOVEWORD) { - if (((bufp[0] ) & 0xff) == G_MW_SEGMENT) { - b0 = (char) ((bufp[0] & 0xff00)>>10); - segment_base[b0] = bufp[1] & 0x00ffffff; - } - } -} - -/* - * dump a RDP-type display list command. - */ -static void -dump_rdp(u32 *bufp) -{ - u8 seg_id; - u32 addr; - int i0, - i1; - char op; - - op = ((*bufp & 0xff000000) >> 24); - - PRINTF(">%08x\n-%08x\n", bufp[0], bufp[1]); - if (op == (char) G_SETTIMG && dotextures) { - if (numtextures>=TX_MAX) { - PRINTF("GBI DUMP ERROR: too many textures (max=%d)\n",TX_MAX); - return; - } - seg_id = (u8) ((bufp[1] & 0x0f000000) >> 24); - addr = segment_base[seg_id] + (bufp[1] & 0x00ffffff); - addr = (u32) osPhysicalToVirtual(addr); - i1=1; - for (i0=0;i0= 0) && (dl_depth < (DL_STACKSIZE - 1))) { - - op = (u8) ((*Gp[dl_depth] & 0xff000000) >> 24); - bcopy((char *) Gp[dl_depth], (char *) &(readBuf[0]), sizeof(Gfx)); - - switch (op & 0xc0) { - - case (u8) 0x00: - dump_dma(readBuf); - break; - - case (u8) 0x80: - dump_imm(readBuf); - break; - - case (u8) 0xc0: - dump_rdp(readBuf); - break; - - default: - PRINTF("ERROR : display list is lost, op = %02x\n", op); - break; - - } - - if (op != (u8) G_DL) { - Gp[dl_depth] += (sizeof(Gfx) >> 2); - } - } - if (dotextures) { - u32 i,j; - for (i=0; it.ucode_boot & 0x7fffffff); - for (i=(int)tp->t.ucode_boot; i<(int)tp->t.ucode_boot+tp->t.ucode_boot_size; i+=4) { - PRINTF("|%08x\n",(int) *((u32 *) i)); - } - - PRINTF("? %08x\n",(int) tp->t.ucode& 0x7fffffff); - for (i=(int)tp->t.ucode; i<(int)tp->t.ucode+UCODE_SIZE_MAX; i+=4) { - PRINTF("|%08x\n",(int) *((u32 *) i)); - } - - PRINTF("? %08x\n",(int) tp->t.ucode_data & 0x7fffffff); - for (i=(int)tp->t.ucode_data; i<(int)tp->t.ucode_data+tp->t.ucode_data_size; i+=4) { - PRINTF("|%08x\n",(int) *((u32 *) i)); - } - - - guDumpGbi((u32 *) tp->t.data_ptr); - - - PRINTF("^\nGBI_DUMP_END:\n"); - - if (flags & GU_PARSEGBI_HANGAFTER) { - int i; - for (i=0; i<1000;i++) - PRINTF("=============================================================\n"); - while(1); - } - - -/* - * Dumps stuff - * each line is either an address for data to follow or data itself - * 1st char on line indicates what it is: - * - * $ task header address - * @ display list address - * & dma data address - * % texture address - * ? code/code data address - * - * < task header data - * > 1st half of display list command - * - 2nd half of display list command - * + dma data - * * texture data - * | code/code data - * - */ - -} - -#endif diff --git a/src/gu/mtxcatl.c b/src/gu/mtxcatl.c deleted file mode 100644 index adb756b..0000000 --- a/src/gu/mtxcatl.c +++ /dev/null @@ -1,45 +0,0 @@ - -/* - * Copyright 1995, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * - * UNPUBLISHED -- Rights reserved under the copyright laws of the United - * States. Use of a copyright notice is precautionary only and does not - * imply publication or disclosure. - * - * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: - * Use, duplication or disclosure by the Government is subject to restrictions - * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights - * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or - * in similar or successor clauses in the FAR, or the DOD or NASA FAR - * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., - * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. - * - * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY - * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, - * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY - * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON - * GRAPHICS, INC. - * - */ - -/* - * File: mtxcatl.c - * Creator: hsa@sgi.com - * Create Date: Thu Nov 2 13:03:02 PST 1995 - * - */ - -#include "guint.h" -#include "os_version.h" - -void guMtxCatL(Mtx* m, Mtx* n, Mtx* res) { - float mf[4][4], nf[4][4], resf[4][4]; - - guMtxL2F(mf, m); - guMtxL2F(nf, n); - - guMtxCatF(mf, nf, resf); - - guMtxF2L(resf, res); -} diff --git a/src/gu/mtxutil.c b/src/gu/mtxutil.c deleted file mode 100644 index 68cd693..0000000 --- a/src/gu/mtxutil.c +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * - * These coded instructions, statements, and computer programs contain * - * unpublished proprietary information of Silicon Graphics, Inc., and * - * are protected by Federal copyright law. They may not be disclosed * - * to third parties or copied or duplicated in any form, in whole or * - * in part, without the prior written consent of Silicon Graphics, Inc. * - * * - **************************************************************************/ - -#include "guint.h" - -void guMtxF2L(float mf[4][4], Mtx* m) { - int i, j; - int e1, e2; - int *ai, *af; - - ai = (int*)&m->m[0][0]; - af = (int*)&m->m[2][0]; - - for (i = 0; i < 4; i++) - for (j = 0; j < 2; j++) { - e1 = FTOFIX32(mf[i][j * 2]); - e2 = FTOFIX32(mf[i][j * 2 + 1]); - *(ai++) = (e1 & 0xffff0000) | ((e2 >> 16) & 0xffff); - *(af++) = ((e1 << 16) & 0xffff0000) | (e2 & 0xffff); - } -} - -void guMtxL2F(float mf[4][4], Mtx* m) { - int i, j; - unsigned int e1, e2; - unsigned int *ai, *af; - int q1, q2; - - ai = (unsigned int*)&m->m[0][0]; - af = (unsigned int*)&m->m[2][0]; - - for (i = 0; i < 4; i++) - for (j = 0; j < 2; j++) { - e1 = (*ai & 0xffff0000) | ((*af >> 16) & 0xffff); - e2 = ((*(ai++) << 16) & 0xffff0000) | (*(af++) & 0xffff); - q1 = *((int*)&e1); - q2 = *((int*)&e2); - - mf[i][j * 2] = FIX32TOF(q1); - mf[i][j * 2 + 1] = FIX32TOF(q2); - } -} - -void guMtxIdentF(float mf[4][4]) { - int i, j; - - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - if (i == j) - mf[i][j] = 1.0; - else - mf[i][j] = 0.0; -} - -void guMtxIdent(Mtx* m) { - float mf[4][4]; - - guMtxIdentF(mf); - - guMtxF2L(mf, m); -} diff --git a/src/host/host_ptn64.c b/src/host/host_ptn64.c deleted file mode 100644 index 3d16931..0000000 --- a/src/host/host_ptn64.c +++ /dev/null @@ -1,205 +0,0 @@ -#include "PR/os_internal.h" -#include "PR/os_version.h" -#include "PR/rcp.h" -#include "memory.h" - -#include "PRinternal/macros.h" - -static volatile unsigned int* ptwtmode = (unsigned*)0xbff08014; -static volatile unsigned int* ptstat = (unsigned*)0xbff08004; -static volatile unsigned int* ptport = (unsigned*)0xbff08000; -static volatile unsigned int* n64piok = (unsigned*)PHYS_TO_K1(PI_STATUS_REG); - -static OSMesgQueue waitPtQueue ALIGNED(0x8); -static OSMesg waitPtQueueBuf; -static u32 isWaitPtQueueCreated = FALSE; - -void __osPiRelAccess(void); -void __osPiGetAccess(void); - -static void createWaitPtQueue(void) { - osCreateMesgQueue(&waitPtQueue, &waitPtQueueBuf, 1); - isWaitPtQueueCreated = TRUE; -} - -static u32 getPT_wait(void) { - OSTimer waitTimer; - u32 status UNUSED; - - for (;;) { - while (*n64piok & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { - ; - } - - if (*ptstat & 2) { - return *ptport; - } - __osPiRelAccess(); - - osRecvMesg(&waitPtQueue, NULL, OS_MESG_NOBLOCK); - osSetTimer(&waitTimer, OS_USEC_TO_CYCLES(1000), 0, &waitPtQueue, NULL); - osRecvMesg(&waitPtQueue, NULL, OS_MESG_BLOCK); - - __osPiGetAccess(); - } -} - -static void putPT(u32 c) { - while (*n64piok & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { - ; - } - while (!(*ptstat & 4)) { - ; - } - *ptport = c; -} - -static u32 getPT(void) { - while (*n64piok & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { - ; - } - while (!(*ptstat & 2)) { - ; - } - return *ptport; -} - -void osReadHost_pt(void* dramAddr, u32 nbytes) { - u8* tPtr; - u32 buf[256]; - u32* bp; - u32 data; - u32 ct; - u32 ct1; - u32 ct1_bak; - u32 shift; - u32 cmd; - u32 size; - - if (nbytes == 0) { - return; - } - - if (!isWaitPtQueueCreated) { - createWaitPtQueue(); - } - - __osPiGetAccess(); - - putPT(0x82U); - - cmd = getPT_wait(); - - size = getPT(); - - if (cmd != 2) { - nbytes = -1U; - } - - putPT(nbytes); - - if (size != nbytes) { - goto osReadHost_ret; - } - - tPtr = dramAddr; - ct = nbytes / 4; - - while (ct != 0) { - if (ct > 0x100) { - ct1_bak = ct1 = 0x100; - ct -= 0x100; - } else { - ct1_bak = ct1 = ct; - ct = 0; - } - bp = (u32*)&buf; - - while (ct1 != 0) { - *(bp++) = getPT(); - ct1--; - } - - memcpy(tPtr, &buf, ct1_bak * 4); - tPtr += ct1_bak * 4; - } - - nbytes &= 3; - - if (nbytes != 0) { - data = getPT(); - shift = 0x18; - - do { - *(tPtr++) = (data >> shift); - nbytes--; - shift -= 8; - } while (nbytes != 0); - } - -osReadHost_ret: - __osPiRelAccess(); - return; -} - -void osWriteHost_pt(void* dramAddr, u32 nbytes) { - u8* tPtr; - u32 buf[256]; - u32* bp; - u32 ct; - u32 ct1; - u32 ct1_bak; - u32 cmd; - u32 size; - - if (nbytes == 0) { - return; - } - - if (!isWaitPtQueueCreated) { - createWaitPtQueue(); - } - - __osPiGetAccess(); - putPT(0x82); - - cmd = getPT_wait(); - - size = getPT(); - - if (cmd != 3) { - nbytes = -1; - } - - putPT(nbytes); - - if (size != nbytes) { - goto osWriteHost_ret; - } - - tPtr = dramAddr; - ct = (nbytes + 3) >> 2; - - while (ct != 0) { - if (ct > 0x100) { - ct1_bak = ct1 = 0x100; - ct -= 0x100; - } else { - ct1_bak = ct1 = ct; - ct = 0; - } - - memcpy(bp = buf, tPtr, ct1_bak * 4); - - while (ct1 != 0) { - putPT(*(bp++)); - ct1--; - } - - tPtr += ct1_bak * 4; - } - -osWriteHost_ret: - __osPiRelAccess(); - return; -} diff --git a/src/monutil.s b/src/monutil.s index e5974bd..4112dee 100644 --- a/src/monutil.s +++ b/src/monutil.s @@ -5,47 +5,6 @@ #include "sgidefs.h" #include "PR/R4300.h" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #define EXC(code) (EXC_##code >> CAUSE_EXCSHIFT) .text diff --git a/src/os/ackramromread.c b/src/os/ackramromread.c deleted file mode 100644 index 7627704..0000000 --- a/src/os/ackramromread.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "PR/os_internal.h" -#include "PR/os_version.h" - -// TODO: this comes from a header -#ident "$Revision: 1.4 $" - -void osAckRamromRead(void) { -} diff --git a/src/os/ackramromwrite.c b/src/os/ackramromwrite.c deleted file mode 100644 index 545918b..0000000 --- a/src/os/ackramromwrite.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "PR/os_internal.h" - -// TODO: this comes from a header -#ident "$Revision: 1.4 $" - -void osAckRamromWrite(void) { -} diff --git a/src/os/exceptasm.s b/src/os/exceptasm.s index fd74948..327c38f 100644 --- a/src/os/exceptasm.s +++ b/src/os/exceptasm.s @@ -136,8 +136,6 @@ LEAF(__osException) sd $10, THREAD_GP10(k0) /* Mark FPU as unused */ sw zero, THREAD_FP(k0) - /* This instruction is useless, leftover because of bad placement of an ifdef for the debug version */ - MFC0( t0, C0_CAUSE) savecontext: /* Save the context of the previously running thread to be restored when it resumes */ diff --git a/src/os/exit.c b/src/os/exit.c deleted file mode 100644 index 05582c5..0000000 --- a/src/os/exit.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "PR/os_internal.h" - -void osExit(void) { - __osGIOInterrupt(16); - - for (;;) { - ; - } -} diff --git a/src/os/seterrorhandler.c b/src/os/seterrorhandler.c index 4e839e8..d7113e7 100644 --- a/src/os/seterrorhandler.c +++ b/src/os/seterrorhandler.c @@ -1,3 +1,4 @@ +#ifndef _FINALROM #include "PR/ultraerror.h" extern OSErrorHandler __osErrorHandler; @@ -8,3 +9,4 @@ OSErrorHandler osSetErrorHandler(OSErrorHandler handler) { __osErrorHandler = handler; return oldHandler; } +#endif diff --git a/src/os/testhost.c b/src/os/testhost.c deleted file mode 100644 index 70514eb..0000000 --- a/src/os/testhost.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "PR/os_internal.h" - -// TODO: this comes from a header -#ident "$Revision: 1.4 $"