Hi Michael,

On 1/18/20 8:13 PM, Michael Rolnik wrote:
This includes:
- CPU data structures
- object model classes and functions
- migration functions
- GDB hooks

Co-developed-by: Michael Rolnik <mrol...@gmail.com>
Co-developed-by: Sarah Harris <s.e.har...@kent.ac.uk>
Signed-off-by: Michael Rolnik <mrol...@gmail.com>
Signed-off-by: Sarah Harris <s.e.har...@kent.ac.uk>
Signed-off-by: Michael Rolnik <mrol...@gmail.com>
Acked-by: Igor Mammedov <imamm...@redhat.com>
Tested-by: Philippe Mathieu-Daudé <phi...@redhat.com>
---
  target/avr/cpu-param.h |  37 ++
  target/avr/cpu-qom.h   |  54 +++
  target/avr/cpu.h       | 258 +++++++++++++
  target/avr/cpu.c       | 826 +++++++++++++++++++++++++++++++++++++++++
  target/avr/gdbstub.c   |  84 +++++
  target/avr/machine.c   | 121 ++++++
  gdb-xml/avr-cpu.xml    |  49 +++
  7 files changed, 1429 insertions(+)
  create mode 100644 target/avr/cpu-param.h
  create mode 100644 target/avr/cpu-qom.h
  create mode 100644 target/avr/cpu.h
  create mode 100644 target/avr/cpu.c
  create mode 100644 target/avr/gdbstub.c
  create mode 100644 target/avr/machine.c
  create mode 100644 gdb-xml/avr-cpu.xml

[...]> diff --git a/target/avr/cpu.c b/target/avr/cpu.c
new file mode 100644
index 0000000000..c74c5106fe
--- /dev/null
+++ b/target/avr/cpu.c
@@ -0,0 +1,826 @@
+/*
+ * QEMU AVR CPU
+ *
+ * Copyright (c) 2019 Michael Rolnik
+ *
+ * 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.1 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/lgpl-2.1.html>
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qemu/qemu-print.h"
+#include "exec/exec-all.h"
+#include "cpu.h"
+#include "disas/dis-asm.h"
+
+static void avr_cpu_set_pc(CPUState *cs, vaddr value)
+{
+    AVRCPU *cpu = AVR_CPU(cs);
+
+    cpu->env.pc_w = value / 2; /* internally PC points to words */
+}
+
+static bool avr_cpu_has_work(CPUState *cs)
+{
+    AVRCPU *cpu = AVR_CPU(cs);
+    CPUAVRState *env = &cpu->env;
+
+    return (cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_RESET))
+            && cpu_interrupts_enabled(env);
+}
+
+static void avr_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb)
+{
+    AVRCPU *cpu = AVR_CPU(cs);
+    CPUAVRState *env = &cpu->env;
+
+    env->pc_w = tb->pc / 2; /* internally PC points to words */
+}
+
+static void avr_cpu_reset(CPUState *cs)
+{
+    AVRCPU *cpu = AVR_CPU(cs);
+    AVRCPUClass *mcc = AVR_CPU_GET_CLASS(cpu);
+    CPUAVRState *env = &cpu->env;
+
+    mcc->parent_reset(cs);
+
+    env->pc_w = 0;
+    env->sregI = 1;
+    env->sregC = 0;
+    env->sregZ = 0;
+    env->sregN = 0;
+    env->sregV = 0;
+    env->sregS = 0;
+    env->sregH = 0;
+    env->sregT = 0;
+
+    env->rampD = 0;
+    env->rampX = 0;
+    env->rampY = 0;
+    env->rampZ = 0;
+    env->eind = 0;
+    env->sp = 0;
+
+    env->skip = 0;
+
+    memset(env->r, 0, sizeof(env->r));
+
+    tlb_flush(cs);

Why are you calling tlb_flush() here?

+}


Reply via email to