diff options
Diffstat (limited to 'src/arch/riscv/stages.c')
-rw-r--r-- | src/arch/riscv/stages.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/arch/riscv/stages.c b/src/arch/riscv/stages.c index 053fd7634c..80754762bd 100644 --- a/src/arch/riscv/stages.c +++ b/src/arch/riscv/stages.c @@ -24,9 +24,20 @@ * linker script. */ +#include <arch/boot.h> +#include <arch/encoding.h> #include <arch/stages.h> +#include <rules.h> void stage_entry(void) { + /* + * Save the FDT pointer before entering ramstage, because mscratch + * might be overwritten in the trap handler, and there is code in + * ramstage that generates misaligned access faults. + */ + if (ENV_RAMSTAGE) + rom_fdt = (const void *)read_csr(mscratch); + main(); } |