[coreboot-gerrit] New patch to review for coreboot: c863c96 mips: do not place branch instructions in branch delay slot

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Wed Apr 1 20:28:21 CEST 2015


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9183

-gerrit

commit c863c96fc2f806a785d193b86e4492a6d1b6adb8
Author: Vadim Bendebury <vbendeb at chromium.org>
Date:   Fri Oct 3 09:47:13 2014 -0700

    mips: do not place branch instructions in branch delay slot
    
    A branch instruction in a branch delay slot confuses the execution
    pipeline and causes an exception.
    
    bootblock.S was written 'by hand', has a branch instruction in branch
    delay slot and includes '.set noreorder' directive, which causes it to
    crash when trying to branch to main().
    
    Adding a nop instruction fixes the problem. Also adding a nop after
    the last branch in the file just in case main() returns and the object
    linked next starts with a branch.
    
    BUG=chrome-os-partner:31438
    TEST=Running on the simulator can reach main() now
    
    Change-Id: I0882b2eb5ce426f5a311018ffbb6f37a2ca64d98
    Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
    Reviewed-on: https://chromium-review.googlesource.com/221421
    Reviewed-by: Aaron Durbin <adurbin at chromium.org>
---
 src/arch/mips/bootblock.S | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/arch/mips/bootblock.S b/src/arch/mips/bootblock.S
index dbde803..f369e00 100644
--- a/src/arch/mips/bootblock.S
+++ b/src/arch/mips/bootblock.S
@@ -39,6 +39,10 @@ _start:
 	/* Run main */
 	b	main
 
-	/* Should never return from main. */
-2:
+	/*
+	 * Should never return from main. Make sure there is no branch in the
+	 * branch delay slot.
+	 */
+2:	nop
 	b	2b
+	nop	/* Make sure there is no branch after this either. */



More information about the coreboot-gerrit mailing list