So I have the following code compiled in an MPLABX project using XC32, the goal is to check if I need to change the context for an RTOS implementation:
.extern OS_TaskRUNNING, 0x04 # Both of these are pointers in a C file
.extern OS_TaskNEW, 0x04
CheckSwitch:
la $1, OS_TaskRUNNING
la $2, OS_TaskNEW
lw $1, 0x00($1)
lw $2, 0x00($2)
xor $1, $1, $2
bne $1, $0, ConfirmSwitch
AbortSwitch:
# stuff happens...
ConfirmSwitch:
# stuff happens...
When the values in the two pointers are different, program execution fails to branch to ConfirmSwitch, instead it continues on to AbortSwitch (note for the incredibly observant people: I am using the 'noat' setting for the code in this file). Branching never happens no matter what values end up in $1 and $2. I've tried other variations such as bne $1, $2, ConfirmSwitch
and end up with the same result. I'm at a loss to understand what I could possibly be doing wrong as this functionality is so basic.