Move variables in .data for most of boot files that have been decompiled

This commit is contained in:
rozlette 2020-02-28 15:16:12 -06:00
parent 2ee01ad0b7
commit dc37a6f9f5
17 changed files with 1109 additions and 34 deletions

View File

@ -207,33 +207,33 @@ SECTIONS
boot_data_start = .;
build/asm/boot_data_0x800969C0.o(.text)
build/asm/boot_data_idle.o(.text)
build/src/boot_O2_g3/idle.o(.data)
build/asm/boot_data_0x80096B40.o(.text)
build/asm/boot_data_z_std_dma.o(.text)
build/asm/boot_data_irqmgr.o(.text)
build/src/boot_O2_g3/z_std_dma.o(.data)
build/src/boot_O2_g3/irqmgr.o(.data)
build/asm/boot_data_fault.o(.text)
build/asm/boot_data_fault_drawer.o(.text)
build/src/boot_O2_g3_trapuv/fault_drawer.o(.data)
build/asm/boot_data_loadfragment.o(.text)
build/asm/boot_data_loadfragment2.o(.text)
build/asm/boot_data_stackcheck.o(.text)
build/src/boot_O2/stackcheck.o(.data)
build/asm/boot_data_0x80085570.o(.text)
build/asm/boot_data_0x800862E0.o(.text)
build/asm/boot_data_0x80086FA0.o(.text)
build/asm/boot_data_0x80097540.o(.text)
build/asm/boot_data_sins.o(.text)
build/src/libultra/gu/sins.o(.data)
build/asm/boot_data_0x80097DE0.o(.text)
build/asm/boot_data_thread.o(.text)
build/asm/boot_data_siacs.o(.text)
build/asm/boot_data_controller.o(.text)
build/src/libultra/os/thread.o(.data)
build/src/libultra/io/siacs.o(.data)
build/src/libultra/io/controller.o(.data)
build/asm/boot_data_initialize.o(.text)
build/asm/boot_data_pimgr.o(.text)
build/asm/boot_data_piacs.o(.text)
build/src/libultra/io/piacs.o(.data)
build/asm/boot_data_0x80097EB0.o(.text)
build/asm/boot_data_seteventmesg.o(.text)
build/asm/boot_data_xprintf.o(.text)
build/asm/boot_data_timerintr.o(.text)
build/src/libultra/os/seteventmesg.o(.data)
build/src/libultra/rmon/xprintf.o(.data)
build/src/libultra/os/timerintr.o(.data)
build/asm/boot_data_position.o(.text)
build/asm/boot_data_rotate.o(.text)
build/src/libultra/gu/rotate.o(.data)
build/asm/boot_data_0x800906D0.o(.text)
build/asm/boot_data_contramread.o(.text)
build/asm/boot_data_vi.o(.text)

View File

