Skip to content

Commit

Permalink
RISC-V: Remove identity_translate from load_elf
Browse files Browse the repository at this point in the history
When load_elf is called with NULL as an argument to the
address translate callback, it does an identity translation.
This commit removes the redundant identity_translate callback.

Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Michael Clark <mjc@sifive.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
Michael Clark committed May 5, 2018
1 parent 6b01e32 commit b793898
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
7 changes: 1 addition & 6 deletions hw/riscv/sifive_e.c
Expand Up @@ -82,16 +82,11 @@ static void copy_le32_to_phys(hwaddr pa, uint32_t *rom, size_t len)
}
}

static uint64_t identity_translate(void *opaque, uint64_t addr)
{
return addr;
}

static uint64_t load_kernel(const char *kernel_filename)
{
uint64_t kernel_entry, kernel_high;

if (load_elf(kernel_filename, identity_translate, NULL,
if (load_elf(kernel_filename, NULL, NULL,
&kernel_entry, NULL, &kernel_high,
0, ELF_MACHINE, 1, 0) < 0) {
error_report("qemu: could not load kernel '%s'", kernel_filename);
Expand Down
7 changes: 1 addition & 6 deletions hw/riscv/sifive_u.c
Expand Up @@ -68,16 +68,11 @@ static void copy_le32_to_phys(hwaddr pa, uint32_t *rom, size_t len)
}
}

static uint64_t identity_translate(void *opaque, uint64_t addr)
{
return addr;
}

static uint64_t load_kernel(const char *kernel_filename)
{
uint64_t kernel_entry, kernel_high;

if (load_elf(kernel_filename, identity_translate, NULL,
if (load_elf(kernel_filename, NULL, NULL,
&kernel_entry, NULL, &kernel_high,
0, ELF_MACHINE, 1, 0) < 0) {
error_report("qemu: could not load kernel '%s'", kernel_filename);
Expand Down
7 changes: 1 addition & 6 deletions hw/riscv/spike.c
Expand Up @@ -59,16 +59,11 @@ static void copy_le32_to_phys(hwaddr pa, uint32_t *rom, size_t len)
}
}

static uint64_t identity_translate(void *opaque, uint64_t addr)
{
return addr;
}

static uint64_t load_kernel(const char *kernel_filename)
{
uint64_t kernel_entry, kernel_high;

if (load_elf_ram_sym(kernel_filename, identity_translate, NULL,
if (load_elf_ram_sym(kernel_filename, NULL, NULL,
&kernel_entry, NULL, &kernel_high, 0, ELF_MACHINE, 1, 0,
NULL, true, htif_symbol_callback) < 0) {
error_report("qemu: could not load kernel '%s'", kernel_filename);
Expand Down
7 changes: 1 addition & 6 deletions hw/riscv/virt.c
Expand Up @@ -62,16 +62,11 @@ static void copy_le32_to_phys(hwaddr pa, uint32_t *rom, size_t len)
}
}

static uint64_t identity_translate(void *opaque, uint64_t addr)
{
return addr;
}

static uint64_t load_kernel(const char *kernel_filename)
{
uint64_t kernel_entry, kernel_high;

if (load_elf(kernel_filename, identity_translate, NULL,
if (load_elf(kernel_filename, NULL, NULL,
&kernel_entry, NULL, &kernel_high,
0, ELF_MACHINE, 1, 0) < 0) {
error_report("qemu: could not load kernel '%s'", kernel_filename);
Expand Down

0 comments on commit b793898

Please sign in to comment.