From: Tim 'mithro' Ansell Date: Mon, 25 Sep 2017 19:28:27 +0000 (+1000) Subject: or1k: Use EXCEPTION_STACK_SIZE of 256bytes. X-Git-Tag: 24jan2021_ls180~1802^2~3 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b1b6a741702a7ca1bf5b021f7f8504784a26aa19;p=litex.git or1k: Use EXCEPTION_STACK_SIZE of 256bytes. or1k defines a 128 byte "red zone" after the stack that can not be touched by the exception handler. We also need 128 bytes to store the 32 registers. --- diff --git a/litex/soc/software/libbase/crt0-or1k.S b/litex/soc/software/libbase/crt0-or1k.S index 5db4142a..ff77910d 100644 --- a/litex/soc/software/libbase/crt0-or1k.S +++ b/litex/soc/software/libbase/crt0-or1k.S @@ -19,7 +19,18 @@ #include -#define EXCEPTION_STACK_SIZE (4*32) +/* + * OR1K Architecture has a 128 byte "red zone" after the stack that can not be + * touched by exception handlers. GCC uses this red zone for locals and + * temps without needing to change the stack pointer. + */ +#define OR1K_RED_ZONE_SIZE 128 + +/* + * We need 4 bytes (32 bits) * 32 registers space on the stack to save all the + * registers. + */ +#define EXCEPTION_STACK_SIZE ((4*32) + OR1K_RED_ZONE_SIZE) #define HANDLE_EXCEPTION ; \ l.addi r1, r1, -EXCEPTION_STACK_SIZE ; \