aboutsummaryrefslogtreecommitdiff
path: root/linux-user/hexagon
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/hexagon')
-rw-r--r--linux-user/hexagon/cpu_loop.c10
-rw-r--r--linux-user/hexagon/elfload.c35
-rw-r--r--linux-user/hexagon/target_elf.h30
-rw-r--r--linux-user/hexagon/target_syscall.h5
4 files changed, 43 insertions, 37 deletions
diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c
index e18a018..1941f4c 100644
--- a/linux-user/hexagon/cpu_loop.c
+++ b/linux-user/hexagon/cpu_loop.c
@@ -36,7 +36,7 @@ void cpu_loop(CPUHexagonState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
- process_queued_cpu_work(cs);
+ qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_INTERRUPT:
@@ -79,9 +79,11 @@ void cpu_loop(CPUHexagonState *env)
}
}
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
+void init_main_thread(CPUState *cs, struct image_info *info)
{
- env->gpr[HEX_REG_PC] = regs->sepc;
- env->gpr[HEX_REG_SP] = regs->sp;
+ CPUArchState *env = cpu_env(cs);
+
+ env->gpr[HEX_REG_PC] = info->entry;
+ env->gpr[HEX_REG_SP] = info->start_stack;
env->gpr[HEX_REG_USR] = 0x56000;
}
diff --git a/linux-user/hexagon/elfload.c b/linux-user/hexagon/elfload.c
new file mode 100644
index 0000000..d8b5450
--- /dev/null
+++ b/linux-user/hexagon/elfload.c
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu.h"
+#include "loader.h"
+
+
+const char *get_elf_cpu_model(uint32_t eflags)
+{
+ static char buf[32];
+ int err;
+
+ /* For now, treat anything newer than v5 as a v73 */
+ /* FIXME - Disable instructions that are newer than the specified arch */
+ if (eflags == 0x04 || /* v5 */
+ eflags == 0x05 || /* v55 */
+ eflags == 0x60 || /* v60 */
+ eflags == 0x61 || /* v61 */
+ eflags == 0x62 || /* v62 */
+ eflags == 0x65 || /* v65 */
+ eflags == 0x66 || /* v66 */
+ eflags == 0x67 || /* v67 */
+ eflags == 0x8067 || /* v67t */
+ eflags == 0x68 || /* v68 */
+ eflags == 0x69 || /* v69 */
+ eflags == 0x71 || /* v71 */
+ eflags == 0x8071 || /* v71t */
+ eflags == 0x73 /* v73 */
+ ) {
+ return "v73";
+ }
+
+ err = snprintf(buf, sizeof(buf), "unknown (0x%x)", eflags);
+ return err >= 0 && err < sizeof(buf) ? buf : "unknown";
+}
diff --git a/linux-user/hexagon/target_elf.h b/linux-user/hexagon/target_elf.h
index 36056fc..f81ae38 100644
--- a/linux-user/hexagon/target_elf.h
+++ b/linux-user/hexagon/target_elf.h
@@ -18,33 +18,7 @@
#ifndef HEXAGON_TARGET_ELF_H
#define HEXAGON_TARGET_ELF_H
-static inline const char *cpu_get_model(uint32_t eflags)
-{
- static char buf[32];
- int err;
-
- /* For now, treat anything newer than v5 as a v73 */
- /* FIXME - Disable instructions that are newer than the specified arch */
- if (eflags == 0x04 || /* v5 */
- eflags == 0x05 || /* v55 */
- eflags == 0x60 || /* v60 */
- eflags == 0x61 || /* v61 */
- eflags == 0x62 || /* v62 */
- eflags == 0x65 || /* v65 */
- eflags == 0x66 || /* v66 */
- eflags == 0x67 || /* v67 */
- eflags == 0x8067 || /* v67t */
- eflags == 0x68 || /* v68 */
- eflags == 0x69 || /* v69 */
- eflags == 0x71 || /* v71 */
- eflags == 0x8071 || /* v71t */
- eflags == 0x73 /* v73 */
- ) {
- return "v73";
- }
-
- err = snprintf(buf, sizeof(buf), "unknown (0x%x)", eflags);
- return err >= 0 && err < sizeof(buf) ? buf : "unknown";
-}
+#define ELF_CLASS ELFCLASS32
+#define ELF_MACHINE EM_HEXAGON
#endif
diff --git a/linux-user/hexagon/target_syscall.h b/linux-user/hexagon/target_syscall.h
index 7f91a4a..d9c9473 100644
--- a/linux-user/hexagon/target_syscall.h
+++ b/linux-user/hexagon/target_syscall.h
@@ -18,11 +18,6 @@
#ifndef HEXAGON_TARGET_SYSCALL_H
#define HEXAGON_TARGET_SYSCALL_H
-struct target_pt_regs {
- abi_long sepc;
- abi_long sp;
-};
-
#define UNAME_MACHINE "hexagon"
#define UNAME_MINIMUM_RELEASE "4.15.0"