mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-15 12:24:39 +00:00
Improve and fix some non matchings (#148)
This commit is contained in:
parent
e29b77919b
commit
c599318a17
11 changed files with 49 additions and 275 deletions
|
@ -2,16 +2,13 @@
|
|||
#include <global.h>
|
||||
#include <ultra64/hardware.h>
|
||||
|
||||
s32 __osSpSetPc(u32 data) {
|
||||
|
||||
s32 __osSpSetPc(void* pc) {
|
||||
register u32 spStatus = HW_REG(SP_STATUS_REG, u32);
|
||||
|
||||
if (!(spStatus & SP_STATUS_HALT)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
else {
|
||||
HW_REG(SP_PC_REG, u32) = data;
|
||||
} else {
|
||||
HW_REG(SP_PC_REG, void*) = pc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -28,7 +28,7 @@ s32 __osSiRawWriteIo(void*, u32);
|
|||
s32 osPiRawReadIo(u32 a0, u32 *a1);
|
||||
void __osSpSetStatus(u32);
|
||||
u32 __osSpGetStatus();
|
||||
s32 __osSpSetPc(u32 data);
|
||||
s32 __osSpSetPc(void*);
|
||||
s32 __osSpDeviceBusy();
|
||||
s32 __osSiDeviceBusy();
|
||||
s32 __osSpRawStartDma(u32 dir, void *sp_ptr, void *dram_ptr, size_t size);
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
}
|
||||
|
||||
static OSTask sTmpTask;
|
||||
|
||||
OSTask* _VirtualToPhysicalTask(OSTask* intp) {
|
||||
OSTask* tp;
|
||||
tp = &sTmpTask;
|
||||
OSTask* tp = &sTmpTask;
|
||||
|
||||
bcopy(intp, tp, sizeof(OSTask));
|
||||
|
||||
_osVirtualToPhysical(tp->t.ucode);
|
||||
|
@ -22,12 +23,9 @@ OSTask* _VirtualToPhysicalTask(OSTask* intp) {
|
|||
return tp;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// very close to matching, just regalloc
|
||||
void osSpTaskLoad(OSTask* intp) {
|
||||
OSTask* tp = _VirtualToPhysicalTask(intp);
|
||||
|
||||
OSTask* tp;
|
||||
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;
|
||||
|
@ -38,11 +36,11 @@ void osSpTaskLoad(OSTask* intp) {
|
|||
}
|
||||
osWritebackDCache(tp, sizeof(OSTask));
|
||||
__osSpSetStatus(SP_CLR_SIG0 | SP_CLR_SIG1 | SP_CLR_SIG2 | SP_SET_INTR_BREAK);
|
||||
while (__osSpSetPc(SP_IMEM_START) == -1) {
|
||||
while (__osSpSetPc((void*)SP_IMEM_START) == -1) {
|
||||
;
|
||||
}
|
||||
|
||||
while (__osSpRawStartDma(1, (SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) {
|
||||
while (__osSpRawStartDma(1, (void*)(SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) {
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -50,13 +48,10 @@ void osSpTaskLoad(OSTask* intp) {
|
|||
;
|
||||
}
|
||||
|
||||
while (__osSpRawStartDma(1, SP_IMEM_START, tp->t.ucode_boot, tp->t.ucode_boot_size) == -1) {
|
||||
while (__osSpRawStartDma(1, (void*)SP_IMEM_START, tp->t.ucode_boot, tp->t.ucode_boot_size) == -1) {
|
||||
;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sptask/osSpTaskLoad.s")
|
||||
#endif
|
||||
|
||||
void osSpTaskStartGo(OSTask* tp) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue