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

RdrouterUboot Router rdrouteruboot at gmail.com
Wed Sep 28 11:09:05 CEST 2011


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


More information about the U-Boot mailing list