vxBoot - 1.2.6 : Allow on-chip X memory symbols
@update <> CMakelist.txt : | dump project version <> loader/elf/image : | check if the section virtual address is in X-memory area | perform relocation only if program reside outside the X area | optimize end section wiping <> loader/entry | add X-memory dump | rename generated dump file @fix <> loader/elf/image | fix debug log information <> hardware/get_info | force perform icbi instruction
This commit is contained in:
parent
81bf1a43f2
commit
c45f115b1e
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.15)
|
||||
project(vxBoot VERSION 1.2.5 LANGUAGES C)
|
||||
project(vxBoot VERSION 1.2.6 LANGUAGES C)
|
||||
|
||||
include(GenerateG1A)
|
||||
include(GenerateG3A)
|
||||
|
|
|
@ -51,6 +51,14 @@ void hardware_utlb_patch(void)
|
|||
if (vaddr == 0x00000000) {
|
||||
addr->V = 0;
|
||||
data->V = 0;
|
||||
__asm__ volatile (
|
||||
"mov %0, r0;"
|
||||
"icbi @r0;"
|
||||
"nop"
|
||||
:
|
||||
: "r"(0xa0000000)
|
||||
:
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ int loader_image_load(struct kernel * const kernel)
|
|||
phdr = kernel->elf.phdr;
|
||||
kernel->memory.program.size = 0;
|
||||
for (int i = 0; i < kernel->elf.hdr.e_phnum; ++i) {
|
||||
if (phdr[i].p_vaddr >= 0xe5007000 && phdr[i].p_vaddr <= 0xe5009000)
|
||||
continue;
|
||||
if (phdr[i].p_vaddr < vmin)
|
||||
vmin = phdr[i].p_vaddr;
|
||||
if (phdr[i].p_vaddr + phdr[i].p_memsz > vmax)
|
||||
|
@ -71,20 +73,27 @@ int loader_image_load(struct kernel * const kernel)
|
|||
|
||||
Note that the p_filesz can be smaller than p_memsz so, we need to
|
||||
wipe the segment area before the dump. */
|
||||
for (int i = 0; i < kernel->elf.hdr.e_phnum; ++i) {
|
||||
paddress = (uintptr_t)phdr[i].p_vaddr - vmin;
|
||||
paddress += (uintptr_t)kernel->memory.program.start;
|
||||
for (int i = 0; i < kernel->elf.hdr.e_phnum; ++i){
|
||||
paddress = (uintptr_t)phdr[i].p_vaddr;
|
||||
if (paddress < 0xe5007000 || paddress > 0xe5009000) {
|
||||
paddress -= vmin;
|
||||
paddress += (uintptr_t)kernel->memory.program.start;
|
||||
}
|
||||
|
||||
memset((void*)paddress, 0x00, phdr[i].p_memsz);
|
||||
smemfs_pread(
|
||||
kernel->inode,
|
||||
(void*)paddress,
|
||||
phdr[i].p_filesz,
|
||||
phdr[i].p_offset
|
||||
);
|
||||
|
||||
memset(
|
||||
(void*)paddress,
|
||||
0x00,
|
||||
phdr[i].p_memsz - phdr[i].p_filesz
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* Generate program entry address */
|
||||
kernel->entry = (uintptr_t)kernel->elf.hdr.e_entry - vmin;
|
||||
kernel->entry += (uintptr_t)kernel->hardware.ram.physical.kernel_addr;
|
||||
|
|
|
@ -68,6 +68,7 @@ static int loader_reloc_section(
|
|||
" > '%s' (%d)...",
|
||||
name, nb_rela
|
||||
);
|
||||
terminal_log(LOG_DEBUG, "\n");
|
||||
|
||||
/* precalculate relocalisation operation */
|
||||
voff = (uintptr_t)kernel->hardware.ram.physical.kernel_addr;
|
||||
|
@ -111,6 +112,8 @@ static int loader_reloc_section(
|
|||
val |= (((uint8_t*)loc)[1] << 16);
|
||||
val |= (((uint8_t*)loc)[2] << 8);
|
||||
val |= (((uint8_t*)loc)[3] << 0);
|
||||
if (val >= 0xe5007000 && val <= 0xe5009000)
|
||||
continue;
|
||||
|
||||
switch (table[type].id) {
|
||||
case R_SH_GOT32:
|
||||
|
|
|
@ -17,9 +17,9 @@ static int dump_reloc(struct kernel *kernel)
|
|||
int size;
|
||||
|
||||
size = kernel->memory.program.size + 1;
|
||||
BFile_Remove(u"\\\\fls0\\reloc_dump.s");
|
||||
BFile_Create(u"\\\\fls0\\reloc_dump.s", BFile_File, &size);
|
||||
handle = BFile_Open(u"\\\\fls0\\reloc_dump.s", BFile_WriteOnly);
|
||||
BFile_Remove(u"\\\\fls0\\dump_reloc.bin");
|
||||
BFile_Create(u"\\\\fls0\\dump_reloc.bin", BFile_File, &size);
|
||||
handle = BFile_Open(u"\\\\fls0\\dump_reloc.bin", BFile_WriteOnly);
|
||||
BFile_Write(
|
||||
handle,
|
||||
(void*)kernel->memory.program.start,
|
||||
|
@ -28,6 +28,24 @@ static int dump_reloc(struct kernel *kernel)
|
|||
return (0);
|
||||
}
|
||||
|
||||
/* dump_ilram() : dump the on-chip IL-memory */
|
||||
static int dump_xram(void)
|
||||
{
|
||||
int handle;
|
||||
int size;
|
||||
|
||||
size = 4069;
|
||||
BFile_Remove(u"\\\\fls0\\dump_xram.bin");
|
||||
BFile_Create(u"\\\\fls0\\dump_xram.bin", BFile_File, &size);
|
||||
handle = BFile_Open(u"\\\\fls0\\dump_xram.bin", BFile_WriteOnly);
|
||||
BFile_Write(
|
||||
handle,
|
||||
(void*)0xe5007000,
|
||||
4096
|
||||
);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* loader_inode: Load a ELF programm (PIE) */
|
||||
int loader(struct smemfs_inode const * restrict const inode, int mode)
|
||||
{
|
||||
|
@ -89,6 +107,7 @@ int loader(struct smemfs_inode const * restrict const inode, int mode)
|
|||
return (0);
|
||||
|
||||
gint_world_switch(GINT_CALL((void*)&dump_reloc, (void*)&kernel));
|
||||
gint_world_switch(GINT_CALL((void*)&dump_xram));
|
||||
return (0);
|
||||
}
|
||||
if (mode == LOADER_TRACE) {
|
||||
|
|
Loading…
Reference in New Issue