nios2: Add disas entries
PATCH 7/7 nios2: Add support for Nios-II R1
In reply to Marek VasutAdd remaining bits of the Altera NiosII R1 support into qemu, which is documentation, MAINTAINERS file entry, configure bits, arch_init and configuration files for both linux-user (userland binaries) and softmmu (hardware emulation).
--- MAINTAINERS | 8 ++++++++ arch_init.c | 2 ++ configure | 5 +++++ default-configs/nios2-linux-user.mak | 1 + default-configs/nios2-softmmu.mak | 6 ++++++ include/sysemu/arch_init.h | 1 + qemu-doc.texi | 3 +++ 7 files changed, 26 insertions(+) create mode 100644 default-configs/nios2-linux-user.mak create mode 100644 default-configs/nios2-softmmu.mak
MAINTAINERS +8 -0
@@ -157,6 +157,14 @@ S: Maintained F: target-moxie/ F: disas/moxie.c +NiosII +M: Chris Wulff <[email protected]> +M: Marek Vasut <[email protected]> +S: Maintained +F: target-nios2/ +F: hw/nios2/ +F: disas/nios2.c + OpenRISC M: Jia Liu <[email protected]> S: Maintained
arch_init.c +2 -0
@@ -64,6 +64,8 @@ int graphic_depth = 32;#define QEMU_ARCH QEMU_ARCH_MIPS#elif defined(TARGET_MOXIE )#define QEMU_ARCH QEMU_ARCH_MOXIE +#elif defined(TARGET_NIOS2 ) +#define QEMU_ARCH QEMU_ARCH_NIOS2#elif defined(TARGET_OPENRISC )#define QEMU_ARCH QEMU_ARCH_OPENRISC#elif defined(TARGET_PPC )
configure +5 -0
@@ -5693,6 +5693,8 @@ case "$target_name" in ;; moxie) ;; + nios2) + ;; or32) TARGET_ARCH=openrisc TARGET_BASE_ARCH=openrisc
@@ -5889,6 +5891,9 @@ for i in $ARCH $TARGET_BASE_ARCH ; do moxie*) disas_config "MOXIE" ;; + nios2) + disas_config "NIOS2" + ;; or32) disas_config "OPENRISC" ;;
default-configs/nios2-linux-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for nios2-linux-user
default-configs/nios2-softmmu.mak new file +6 -0
@@ -0,0 +1,6 @@ +# Default configuration for nios2-softmmu + +CONFIG_NIOS2=y +CONFIG_SERIAL=y +CONFIG_PTIMER=y +CONFIG_ALTERA_TIMER=y
include/sysemu/arch_init.h +1 -0
@@ -23,6 +23,7 @@ enum {QEMU_ARCH_UNICORE32 = (1 <<14 ),QEMU_ARCH_MOXIE = (1 <<15 ),QEMU_ARCH_TRICORE = (1 <<16 ), + QEMU_ARCH_NIOS2 = (1 << 17), };extern const uint32_t arch_type;
qemu-doc.texi +3 -0
@@ -2856,6 +2856,9 @@ The binary format is detected automatically. @command{qemu-mips} TODO. @command{qemu-mipsel} TODO. +@cindex user mode (NiosII) +@command{qemu-nios2} TODO. + @cindex user mode (PowerPC) @command{qemu-ppc64abi32} TODO. @command{qemu-ppc64} TODO.
Signature · 1 line
2.7.0
PATCH 5/7 nios2: Add periodic timer emulation
In reply to Marek VasutFrom: Chris Wulff <[email protected]>
Add the Altera timer model.
--- hw/timer/Makefile.objs | 1 + hw/timer/altera_timer.c | 225 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+) create mode 100644 hw/timer/altera_timer.c
hw/timer/Makefile.objs +1 -0
@@ -18,6 +18,7 @@ common-obj-$(CONFIG_IMX) += imx_gpt.o common-obj-$(CONFIG_LM32) += lm32_timer.o common-obj-$(CONFIG_MILKYMIST) += milkymist-sysctl.o +obj-$(CONFIG_ALTERA_TIMER) += altera_timer.o obj-$(CONFIG_EXYNOS4) += exynos4210_mct.o obj-$(CONFIG_EXYNOS4) += exynos4210_pwm.o obj-$(CONFIG_EXYNOS4) += exynos4210_rtc.o
hw/timer/altera_timer.c new file +225 -0
225 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH 3/7 nios2: Add usermode binaries emulation
In reply to Marek VasutAdd missing bits for qemu-user required for emulating Altera Nios2 userspace binaries.
--- include/elf.h | 2 + linux-user/elfload.c | 58 +++++++ linux-user/main.c | 136 +++++++++++++++- linux-user/nios2/syscall_nr.h | 330 ++++++++++++++++++++++++++++++++++++++ linux-user/nios2/target_cpu.h | 38 +++++ linux-user/nios2/target_signal.h | 26 +++ linux-user/nios2/target_structs.h | 58 +++++++ linux-user/nios2/target_syscall.h | 37 +++++ linux-user/nios2/termbits.h | 220 +++++++++++++++++++++++++ linux-user/signal.c | 238 ++++++++++++++++++++++++++- linux-user/syscall_defs.h | 7 +- 11 files changed, 1143 insertions(+), 7 deletions(-) create mode 100644 linux-user/nios2/syscall_nr.h create mode 100644 linux-user/nios2/target_cpu.h create mode 100644 linux-user/nios2/target_signal.h create mode 100644 linux-user/nios2/target_structs.h create mode 100644 linux-user/nios2/target_syscall.h create mode 100644 linux-user/nios2/termbits.h
include/elf.h +2 -0
@@ -125,6 +125,8 @@ typedef int64_t Elf64_Sxword;*/ #define EM_S390_OLD 0xA390 +#define EM_ALTERA_NIOS2 113/* Altera Nios II soft-core processor */ +#define EM_MICROBLAZE 189#define EM_MICROBLAZE_OLD 0xBAAB
linux-user/elfload.c +58 -0
64 lines not on this page · raw message
linux-user/main.c +134 -2
154 lines not on this page · raw message
linux-user/nios2/syscall_nr.h new file +330 -0
330 lines not on this page · raw message
linux-user/nios2/target_cpu.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Nios2 specific CPU ABI and functions for linux-user +* +* Copyright (c) 2016 Marek Vasut <[email protected]> +* +* 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_CPU_H +#define TARGET_CPU_H + +static inline void cpu_clone_regs (CPUNios2State *env,target_ulong newsp) +{ +if (newsp) { + env->regs[R_SP ] = newsp; + } + env->regs[R_RET0 ] =0 ; +} + +static inline void cpu_set_tls (CPUNios2State *env,target_ulong newtls) +{ +/* Linux kernel 3.10 does not pay any attention to CLONE_SETTLS +* in copy_thread(), so QEMU need not do so either. +*/ +} + +#endif
linux-user/nios2/target_signal.h new file +26 -0
@@ -0,0 +1,26 @@ +#ifndef TARGET_SIGNAL_H +#define TARGET_SIGNAL_H + +#include "cpu.h" + +/* this struct defines a stack used during syscall handling */ + +typedef struct target_sigaltstack { +abi_long ss_sp; +abi_ulong ss_size; +abi_long ss_flags; +}target_stack_t ; + +/* sigaltstack controls */ +#define TARGET_SS_ONSTACK 1 +#define TARGET_SS_DISABLE 2 + +#define TARGET_MINSIGSTKSZ 2048 +#define TARGET_SIGSTKSZ 8192 + +static inline abi_ulong get_sp_from_cpustate (CPUNios2State *state) +{ +return state->regs[R_SP ]; +} + +#endif /* TARGET_SIGNAL_H */
linux-user/nios2/target_structs.h new file +58 -0
58 lines not on this page · raw message
linux-user/nios2/target_syscall.h new file +37 -0
@@ -0,0 +1,37 @@ +#ifndef TARGET_SYSCALL_H +#define TARGET_SYSCALL_H + +#define UNAME_MACHINE "nios2" +#define UNAME_MINIMUM_RELEASE "3.19.0" + +struct target_pt_regs { +unsigned long r8;/* r8-r15 Caller-saved GP registers */ +unsigned long r9; +unsigned long r10; +unsigned long r11; +unsigned long r12; +unsigned long r13; +unsigned long r14; +unsigned long r15; +unsigned long r1;/* Assembler temporary */ +unsigned long r2;/* Retval LS 32bits */ +unsigned long r3;/* Retval MS 32bits */ +unsigned long r4;/* r4-r7 Register arguments */ +unsigned long r5; +unsigned long r6; +unsigned long r7; +unsigned long orig_r2;/* Copy of r2 ?? */ +unsigned long ra;/* Return address */ +unsigned long fp;/* Frame pointer */ +unsigned long sp;/* Stack pointer */ +unsigned long gp;/* Global pointer */ +unsigned long estatus; +unsigned long ea;/* Exception return address (pc) */ +unsigned long orig_r7; +}; + +#define TARGET_MINSIGSTKSZ 2048 +#define TARGET_MLOCKALL_MCL_CURRENT 1 +#define TARGET_MLOCKALL_MCL_FUTURE 2 + +#endif /* TARGET_SYSCALL_H */
linux-user/nios2/termbits.h new file +220 -0
220 lines not on this page · raw message
linux-user/signal.c +236 -2
256 lines not on this page · raw message
linux-user/syscall_defs.h +4 -3
@@ -69,7 +69,8 @@#if defined(TARGET_I386 ) || defined(TARGET_ARM ) || defined(TARGET_SH4 ) \ || defined(TARGET_M68K ) || defined(TARGET_CRIS ) \ || defined(TARGET_UNICORE32 ) || defined(TARGET_S390X ) \ - || defined(TARGET_OPENRISC ) || defined(TARGET_TILEGX ) + || defined(TARGET_OPENRISC ) || defined(TARGET_TILEGX ) \ + || defined(TARGET_NIOS2 )#define TARGET_IOC_SIZEBITS 14#define TARGET_IOC_DIRBITS 2
@@ -374,7 +375,7 @@ int do_sigaction(int sig, const struct target_sigaction *act, ||defined (TARGET_M68K ) ||defined (TARGET_ALPHA ) ||defined (TARGET_CRIS ) \ ||defined (TARGET_MICROBLAZE ) ||defined (TARGET_UNICORE32 ) \ ||defined (TARGET_S390X ) ||defined (TARGET_OPENRISC ) \ - || defined(TARGET_TILEGX) + || defined(TARGET_TILEGX) || defined(TARGET_NIOS2)#if defined(TARGET_SPARC )#define TARGET_SA_NOCLDSTOP 8u
@@ -1906,7 +1907,7 @@ struct target_stat {abi_ulong target_st_ctime_nsec; unsigned int __unused[2]; }; -#elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) +#elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || defined(TARGET_NIOS2)/* These are the asm-generic versions of the stat and stat64 structures */
Signature · 1 line
2.7.0
PATCH 4/7 nios2: Add IIC interrupt controller emulation
In reply to Marek VasutFrom: Chris Wulff <[email protected]>
Add the Altera Nios2 internal interrupt controller model.
--- hw/intc/Makefile.objs | 1 + hw/intc/nios2_iic.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 hw/intc/nios2_iic.c
hw/intc/Makefile.objs +1 -0
@@ -32,3 +32,4 @@ obj-$(CONFIG_ALLWINNER_A10_PIC) += allwinner-a10-pic.o obj-$(CONFIG_S390_FLIC) += s390_flic.o obj-$(CONFIG_S390_FLIC_KVM) += s390_flic_kvm.o obj-$(CONFIG_ASPEED_SOC) += aspeed_vic.o +obj-$(CONFIG_NIOS2) += nios2_iic.o
hw/intc/nios2_iic.c new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH 6/7 nios2: Add Altera 10M50 GHRD emulation
In reply to Marek VasutAdd the Altera 10M50 Nios2 GHRD model. This allows emulating the 10M50 development kit with the Nios2 GHRD loaded in the FPGA. It is possible to boot Linux kernel and run userspace, thus far only from initrd as storage support is not yet implemented.
--- hw/nios2/10m50_devboard.c | 125 ++++++++++++++++++++++++++ hw/nios2/Makefile.objs | 1 + hw/nios2/boot.c | 223 ++++++++++++++++++++++++++++++++++++++++++++++ hw/nios2/boot.h | 11 +++ hw/nios2/cpu_pic.c | 74 +++++++++++++++ 5 files changed, 434 insertions(+) create mode 100644 hw/nios2/10m50_devboard.c create mode 100644 hw/nios2/Makefile.objs create mode 100644 hw/nios2/boot.c create mode 100644 hw/nios2/boot.h create mode 100644 hw/nios2/cpu_pic.c
hw/nios2/10m50_devboard.c new file +125 -0
@@ -0,0 +1,125 @@ +/* +* Altera 10M50 Nios2 GHRD +* +* Copyright (c) 2016 Marek Vasut <[email protected]> +* +* Based on LabX device code +* +* Copyright (c) 2012 Chris Wulff <[email protected]> +* +* 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-common.h" +#include "cpu.h" + +#include "hw/sysbus.h" +#include "hw/hw.h" +#include "hw/char/serial.h" +#include "sysemu/sysemu.h" +#include "hw/boards.h" +#include "exec/memory.h" +#include "exec/address-spaces.h" +#include "qemu/config-file.h" + +#include "boot.h" + +#define BINARY_DEVICE_TREE_FILE "10m50-devboard.dtb" + +static void nios2_10m50_ghrd_init (MachineState *machine) +{ +Nios2CPU *cpu; +DeviceState *dev; +MemoryRegion *address_space_mem =get_system_memory (); +MemoryRegion *phys_tcm =g_new (MemoryRegion,1 ); +MemoryRegion *phys_tcm_alias =g_new (MemoryRegion,1 ); +MemoryRegion *phys_ram =g_new (MemoryRegion,1 ); +MemoryRegion *phys_ram_alias =g_new (MemoryRegion,1 ); +ram_addr_t tcm_base =0x0 ; +ram_addr_t tcm_size =0x1000 ;/* 1 kiB, but QEMU limit is 4 kiB */ +ram_addr_t ram_base =0x08000000 ; +ram_addr_t ram_size =0x08000000 ; +qemu_irq *cpu_irq, irq[32 ]; +int i; + +/* Physical TCM (tb_ram_1k) with alias at 0xc0000000 */ +memory_region_init_ram (phys_tcm,NULL ,"nios2.tcm" , tcm_size, &error_abort); +memory_region_init_alias (phys_tcm_alias,NULL ,"nios2.tcm.alias" , + phys_tcm,0 , tcm_size); +vmstate_register_ram_global (phys_tcm); +memory_region_add_subregion (address_space_mem, tcm_base, phys_tcm); +memory_region_add_subregion (address_space_mem,0xc0000000 + tcm_base, + phys_tcm_alias); + +/* Physical DRAM with alias at 0xc0000000 */ +memory_region_init_ram (phys_ram,NULL ,"nios2.ram" , ram_size, &error_abort); +memory_region_init_alias (phys_ram_alias,NULL ,"nios2.ram.alias" , + phys_ram,0 , ram_size); +vmstate_register_ram_global (phys_ram); +memory_region_add_subregion (address_space_mem, ram_base, phys_ram); +memory_region_add_subregion (address_space_mem,0xc0000000 + ram_base, + phys_ram_alias); + +/* Create CPU -- FIXME */ + cpu =cpu_nios2_init ("nios2" ); + +/* Register: CPU interrupt controller (PIC) */ + cpu_irq =nios2_cpu_pic_init (cpu); + +/* Register: Internal Interrupt Controller (IIC) */ + dev =qdev_create (NULL ,"altera,iic" ); +qdev_prop_set_ptr (dev,"cpu" , cpu); +qdev_init_nofail (dev); +sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , cpu_irq[0 ]); +for (i =0 ; i <32 ; i++) + irq[i] =qdev_get_gpio_in (dev, i); + +/* Register: Altera 16550 UART */ +serial_mm_init (address_space_mem,0xf8001600 ,2 , irq[1 ],115200 , + serial_hds[0 ],DEVICE_NATIVE_ENDIAN ); + +/* Register: Timer sys_clk_timer */ + dev =qdev_create (NULL ,"ALTR.timer" ); +qdev_prop_set_uint32 (dev,"clock-frequency" ,75 *1000000 ); +qdev_init_nofail (dev); +sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,0xf8001440 ); +sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , irq[0 ]); + +/* Register: Timer sys_clk_timer_1 */ + dev =qdev_create (NULL ,"ALTR.timer" ); +qdev_prop_set_uint32 (dev,"clock-frequency" ,75 *1000000 ); +qdev_init_nofail (dev); +sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,0xe0000880 ); +sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , irq[5 ]); + +/* Configure new exception vectors and reset CPU for it to take effect. */ + cpu->env.reset_addr =0xd4000000 ; + cpu->env.exception_addr =0xc8000120 ; + cpu->env.fast_tlb_miss_addr =0xc0000100 ; + +nios2_load_kernel (cpu, ram_base, ram_size, machine->initrd_filename, +BINARY_DEVICE_TREE_FILE ,NULL ); +} + +static void nios2_10m50_ghrd_machine_init (struct MachineClass *mc) +{ + mc->desc ="Altera 10M50 GHRD Nios II design" ; + mc->init = nios2_10m50_ghrd_init; + mc->is_default =1 ; +} + +DEFINE_MACHINE ("10m50-ghrd" , nios2_10m50_ghrd_machine_init);
hw/nios2/Makefile.objs new file +1 -0
@@ -0,0 +1 @@ +obj-y = boot.o cpu_pic.o 10m50_devboard.o
hw/nios2/boot.c new file +223 -0
223 lines not on this page · raw message
hw/nios2/boot.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef __NIOS2_BOOT__ +#define __NIOS2_BOOT__ + +#include "hw/hw.h" +#include "cpu.h" + +void nios2_load_kernel (Nios2CPU *cpu,hwaddr ddr_base,uint32_t ramsize, +const char *initrd_filename,const char *dtb_filename, +void (*machine_cpu_reset)(Nios2CPU *)); + +#endif /* __NIOS2_BOOT__ */
hw/nios2/cpu_pic.c new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH 2/7 nios2: Add architecture emulation support
In reply to Marek VasutFrom: Chris Wulff <[email protected]>
Add support for emulating Altera NiosII R1 architecture into qemu. This patch is based on previous work by Chris Wulff from 2012 and updated to latest mainline QEMU.
--- target-nios2/Makefile.objs | 4 + target-nios2/cpu.c | 220 +++++++ target-nios2/cpu.h | 266 +++++++++ target-nios2/helper.c | 304 ++++++++++ target-nios2/helper.h | 41 ++ target-nios2/instruction.c | 1427 ++++++++++++++++++++++++++++++++++++++++++++ target-nios2/instruction.h | 279 +++++++++ target-nios2/machine.c | 38 ++ target-nios2/mmu.c | 292 +++++++++ target-nios2/mmu.h | 54 ++ target-nios2/monitor.c | 35 ++ target-nios2/op_helper.c | 86 +++ target-nios2/translate.c | 242 ++++++++ 13 files changed, 3288 insertions(+) create mode 100644 target-nios2/Makefile.objs create mode 100644 target-nios2/cpu.c create mode 100644 target-nios2/cpu.h create mode 100644 target-nios2/helper.c create mode 100644 target-nios2/helper.h create mode 100644 target-nios2/instruction.c create mode 100644 target-nios2/instruction.h create mode 100644 target-nios2/machine.c create mode 100644 target-nios2/mmu.c create mode 100644 target-nios2/mmu.h create mode 100644 target-nios2/monitor.c create mode 100644 target-nios2/op_helper.c create mode 100644 target-nios2/translate.c
target-nios2/Makefile.objs new file +4 -0
@@ -0,0 +1,4 @@ +obj-y += translate.o op_helper.o helper.o cpu.o mmu.o instruction.o +obj-$(CONFIG_SOFTMMU) += monitor.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target-nios2/cpu.c new file +220 -0
220 lines not on this page · raw message
target-nios2/cpu.h new file +266 -0
266 lines not on this page · raw message
target-nios2/helper.c new file +304 -0
304 lines not on this page · raw message
target-nios2/helper.h new file +41 -0
41 lines not on this page · raw message
target-nios2/instruction.c new file +1427 -0
1,427 lines not on this page · raw message
target-nios2/instruction.h new file +279 -0
279 lines not on this page · raw message
target-nios2/machine.c new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Altera Nios II MMU emulation for qemu. +* +* Copyright (C) 2012 Chris Wulff <[email protected]> +* +* 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> +*/ + +/* +* FIXME: Convert to VMstate +*/ + +#include "qemu/osdep.h" +#include "hw/hw.h" +#include "hw/boards.h" + +void cpu_save (QEMUFile *f,void *opaque) +{ +/* TODO */ +} + +int cpu_load (QEMUFile *f,void *opaque,int version_id) +{ +/* TODO */ +return 0 ; +}
target-nios2/mmu.c new file +292 -0
292 lines not on this page · raw message
target-nios2/mmu.h new file +54 -0
54 lines not on this page · raw message
target-nios2/monitor.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* QEMU monitor +* +* Copyright (c) 2003-2004 Fabrice Bellard +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ +#include "qemu/osdep.h" +#include "cpu.h" +#include "monitor/monitor.h" +#include "monitor/hmp-target.h" +#include "hmp.h" + +void hmp_info_tlb (Monitor *mon,const QDict *qdict) +{ +CPUArchState *env1 =mon_get_cpu_env (); + +dump_mmu ((FILE *)mon, (fprintf_function )monitor_printf, env1); +}
target-nios2/op_helper.c new file +86 -0
40 lines not on this page · raw message
target-nios2/translate.c new file +242 -0
242 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.0
Part of the diff is not shown here. View the raw message.
PATCH 1/7 nios2: Add disas entries
Add nios2 disassembler support. This patch is composed from binutils files from commit "Opcodes and assembler support for Nios II R2". The files from binutils used in this patch are:
include/opcode/nios2.h
include/opcode/nios2r1.h
include/opcode/nios2r2.h
opcodes/nios2-opc.c
opcodes/nios2-dis.c
--- disas/Makefile.objs | 1 + disas/nios2.c | 3620 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/disas/bfd.h | 6 + 3 files changed, 3627 insertions(+) create mode 100644 disas/nios2.c
disas/Makefile.objs +1 -0
@@ -15,6 +15,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_NIOS2_DIS) += nios2.o common-obj-$(CONFIG_MOXIE_DIS) += moxie.o common-obj-$(CONFIG_PPC_DIS) += ppc.o common-obj-$(CONFIG_S390_DIS) += s390.o
disas/nios2.c new file +3620 -0
2,993 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.0
Part of the diff is not shown here. View the raw message.
Quoted 17 lines · Marek Vasut
Add nios2 disassembler support. This patch is composed from binutils files from commit "Opcodes and assembler support for Nios II R2". The files from binutils used in this patch are:
+++
b/disas/nios2.cdisas/nios2.c new file +10
-0@@ -0,0 +1,3620 @@ +/* +* This file is a concatenation of the following files from binutils: +* include/opcode/nios2.h +* include/opcode/nios2r1.h +* include/opcode/nios2r2.h +* opcodes/nios2-opc.c +* opcodes/nios2-dis.c +*/ + +/* Nios II opcode list for GAS, the GNU assembler.
disas/nios2.c line 20
Quoted 10 lines
disas/nios2.c new file +10
-0+ Copyright (C) 2012-2016 Free Software Foundation, Inc. + Contributed by Nigel Gray ([email protected]). + Contributed by Mentor Graphics, Inc. + + This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler. + + GAS/GDB is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version.
This is a non-starter. Qemu is a GPLv2-only project because of some of the files it has already borrowed from other places, so we CANNOT use GPLv3 files. You'll have to implement this from scratch, or pull from binutils at the point prior to where upstream binutils upgraded to GPLv3.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 25 lines · Eric Blake
Quoted 24 lines · Marek Vasut
Add nios2 disassembler support. This patch is composed from binutils files from commit "Opcodes and assembler support for Nios II R2". The files from binutils used in this patch are:
+++
b/disas/nios2.cdisas/nios2.c new file +17
-0@@ -0,0 +1,3620 @@ +/* +* This file is a concatenation of the following files from binutils: +* include/opcode/nios2.h +* include/opcode/nios2r1.h +* include/opcode/nios2r2.h +* opcodes/nios2-opc.c +* opcodes/nios2-dis.c +*/ + +/* Nios II opcode list for GAS, the GNU assembler. +Copyright (C) 2012-2016 Free Software Foundation, Inc. +Contributed by Nigel Gray ([email protected]). +Contributed by Mentor Graphics, Inc. + +This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler. + +GAS/GDB is free software; you can redistribute it and/or modify
Quoted 9 lines
disas/nios2.c line 20
Quoted 3 lines
disas/nios2.c new file +3
-0+ it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version.This is a non-starter. Qemu is a GPLv2-only project because of some of the files it has already borrowed from other places, so we CANNOT use GPLv3 files. You'll have to implement this from scratch, or pull from binutils at the point prior to where upstream binutils upgraded to GPLv3.
Ouch, I see. I hope Sandra (on CC) might have some idea how to best go about this licensing thing. I briefly checked and the nios2 stuff landed in binutils under gpl3 already.
Signature · 2 lines
Best regards, Marek Vasut
Quoted 35 lines · Marek Vasut
Quoted 25 lines · Eric Blake
Quoted 24 lines · Marek Vasut
Add nios2 disassembler support. This patch is composed from binutils files from commit "Opcodes and assembler support for Nios II R2". The files from binutils used in this patch are:
+++
b/disas/nios2.cdisas/nios2.c new file +17
-0@@ -0,0 +1,3620 @@ +/* +* This file is a concatenation of the following files from binutils: +* include/opcode/nios2.h +* include/opcode/nios2r1.h +* include/opcode/nios2r2.h +* opcodes/nios2-opc.c +* opcodes/nios2-dis.c +*/ + +/* Nios II opcode list for GAS, the GNU assembler. +Copyright (C) 2012-2016 Free Software Foundation, Inc. +Contributed by Nigel Gray ([email protected]). +Contributed by Mentor Graphics, Inc. + +This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler. + +GAS/GDB is free software; you can redistribute it and/or modify Quoted 9 lines
disas/nios2.c line 20
Quoted 3 lines
disas/nios2.c new file +3
-0+ it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version.This is a non-starter. Qemu is a GPLv2-only project because of some of the files it has already borrowed from other places, so we CANNOT use GPLv3 files. You'll have to implement this from scratch, or pull from binutils at the point prior to where upstream binutils upgraded to GPLv3.
Quoted 3 lines
Ouch, I see. I hope Sandra (on CC) might have some idea how to best go about this licensing thing. I briefly checked and the nios2 stuff landed in binutils under gpl3 already.
Hmmmm. Upstream binutils was already using GPLv3 at the time the nios2 support was contributed. I believe Altera's original out-of-tree patch set was GPLv2 but it is extremely bit-rotten at this point and doesn't include the new R2 instruction set or abstractions to support multiple ISA variants (I had to do a lot of refactoring of the old opcodes/disassembler support that amounted to almost a complete rewrite). I could look into whether Mentor Graphics could relicense our changes under GPLv2, but I'm not sure that would be possible or helpful given that both Altera and Mentor have already assigned copyright to the FSF? I'm not a legal expert. :-(
-Sandra
Quoted 10 lines · Sandra Loosemore
Quoted 9 lines
Quoted 6 lines
This is a non-starter. Qemu is a GPLv2-only project because of some of the files it has already borrowed from other places, so we CANNOT use GPLv3 files. You'll have to implement this from scratch, or pull from binutils at the point prior to where upstream binutils upgraded to GPLv3.
Ouch, I see. I hope Sandra (on CC) might have some idea how to best go about this licensing thing. I briefly checked and the nios2 stuff landed in binutils under gpl3 already.
Quoted 10 lines
Hmmmm. Upstream binutils was already using GPLv3 at the time the nios2 support was contributed. I believe Altera's original out-of-tree patch set was GPLv2 but it is extremely bit-rotten at this point and doesn't include the new R2 instruction set or abstractions to support multiple ISA variants (I had to do a lot of refactoring of the old opcodes/disassembler support that amounted to almost a complete rewrite). I could look into whether Mentor Graphics could relicense our changes under GPLv2, but I'm not sure that would be possible or helpful given that both Altera and Mentor have already assigned copyright to the FSF? I'm not a legal expert. :-(
I'm not a copyright lawyer. However, I _do_ know that when you assign copyright to the FSF, you retain the right as original author to relicense _your_ contribution however you see fit. That is, if the authors of ALL patches to that file agree (or if you can filter out any patches from other authors and get back to a version of the file that just consenting authors wrote), you can declare that your contributions are GPLv2+, which will make them usable in qemu under GPLv2+, while still remaining GPLv3+ in binutils. And you may want to consult with an actual lawyer before attempting anything that might cause legal issues.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org