Remove unused Indy code, make sure debug code isn't being included in ROM version builds (#24)

* Remove outdated code from errorasm/exceptasm

* Delete osAckRamromWrite and osAckRamromRead, old unused stubs

* Remove osDriveRomInit, as this is old OS2.0I code that's not supposed to be in later versions

* Remove error.c as this was removed in 2.0J and duplicates other code

* Remove old libleo code which was only in 2.0I

* Remove mtxutil and mtxcatl as these are duplicate of functions rewritten in mgu

* Remove dump_gbi as it's literally all #if 0

* Remove GIO functions as they're leftover Indy board code

* Remove leftover Partner-N64 code

* Prevent debug code from being included in ROM version

* Remove testhost due to being a stub file with nothing in it

* Remove osExit as it's indy board code useless on non-indy

* Add ifdef _FINALROM to dumpturbo

* All debug code included in non ROM builds checked and #ifndef _FINALROM added where needed

* Add missing ifdef and endlines

* Restore libleo code (will be taken care of in a seperate PR)
This commit is contained in:
CrashOveride95
2025-11-02 21:26:58 -05:00
committed by GitHub
parent 186699c5c3
commit ad5828b772
28 changed files with 19 additions and 858 deletions

View File

@@ -46,7 +46,6 @@
#include <PR/os_cache.h>
#include <PR/os_debug.h>
#include <PR/os_error.h>
#include <PR/os_gio.h>
#include <PR/os_reg.h>
#include <PR/os_system.h>
#include <PR/os_eeprom.h>

View File

@@ -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 <PR/ultratypes.h>
#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_ */

View File

@@ -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"

View File

@@ -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 <PR/os.h>
#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 */

View File

@@ -98,7 +98,6 @@ extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */
*/
extern void osInitialize(void);
extern void osExit(void);
extern u32 osGetMemSize(void);
/* pre-NMI */

View File

@@ -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

View File

@@ -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

View File

@@ -1,3 +1,4 @@
#ifndef _FINALROM
#include "osint_debug.h"
void osThreadProfileInit(void) {
@@ -14,3 +15,4 @@ void osThreadProfileInit(void) {
osThreadProfileClear(i);
}
}
#endif

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -1,8 +0,0 @@
#include "PR/os_internal.h"
#include "PRinternal/piint.h"
void __osGIOInterrupt(s32 value) {
__osPiGetAccess();
__osGIORawInterrupt(value);
__osPiRelAccess();
}

View File

@@ -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);
}

View File

@@ -16,6 +16,8 @@
*
*/
#ifndef _FINALROM
#include <ultra64.h>
#include <gt.h>
#include "PRinternal/macros.h"
@@ -220,3 +222,4 @@ void gtDumpTurbo(OSTask* tp, u8 flags) {
*
*/
}
#endif

View File

@@ -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<numtextures;i0++)
if (textures[i0] == addr) i1=0;
if (i1) textures[numtextures++]=addr;
}
}
/*
* Takes a pointer in DRAM, and a length in bytes. Dumps
* the display list, until a G_ENDDL command is found.
*/
static void
guDumpGbi(u32 *gfxp)
{
u8 op;
u32 readBuf[4];
Gp[dl_depth] = gfxp;
numtextures=0;
PRINTF("@ %08x\n",(int)Gp[dl_depth]&0x7fffffff);
while ((dl_depth >= 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; i<numtextures; i++) {
PRINTF("%% %08x\n",textures[i]&0x7fffffff);
for (j=textures[i]; j<textures[i]+0x400; j+=4) {
PRINTF("*%08x\n",(int) *((u32 *) j));
}
}
}
}
#define UCODE_SIZE_MAX (4096 * 3)
void
guDumpGbiDL(OSTask *tp,u8 flags)
{
int i;
if (flags & GU_PARSEGBI_NOTEXTURES) dotextures=0;
PRINTF("\nGBI_DUMP_START:\n");
PRINTF("$ %08x\n",(int) tp & 0x7fffffff);
for (i=(int)tp; i<(int)tp+sizeof(OSTask); i+=4) {
PRINTF("<%08x\n",(int) *((u32 *) i));
}
PRINTF("? %08x\n",(int) tp->t.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

View File

@@ -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);
}

View File

@@ -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);
}

Some files were not shown because too many files have changed in this diff Show More