mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-10 17:00:19 +00:00
Improve the state of handwritten assembly files (#865)
* Format all handwritten asm and document some * Use c preprocessor for constants * Fix * Fix PI_STATUS_ERROR, some label improvements * Avoid hi/lo for constants * Some more comments * Properly mark functions as functions and their sizes * Fix merge * Improvements * Review suggestions, rework procedure start/end macros to be more like libreultra * Move IPL3 symbol definitions into ipl3.s * Fix undefined_syms, add include and language guards to asm.h and fix the comment in gbi.h * Consistent hex capitalization, add some MIPS builtin defines to CC_CHECK to behave properly * Add -no-pad-sections assembler option and clean up alignment in gu files and bzero * Further suggestions and improvements * Matrix conversion function clarifications * Fix passing AVOID_UB to gcc * Suggestions * Suggestions, global interrupt mask improvements * Further suggestions, interrupt mask comments * Comments fixes, rdb.h * Switch from # comments to // comments, remove unnecesary .set gp=64 directives * Further review suggestions * Missed one
This commit is contained in:
parent
b9fded7b4e
commit
7334ffa373
62 changed files with 2758 additions and 2083 deletions
|
@ -27,8 +27,9 @@ OSPiHandle* osCartRomInit(void) {
|
|||
__CartRomHandle.speed = 0;
|
||||
bzero(&__CartRomHandle.transferInfo, sizeof(__OSTranxInfo));
|
||||
|
||||
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
;
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
}
|
||||
|
||||
lastLatency = HW_REG(PI_BSD_DOM1_LAT_REG, u32);
|
||||
|
|
|
@ -28,7 +28,7 @@ void __osDevMgrMain(void* arg) {
|
|||
phi_s2 = ((transfer->transferMode == 2) && (ioMesg->piHandle->transferInfo.cmdType == 0)) ? 1 : 0;
|
||||
|
||||
osRecvMesg(arg0->acccessQueue, &sp6C, OS_MESG_BLOCK);
|
||||
__osResetGlobalIntMask(0x00100401);
|
||||
__osResetGlobalIntMask(OS_IM_PI);
|
||||
__osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x80000000);
|
||||
|
||||
while (true) {
|
||||
|
@ -43,8 +43,8 @@ void __osDevMgrMain(void* arg) {
|
|||
__osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x1000000);
|
||||
}
|
||||
block->errStatus = 4;
|
||||
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
|
||||
__osSetGlobalIntMask(0x00100C01);
|
||||
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLR_INTR;
|
||||
__osSetGlobalIntMask(OS_IM_CART | OS_IM_PI);
|
||||
}
|
||||
osSendMesg(ioMesg->hdr.retQueue, (OSMesg)ioMesg, OS_MESG_NOBLOCK);
|
||||
|
||||
|
|
|
@ -22,8 +22,9 @@ OSPiHandle* osDriveRomInit(void) {
|
|||
__DriveRomHandle.speed = 0;
|
||||
bzero(&__DriveRomHandle.transferInfo, sizeof(__OSTranxInfo));
|
||||
|
||||
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
;
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
}
|
||||
|
||||
HW_REG(PI_BSD_DOM1_LAT_REG, u32) = 0xFF;
|
||||
|
|
|
@ -4,8 +4,9 @@ s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dr
|
|||
s32 status;
|
||||
OSPiHandle* curHandle;
|
||||
|
||||
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
;
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
}
|
||||
|
||||
if (__osCurrentHandle[handle->domain]->type != handle->type) {
|
||||
|
|
|
@ -4,8 +4,9 @@ s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data) {
|
|||
s32 status;
|
||||
OSPiHandle* curHandle;
|
||||
|
||||
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
;
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
}
|
||||
|
||||
if (__osCurrentHandle[handle->domain]->type != handle->type) {
|
||||
|
|
|
@ -4,8 +4,9 @@ s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) {
|
|||
s32 status;
|
||||
OSPiHandle* curHandle;
|
||||
|
||||
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
;
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
}
|
||||
|
||||
if (__osCurrentHandle[handle->domain]->type != handle->type) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "global.h"
|
||||
|
||||
s32 __osPiRawStartDma(s32 dir, u32 cartAddr, void* dramAddr, size_t size) {
|
||||
register s32 status = HW_REG(PI_STATUS_REG, u32);
|
||||
s32 status;
|
||||
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||
status = HW_REG(PI_STATUS_REG, u32);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "ultra64/asm.h"
|
||||
|
||||
__OSThreadTail __osThreadTail = { NULL, OS_PRIORITY_THREADTAIL };
|
||||
OSThread* __osRunQueue = (OSThread*)&__osThreadTail;
|
||||
|
@ -16,7 +17,7 @@ void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg,
|
|||
thread->queue = NULL;
|
||||
thread->context.pc = (u32)entry;
|
||||
thread->context.a0 = arg;
|
||||
thread->context.sp = (u64)(s32)sp - 16;
|
||||
thread->context.sp = (u64)(s32)sp - FRAMESZ(SZREG * NARGSAVE);
|
||||
thread->context.ra = __osCleanupThread;
|
||||
|
||||
mask = OS_IM_ALL;
|
||||
|
|
|
@ -7,6 +7,8 @@ typedef struct {
|
|||
u32 ins_0C; // nop
|
||||
} struct_exceptionPreamble;
|
||||
|
||||
void __osExceptionPreamble(void);
|
||||
|
||||
u64 osClockRate = OS_CLOCK_RATE;
|
||||
s32 osViClock = VI_NTSC_CLOCK;
|
||||
u32 __osShutdown = 0;
|
||||
|
@ -58,7 +60,7 @@ void __osInitialize_common(void) {
|
|||
osClockRate = (u64)((osClockRate * 3ll) / 4ull);
|
||||
|
||||
if (!osResetType) {
|
||||
bzero(osAppNmiBuffer, sizeof(osAppNmiBuffer));
|
||||
bzero(osAppNMIBuffer, sizeof(osAppNMIBuffer));
|
||||
}
|
||||
|
||||
if (osTvType == OS_TV_PAL) {
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
void __osResetGlobalIntMask(OSHWIntr mask) {
|
||||
register u32 prevInt = __osDisableInt();
|
||||
|
||||
__OSGlobalIntMask &= ~(mask & ~0x401);
|
||||
__OSGlobalIntMask &= ~(mask & ~OS_IM_RCP);
|
||||
__osRestoreInt(prevInt);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue