aboutsummaryrefslogtreecommitdiff
path: root/linux-user/elfload.c
diff options
context:
space:
mode:
authorMichael Clark <mjc@sifive.com>2018-03-03 01:31:11 +1300
committerMichael Clark <mjc@sifive.com>2018-03-07 08:30:28 +1300
commit47ae93cdfedc683c56e19113d516d7ce4971c8e6 (patch)
tree713240f8392d981ec9b11893d603475f7a5dcfa5 /linux-user/elfload.c
parent65c5b75c38b3e56650fc63674039108697096f75 (diff)
RISC-V Linux User Emulation
Implementation of linux user emulation for RISC-V. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Sagar Karandikar <sagark@eecs.berkeley.edu> Signed-off-by: Michael Clark <mjc@sifive.com>
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r--linux-user/elfload.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index e3689c658a..5fc130cc20 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1295,6 +1295,28 @@ static inline void init_thread(struct target_pt_regs *regs,
#endif /* TARGET_TILEGX */
+#ifdef TARGET_RISCV
+
+#define ELF_START_MMAP 0x80000000
+#define ELF_ARCH EM_RISCV
+
+#ifdef TARGET_RISCV32
+#define ELF_CLASS ELFCLASS32
+#else
+#define ELF_CLASS ELFCLASS64
+#endif
+
+static inline void init_thread(struct target_pt_regs *regs,
+ struct image_info *infop)
+{
+ regs->sepc = infop->entry;
+ regs->sp = infop->start_stack;
+}
+
+#define ELF_EXEC_PAGESIZE 4096
+
+#endif /* TARGET_RISCV */
+
#ifdef TARGET_HPPA
#define ELF_START_MMAP 0x80000000