- Fix wrong amoswap t1 usage in startup. - Reset the board after crash. - Enable distro booting from an attached SCSI disk for QEMU. - Support the optional header fields in efi header.
This commit is contained in:
@@ -123,7 +123,7 @@ call_board_init_f_0:
|
|||||||
* wait for initialization to complete.
|
* wait for initialization to complete.
|
||||||
*/
|
*/
|
||||||
la t0, hart_lottery
|
la t0, hart_lottery
|
||||||
li s2, 1
|
li t1, 1
|
||||||
amoswap.w s2, t1, 0(t0)
|
amoswap.w s2, t1, 0(t0)
|
||||||
bnez s2, wait_for_gd_init
|
bnez s2, wait_for_gd_init
|
||||||
#else
|
#else
|
||||||
|
@@ -15,11 +15,13 @@
|
|||||||
#define SAVE_LONG(reg, idx) sd reg, (idx*SIZE_LONG)(sp)
|
#define SAVE_LONG(reg, idx) sd reg, (idx*SIZE_LONG)(sp)
|
||||||
#define LOAD_LONG(reg, idx) ld reg, (idx*SIZE_LONG)(sp)
|
#define LOAD_LONG(reg, idx) ld reg, (idx*SIZE_LONG)(sp)
|
||||||
#define PE_MACHINE IMAGE_FILE_MACHINE_RISCV64
|
#define PE_MACHINE IMAGE_FILE_MACHINE_RISCV64
|
||||||
|
#define PE_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
|
||||||
#else
|
#else
|
||||||
#define SIZE_LONG 4
|
#define SIZE_LONG 4
|
||||||
#define SAVE_LONG(reg, idx) sw reg, (idx*SIZE_LONG)(sp)
|
#define SAVE_LONG(reg, idx) sw reg, (idx*SIZE_LONG)(sp)
|
||||||
#define LOAD_LONG(reg, idx) lw reg, (idx*SIZE_LONG)(sp)
|
#define LOAD_LONG(reg, idx) lw reg, (idx*SIZE_LONG)(sp)
|
||||||
#define PE_MACHINE IMAGE_FILE_MACHINE_RISCV32
|
#define PE_MACHINE IMAGE_FILE_MACHINE_RISCV32
|
||||||
|
#define PE_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ coff_header:
|
|||||||
IMAGE_FILE_LOCAL_SYMS_STRIPPED | \
|
IMAGE_FILE_LOCAL_SYMS_STRIPPED | \
|
||||||
IMAGE_FILE_DEBUG_STRIPPED)
|
IMAGE_FILE_DEBUG_STRIPPED)
|
||||||
optional_header:
|
optional_header:
|
||||||
.short IMAGE_NT_OPTIONAL_HDR64_MAGIC /* PE32+ format */
|
.short PE_MAGIC /* PE32(+) format */
|
||||||
.byte 0x02 /* MajorLinkerVersion */
|
.byte 0x02 /* MajorLinkerVersion */
|
||||||
.byte 0x14 /* MinorLinkerVersion */
|
.byte 0x14 /* MinorLinkerVersion */
|
||||||
.long _edata - _start /* SizeOfCode */
|
.long _edata - _start /* SizeOfCode */
|
||||||
@@ -56,9 +58,16 @@ optional_header:
|
|||||||
.long 0 /* SizeOfUninitializedData */
|
.long 0 /* SizeOfUninitializedData */
|
||||||
.long _start - ImageBase /* AddressOfEntryPoint */
|
.long _start - ImageBase /* AddressOfEntryPoint */
|
||||||
.long _start - ImageBase /* BaseOfCode */
|
.long _start - ImageBase /* BaseOfCode */
|
||||||
|
#if __riscv_xlen == 32
|
||||||
|
.long 0 /* BaseOfData */
|
||||||
|
#endif
|
||||||
|
|
||||||
extra_header_fields:
|
extra_header_fields:
|
||||||
|
#if __riscv_xlen == 32
|
||||||
|
.long 0 /* ImageBase */
|
||||||
|
#else
|
||||||
.quad 0 /* ImageBase */
|
.quad 0 /* ImageBase */
|
||||||
|
#endif
|
||||||
.long 0x20 /* SectionAlignment */
|
.long 0x20 /* SectionAlignment */
|
||||||
.long 0x8 /* FileAlignment */
|
.long 0x8 /* FileAlignment */
|
||||||
.short 0 /* MajorOperatingSystemVersion */
|
.short 0 /* MajorOperatingSystemVersion */
|
||||||
@@ -78,10 +87,17 @@ extra_header_fields:
|
|||||||
.long 0 /* CheckSum */
|
.long 0 /* CheckSum */
|
||||||
.short IMAGE_SUBSYSTEM_EFI_APPLICATION /* Subsystem */
|
.short IMAGE_SUBSYSTEM_EFI_APPLICATION /* Subsystem */
|
||||||
.short 0 /* DllCharacteristics */
|
.short 0 /* DllCharacteristics */
|
||||||
|
#if __riscv_xlen == 32
|
||||||
|
.long 0 /* SizeOfStackReserve */
|
||||||
|
.long 0 /* SizeOfStackCommit */
|
||||||
|
.long 0 /* SizeOfHeapReserve */
|
||||||
|
.long 0 /* SizeOfHeapCommit */
|
||||||
|
#else
|
||||||
.quad 0 /* SizeOfStackReserve */
|
.quad 0 /* SizeOfStackReserve */
|
||||||
.quad 0 /* SizeOfStackCommit */
|
.quad 0 /* SizeOfStackCommit */
|
||||||
.quad 0 /* SizeOfHeapReserve */
|
.quad 0 /* SizeOfHeapReserve */
|
||||||
.quad 0 /* SizeOfHeapCommit */
|
.quad 0 /* SizeOfHeapCommit */
|
||||||
|
#endif
|
||||||
.long 0 /* LoaderFlags */
|
.long 0 /* LoaderFlags */
|
||||||
.long 0x6 /* NumberOfRvaAndSizes */
|
.long 0x6 /* NumberOfRvaAndSizes */
|
||||||
|
|
||||||
@@ -91,6 +107,16 @@ extra_header_fields:
|
|||||||
.quad 0 /* ExceptionTable */
|
.quad 0 /* ExceptionTable */
|
||||||
.quad 0 /* CertificationTable */
|
.quad 0 /* CertificationTable */
|
||||||
.quad 0 /* BaseRelocationTable */
|
.quad 0 /* BaseRelocationTable */
|
||||||
|
.quad 0 /* Debug */
|
||||||
|
.quad 0 /* Architecture */
|
||||||
|
.quad 0 /* Global Ptr */
|
||||||
|
.quad 0 /* TLS Table */
|
||||||
|
.quad 0 /* Load Config Table */
|
||||||
|
.quad 0 /* Bound Import */
|
||||||
|
.quad 0 /* IAT */
|
||||||
|
.quad 0 /* Delay Import Descriptor */
|
||||||
|
.quad 0 /* CLR Runtime Header */
|
||||||
|
.quad 0 /* Reserved */
|
||||||
|
|
||||||
/* Section table */
|
/* Section table */
|
||||||
section_table:
|
section_table:
|
||||||
|
@@ -27,7 +27,7 @@ static void show_efi_loaded_images(uintptr_t epc)
|
|||||||
static void show_regs(struct pt_regs *regs)
|
static void show_regs(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SHOW_REGS
|
#ifdef CONFIG_SHOW_REGS
|
||||||
printf("SP: " REG_FMT " GP: " REG_FMT " TP: " REG_FMT "\n",
|
printf("\nSP: " REG_FMT " GP: " REG_FMT " TP: " REG_FMT "\n",
|
||||||
regs->sp, regs->gp, regs->tp);
|
regs->sp, regs->gp, regs->tp);
|
||||||
printf("T0: " REG_FMT " T1: " REG_FMT " T2: " REG_FMT "\n",
|
printf("T0: " REG_FMT " T1: " REG_FMT " T2: " REG_FMT "\n",
|
||||||
regs->t0, regs->t1, regs->t2);
|
regs->t0, regs->t1, regs->t2);
|
||||||
@@ -45,7 +45,7 @@ static void show_regs(struct pt_regs *regs)
|
|||||||
regs->s7, regs->s8, regs->s9);
|
regs->s7, regs->s8, regs->s9);
|
||||||
printf("S10: " REG_FMT " S11: " REG_FMT " T3: " REG_FMT "\n",
|
printf("S10: " REG_FMT " S11: " REG_FMT " T3: " REG_FMT "\n",
|
||||||
regs->s10, regs->s11, regs->t3);
|
regs->s10, regs->s11, regs->t3);
|
||||||
printf("T4: " REG_FMT " T5: " REG_FMT " T6: " REG_FMT "\n\n",
|
printf("T4: " REG_FMT " T5: " REG_FMT " T6: " REG_FMT "\n",
|
||||||
regs->t4, regs->t5, regs->t6);
|
regs->t4, regs->t5, regs->t6);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -80,12 +80,12 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
|
|||||||
epc, regs->ra, tval);
|
epc, regs->ra, tval);
|
||||||
/* Print relocation adjustments, but only if gd is initialized */
|
/* Print relocation adjustments, but only if gd is initialized */
|
||||||
if (gd && gd->flags & GD_FLG_RELOC)
|
if (gd && gd->flags & GD_FLG_RELOC)
|
||||||
printf("EPC: " REG_FMT " RA: " REG_FMT " reloc adjusted\n\n",
|
printf("EPC: " REG_FMT " RA: " REG_FMT " reloc adjusted\n",
|
||||||
epc - gd->reloc_off, regs->ra - gd->reloc_off);
|
epc - gd->reloc_off, regs->ra - gd->reloc_off);
|
||||||
|
|
||||||
show_regs(regs);
|
show_regs(regs);
|
||||||
show_efi_loaded_images(epc);
|
show_efi_loaded_images(epc);
|
||||||
hang();
|
panic("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int interrupt_init(void)
|
int interrupt_init(void)
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#define BOOT_TARGET_DEVICES(func) \
|
#define BOOT_TARGET_DEVICES(func) \
|
||||||
func(QEMU, qemu, na) \
|
func(QEMU, qemu, na) \
|
||||||
func(VIRTIO, virtio, 0) \
|
func(VIRTIO, virtio, 0) \
|
||||||
|
func(SCSI, scsi, 0) \
|
||||||
func(DHCP, dhcp, na)
|
func(DHCP, dhcp, na)
|
||||||
|
|
||||||
#include <config_distro_bootcmd.h>
|
#include <config_distro_bootcmd.h>
|
||||||
|
Reference in New Issue
Block a user