• Paul Burton's avatar
    MIPS: Always allocate exception vector for MIPSr2+ · 172dcd93
    Paul Burton authored
    Currently we allocate the exception vector on systems which use a
    vectored interrupt mode, but otherwise attempt to reuse whatever
    exception vector the bootloader uses.
    
    This can be problematic for a number of reasons:
    
      1) The memory isn't properly marked reserved in the memblock
         allocator. We've relied on the fact that EBase is generally in the
         memory below the kernel image which we don't free, but this is
         about to change.
    
      2) Recent versions of U-Boot place their exception vector high in
         kseg0, in memory which isn't protected by being lower than the
         kernel anyway & can end up being clobbered.
    
      3) We are unnecessarily reliant upon there being memory at the address
         EBase points to upon entry to the kernel. This is often the case,
         but if the bootloader doesn't configure EBase & leaves it with its
         default value then we rely upon there being memory at physical
         address 0 for no good reason.
    
    Improve this situation by allocating the exception vector in all cases
    when running on MIPSr2 or higher, and reserving the memory for MIPSr1 or
    lower. This ensures we don't clobber the exception vector in any
    configuration, and for MIPSr2 & higher removes the need for memory at
    physical address 0.
    Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
    Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
    Tested-by: default avatarSerge Semin <fancer.lancer@gmail.com>
    Cc: linux-mips@vger.kernel.org
    172dcd93
traps.c 60.6 KB