mirror of
https://github.com/qemu/qemu.git
synced 2024-12-04 09:13:39 +08:00
hw/mips/fuloong2e: Use bl_gen_kernel_jump to generate bootloaders
Replace embedded binary with generated code. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20201215064507.30148-2-jiaxun.yang@flygoat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> [PMD: Split original patch as one for each machine (here fuloong2e)] Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
parent
3ebbf86128
commit
4d0c59fa07
@ -33,6 +33,7 @@
|
||||
#include "hw/i2c/smbus_eeprom.h"
|
||||
#include "hw/block/flash.h"
|
||||
#include "hw/mips/mips.h"
|
||||
#include "hw/mips/bootloader.h"
|
||||
#include "hw/mips/cpudevs.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "qemu/log.h"
|
||||
@ -185,30 +186,8 @@ static void write_bootloader(CPUMIPSState *env, uint8_t *base,
|
||||
/* Second part of the bootloader */
|
||||
p = (uint32_t *)(base + 0x040);
|
||||
|
||||
/* lui a0, 0 */
|
||||
stl_p(p++, 0x3c040000);
|
||||
/* ori a0, a0, 2 */
|
||||
stl_p(p++, 0x34840002);
|
||||
/* lui a1, high(ENVP_VADDR) */
|
||||
stl_p(p++, 0x3c050000 | ((ENVP_VADDR >> 16) & 0xffff));
|
||||
/* ori a1, a0, low(ENVP_VADDR) */
|
||||
stl_p(p++, 0x34a50000 | (ENVP_VADDR & 0xffff));
|
||||
/* lui a2, high(ENVP_VADDR + 8) */
|
||||
stl_p(p++, 0x3c060000 | (((ENVP_VADDR + 8) >> 16) & 0xffff));
|
||||
/* ori a2, a2, low(ENVP_VADDR + 8) */
|
||||
stl_p(p++, 0x34c60000 | ((ENVP_VADDR + 8) & 0xffff));
|
||||
/* lui a3, high(env->ram_size) */
|
||||
stl_p(p++, 0x3c070000 | (loaderparams.ram_size >> 16));
|
||||
/* ori a3, a3, low(env->ram_size) */
|
||||
stl_p(p++, 0x34e70000 | (loaderparams.ram_size & 0xffff));
|
||||
/* lui ra, high(kernel_addr) */
|
||||
stl_p(p++, 0x3c1f0000 | ((kernel_addr >> 16) & 0xffff));
|
||||
/* ori ra, ra, low(kernel_addr) */
|
||||
stl_p(p++, 0x37ff0000 | (kernel_addr & 0xffff));
|
||||
/* jr ra */
|
||||
stl_p(p++, 0x03e00008);
|
||||
/* nop */
|
||||
stl_p(p++, 0x00000000);
|
||||
bl_gen_jump_kernel(&p, ENVP_VADDR - 64, 2, ENVP_VADDR, ENVP_VADDR + 8,
|
||||
loaderparams.ram_size, kernel_addr);
|
||||
}
|
||||
|
||||
static void main_cpu_reset(void *opaque)
|
||||
|
Loading…
Reference in New Issue
Block a user