aboutsummaryrefslogtreecommitdiff
path: root/pk/elf.c
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-02-19 12:09:14 -0800
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-02-19 12:09:14 -0800
commit31ad71b8a4a2ef1b9692a844c3b9a938a22fb9b1 (patch)
treea0db4f0328e0c69e4c14f44ec7ee3caae2025e68 /pk/elf.c
parent676c953b798e33022a8a63a55f2c65af43442cb4 (diff)
downloadriscv-pk-31ad71b8a4a2ef1b9692a844c3b9a938a22fb9b1.zip
riscv-pk-31ad71b8a4a2ef1b9692a844c3b9a938a22fb9b1.tar.gz
riscv-pk-31ad71b8a4a2ef1b9692a844c3b9a938a22fb9b1.tar.bz2
Remove incorrect code supporting ELF32 on RV64 and vice-versa
This is technically possible by running an RV32 supervisor on an RV64 machine, but the M-mode and S-mode code would need to be compiled and linked separately.
Diffstat (limited to 'pk/elf.c')
-rw-r--r--pk/elf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/pk/elf.c b/pk/elf.c
index f5da5a6..5f7210c 100644
--- a/pk/elf.c
+++ b/pk/elf.c
@@ -84,15 +84,20 @@ void load_elf(const char* fn, elf_info* info)
} \
} while(0)
- info->elf64 = IS_ELF64(eh64);
- if (info->elf64)
+ if (IS_ELF64(eh64))
{
+#ifndef __riscv64
+ panic("can't run 64-bit ELF on 32-bit arch");
+#endif
Elf64_Ehdr* eh;
Elf64_Phdr* ph;
LOAD_ELF;
}
else if (IS_ELF32(eh64))
{
+#ifdef __riscv64
+ panic("can't run 32-bit ELF on 64-bit arch");
+#endif
Elf32_Ehdr* eh;
Elf32_Phdr* ph;
LOAD_ELF;