MIPS questions

gregory.menke at gsfc.nasa.gov gregory.menke at gsfc.nasa.gov
Fri Oct 24 18:18:02 UTC 2003


Jay Monkman writes:
 > I'm working on a MIPS BSP, and have a couple questions.
 > 
 > Does anybody have TCP/IP working? Unless I make changes, I get
 > alignment errors. During processing, the stack overlays the TCP source
 > and dest port numbers with the address of the mbuf. Since there's no
 > guarantee those stay aligned, how is TCP working on MIPS? It looks
 > like the fixes we put in for ARM will fix this also.

Could you be more specific here?  What driver are you using, where is
the alignment error happening, etc...

 
 > 
 > In _CPU_ISR_Set_level in cpukit/score/cpu/mips/cpu.c, there's a chunk
 > of code:
 >   sr = srbits | ((new_level==0)? (0xfc00 | SR_EXL | SR_IE): \
 >                  (((new_level<<9) & 0xfc00) | \
 >                   (new_level & 1)?(SR_EXL | SR_IE):0));
 > 
 > I think there needs to be parentheses around the last line. Without
 > the parentheses, the statement turns into:
 >   sr = srbits | ((new_level==0)? (0xfc00 | SR_EXL | SR_IE): \
 >	             (SR_EXL | SR_IE));
 > 
 > Or am I missing something?

I think you're missing something, the false term of the first ?: is in
parens.  The 9 bit rightshift and mask yields a constant or'ed into
the expression.  The 2nd ?: tests for 1, which if false yields 0
else the (SR_EXL | SR_IE).  But it is kind of messy and extra parens
would be helpful.

Gregm




More information about the users mailing list