u-boot/arch
Weijie Gao 6e9281b559 mips: start.S: avoid overwriting outside gd when clearing global data in stack
When setting up initial stack, global data will also be put in the stack,
and being cleared.

The assembler instructions for clearing gd is as follows:

	move	t0, k0
1:
	PTR_S	zero, 0(t0)
	blt	t0, t1, 1b
	 PTR_ADDIU t0, PTRSIZE

t0 is the start address of gd, t1 is the end address of gd (t0 + GD_SIZE).

[PTR_ADDIU t0, PTRSIZE] is in the delay slot of [blt t0, t1, 1b], so it
will be executed before the branch operation.

However the comparison for the BLT instruction is done before executing the
delay slot. This means when the last word just before k1 is cleared, the
loop will continue to run once. This will clear an extra word at k1, which
is outside the global data.

Global data is placed at the top of the stack. If the initial stack is a
SRAM or locked cache, the area outside them may be inaccessible. A write
operation performed in this area may cause an exception.

To solve this, [PTR_ADDIU t0, PTRSIZE] should be placed before the BLT
instruction.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2020-04-27 20:29:33 +02:00
..
arc ARC: HSDK: Enable on-chip reset controller 2020-04-16 23:36:36 +03:00
arm arm: add Cubieboard7 board support 2020-04-24 16:40:09 -04:00
m68k kconfig / kbuild: Re-sync with Linux 4.19 2020-04-10 11:18:32 -04:00
microblaze Kconfig: Remove redundant variable sets 2020-03-16 16:42:50 -04:00
mips mips: start.S: avoid overwriting outside gd when clearing global data in stack 2020-04-27 20:29:33 +02:00
nds32 dma-mapping: move dma_map_(un)single() to <linux/dma-mapping.h> 2020-02-19 21:27:30 +08:00
nios2 common: Move hang() to the same header as panic() 2020-01-24 23:06:49 +05:30
powerpc phy: add support for backplane kr mode 2020-04-20 13:35:11 +05:30
riscv riscv: Move all fdt fixups together 2020-04-23 10:14:16 +08:00
sandbox test: pinmux: add pincontrol-gpio for pin configuration 2020-04-16 23:06:54 -04:00
sh dma-mapping: add <asm/dma-mapping.h> for all architectures 2020-02-20 15:09:54 +08:00
x86 x86: Move acpi_table header to main include/ directory 2020-04-16 14:36:28 +08:00
xtensa dma-mapping: add <asm/dma-mapping.h> for all architectures 2020-02-20 15:09:54 +08:00
.gitignore
Kconfig sandbox: implement ft_board_setup() 2020-04-16 08:07:58 -06:00
u-boot-elf.lds arch: Add explicit linker script for u-boot-elf 2020-04-03 11:52:55 -04:00