On Mon, Dec 19, 2011 at 8:43 PM, Matthew Hicks <[email protected]> wrote:
> Below is a patch the redefines the macro used for clearing general purpose
> registers from l.or to l.movhi. Using l.or relies on other possible
> uninitialized registers while l.movhi just relies on a 0 immediate value.
> This is important in RTL simulations and environments where the memory used
> for the reg file is NOT guaranteed to be reset to zero. I have also added a
> line which resets r0 since before its first use since it is possible that r0
> may not contain the value 0, but software expects it to be 0.
>
> diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S
> index 1088b5f..1fa6b1d 100644
> --- a/arch/openrisc/kernel/head.S
> +++ b/arch/openrisc/kernel/head.S
> @@ -33,7 +33,7 @@
> l.add rd,rd,rs
>
> #define CLEAR_GPR(gpr) \
> - l.or gpr,r0,r0
> + l.movhi gpr,0
I reckon this is a good move.
>
> #define LOAD_SYMBOL_2_GPR(gpr,symbol) \
> l.movhi gpr,hi(symbol) ;\
> @@ -441,6 +441,9 @@ _dispatch_do_ipage_fault:
> __HEAD
> .global _start
> _start:
> + /* Ensure that r0 really is 0 */
> + CLEAR_GPR(r0)
> +
Shouldn't this be the first instruction of the reset vector instead of _start()?
Cheers
Julius
_______________________________________________
OpenRISC mailing list
[email protected]
http://lists.openrisc.net/listinfo/openrisc