lm32 fixes and additions
Hi Blue,
Please pull the following lm32 fixes and additions.
v2:
- prefix enumerations in lm32-dis.c to avoid name conflicts
The following changes since commit b7c8e15a146a7b20021b524f41d6b8072ee093b5:
Merge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm (2012-03-31 12:10:07 +0000)
are available in the git repository at:
git://github.com/mwalle/qemu.git for-upstream
Michael Walle (5):
tests: fix out-of-tree building for lm32 target
target-lm32: init tcg only if available
milkymist-sysctl: support for new core version
target-lm32: add simple disassembler
milkymist-vgafb: add missing register
Makefile.objs | 1 + configure | 8 +- dis-asm.h | 3 + disas.c | 6 + hw/milkymist-sysctl.c | 26 +++-- hw/milkymist-vgafb.c | 5 +- lm32-dis.c | 361 +++++++++++++++++++++++++++++++++++++++++++++++ target-lm32/helper.c | 2 +- tests/tcg/lm32/Makefile | 13 +- 9 files changed, 408 insertions(+), 17 deletions(-) create mode 100644 lm32-dis.c
PATCH 1/5 tests: fix out-of-tree building for lm32 target
--- configure | 4 +++- tests/tcg/lm32/Makefile | 13 ++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-)
configure +3 -1
@@ -3876,7 +3876,8 @@ echo "QEMU_INCLUDES+=$includes" >> $config_target_mak done # for target in $targets # build tree in object directory in case the source is not in the current directory -DIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom" +DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32" +DIRS="$DIRS slirp audio block net pc-bios/optionrom" DIRS="$DIRS pc-bios/spapr-rtas" DIRS="$DIRS roms/seabios roms/vgabios" DIRS="$DIRS fsdev ui usb"
@@ -3884,6 +3885,7 @@ DIRS="$DIRS qapi qapi-generated" DIRS="$DIRS qga trace qom" FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" +FILES="$FILES tests/tcg/lm32/Makefile" FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" FILES="$FILES pc-bios/spapr-rtas/Makefile" FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
tests/tcg/lm32/Makefile +8 -5
@@ -1,4 +1,4 @@ --include ../../config-host.mak +-include ../../../config-host.mak CROSS=lm32-elf-
@@ -12,7 +12,10 @@ SIZE = $(CROSS)size LD = $(CC) OBJCOPY = $(CROSS)objcopy -LDFLAGS = -Tlinker.ld +TSRC_PATH = $(SRC_PATH)/tests/tcg/lm32 + +LDFLAGS = -T$(TSRC_PATH)/linker.ld +ASFLAGS += -Wa,-I,$(TSRC_PATH)/ CRT = crt.o TESTCASES += test_add.tst
@@ -82,13 +85,13 @@ TESTCASES += test_xori.tst all: build -%.o: $(SRC_PATH)/tests/lm32/%.c +%.o: $(TSRC_PATH)/%.c $(CC) $(CFLAGS) -c $< -o $@ -%.o: $(SRC_PATH)/tests/lm32/%.S +%.o: $(TSRC_PATH)/%.S $(AS) $(ASFLAGS) -c $< -o $@ -%.tst: %.o macros.inc $(CRT) +%.tst: %.o $(TSRC_PATH)/macros.inc $(CRT) $(LD) $(LDFLAGS) $(NOSTDFLAGS) $(CRT) $< -o $@ build: $(CRT) $(TESTCASES)
Signature · 1 line
1.7.2.5
PATCH 2/5 target-lm32: init tcg only if available
In reply to Michael WalleOnce qtest support for target-lm32 arrives, tcg may be disabled.
--- target-lm32/helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
target-lm32/helper.c +1 -1
@@ -215,7 +215,7 @@ CPULM32State *cpu_lm32_init(const char *cpu_model)cpu_state_reset (env);qemu_init_vcpu (env); -if (!tcg_initialized) { +if (tcg_enabled () && !tcg_initialized) { tcg_initialized =1 ;lm32_translate_init (); }
Signature · 1 line
1.7.2.5
PATCH 3/5 milkymist-sysctl: support for new core version
In reply to Michael WalleThe new version introduces the following new registers:
- SoC clock frequency: read-only of system clock used on the SoC
- debug scratchpad: 8 bit scratchpad register
- debug write lock: write once register, without any function on QEMU
--- hw/milkymist-sysctl.c | 26 +++++++++++++++++--------- 1 files changed, 17 insertions(+), 9 deletions(-)
hw/milkymist-sysctl.c +17 -9
@@ -1,7 +1,7 @@/* * QEMU model of the Milkymist System Controller. * -* Copyright (c) 2010 Michael Walle <[email protected]> +* Copyright (c) 2010-2012 Michael Walle <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public
@@ -39,20 +39,19 @@ enum { };enum { -R_GPIO_IN =0 , +R_GPIO_IN =0 ,R_GPIO_OUT ,R_GPIO_INTEN , -R_RESERVED0 , -R_TIMER0_CONTROL , +R_TIMER0_CONTROL =4 ,R_TIMER0_COMPARE ,R_TIMER0_COUNTER , -R_RESERVED1 , -R_TIMER1_CONTROL , +R_TIMER1_CONTROL =8 ,R_TIMER1_COMPARE ,R_TIMER1_COUNTER , -R_RESERVED2 , -R_RESERVED3 , -R_ICAP , +R_ICAP =16 , +R_DBG_SCRATCHPAD =20 , +R_DBG_WRITE_LOCK , +R_CLK_FREQUENCY =29 ,R_CAPABILITIES ,R_SYSTEM_ID ,R_MAX
@@ -116,6 +115,9 @@ static uint64_t sysctl_read(void *opaque, target_phys_addr_t addr,case R_TIMER1_CONTROL :case R_TIMER1_COMPARE :case R_ICAP : +case R_DBG_SCRATCHPAD : +case R_DBG_WRITE_LOCK : +case R_CLK_FREQUENCY :case R_CAPABILITIES :case R_SYSTEM_ID : r = s->regs[addr];
@@ -145,6 +147,7 @@ static void sysctl_write(void *opaque, target_phys_addr_t addr, uint64_t value,case R_GPIO_INTEN :case R_TIMER0_COUNTER :case R_TIMER1_COUNTER : +case R_DBG_SCRATCHPAD : s->regs[addr] = value;break ;case R_TIMER0_COMPARE :
@@ -182,11 +185,15 @@ static void sysctl_write(void *opaque, target_phys_addr_t addr, uint64_t value,case R_ICAP :sysctl_icap_write (s, value);break ; +case R_DBG_WRITE_LOCK : + s->regs[addr] =1 ; +break ;case R_SYSTEM_ID :qemu_system_reset_request ();break ;case R_GPIO_IN : +case R_CLK_FREQUENCY :case R_CAPABILITIES :error_report ("milkymist_sysctl: write to read-only register 0x" TARGET_FMT_plx, addr <<2 );
@@ -253,6 +260,7 @@ static void milkymist_sysctl_reset(DeviceState *d)/* defaults */ s->regs[R_ICAP ] =ICAP_READY ; s->regs[R_SYSTEM_ID ] = s->systemid; + s->regs[R_CLK_FREQUENCY ] = s->freq_hz; s->regs[R_CAPABILITIES ] = s->capabilities; s->regs[R_GPIO_IN ] = s->strappings; }
Signature · 1 line
1.7.2.5
PATCH 4/5 target-lm32: add simple disassembler
In reply to Michael WalleBecause binutils disassembler is based on libopcode, this is a rewrite from scratch.
--- Makefile.objs | 1 + configure | 4 + dis-asm.h | 3 + disas.c | 6 + lm32-dis.c | 361 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 375 insertions(+), 0 deletions(-) create mode 100644 lm32-dis.c
Makefile.objs +1 -0
@@ -365,6 +365,7 @@ libdis-$(CONFIG_PPC_DIS) += ppc-dis.o libdis-$(CONFIG_S390_DIS) += s390-dis.o libdis-$(CONFIG_SH4_DIS) += sh4-dis.o libdis-$(CONFIG_SPARC_DIS) += sparc-dis.o +libdis-$(CONFIG_LM32_DIS) += lm32-dis.o ###################################################################### # trace
configure +4 -0
@@ -3770,6 +3770,10 @@ for i in $ARCH $TARGET_BASE_ARCH ; do echo "CONFIG_IA64_DIS=y" >> $config_target_mak echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak ;; + lm32) + echo "CONFIG_LM32_DIS=y" >> $config_target_mak + echo "CONFIG_LM32_DIS=y" >> $libdis_config_mak + ;; m68k) echo "CONFIG_M68K_DIS=y" >> $config_target_mak echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
dis-asm.h +3 -0
@@ -221,6 +221,8 @@ enum bfd_architecture bfd_arch_ia64, /* HP/Intel ia64 */#define bfd_mach_ia64_elf64 64#define bfd_mach_ia64_elf32 32 + bfd_arch_lm32, /* Lattice Mico32 */ +#define bfd_mach_lm32 1 bfd_arch_last };#define bfd_mach_s390_31 31
@@ -404,6 +406,7 @@ int print_insn_crisv32 (bfd_vma, disassemble_info*);int print_insn_crisv10 (bfd_vma ,disassemble_info *);int print_insn_microblaze (bfd_vma ,disassemble_info *);int print_insn_ia64 (bfd_vma ,disassemble_info *); +int print_insn_lm32 (bfd_vma ,disassemble_info *);#if 0 /* Fetch the disassembler for a given BFD, if that support is available. */
disas.c +6 -0
@@ -220,6 +220,9 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)#elif defined(TARGET_MICROBLAZE ) disasm_info.mach = bfd_arch_microblaze; print_insn = print_insn_microblaze; +#elif defined(TARGET_LM32 ) + disasm_info.mach = bfd_mach_lm32; + print_insn = print_insn_lm32;#else fprintf (out,"0x" TARGET_FMT_lx": Asm output not supported on this arch\n" , code);
@@ -421,6 +424,9 @@ void monitor_disas(Monitor *mon, CPUArchState *env,#elif defined(TARGET_S390X ) disasm_info.mach = bfd_mach_s390_64; print_insn = print_insn_s390; +#elif defined(TARGET_LM32 ) + disasm_info.mach = bfd_mach_lm32; + print_insn = print_insn_lm32;#else monitor_printf (mon,"0x" TARGET_FMT_lx": Asm output not supported on this arch\n" , pc);
lm32-dis.c new file +361 -0
361 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH 5/5 milkymist-vgafb: add missing register
In reply to Michael WalleThis bug existed since the first commit. Fortunately, the affected registers have no functionality in qemu. This will only prevent the following warning:
milkymist_vgafb: write access to unknown register 0x00000034
--- hw/milkymist-vgafb.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
hw/milkymist-vgafb.c +4 -1
@@ -2,7 +2,7 @@/* * QEMU model of the Milkymist VGA framebuffer. * -* Copyright (c) 2010 Michael Walle <[email protected]> +* Copyright (c) 2010-2012 Michael Walle <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public
@@ -54,6 +54,7 @@ enum {R_BASEADDRESS ,R_BASEADDRESS_ACT ,R_BURST_COUNT , +R_DDC ,R_SOURCE_CLOCK , R_MAX };
@@ -173,6 +174,7 @@ static uint64_t vgafb_read(void *opaque, target_phys_addr_t addr,case R_VSCAN :case R_BASEADDRESS :case R_BURST_COUNT : +case R_DDC :case R_SOURCE_CLOCK : r = s->regs[addr];break ;
@@ -211,6 +213,7 @@ static void vgafb_write(void *opaque, target_phys_addr_t addr, uint64_t value,case R_VSYNC_END :case R_VSCAN :case R_BURST_COUNT : +case R_DDC :case R_SOURCE_CLOCK : s->regs[addr] = value;break ;
Signature · 1 line
1.7.2.5
Quoted 3 lines · Michael Walle
Hi Blue,
Please pull the following lm32 fixes and additions.
Thanks, pulled.
Quoted 30 lines
v2:
- prefix enumerations inlm32-dis.cto avoid name conflictsThe following changes since commit
b7c8e15a146a7b20021b524f41d6b8072ee093b5:Merge branch 'arm-devs.for-upstream' of
git://git.linaro.org/people/pmaydell/qemu-arm(2012-03-31 12:10:07 +0000)are available in the git repository at:
git://github.com/mwalle/qemu.git for-upstream
Michael Walle (5):
tests: fix out-of-tree building for lm32 target
target-lm32: init tcg only if available
milkymist-sysctl: support for new core version
target-lm32: add simple disassembler
milkymist-vgafb: add missing registerMakefile.objs | 1 +
configure | 8 +-
dis-asm.h | 3 +
disas.c | 6 +
hw/milkymist-sysctl.c | 26 +++--
hw/milkymist-vgafb.c | 5 +-
lm32-dis.c | 361 +++++++++++++++++++++++++++++++++++++++++++++++target-lm32/helper.c| 2 +-
tests/tcg/lm32/Makefile | 13 +-9 files changed, 408 insertions(+), 17 deletions(-)create mode 100644
lm32-dis.c