Hi,

I am porting SEL4 on RISCV FPGA. I am stuck midway in the kernel elf loader.

The function stuck is memcpy. I have added prints and I am not progressing after the last memcpy call in unpack_elf_to_paddr(). All kinds of input appreciated.


Function under review:
static void unpack_elf_to_paddr(void *elf, paddr_t dest_paddr)

        /* Parse size/length headers. */
        dest_vaddr = elf_getProgramHeaderVaddr(elf, i);
        data_size = elf_getProgramHeaderFileSize(elf, i);
        data_offset = elf_getProgramHeaderOffset(elf, i);

        /* Load data into memory. */

        memcpy((char *)dest_vaddr + phys_virt_offset,
               (char *)elf + data_offset, data_size);
printf("loaded data into memory \n");                 -----> Stuck Here !
     }

}

Can anyone give me a clue on whatsoever to check here ? It worked perfectly in spike simulation.

RISCV FPGA configuration - It supports IMAFD. It has already booted linux. Kernel is loaded at physical address 80 million.


Snap shot

ELF-loader started on
  paddr=[80200000..8060dc17]
elfFile->e_phnum = 1
elfFile->e_phnum = 1
elfFile->e_phnum = 1
elfFile->e_phnum = 1
ELF-loading image 'kernel'
  paddr=[c0000000..c002dfff]
  vaddr=[ffffffff80000000..ffffffff8002dfff]
  virt_entry=ffffffff80000000
elf file is valid
image is aligned
phy range valiidngetting size of image 
elfFile->e_phnum = 1
elfFile->e_phnum = 1
memset each segment in the elf file 
loading each segment in the elf file 2d018
elfFile->e_phnum = 1
loading data into memory 
char *)dest_vaddr + phys_virt_offset = ffffffffc0000000  (char *)elf + data_offset, = ffffffff8020a694
----- ?
 



--
 regards,
Sathya