@ -1,6 +1,9 @@
#include <ultra64.h>
#include <global.h>
StackEntry* sStackInfoListStart = NULL;
StackEntry* sStackInfoListEnd = NULL;
void StackCheck_Init(StackEntry* entry, u32 stackTop, u32 stackBottom, u32 initValue, s32 minSpace, char* name) {
StackEntry* iter;
u32* addr;

View File

@ -1,6 +1,13 @@
#include <ultra64.h>
#include <global.h>
u8 D_80096B20 = 1;
vu8 D_80096B24 = 1;
u8 D_80096B28 = 0;
u32 viEnabledSpecialFeatures = 0x42;
f32 screenXScale = 1.0f;
f32 screenYScale = 1.0f;
void Idle_ClearMemory(void* begin, void* end){
if (begin < end) {
bzero(begin, (s32)(int)end - (int)begin);

View File

@ -6,11 +6,10 @@
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
// TODO .data section
//vs32 gPrenmiStage;
//volatile OSTime sLastPrenmiTime;
//vu64 gLastFrameDuration;
//s32 sFrameCount;
vs32 gPrenmiStage = 0;
volatile OSTime sLastPrenmiTime = 0;
vu64 gLastFrameDuration = 0;
s32 sFrameCount = 0;
void IrqMgr_AddCallback(IrqMgr* irqmgr, OSMesgQueueListNode* param_2, OSMesgQueue* param_3) {
u32 saveMask;

View File

@ -1,6 +1,8 @@
#include <ultra64.h>
#include <global.h>
UNK_TYPE4 dmamgrChunkSize = 0x2000;
s32 Dmamgr_DoDmaTransfer(u32 a0, void* a1, u32 a2) {
OSIoMesg sp60;
OSMesgQueue sp48;

View File

@ -1,6 +1,26 @@
#include <ultra64.h>
#include <global.h>
FaultDrawer* faultDrawContext = &faultDrawContextStruct;
FaultDrawer faultDrawContextInit = {
(u16*)0x803DA800, // fb - TODO map out buffers in this region and avoid hard-coded pointer
320, 240, // w, h
16, 223, // yStart, yEnd
22, 297,// xStart, xEnd
0xFFFF, 0x0000, // foreColor, backColor
22, 16, // cursorX, cursorY
(u32*)&faultDrawFont, // font
8, 8, 0, 0, // charW, charH, charWPad, charHPad
{ // printColors
0x0001, 0xF801, 0x07C1, 0xFFC1,
0x003F, 0xF83F, 0x07FF, 0xFFFF,
0x7BDF, 0xB5AD
},
0, // escCode
0, // osSyncPrintfEnabled
NULL, // inputCallback
};
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
faultDrawContext->osSyncPrintfEnabled = enabled;
}

View File

@ -2,8 +2,7 @@
#include <global.h>
void guRotateF(float m[4][4], float a, float x, float y, float z) {
// TODO move in .data section
// static float dtor;
static float D_80097F90 = 0.017453292; // TODO this is PI / 180.0, we should define pi somewhere
float sine;
float cosine;
float ab;

View File

@ -1,7 +1,6 @@
#include <guint.h>
// TODO we can't include this because then sintable is placed in .data, which we strip out
//#include "sintable.h"
extern short sintable[1024];
#include "sintable.h"
short sins(unsigned short x) {
short val;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
#include <ultra64.h>
#include <global.h>
UNK_TYPE4 D_80097E40 = 0;
s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data) {
OSMesg dummy;
s32 ret = 0;

View File

@ -1,6 +1,8 @@
#include <ultra64.h>
#include <global.h>
UNK_TYPE4 __osPiAccessQueueEnabled = 0;
void __osPiCreateAccessQueue(void) {
__osPiAccessQueueEnabled = 1;
osCreateMesgQueue(&__osPiAccessQueue, D_8009E3F0, 1);

View File

@ -1,6 +1,8 @@
#include <ultra64.h>
#include <global.h>
u32 __osSiAccessQueueEnabled = 0;
void __osSiCreateAccessQueue() {
__osSiAccessQueueEnabled = 1;
osCreateMesgQueue(&__osSiAccessQueue, siAccessBuf, 1);

View File

@ -1,6 +1,11 @@
#include <ramrom.h>
#include <osint.h>
u64 osClockRate = 0x0000000003B9ACA0;
s32 osViClock = 0x02E6D354;
UNK_TYPE4 __osShutdown = 0;
UNK_TYPE4 __OSGlobalIntMask = 0x003FFF01;
void func_8008A660(void) {
D_8009D130.type = 7;
D_8009D130.latency = *(u32*)0xA4600014;

View File

@ -1,22 +1,24 @@
#include <osint.h>
UNK_TYPE4 D_80097F10 = 0;
void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg m) {
register u32 saveMask;
__OSEventState* es;
saveMask = __osDisableInt();
es = &__osEventStateTab[e];
es->messageQueue = mq;
es->message = m;
if (e == 14) {
if (__osShutdown != 0 && D_80097F10 == 0) {
osSendMesg(mq, m, 0);
}
D_80097F10 = 1;
}
__osRestoreInt(saveMask);
}

View File

@ -1,11 +1,18 @@
#include <PR/ultratypes.h>
#include <osint.h>
OSThread* __osThreadTail = NULL;
UNK_TYPE D_80097E14 = -1;
OSThread* __osRunQueue = (OSThread*)&__osThreadTail;
OSThread* __osActiveQueue = (OSThread*)&__osThreadTail;
OSThread* __osRunningThread = NULL;
OSThread* __osFaultedThread = NULL;
void __osDequeueThread(OSThread** queue, OSThread* t)
{
register OSThread* pred;
register OSThread* succ;
pred = (OSThread*)queue; //! This seems questionable, but the function matches...
succ = pred->next;
while (succ != NULL) {

View File

@ -6,6 +6,8 @@ u32 __osBaseCounter;
u32 __osViIntrCount;
u32 __osTimerCounter;
extern OSTimer* __osTimerList = &D_8009E590;
void __osTimerServicesInit(void) {
__osCurrentTime = 0;
__osBaseCounter = 0;

View File

@ -32,9 +32,8 @@
#define FLAGS_HASH 8
#define FLAGS_ZERO 16
// TODO .data section should be included after boot .data is split
//char spaces[] = " ";
//char zeroes[] = "00000000000000000000000000000000";
char spaces[] = " ";
char zeroes[] = "00000000000000000000000000000000";
int _Printf(printf_func pfn, void* arg, char* fmt, va_list ap) {
_Pft x;