Moxie CPU port
v11 cover Moxie CPU port
This version of the patch addresses recent changes in the upstream qemu sources (where interrupt_request resides).
Please consider applying this version of the patch.
Thank you!
AG
Anthony Green (4):
Add moxie target code
Add moxie disassembler
Add sample moxie system
Add top level changes for moxie
MAINTAINERS | 5 + arch_init.c | 2 + configure | 9 +- cpu-exec.c | 2 + default-configs/moxie-softmmu.mak | 2 + disas.c | 6 + disas/Makefile.objs | 1 + disas/moxie.c | 360 +++++++++++++++ hw/moxie/Makefile.objs | 6 + hw/moxie/moxiesim.c | 174 +++++++ include/disas/bfd.h | 2 + include/sysemu/arch_init.h | 1 + qapi-schema.json | 6 +- target-moxie/Makefile.objs | 2 + target-moxie/cpu.c | 172 +++++++ target-moxie/cpu.h | 167 +++++++ target-moxie/helper.c | 171 +++++++ target-moxie/helper.h | 9 + target-moxie/machine.c | 28 ++ target-moxie/machine.h | 1 + target-moxie/mmu.c | 36 ++ target-moxie/mmu.h | 19 + target-moxie/translate.c | 926 ++++++++++++++++++++++++++++++++++++++ 23 files changed, 2103 insertions(+), 4 deletions(-) create mode 100644 default-configs/moxie-softmmu.mak create mode 100644 disas/moxie.c create mode 100644 hw/moxie/Makefile.objs create mode 100644 hw/moxie/moxiesim.c create mode 100644 target-moxie/Makefile.objs create mode 100644 target-moxie/cpu.c create mode 100644 target-moxie/cpu.h create mode 100644 target-moxie/helper.c create mode 100644 target-moxie/helper.h create mode 100644 target-moxie/machine.c create mode 100644 target-moxie/machine.h create mode 100644 target-moxie/mmu.c create mode 100644 target-moxie/mmu.h create mode 100644 target-moxie/translate.c
Signature · 1 line
1.8.1.4
PATCH v11 1/4 Add moxie target code
--- target-moxie/Makefile.objs | 2 + target-moxie/cpu.c | 172 +++++++++ target-moxie/cpu.h | 167 ++++++++ target-moxie/helper.c | 171 +++++++++ target-moxie/helper.h | 9 + target-moxie/machine.c | 28 ++ target-moxie/machine.h | 1 + target-moxie/mmu.c | 36 ++ target-moxie/mmu.h | 19 + target-moxie/translate.c | 926 +++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 1531 insertions(+) create mode 100644 target-moxie/Makefile.objs create mode 100644 target-moxie/cpu.c create mode 100644 target-moxie/cpu.h create mode 100644 target-moxie/helper.c create mode 100644 target-moxie/helper.h create mode 100644 target-moxie/machine.c create mode 100644 target-moxie/machine.h create mode 100644 target-moxie/mmu.c create mode 100644 target-moxie/mmu.h create mode 100644 target-moxie/translate.c
target-moxie/Makefile.objs new file +2 -0
@@ -0,0 +1,2 @@ +obj-y += translate.o helper.o machine.o cpu.o machine.o +obj-$(CONFIG_SOFTMMU) += mmu.o
target-moxie/cpu.c new file +172 -0
172 lines not on this page · raw message
target-moxie/cpu.h new file +167 -0
167 lines not on this page · raw message
target-moxie/helper.c new file +171 -0
171 lines not on this page · raw message
target-moxie/helper.h new file +9 -0
@@ -0,0 +1,9 @@ +#include "exec/def-helper.h" + +DEF_HELPER_2(raise_exception, void, env, int) +DEF_HELPER_1(debug, void, env) + +DEF_HELPER_FLAGS_3(div, TCG_CALL_NO_WG, i32, env, i32, i32) +DEF_HELPER_FLAGS_3(udiv, TCG_CALL_NO_WG, i32, env, i32, i32) + +#include "exec/def-helper.h"
target-moxie/machine.c new file +28 -0
@@ -0,0 +1,28 @@ +#include "hw/hw.h" +#include "hw/boards.h" + +const VMStateDescription vmstate_moxie_cpu = { + .name ="cpu" , + .version_id =CPU_SAVE_VERSION , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (flags, CPUMoxieState), +VMSTATE_UINT32_ARRAY (gregs, CPUMoxieState,16 ), +VMSTATE_UINT32_ARRAY (sregs, CPUMoxieState,256 ), +VMSTATE_UINT32 (pc, CPUMoxieState), +VMSTATE_UINT32 (cc_a, CPUMoxieState), +VMSTATE_UINT32 (cc_b, CPUMoxieState), +VMSTATE_END_OF_LIST () + } +}; + +void cpu_save (QEMUFile *f,void *opaque) +{ +vmstate_save_state (f, &vmstate_moxie_cpu, opaque); +} + +int cpu_load (QEMUFile *f,void *opaque,int version_id) +{ +return vmstate_load_state (f, &vmstate_moxie_cpu, opaque, version_id); +}
target-moxie/machine.h new file +1 -0
@@ -0,0 +1 @@ +extern const VMStateDescription vmstate_moxie_cpu;
target-moxie/mmu.c new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Moxie mmu emulation. +* +* Copyright (c) 2008, 2013 Anthony Green +* +* 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 General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#include "config.h" +#include "cpu.h" +#include "mmu.h" +#include "exec/exec-all.h" + +int moxie_mmu_translate (MoxieMMUResult *res, +CPUMoxieState *env,uint32_t vaddr, +int rw,int mmu_idx) +{ +/* Perform no translation yet. */ + res->phy = vaddr; +return 0 ; +}
target-moxie/mmu.h new file +19 -0
@@ -0,0 +1,19 @@ +#define MOXIE_MMU_ERR_EXEC 0 +#define MOXIE_MMU_ERR_READ 1 +#define MOXIE_MMU_ERR_WRITE 2 +#define MOXIE_MMU_ERR_FLUSH 3 + +typedef struct { +uint32_t phy; +uint32_t pfn; +int g:1 ; +int v:1 ; +int k:1 ; +int w:1 ; +int e:1 ; +int cause_op; +}MoxieMMUResult ; + +int moxie_mmu_translate (MoxieMMUResult *res, +CPUMoxieState *env,uint32_t vaddr, +int rw,int mmu_idx);
target-moxie/translate.c new file +926 -0
926 lines not on this page · raw message
Signature · 1 line
1.8.1.4
PATCH v11 2/4 Add moxie disassembler
In reply to Anthony Green--- disas.c | 6 + disas/Makefile.objs | 1 + disas/moxie.c | 360 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/disas/bfd.h | 2 + 4 files changed, 369 insertions(+) create mode 100644 disas/moxie.c
disas.c +6 -0
@@ -256,6 +256,9 @@ void target_disas(FILE *out, CPUArchState *env, target_ulong code,#elif defined(TARGET_MICROBLAZE ) s.info.mach = bfd_arch_microblaze; print_insn = print_insn_microblaze; +#elif defined(TARGET_MOXIE ) + s.info.mach = bfd_arch_moxie; + print_insn = print_insn_moxie;#elif defined(TARGET_LM32 ) s.info.mach = bfd_mach_lm32; print_insn = print_insn_lm32;
@@ -462,6 +465,9 @@ void monitor_disas(Monitor *mon, CPUArchState *env,#elif defined(TARGET_S390X ) s.info.mach = bfd_mach_s390_64; print_insn = print_insn_s390; +#elif defined(TARGET_MOXIE ) + s.info.mach = bfd_arch_moxie; + print_insn = print_insn_moxie;#elif defined(TARGET_LM32 ) s.info.mach = bfd_mach_lm32; print_insn = print_insn_lm32;
disas/Makefile.objs +1 -0
@@ -7,6 +7,7 @@ common-obj-$(CONFIG_IA64_DIS) += ia64.o common-obj-$(CONFIG_M68K_DIS) += m68k.o common-obj-$(CONFIG_MICROBLAZE_DIS) += microblaze.o common-obj-$(CONFIG_MIPS_DIS) += mips.o +common-obj-$(CONFIG_MOXIE_DIS) += moxie.o common-obj-$(CONFIG_PPC_DIS) += ppc.o common-obj-$(CONFIG_S390_DIS) += s390.o common-obj-$(CONFIG_SH4_DIS) += sh4.o
disas/moxie.c new file +360 -0
360 lines not on this page · raw message
include/disas/bfd.h +2 -0
@@ -218,6 +218,7 @@ enum bfd_architecture#define bfd_mach_cris_v32 32#define bfd_mach_cris_v10_v32 1032 bfd_arch_microblaze, /* Xilinx MicroBlaze. */ + bfd_arch_moxie,/* The Moxie core. */ bfd_arch_ia64,/* HP/Intel ia64 */ #define bfd_mach_ia64_elf64 64 #define bfd_mach_ia64_elf32 32
@@ -392,6 +393,7 @@ int print_insn_m32r (bfd_vma, disassemble_info*);int print_insn_m88k (bfd_vma ,disassemble_info *);int print_insn_mn10200 (bfd_vma ,disassemble_info *);int print_insn_mn10300 (bfd_vma ,disassemble_info *); +int print_insn_moxie (bfd_vma ,disassemble_info *);int print_insn_ns32k (bfd_vma ,disassemble_info *);int print_insn_big_powerpc (bfd_vma ,disassemble_info *);int print_insn_little_powerpc (bfd_vma ,disassemble_info *);
Signature · 1 line
1.8.1.4
PATCH v11 3/4 Add sample moxie system
In reply to Anthony Green--- hw/moxie/Makefile.objs | 6 ++ hw/moxie/moxiesim.c | 174 +++++++++++++++++++++++++++++++++++++++++++++ include/sysemu/arch_init.h | 1 + 3 files changed, 181 insertions(+) create mode 100644 hw/moxie/Makefile.objs create mode 100644 hw/moxie/moxiesim.c
hw/moxie/Makefile.objs new file +6 -0
@@ -0,0 +1,6 @@ +# moxie boards +obj-y = serial.o mc146818rtc.o vga.o +obj-$(CONFIG_FDT) += device_tree.o + +obj-y := $(addprefix ../,$(obj-y)) +obj-y += moxiesim.o
hw/moxie/moxiesim.c new file +174 -0
174 lines not on this page · raw message
include/sysemu/arch_init.h +1 -0
@@ -20,6 +20,7 @@ enum {QEMU_ARCH_XTENSA =4096 ,QEMU_ARCH_OPENRISC =8192 ,QEMU_ARCH_UNICORE32 =0x4000 , + QEMU_ARCH_MOXIE = 0x8000, };extern const uint32_t arch_type;
Signature · 1 line
1.8.1.4
PATCH v11 4/4 Add top level changes for moxie
In reply to Anthony Green--- MAINTAINERS | 5 +++++ arch_init.c | 2 ++ configure | 9 ++++++++- cpu-exec.c | 2 ++ default-configs/moxie-softmmu.mak | 2 ++ qapi-schema.json | 6 +++--- 6 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 default-configs/moxie-softmmu.mak
MAINTAINERS +5 -0
@@ -91,6 +91,11 @@ M: Aurelien Jarno <[email protected]> S: Odd Fixes F: target-mips/ +Moxie +M: Anthony Green <[email protected]> +S: Maintained +F: target-moxie/ + PowerPC M: Alexander Graf <[email protected]> L: [email protected]
arch_init.c +2 -0
@@ -85,6 +85,8 @@ int graphic_depth = 15;#define QEMU_ARCH QEMU_ARCH_MICROBLAZE#elif defined(TARGET_MIPS )#define QEMU_ARCH QEMU_ARCH_MIPS +#elif defined(TARGET_MOXIE ) +#define QEMU_ARCH QEMU_ARCH_MOXIE#elif defined(TARGET_OPENRISC )#define QEMU_ARCH QEMU_ARCH_OPENRISC#elif defined(TARGET_PPC )
configure +8 -1
@@ -961,6 +961,7 @@ mips-softmmu \ mipsel-softmmu \ mips64-softmmu \ mips64el-softmmu \ +moxie-softmmu \ or32-softmmu \ ppc-softmmu \ ppcemb-softmmu \
@@ -3946,7 +3947,7 @@ target_arch2=`echo $target | cut -d '-' -f 1` target_bigendian="no" case "$target_arch2" in - armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) + armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) target_bigendian=yes ;; esac
@@ -4050,6 +4051,8 @@ case "$target_arch2" in echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak target_long_alignment=8 ;; + moxie) + ;; or32) TARGET_ARCH=openrisc TARGET_BASE_ARCH=openrisc
@@ -4287,6 +4290,10 @@ for i in $ARCH $TARGET_BASE_ARCH ; do echo "CONFIG_MIPS_DIS=y" >> $config_target_mak echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak ;; + moxie*) + echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak + echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak + ;; or32) echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
cpu-exec.c +2 -0
@@ -240,6 +240,7 @@ int cpu_exec(CPUArchState *env)#elif defined(TARGET_LM32 )#elif defined(TARGET_MICROBLAZE )#elif defined(TARGET_MIPS ) +#elif defined(TARGET_MOXIE )#elif defined(TARGET_OPENRISC )#elif defined(TARGET_SH4 )#elif defined(TARGET_CRIS )
@@ -692,6 +693,7 @@ int cpu_exec(CPUArchState *env) | env->cc_dest | (env->cc_x << 4);#elif defined(TARGET_MICROBLAZE )#elif defined(TARGET_MIPS ) +#elif defined(TARGET_MOXIE )#elif defined(TARGET_OPENRISC )#elif defined(TARGET_SH4 )#elif defined(TARGET_ALPHA )
default-configs/moxie-softmmu.mak new file +2 -0
@@ -0,0 +1,2 @@ +# Default configuration for moxie-softmmu +
qapi-schema.json +3 -3
@@ -2994,9 +2994,9 @@ ## { 'enum': 'TargetType', 'data': [ 'alpha', 'arm', 'cris', 'i386', 'lm32', 'm68k', 'microblazeel', - 'microblaze', 'mips64el', 'mips64', 'mipsel', 'mips', 'or32', - 'ppc64', 'ppcemb', 'ppc', 's390x', 'sh4eb', 'sh4', 'sparc64', - 'sparc', 'unicore32', 'x86_64', 'xtensaeb', 'xtensa' ] } + 'microblaze', 'mips64el', 'mips64', 'mipsel', 'mips', 'moxie', + 'or32', 'ppc64', 'ppcemb', 'ppc', 's390x', 'sh4eb', 'sh4', + 'sparc64', 'sparc', 'unicore32', 'x86_64', 'xtensaeb', 'xtensa' ] } ## # @TargetInfo:
Signature · 1 line
1.8.1.4
Blue Swirl
AppliedQuoted 4 lines · Anthony Green
This version of the patch addresses recent changes in the upstream qemu sources (where
interrupt_requestresides).Please consider applying this version of the patch.
Thanks, applied all.
Quoted 53 lines
Thank you!
AG
Anthony Green (4):
Add moxie target code
Add moxie disassembler
Add sample moxie system
Add top level changes for moxieMAINTAINERS | 5 + arch_init.c | 2 + configure | 9 +- cpu-exec.c | 2 + default-configs/moxie-softmmu.mak | 2 + disas.c | 6 + disas/Makefile.objs | 1 + disas/moxie.c | 360 +++++++++++++++ hw/moxie/Makefile.objs | 6 + hw/moxie/moxiesim.c | 174 +++++++ include/disas/bfd.h | 2 + include/sysemu/arch_init.h | 1 + qapi-schema.json | 6 +- target-moxie/Makefile.objs | 2 + target-moxie/cpu.c | 172 +++++++ target-moxie/cpu.h | 167 +++++++ target-moxie/helper.c | 171 +++++++ target-moxie/helper.h | 9 + target-moxie/machine.c | 28 ++ target-moxie/machine.h | 1 + target-moxie/mmu.c | 36 ++ target-moxie/mmu.h | 19 + target-moxie/translate.c | 926 ++++++++++++++++++++++++++++++++++++++ 23 files changed, 2103 insertions(+), 4 deletions(-) create mode 100644 default-configs/moxie-softmmu.mak create mode 100644 disas/moxie.c create mode 100644 hw/moxie/Makefile.objs create mode 100644 hw/moxie/moxiesim.c create mode 100644 target-moxie/Makefile.objs create mode 100644 target-moxie/cpu.c create mode 100644 target-moxie/cpu.h create mode 100644 target-moxie/helper.c create mode 100644 target-moxie/helper.h create mode 100644 target-moxie/machine.c create mode 100644 target-moxie/machine.h create mode 100644 target-moxie/mmu.c create mode 100644 target-moxie/mmu.h create mode 100644 target-moxie/translate.c--
1.8.1.4
Quoted 8 lines · Blue Swirl
Quoted 4 lines · Anthony Green
This version of the patch addresses recent changes in the upstream qemu sources (where
interrupt_requestresides).Please consider applying this version of the patch.
Thanks, applied all.
After these commits, QEMU doesn't build anymore:
| $ make | make[1]: *** No rule to make target `hw/moxie/../device_tree.o', needed by `qemu-system-moxie'. Stop. | make: *** [subdir-moxie-softmmu] Error 2
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net