qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/23] Add CPU initialization function


From: Richard Henderson
Subject: Re: [PATCH 01/23] Add CPU initialization function
Date: Mon, 17 Jun 2024 21:17:04 -0700
User-agent: Mozilla Thunderbird

On 6/17/24 11:57, Ajeet Singh wrote:
From: Stacey Son <sson@FreeBSD.org>

Addded function to initialize ARM CPU
and to check if it supports 64 bit mode

Signed-off-by: Ajeet Singh <itachis@FreeBSD.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
---
  bsd-user/aarch64/target_arch_cpu.h | 42 ++++++++++++++++++++++++++++++
  1 file changed, 42 insertions(+)
  create mode 100644 bsd-user/aarch64/target_arch_cpu.h

diff --git a/bsd-user/aarch64/target_arch_cpu.h 
b/bsd-user/aarch64/target_arch_cpu.h
new file mode 100644
index 0000000000..db5c7062b9
--- /dev/null
+++ b/bsd-user/aarch64/target_arch_cpu.h
@@ -0,0 +1,42 @@
+/*
+ *  ARM AArch64 cpu init and loop
+ *
+ * Copyright (c) 2015 Stacey Son
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TARGET_ARCH_CPU_H
+#define TARGET_ARCH_CPU_H
+
+#include "target_arch.h"
+#include "target/arm/syndrome.h"

Do you actually need syndrome.h?

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

+
+#define TARGET_DEFAULT_CPU_MODEL "any"
+
+static inline void target_cpu_init(CPUARMState *env,
+    struct target_pt_regs *regs)
+{
+    int i;
+
+    if (!(arm_feature(env, ARM_FEATURE_AARCH64))) {
+        fprintf(stderr, "The selected ARM CPU does not support 64 bit mode\n");
+        exit(1);
+    }
+    for (i = 0; i < 31; i++) {
+        env->xregs[i] = regs->regs[i];
+    }
+    env->pc = regs->pc;
+    env->xregs[31] = regs->sp;
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]