[U-Boot] Is it necessary that uboot(mips) should read status register($12) before setting it

Hi all,
MIPS Uboot works OK.Part of the code is as below.
And my questions: 1.read status register($12) and save value to $10,but don't use the value in $10 to do anything. Because uboot overwrite $10.
2.Is it right?I can delete this code "mfc0 $10,$12" from uboot.
Thanks.
Bruce
# Initialize Misc. Cop0 state
# Read status register mfc0 $10, $12 //Can I delete this code?
# Set up Status register: # Disable Coprocessor Usable bits # Turn off Reduce Power bit # Turn off reverse endian # Turn off BEV (use normal exception vectors) # Clear TS, SR, NMI bits # Clear Interrupt masks # Clear User Mode # Clear ERL # Set EXL # Clear Interrupt Enable # modify by Bruce #li $11, 0x0000ff02 li $11, 0x00000004 mtc0 $11, $12
# Disable watch exceptions mtc0 $0, $18
# Clear Watch Status bits li $11, 0x3 mtc0 $11, $19
# Clear WP bit to avoid watch exception upon user code entry # Clear IV bit - Interrupts go to general exception vector # Clear software interrupts mtc0 $0, $13
# Set KSeg0 to cacheable # Config.K0 mfc0 $10, $16 //Overwrite $10 register.Why uboot read status register($12) and save value to $10,but don't use $10.
li $11, 0x7 not $11 and $10, $11 or $10, 0x3 mtc0 $10, $16

Hi Bruce,
MIPS Uboot works OK.Part of the code is as below.
Congratulations. Although I'm not sure what I'm congratulating on ;)
And my questions: 1.read status register($12) and save value to $10,but don't use the value in $10 to do anything. Because uboot overwrite $10.
2.Is it right?I can delete this code "mfc0 $10,$12" from uboot.
I'm sorry, but I don;t know what to make of this. Can you tell us if this code is from U-Boot and if so, in which file? Also can't you try for yourself if U-Boot still works after removing this instruction?
What exactly do you want us to tell you?
Cheers Detlev

On Wednesday, September 28, 2011 11:09:05 AM RdrouterUboot Router wrote:
Hi all,
MIPS Uboot works OK.Part of the code is as below.
And my questions: 1.read status register($12) and save value to $10,but don't use the value in $10 to do anything. Because uboot overwrite $10.
2.Is it right?I can delete this code "mfc0 $10,$12" from uboot.
Thanks.
Bruce
I don't see this code in uboot at all ... what version do you use ?

On 09/28/2011 06:09 PM, RdrouterUboot Router wrote:
2.Is it right?I can delete this code "mfc0 $10,$12" from uboot.
You can delete that MFC0 instruction in this case and save one word. Presumably the original code used to update the Status register value in read-modify-write manner, and at some point someone modified into current shape.
By the way, since the first MIPS implementation of U-Boot was merged into the tree (by wdenk), we've been using k0($26) or t0($8) register as a scratch pad when modifying the Status register, while your example code uses t2($10). So it would be a custom U-Boot we don't know of.
participants (4)
-
Detlev Zundel
-
Marek Vasut
-
RdrouterUboot Router
-
Shinya Kuribayashi