# HG changeset patch # User Paul Boddie # Date 1453052982 -3600 # Node ID e75e6bb0021e132c0aa2012862219cbbc077254b # Parent 5e7f7cb747e11daef4f9957d875037c668b66e33 Initialise registers so that the stage 2 payload may use interrupts. diff -r 5e7f7cb747e1 -r e75e6bb0021e stage1/head1.S --- a/stage1/head1.S Sun Jan 17 18:48:13 2016 +0100 +++ b/stage1/head1.S Sun Jan 17 18:49:42 2016 +0100 @@ -4,7 +4,7 @@ * Copyright (C) 2009 Qi Hardware Inc. * Author: Wolfgang Spraul * - * Copyright (C) 2015 Paul Boddie + * Copyright (C) 2015, 2016 Paul Boddie * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,10 +25,15 @@ .globl _start .set noreorder +#define CP0_STATUS $12 +#define CP0_CAUSE $13 + _start: b real_start nop - // 8 words for firmware parameters (0x80002008), struct fw_args + + /* 8 words for firmware parameters (0x80002008), struct fw_args */ + .word 0x0 .word 0x0 .word 0x0 @@ -37,7 +42,19 @@ .word 0x0 .word 0x0 .word 0x0 + real_start: + /* + Reset various registers. Otherwise, interrupts do not apparently get + re-enabled properly later when requested. + */ + + li $t0, 0x0040fc04 /* BEV=1, interrupts enabled, ERL=1 */ + mtc0 $t0, CP0_STATUS + + li $t0, 0x00800000 /* IV=1 */ + mtc0 $t0, CP0_CAUSE + /* Setup stack, jump to C code. */ la $sp, 0x80004000