mirror of
https://github.com/pret/pokestadium.git
synced 2026-09-09 03:45:43 -05:00
Merge pull request #29 from ProjectRevoTPP/decompile_sptask
decompile sptask
This commit is contained in:
3
Makefile
3
Makefile
@@ -45,7 +45,7 @@ CC_OLD = tools/ido_recomp/linux/5.3/cc
|
||||
ASFLAGS = -EB -mtune=vr4300 -march=vr4300 -Iinclude
|
||||
|
||||
# we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff.
|
||||
CFLAGS = -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -Wab,-r4300_mul -D _LANGUAGE_C -woff 649,838,712 -mips2
|
||||
CFLAGS = -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -Wab,-r4300_mul -D _LANGUAGE_C -D F3DEX_GBI -woff 649,838,712 -mips2
|
||||
|
||||
LDFLAGS = -T undefined_syms.txt -T undefined_syms_auto.txt -T undefined_funcs_auto.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/$(TARGET).map --no-check-sections
|
||||
|
||||
@@ -60,6 +60,7 @@ build/src/libultra/os/osSendMesg.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/osStopThread.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/os/osRecvMesg.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/pigetcmdq.c.o: OPTFLAGS := -O1
|
||||
build/src/libultra/io/sptask.c.o: OPTFLAGS := -O1
|
||||
|
||||
default: all
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#ifndef _RCP_H_
|
||||
#define _RCP_H_
|
||||
|
||||
#ifdef _LANGUAGE_C
|
||||
#define HW_REG(reg, type) *(volatile type*)((reg) | 0xA0000000)
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||
@@ -600,7 +604,6 @@ The Indy development board use cartridge domain 1:
|
||||
#define VI_PAL_CLOCK 49656530 /* Hz = 49.656530 MHz */
|
||||
#define VI_MPAL_CLOCK 48628316 /* Hz = 48.628316 MHz */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Audio Interface (AI) Registers
|
||||
*
|
||||
|
||||
@@ -166,7 +166,7 @@ segments:
|
||||
- [0x578F0, asm, libultra/gu/scale]
|
||||
- [0x57990, asm, libultra/gu/sinf]
|
||||
- [0x57B50, asm, libultra/al/sl]
|
||||
- [0x57C10, asm, libultra/io/sptask]
|
||||
- [0x57C10, c, libultra/io/sptask]
|
||||
- [0x57F00, asm, libultra/os/destroythread]
|
||||
- [0x58010, asm, libultra/libc/ll]
|
||||
- [0x582D0, asm, libultra/os/exceptasm]
|
||||
|
||||
60
src/libultra/io/sptask.c
Normal file
60
src/libultra/io/sptask.c
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#define _osVirtualToPhysical(ptr) \
|
||||
if (ptr != NULL) { \
|
||||
ptr = (void*)osVirtualToPhysical(ptr); \
|
||||
}
|
||||
|
||||
extern OSTask sTmpTask;
|
||||
|
||||
OSTask* _VirtualToPhysicalTask(OSTask* intp) {
|
||||
OSTask* tp = &sTmpTask;
|
||||
|
||||
_bcopy(intp, tp, sizeof(OSTask));
|
||||
|
||||
_osVirtualToPhysical(tp->t.ucode);
|
||||
_osVirtualToPhysical(tp->t.ucode_data);
|
||||
_osVirtualToPhysical(tp->t.dram_stack);
|
||||
_osVirtualToPhysical(tp->t.output_buff);
|
||||
_osVirtualToPhysical(tp->t.output_buff_size);
|
||||
_osVirtualToPhysical(tp->t.data_ptr);
|
||||
_osVirtualToPhysical(tp->t.yield_data_ptr);
|
||||
|
||||
return tp;
|
||||
}
|
||||
|
||||
void osSpTaskLoad(OSTask* intp) {
|
||||
OSTask* tp = _VirtualToPhysicalTask(intp);
|
||||
|
||||
if (tp->t.flags & OS_TASK_YIELDED) {
|
||||
tp->t.ucode_data = tp->t.yield_data_ptr;
|
||||
tp->t.ucode_data_size = tp->t.yield_data_size;
|
||||
intp->t.flags &= ~OS_TASK_YIELDED;
|
||||
|
||||
if (tp->t.flags & OS_TASK_LOADABLE) {
|
||||
tp->t.ucode = (u64*)HW_REG((u32)intp->t.yield_data_ptr + OS_YIELD_DATA_SIZE - 4, u32);
|
||||
}
|
||||
}
|
||||
osWritebackDCache(tp, sizeof(OSTask));
|
||||
__osSpSetStatus(SP_CLR_SIG0 | SP_CLR_SIG1 | SP_CLR_SIG2 | SP_SET_INTR_BREAK);
|
||||
|
||||
while (__osSpSetPc((void*)SP_IMEM_START) == -1) {
|
||||
;
|
||||
}
|
||||
while (__osSpRawStartDma(OS_WRITE, (void*)(SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) {
|
||||
;
|
||||
}
|
||||
while (__osSpDeviceBusy()) {
|
||||
;
|
||||
}
|
||||
while (__osSpRawStartDma(OS_WRITE, (void*)SP_IMEM_START, tp->t.ucode_boot, tp->t.ucode_boot_size) == -1) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void osSpTaskStartGo(OSTask* tp) {
|
||||
while (__osSpDeviceBusy()) {
|
||||
;
|
||||
}
|
||||
__osSpSetStatus(SP_SET_INTR_BREAK | SP_CLR_SSTEP | SP_CLR_BROKE | SP_CLR_HALT);
|
||||
}
|
||||
@@ -282,4 +282,8 @@ _timeToSamples = 0x8005FBDC;
|
||||
alUnlink = 0x80056F50;
|
||||
alLink = 0x80056F80;
|
||||
alClose = 0x80056FA4;
|
||||
alInit = 0x80056FDC;
|
||||
alInit = 0x80056FDC;
|
||||
_VirtualToPhysicalTask = 0x80057010;
|
||||
osSpTaskLoad = 0x8005712C;
|
||||
osSpTaskStartGo = 0x800572BC;
|
||||
sTmpTask = 0x80102100;
|
||||
Reference in New Issue
Block a user