Add RX archtecture support
v19 cover Add RX archtecture support
Hi Yoshinori, Richard, Igor.
This series an iteration of the previous v16 from Yoshinori with the fixups requested by Igor here:
https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg07260.html
and
https://lists.gnu.org/archive/html/qemu-devel/2019-06/msg01547.html
plus trivial cleanups.
It is based on commit 19735c837ae2056b4651720290eda59498eca65a, that is before the merge of pull-tcg-20190610 (CPUNegativeOffsetState) which resulted in commit a578cdfbdd8f9beff5ced52b7826ddb1669abbbf.
Series reordered, some patches squashed.
Patches modified: 2, 3, 14, 19 (wait review from Igor) New patch: 16 (wait review from Yoshinori) Extra patch: 21 (meant for testing)
This branch is available here: https://gitlab.com/philmd/qemu/tree/rx-v19
We have:
$ qemu-system-rx -cpu help rx62n
(qemu) info qom-tree
/machine (rx-virt-machine)
/peripheral (container)
/mcu (rx62n)
/sci[0] (renesas-sci)
/renesas-sci[0] (qemu:memory-region)
/icu (rx-icu)
...
/cpu (rx62n-rx-cpu)
/unnamed-gpio-in[0] (irq)
/unnamed-gpio-in[1] (irq)
...$ git backport-diff -u rx-16 -r 19735c837ae..rx-v19 Key: [----] : patches are identical [####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
001/21:[----] [--] 'target/rx: TCG translation'
002/21:[0011] [FC] 'target/rx: TCG helper'
003/21:[0136] [FC] 'target/rx: CPU definition'
004/21:[----] [--] 'target/rx: RX disassembler'
005/21:[----] [--] 'target/rx: Disassemble rx_index_addr into a string' 006/21:[----] [--] 'target/rx: Replace operand with prt_ldmi in disassembler' 007/21:[----] [--] 'target/rx: Use prt_ldmi for XCHG_mr disassembly' 008/21:[----] [--] 'target/rx: Emit all disassembly in one prt()' 009/21:[----] [--] 'target/rx: Collect all bytes during disassembly' 010/21:[----] [--] 'target/rx: Dump bytes for each insn during disassembly' 011/21:[----] [--] 'hw/intc: RX62N interrupt controller (ICUa)' 012/21:[----] [--] 'hw/timer: RX62N internal timer modules' 013/21:[----] [--] 'hw/char: RX62N serial communication interface (SCI)' 014/21:[0013] [FC] 'hw/rx: RX Target hardware definition' 015/21:[----] [-C] 'hw/rx: Honor -accel qtest'
016/21:[down] 'hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core' 017/21:[----] [--] 'qemu/bitops.h: Add extract8 and extract16' 018/21:[----] [--] 'hw/registerfields.h: Add 8bit and 16bit register macros' 019/21:[0005] [FC] 'Add rx-softmmu'
020/21:[----] [--] 'MAINTAINERS: Add RX'
021/21:[down] 'BootLinuxConsoleTest: Test the RX-Virt machine'
Thanks,
Phil.
Philippe Mathieu-Daudé (3):
hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core hw/registerfields.h: Add 8bit and 16bit register macros
BootLinuxConsoleTest: Test the RX-Virt machine
Richard Henderson (7):
target/rx: Disassemble rx_index_addr into a string target/rx: Replace operand with prt_ldmi in disassembler target/rx: Use prt_ldmi for XCHG_mr disassembly target/rx: Emit all disassembly in one prt() target/rx: Collect all bytes during disassembly target/rx: Dump bytes for each insn during disassembly hw/rx: Honor -accel qtest
Yoshinori Sato (11):
target/rx: TCG translation
target/rx: TCG helper
target/rx: CPU definition
target/rx: RX disassembler
hw/intc: RX62N interrupt controller (ICUa) hw/timer: RX62N internal timer modules hw/char: RX62N serial communication interface (SCI) hw/rx: RX Target hardware definition qemu/bitops.h: Add extract8 and extract16 Add rx-softmmu
MAINTAINERS: Add RX
MAINTAINERS | 19 + arch_init.c | 2 + configure | 8 + default-configs/rx-softmmu.mak | 3 + hw/Kconfig | 1 + hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + hw/char/renesas_sci.c | 340 ++++ hw/intc/Kconfig | 3 + hw/intc/Makefile.objs | 1 + hw/intc/rx_icu.c | 376 ++++ hw/rx/Kconfig | 14 + hw/rx/Makefile.objs | 2 + hw/rx/rx-virt.c | 113 ++ hw/rx/rx62n.c | 246 +++ hw/timer/Kconfig | 6 + hw/timer/Makefile.objs | 3 + hw/timer/renesas_cmt.c | 275 +++ hw/timer/renesas_tmr.c | 455 +++++ include/disas/dis-asm.h | 5 + include/exec/poison.h | 1 + include/hw/char/renesas_sci.h | 45 + include/hw/intc/rx_icu.h | 56 + include/hw/registerfields.h | 32 +- include/hw/rx/rx.h | 7 + include/hw/rx/rx62n.h | 91 + include/hw/timer/renesas_cmt.h | 38 + include/hw/timer/renesas_tmr.h | 53 + include/qemu/bitops.h | 38 + include/sysemu/arch_init.h | 1 + qapi/common.json | 3 +- target/rx/Makefile.objs | 12 + target/rx/cpu-qom.h | 42 + target/rx/cpu.c | 252 +++ target/rx/cpu.h | 201 ++ target/rx/disas.c | 1446 ++++++++++++++ target/rx/gdbstub.c | 112 ++ target/rx/helper.c | 148 ++ target/rx/helper.h | 31 + target/rx/insns.decode | 621 ++++++ target/rx/monitor.c | 38 + target/rx/op_helper.c | 470 +++++ target/rx/translate.c | 2432 ++++++++++++++++++++++++ tests/acceptance/boot_linux_console.py | 51 + tests/machine-none-test.c | 1 + 45 files changed, 8096 insertions(+), 2 deletions(-) create mode 100644 default-configs/rx-softmmu.mak create mode 100644 hw/char/renesas_sci.c create mode 100644 hw/intc/rx_icu.c create mode 100644 hw/rx/Kconfig create mode 100644 hw/rx/Makefile.objs create mode 100644 hw/rx/rx-virt.c create mode 100644 hw/rx/rx62n.c create mode 100644 hw/timer/renesas_cmt.c create mode 100644 hw/timer/renesas_tmr.c create mode 100644 include/hw/char/renesas_sci.h create mode 100644 include/hw/intc/rx_icu.h create mode 100644 include/hw/rx/rx.h create mode 100644 include/hw/rx/rx62n.h create mode 100644 include/hw/timer/renesas_cmt.h create mode 100644 include/hw/timer/renesas_tmr.h create mode 100644 target/rx/Makefile.objs create mode 100644 target/rx/cpu-qom.h create mode 100644 target/rx/cpu.c create mode 100644 target/rx/cpu.h create mode 100644 target/rx/disas.c create mode 100644 target/rx/gdbstub.c create mode 100644 target/rx/helper.c create mode 100644 target/rx/helper.h create mode 100644 target/rx/insns.decode create mode 100644 target/rx/monitor.c create mode 100644 target/rx/op_helper.c create mode 100644 target/rx/translate.c
Signature · 1 line
2.20.1
PATCH v19 1/21 target/rx: TCG translation
From: Yoshinori Sato <[email protected]>
This part only supported RXv1 instructions.
Instruction manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01us0032ej0120_rxsm.pdf
Message-Id: <[email protected]>
--- target/rx/Makefile.objs | 12 + target/rx/insns.decode | 621 ++++++++++ target/rx/translate.c | 2432 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 3065 insertions(+) create mode 100644 target/rx/Makefile.objs create mode 100644 target/rx/insns.decode create mode 100644 target/rx/translate.c
target/rx/Makefile.objs new file +12 -0
@@ -0,0 +1,12 @@ +obj-y += translate.o op_helper.o helper.o cpu.o gdbstub.o disas.o +obj-$(CONFIG_SOFTMMU) += monitor.o + +DECODETREE = $(SRC_PATH)/scripts/decodetree.py + +target/rx/decode.inc.c: \ + $(SRC_PATH)/target/rx/insns.decode $(DECODETREE) + $(call quiet-command,\ + $(PYTHON) $(DECODETREE) --varinsnwidth 32 -o $@ $<, "GEN", $(TARGET_DIR)$@) + +target/rx/translate.o: target/rx/decode.inc.c +target/rx/disas.o: target/rx/decode.inc.c
target/rx/insns.decode new file +621 -0
621 lines not on this page · raw message
target/rx/translate.c new file +2432 -0
2,367 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.20.1
Part of the diff is not shown here. View the raw message.
PATCH v19 2/21 target/rx: TCG helper
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Message-Id: <[email protected]>
[PMD: Removed tlb_fill, extracted from patch of Yoshinori Sato
'Convert to CPUClass::tlb_fill']
--- target/rx/helper.c | 148 +++++++++++++ target/rx/helper.h | 31 +++ target/rx/op_helper.c | 470 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 649 insertions(+) create mode 100644 target/rx/helper.c create mode 100644 target/rx/helper.h create mode 100644 target/rx/op_helper.c
target/rx/helper.c new file +148 -0
@@ -0,0 +1,148 @@ +/* +* RX emulation +* +* Copyright (c) 2019 Yoshinori Sato +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 "qemu/osdep.h" +#include "qemu/bitops.h" +#include "cpu.h" +#include "exec/log.h" +#include "exec/cpu_ldst.h" +#include "sysemu/sysemu.h" + +void rx_cpu_unpack_psw (CPURXState *env,uint32_t psw,int rte) +{ +if (env->psw_pm ==0 ) { + env->psw_ipl =FIELD_EX32 (psw,PSW ,IPL ); +if (rte) { +/* PSW.PM can write RTE and RTFI */ + env->psw_pm =FIELD_EX32 (psw,PSW ,PM ); + } + env->psw_u =FIELD_EX32 (psw,PSW ,U ); + env->psw_i =FIELD_EX32 (psw,PSW ,I ); + } + env->psw_o =FIELD_EX32 (psw,PSW ,O ) <<31 ; + env->psw_s =FIELD_EX32 (psw,PSW ,S ) <<31 ; + env->psw_z =1 -FIELD_EX32 (psw,PSW ,Z ); + env->psw_c =FIELD_EX32 (psw,PSW ,C ); +} + +#define INT_FLAGS (CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIR) +void rx_cpu_do_interrupt (CPUState *cs) +{ +RXCPU *cpu =RXCPU (cs); +CPURXState *env = &cpu->env; +int do_irq = cs->interrupt_request &INT_FLAGS ; +uint32_t save_psw; + + env->in_sleep =0 ; + +if (env->psw_u) { + env->usp = env->regs[0 ]; + }else { + env->isp = env->regs[0 ]; + } + save_psw =rx_cpu_pack_psw (env); + env->psw_pm = env->psw_i = env->psw_u =0 ; + +if (do_irq) { +if (do_irq &CPU_INTERRUPT_FIR ) { + env->bpc = env->pc; + env->bpsw = save_psw; + env->pc = env->fintv; + env->psw_ipl =15 ; + cs->interrupt_request &= ~CPU_INTERRUPT_FIR ; +qemu_set_irq (env->ack, env->ack_irq); +qemu_log_mask (CPU_LOG_INT ,"fast interrupt raised\n" ); + }else if (do_irq &CPU_INTERRUPT_HARD ) { + env->isp -=4 ; +cpu_stl_all (env, env->isp, save_psw); + env->isp -=4 ; +cpu_stl_all (env, env->isp, env->pc); + env->pc =cpu_ldl_all (env, env->intb + env->ack_irq *4 ); + env->psw_ipl = env->ack_ipl; + cs->interrupt_request &= ~CPU_INTERRUPT_HARD ; +qemu_set_irq (env->ack, env->ack_irq); +qemu_log_mask (CPU_LOG_INT , +"interrupt 0x%02x raised\n" , env->ack_irq); + } + }else { +uint32_t vec = cs->exception_index; +const char *expname ="unknown exception" ; + + env->isp -=4 ; +cpu_stl_all (env, env->isp, save_psw); + env->isp -=4 ; +cpu_stl_all (env, env->isp, env->pc); + +if (vec <0x100 ) { + env->pc =cpu_ldl_all (env,0xffffffc0 + vec *4 ); + }else { + env->pc =cpu_ldl_all (env, env->intb + (vec &0xff ) *4 ); + } +switch (vec) { +case 20 : + expname ="privilege violation" ; +break ; +case 21 : + expname ="access exception" ; +break ; +case 23 : + expname ="illegal instruction" ; +break ; +case 25 : + expname ="fpu exception" ; +break ; +case 30 : + expname ="non-maskable interrupt" ; +break ; + case 0x100 ... 0x1ff: + expname ="unconditional trap" ; + } +qemu_log_mask (CPU_LOG_INT ,"exception 0x%02x [%s] raised\n" , + (vec &0xff ), expname); + } + env->regs[0 ] = env->isp; +} + +bool rx_cpu_exec_interrupt (CPUState *cs,int interrupt_request) +{ +RXCPU *cpu =RXCPU (cs); +CPURXState *env = &cpu->env; +int accept =0 ; +/* hardware interrupt (Normal) */ +if ((interrupt_request &CPU_INTERRUPT_HARD ) && + env->psw_i && (env->psw_ipl < env->req_ipl)) { + env->ack_irq = env->req_irq; + env->ack_ipl = env->req_ipl; + accept =1 ; + } +/* hardware interrupt (FIR) */ +if ((interrupt_request &CPU_INTERRUPT_FIR ) && + env->psw_i && (env->psw_ipl <15 )) { + accept =1 ; + } +if (accept) { +rx_cpu_do_interrupt (cs); +return true; + } +return false; +} + +hwaddr rx_cpu_get_phys_page_debug (CPUState *cs,vaddr addr) +{ +return addr; +}
target/rx/helper.h new file +31 -0
@@ -0,0 +1,31 @@ +DEF_HELPER_1(raise_illegal_instruction, noreturn, env) +DEF_HELPER_1(raise_access_fault, noreturn, env) +DEF_HELPER_1(raise_privilege_violation, noreturn, env) +DEF_HELPER_1(wait, noreturn, env) +DEF_HELPER_1(debug, noreturn, env) +DEF_HELPER_2(rxint, noreturn, env, i32) +DEF_HELPER_1(rxbrk, noreturn, env) +DEF_HELPER_FLAGS_3(fadd, TCG_CALL_NO_WG, f32, env, f32, f32) +DEF_HELPER_FLAGS_3(fsub, TCG_CALL_NO_WG, f32, env, f32, f32) +DEF_HELPER_FLAGS_3(fmul, TCG_CALL_NO_WG, f32, env, f32, f32) +DEF_HELPER_FLAGS_3(fdiv, TCG_CALL_NO_WG, f32, env, f32, f32) +DEF_HELPER_FLAGS_3(fcmp, TCG_CALL_NO_WG, void, env, f32, f32) +DEF_HELPER_FLAGS_2(ftoi, TCG_CALL_NO_WG, i32, env, f32) +DEF_HELPER_FLAGS_2(round, TCG_CALL_NO_WG, i32, env, f32) +DEF_HELPER_FLAGS_2(itof, TCG_CALL_NO_WG, f32, env, i32) +DEF_HELPER_2(set_fpsw, void, env, i32) +DEF_HELPER_FLAGS_2(racw, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(set_psw_rte, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(set_psw, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_1(pack_psw, i32, env) +DEF_HELPER_FLAGS_3(div, TCG_CALL_NO_WG, i32, env, i32, i32) +DEF_HELPER_FLAGS_3(divu, TCG_CALL_NO_WG, i32, env, i32, i32) +DEF_HELPER_FLAGS_1(scmpu, TCG_CALL_NO_WG, void, env) +DEF_HELPER_1(smovu, void, env) +DEF_HELPER_1(smovf, void, env) +DEF_HELPER_1(smovb, void, env) +DEF_HELPER_2(sstr, void, env, i32) +DEF_HELPER_FLAGS_2(swhile, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(suntil, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_FLAGS_2(rmpa, TCG_CALL_NO_WG, void, env, i32) +DEF_HELPER_1 (satr, void, env)
target/rx/op_helper.c new file +470 -0
470 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v19 3/21 target/rx: CPU definition
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Message-Id: <[email protected]>
[PMD: Use newer QOM style, split cpu-qom.h, restrict access to
extable array, use rx_cpu_tlb_fill() extracted from patch of Yoshinori Sato 'Convert to CPUClass::tlb_fill']
--- target/rx/cpu-qom.h | 42 ++++++++ target/rx/cpu.c | 252 ++++++++++++++++++++++++++++++++++++++++++++ target/rx/cpu.h | 201 +++++++++++++++++++++++++++++++++++ target/rx/gdbstub.c | 112 ++++++++++++++++++++ target/rx/monitor.c | 38 +++++++ 5 files changed, 645 insertions(+) create mode 100644 target/rx/cpu-qom.h create mode 100644 target/rx/cpu.c create mode 100644 target/rx/cpu.h create mode 100644 target/rx/gdbstub.c create mode 100644 target/rx/monitor.c
target/rx/cpu-qom.h new file +42 -0
@@ -0,0 +1,42 @@ +#ifndef QEMU_SUPERH_CPU_QOM_H +#define QEMU_SUPERH_CPU_QOM_H + +#include "qom/cpu.h" +/* +* RX CPU +* +* Copyright (c) 2019 Yoshinori Sato +* SPDX-License-Identifier: LGPL-2.0+ +*/ + +#define TYPE_RX_CPU "rx-cpu" + +#define TYPE_RX62N_CPU RX_CPU_TYPE_NAME("rx62n") + +#define RXCPU_CLASS (klass) \ + OBJECT_CLASS_CHECK(RXCPUClass, (klass), TYPE_RX_CPU) +#define RXCPU (obj) \ + OBJECT_CHECK(RXCPU, (obj), TYPE_RX_CPU) +#define RXCPU_GET_CLASS (obj) \ + OBJECT_GET_CLASS(RXCPUClass, (obj), TYPE_RX_CPU) + +/* +* RXCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_reset: The parent class' reset handler. +* +* A RX CPU model. +*/ +typedef struct RXCPUClass { +/*< private >*/ +CPUClass parent_class; +/*< public >*/ + +DeviceRealize parent_realize; +void (*parent_reset)(CPUState *cpu); + +}RXCPUClass ; + +#define CPUArchState struct CPURXState + +#endif
target/rx/cpu.c new file +252 -0
252 lines not on this page · raw message
target/rx/cpu.h new file +201 -0
201 lines not on this page · raw message
target/rx/gdbstub.c new file +112 -0
112 lines not on this page · raw message
target/rx/monitor.c new file +38 -0
@@ -0,0 +1,38 @@ +/* +* 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 *env =mon_get_cpu_env (); + +if (!env) { +monitor_printf (mon,"No CPU available\n" ); +return ; + } +}
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v19 03/21] target/rx: CPU definition
Quoted 142 lines · On Tue, 11 Jun 2019 13:37:13 +0200 Philippe Mathieu-Daudé <[email protected]>…
From: Yoshinori Sato <[email protected]>
Signed-off-by Yoshinori Sato <[email protected]>Reviewed-by Richard Henderson <[email protected]>Message-Id: <[email protected]>
Signed-off-by Richard Henderson <[email protected]>[PMD: Use newer QOM style, split
cpu-qom.h, restrict access to
extable array, userx_cpu_tlb_fill()extracted from patch of Yoshinori Sato 'Convert toCPUClass::tlb_fill']Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/rx/cpu-qom.h | 42 ++++++++ target/rx/cpu.c | 252 ++++++++++++++++++++++++++++++++++++++++++++ target/rx/cpu.h | 201 +++++++++++++++++++++++++++++++++++ target/rx/gdbstub.c | 112 ++++++++++++++++++++ target/rx/monitor.c | 38 +++++++ 5 files changed, 645 insertions(+) create mode 100644 target/rx/cpu-qom.h create mode 100644 target/rx/cpu.c create mode 100644 target/rx/cpu.h create mode 100644 target/rx/gdbstub.c create mode 100644 target/rx/monitor.ctarget/rx/cpu-qom.h new file +42
-0@@ -0,0 +1,42 @@ +#ifndef QEMU_SUPERH_CPU_QOM_H +#define QEMU_SUPERH_CPU_QOM_H + +#include "qom/cpu.h" +/* +* RX CPU +* +* Copyright (c) 2019 Yoshinori Sato +* SPDX-License-Identifier: LGPL-2.0+ +*/ + +#define TYPE_RX_CPU "rx-cpu" + +#define TYPE_RX62N_CPU RX_CPU_TYPE_NAME("rx62n") + +#define RXCPU_CLASS (klass) \ + OBJECT_CLASS_CHECK(RXCPUClass, (klass), TYPE_RX_CPU) +#define RXCPU (obj) \ + OBJECT_CHECK(RXCPU, (obj), TYPE_RX_CPU) +#define RXCPU_GET_CLASS (obj) \ + OBJECT_GET_CLASS(RXCPUClass, (obj), TYPE_RX_CPU) + +/* +* RXCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_reset: The parent class' reset handler. +* +* A RX CPU model. +*/ +typedef struct RXCPUClass { +/*< private >*/ +CPUClass parent_class; +/*< public >*/ + +DeviceRealize parent_realize; +void (*parent_reset)(CPUState *cpu); + +}RXCPUClass ; + +#define CPUArchState struct CPURXState + +#endif target/rx/cpu.c new file +65
-0@@ -0,0 +1,252 @@ +/* +* QEMU RX CPU +* +* Copyright (c) 2019 Yoshinori Sato +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 "qemu/osdep.h" +#include "qemu/qemu-print.h" +#include "qapi/error.h" +#include "cpu.h" +#include "qemu-common.h" +#include "migration/vmstate.h" +#include "exec/exec-all.h" +#include "hw/loader.h" +#include "fpu/softfloat.h" + +static void rx_cpu_set_pc (CPUState *cs,vaddr value) +{ +RXCPU *cpu =RXCPU (cs); + + cpu->env.pc = value; +} + +static void rx_cpu_synchronize_from_tb (CPUState *cs,TranslationBlock *tb) +{ +RXCPU *cpu =RXCPU (cs); + + cpu->env.pc = tb->pc; +} + +static bool rx_cpu_has_work (CPUState *cs) +{ +return cs->interrupt_request & + (CPU_INTERRUPT_HARD |CPU_INTERRUPT_FIR ); +} + +static void rx_cpu_reset (CPUState *s) +{ +RXCPU *cpu =RXCPU (s); +RXCPUClass *rcc =RXCPU_GET_CLASS (cpu); +CPURXState *env = &cpu->env; +uint32_t *resetvec; + + rcc->parent_reset (s); + +memset (env,0 , offsetof(CPURXState , end_reset_fields)); + + resetvec =rom_ptr (0xfffffffc ,4 ); +if (resetvec) { +/* In the case of kernel, it is ignored because it is not set. */ + env->pc =ldl_p (resetvec); + } +rx_cpu_unpack_psw (env,0 ,1 );
target/rx/cpu.c line 75
Quoted 10 lines
target/rx/cpu.c new file +10
-0+ env->regs[0 ] = env->isp = env->usp =0 ; + env->fpsw =0 ; +set_flush_to_zero (1 , &env->fp_status); +set_flush_inputs_to_zero (1 , &env->fp_status); +} + +static void rx_cpu_list_entry (gpointer data,gpointer user_data) +{ +const char *typename =object_class_get_name (OBJECT_CLASS (data)); +int len =strlen (typename) -strlen (RX_CPU_TYPE_SUFFIX );
you'd probably need to fix this up to account for comment below.
Quoted 12 lines
target/rx/cpu.c new file +12
-0+ +qemu_printf ("%.*s\n" , len, typename); +} + +void rx_cpu_list (void ) +{ +GSList *list; + list =object_class_get_list_sorted (TYPE_RX_CPU , false); +g_slist_foreach (list, rx_cpu_list_entry,NULL ); +g_slist_free (list); +} +
target/rx/cpu.c line 97
Quoted 10 lines
target/rx/cpu.c new file +10
-0+static ObjectClass *rx_cpu_class_by_name (const char *cpu_model) +{ +ObjectClass *oc; +char *typename; + + oc =object_class_by_name (cpu_model); +if (oc !=NULL &&object_class_dynamic_cast (oc,TYPE_RX_CPU ) !=NULL && + !object_class_is_abstract (oc)) { +return oc; + }
Leave only this part and drop the rest, so that it would be consistent with other interfaces (hmp/qmp/-device) which use pure type names. The less invariants we support the better.
It's true that pr-existing cpu types support various ways to name CPUs but that's mostly due to us keeping compatibility for what used to work and definitely not from desire to support that madness.
target/rx/cpu.c line 109
Quoted 11 lines
target/rx/cpu.c new file +11
-0+ typename =g_strdup_printf (RX_CPU_TYPE_NAME ("%s" ), cpu_model); + oc =object_class_by_name (typename); +if (oc !=NULL &&object_class_is_abstract (oc)) { + oc =NULL ; + } +g_free (typename); + +if (!oc) { +/* default to rx62n */ + oc =object_class_by_name (TYPE_RX62N_CPU ); + }
pls don't do fallbacks on nonsense user input, it's much better to return NULL here and make user fix error in his CLI.
target/rx/cpu.c line 97
Quoted 3 lines
target/rx/cpu.c new file +3
-0+ +return oc; +}
PS:
it's fine to reply with v20 here is it doesn't break the rest of the series.
[...]
Quoted 11 lines
target/rx/cpu.c new file +11
-0+void rx_load_image (RXCPU *cpu,const char *filename, +uint32_t start,uint32_t size) +{ +static uint32_t extable[32 ]; +long kernel_size; +int i; + + kernel_size =load_image_targphys (filename, start, size); +if (kernel_size <0 ) { +fprintf (stderr,"qemu: could not load kernel '%s'\n" , filename); +exit (1 );
target/rx/cpu.c line 252
Quoted 10 lines
target/rx/cpu.c new file +10
-0+ } + cpu->env.pc = start; + +/* setup exception trap trampoline */ +/* linux kernel only works little-endian mode */ +for (i =0 ; i <ARRAY_SIZE (extable); i++) { + extable[i] =cpu_to_le32 (0x10 + i *4 ); + } +rom_add_blob_fixed ("extable" , extable,sizeof (extable),0xffffff80 ); +}
well, it doesn't look like code that belongs to cpu.c, typically it is done from board specific code.
Quoted 369 lines
target/rx/cpu.h new file +201
-0@@ -0,0 +1,201 @@ +/* +* RX emulation definition +* +* Copyright (c) 2019 Yoshinori Sato +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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/>. +*/ + +#ifndef RX_CPU_H +#define RX_CPU_H + +#include "qemu/bitops.h" +#include "qemu-common.h" +#include "hw/registerfields.h" +#include "cpu-qom.h" +#include "qom/cpu.h" + +#define TARGET_LONG_BITS 32 +#define TARGET_PAGE_BITS 12 + +#include "exec/cpu-defs.h" + +#define TARGET_PHYS_ADDR_SPACE_BITS 32 +#define TARGET_VIRT_ADDR_SPACE_BITS 32 + +/* PSW define */ +REG32(PSW, 0) +FIELD(PSW, C, 0, 1) +FIELD(PSW, Z, 1, 1) +FIELD(PSW, S, 2, 1) +FIELD(PSW, O, 3, 1) +FIELD(PSW, I, 16, 1) +FIELD(PSW, U, 17, 1) +FIELD(PSW, PM, 20, 1) +FIELD (PSW ,IPL ,24 ,4 ) + +/* FPSW define */ +REG32(FPSW, 0) +FIELD(FPSW, RM, 0, 2) +FIELD(FPSW, CV, 2, 1) +FIELD(FPSW, CO, 3, 1) +FIELD(FPSW, CZ, 4, 1) +FIELD(FPSW, CU, 5, 1) +FIELD(FPSW, CX, 6, 1) +FIELD(FPSW, CE, 7, 1) +FIELD(FPSW, CAUSE, 2, 6) +FIELD(FPSW, DN, 8, 1) +FIELD(FPSW, EV, 10, 1) +FIELD(FPSW, EO, 11, 1) +FIELD(FPSW, EZ, 12, 1) +FIELD(FPSW, EU, 13, 1) +FIELD(FPSW, EX, 14, 1) +FIELD(FPSW, ENABLE, 10, 5) +FIELD(FPSW, FV, 26, 1) +FIELD(FPSW, FO, 27, 1) +FIELD(FPSW, FZ, 28, 1) +FIELD(FPSW, FU, 29, 1) +FIELD(FPSW, FX, 30, 1) +FIELD(FPSW, FLAGS, 26, 4) +FIELD(FPSW, FS, 31, 1) + +#define NB_MMU_MODES 1 +#define MMU_MODE0_SUFFIX _all + +enum { +NUM_REGS =16 , +}; + +typedef struct CPURXState { +/* CPU registers */ +uint32_t regs[NUM_REGS ];/* general registers */ +uint32_t psw_o;/* O bit of status register */ +uint32_t psw_s;/* S bit of status register */ +uint32_t psw_z;/* Z bit of status register */ +uint32_t psw_c;/* C bit of status register */ +uint32_t psw_u; +uint32_t psw_i; +uint32_t psw_pm; +uint32_t psw_ipl; +uint32_t bpsw;/* backup status */ +uint32_t bpc;/* backup pc */ +uint32_t isp;/* global base register */ +uint32_t usp;/* vector base register */ +uint32_t pc;/* program counter */ +uint32_t intb;/* interrupt vector */ +uint32_t fintv; +uint32_t fpsw; +uint64_t acc; + +/* Fields up to this point are cleared by a CPU reset */ +struct {} end_reset_fields; + +/* Internal use */ +uint32_t in_sleep; +uint32_t req_irq;/* Requested interrupt no (hard) */ +uint32_t req_ipl;/* Requested interrupt level */ +uint32_t ack_irq;/* execute irq */ +uint32_t ack_ipl;/* execute ipl */ +float_status fp_status; +qemu_irq ack;/* Interrupt acknowledge */ + + CPU_COMMON +}CPURXState ; + +/* +* RXCPU: +* @env: #CPURXState +* +* A RX CPU +*/ +struct RXCPU { +/*< private >*/ +CPUState parent_obj; +/*< public >*/ + +CPURXState env; +}; + +typedef struct RXCPU RXCPU ; +typedef RXCPU ArchCPU ; + +static inline RXCPU *rx_env_get_cpu (CPURXState *env) +{ +return container_of (env,RXCPU , env); +} + +#define ENV_GET_CPU (e) CPU(rx_env_get_cpu(e)) + +#define ENV_OFFSET offsetof(RXCPU, env) + +#define RX_CPU_TYPE_SUFFIX "-" TYPE_RX_CPU +#define RX_CPU_TYPE_NAME (model) model RX_CPU_TYPE_SUFFIX +#define CPU_RESOLVING_TYPE TYPE_RX_CPU + +extern const char rx_crname[][6 ]; + +void rx_cpu_do_interrupt (CPUState *cpu); +bool rx_cpu_exec_interrupt (CPUState *cpu,int int_req); +void rx_cpu_dump_state (CPUState *cpu,FILE *f,int flags); +int rx_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg); +int rx_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); +hwaddr rx_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); + +void rx_translate_init (void ); +int cpu_rx_signal_handler (int host_signum,void *pinfo, +void *puc); + +void rx_cpu_list (void ); +void rx_load_image (RXCPU *cpu,const char *filename, +uint32_t start,uint32_t size); +void rx_cpu_unpack_psw (CPURXState *env,uint32_t psw,int rte); + +#define cpu_signal_handler cpu_rx_signal_handler +#define cpu_list rx_cpu_list + +#include "exec/cpu-all.h" + +#define CPU_INTERRUPT_SOFT CPU_INTERRUPT_TGT_INT_0 +#define CPU_INTERRUPT_FIR CPU_INTERRUPT_TGT_INT_1 + +#define RX_CPU_IRQ 0 +#define RX_CPU_FIR 1 + +static inline void cpu_get_tb_cpu_state (CPURXState *env,target_ulong *pc, +target_ulong *cs_base,uint32_t *flags) +{ + *pc = env->pc; + *cs_base =0 ; + *flags =FIELD_DP32 (0 ,PSW ,PM , env->psw_pm); +} + +static inline int cpu_mmu_index (CPURXState *env,bool ifetch) +{ +return 0 ; +} + +static inline uint32_t rx_cpu_pack_psw (CPURXState *env) +{ +uint32_t psw =0 ; + psw =FIELD_DP32 (psw,PSW ,IPL , env->psw_ipl); + psw =FIELD_DP32 (psw,PSW ,PM , env->psw_pm); + psw =FIELD_DP32 (psw,PSW ,U , env->psw_u); + psw =FIELD_DP32 (psw,PSW ,I , env->psw_i); + psw =FIELD_DP32 (psw,PSW ,O , env->psw_o >>31 ); + psw =FIELD_DP32 (psw,PSW ,S , env->psw_s >>31 ); + psw =FIELD_DP32 (psw,PSW ,Z , env->psw_z ==0 ); + psw =FIELD_DP32 (psw,PSW ,C , env->psw_c); +return psw; +} + +#endif /* RX_CPU_H */ target/rx/gdbstub.c new file +112
-0@@ -0,0 +1,112 @@ +/* +* RX gdb server stub +* +* Copyright (c) 2019 Yoshinori Sato +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU 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 "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" +#include "exec/gdbstub.h" + +int rx_cpu_gdb_read_register (CPUState *cs,uint8_t *mem_buf,int n) +{ +RXCPU *cpu =RXCPU (cs); +CPURXState *env = &cpu->env; + +switch (n) { + case 0 ... 15: +return gdb_get_regl (mem_buf, env->regs[n]); +case 16 : +return gdb_get_regl (mem_buf, (env->psw_u) ? env->regs[0 ] : env->usp); +case 17 : +return gdb_get_regl (mem_buf, (!env->psw_u) ? env->regs[0 ] : env->isp); +case 18 : +return gdb_get_regl (mem_buf,rx_cpu_pack_psw (env)); +case 19 : +return gdb_get_regl (mem_buf, env->pc); +case 20 : +return gdb_get_regl (mem_buf, env->intb); +case 21 : +return gdb_get_regl (mem_buf, env->bpsw); +case 22 : +return gdb_get_regl (mem_buf, env->bpc); +case 23 : +return gdb_get_regl (mem_buf, env->fintv); +case 24 : +return gdb_get_regl (mem_buf, env->fpsw); +case 25 : +return 0 ; + } +return 0 ; +} + +int rx_cpu_gdb_write_register (CPUState *cs,uint8_t *mem_buf,int n) +{ +RXCPU *cpu =RXCPU (cs); +CPURXState *env = &cpu->env; +uint32_t psw; +switch (n) { + case 0 ... 15: + env->regs[n] =ldl_p (mem_buf); +if (n ==0 ) { +if (env->psw_u) { + env->usp = env->regs[0 ]; + }else { + env->isp = env->regs[0 ]; + } + } +break ; +case 16 : + env->usp =ldl_p (mem_buf); +if (env->psw_u) { + env->regs[0 ] =ldl_p (mem_buf); + } +break ; +case 17 : + env->isp =ldl_p (mem_buf); +if (!env->psw_u) { + env->regs[0 ] =ldl_p (mem_buf); + } +break ; +case 18 : + psw =ldl_p (mem_buf); +rx_cpu_unpack_psw (env, psw,1 ); +break ; +case 19 : + env->pc =ldl_p (mem_buf); +break ; +case 20 : + env->intb =ldl_p (mem_buf); +break ; +case 21 : + env->bpsw =ldl_p (mem_buf); +break ; +case 22 : + env->bpc =ldl_p (mem_buf); +break ; +case 23 : + env->fintv =ldl_p (mem_buf); +break ; +case 24 : + env->fpsw =ldl_p (mem_buf); +break ; +case 25 : +return 8 ; +default : +return 0 ; + } + +return 4 ; +}target/rx/monitor.c new file +38
-0@@ -0,0 +1,38 @@ +/* +* 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 *env =mon_get_cpu_env (); + +if (!env) { +monitor_printf (mon,"No CPU available\n" ); +return ; + } +}
PATCH v19 4/21 target/rx: RX disassembler
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Message-Id: <[email protected]>
--- include/disas/dis-asm.h | 5 + target/rx/disas.c | 1480 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 1485 insertions(+) create mode 100644 target/rx/disas.c
include/disas/dis-asm.h +5 -0
@@ -226,6 +226,10 @@ enum bfd_architecture#define bfd_mach_nios2r2 2 bfd_arch_lm32, /* Lattice Mico32 */#define bfd_mach_lm32 1 + bfd_arch_rx, /* Renesas RX */ +#define bfd_mach_rx 0x75 +#define bfd_mach_rx_v2 0x76 +#define bfd_mach_rx_v3 0x77 bfd_arch_last };#define bfd_mach_s390_31 31
@@ -433,6 +437,7 @@ int print_insn_little_nios2 (bfd_vma, disassemble_info*);int print_insn_xtensa (bfd_vma ,disassemble_info *);int print_insn_riscv32 (bfd_vma ,disassemble_info *);int print_insn_riscv64 (bfd_vma ,disassemble_info *); +int print_insn_rx (bfd_vma ,disassemble_info *);#if 0 /* Fetch the disassembler for a given BFD, if that support is available. */
target/rx/disas.c new file +1480 -0
1,480 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v19 5/21 target/rx: Disassemble rx_index_addr into a string
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
We were eliding all zero indexes. It is only ld==0 that does not have an index in the instruction. This also allows us to avoid breaking the final print into multiple pieces.
Message-Id: <[email protected]>
--- target/rx/disas.c | 154 +++++++++++++++++----------------------------- 1 file changed, 55 insertions(+), 99 deletions(-)
target/rx/disas.c +55 -99
@@ -107,49 +107,42 @@ static const char psw[] = { 'i', 'u', 0, 0, 0, 0, 0, 0, }; -static uint32_t rx_index_addr (int ld,int size,DisasContext *ctx) +static void rx_index_addr (DisasContext *ctx,char out[8 ],int ld,int mi) { -bfd_byte buf[2 ]; +uint32_t addr = ctx->addr; +uint8_t buf[2 ]; +uint16_t dsp; +switch (ld) {case 0 : -return 0 ; +/* No index; return empty string. */ + out[0 ] ='\0' ; +return ;case 1 : - ctx->dis->read_memory_func (ctx->addr, buf,1 , ctx->dis); ctx->addr +=1 ; -return ((uint8_t )buf[0 ]) << size; + ctx->dis->read_memory_func (addr, buf,1 , ctx->dis); + dsp = buf[0 ]; +break ;case 2 : - ctx->dis->read_memory_func (ctx->addr, buf,2 , ctx->dis); ctx->addr +=2 ; -return lduw_le_p (buf) << size; + ctx->dis->read_memory_func (addr, buf,2 , ctx->dis); + dsp =lduw_le_p (buf); +break ; +default : +g_assert_not_reached (); } -g_assert_not_reached (); + +sprintf (out,"%u" , dsp << (mi <3 ? mi :4 - mi)); }static void operand (DisasContext *ctx,int ld,int mi,int rs,int rd) { -int dsp;static const char sizes[][4 ] = {".b" ,".w" ,".l" ,".uw" ,".ub" }; +char dsp[8 ]; +if (ld <3 ) { -switch (mi) { -case 4 : -/* dsp[rs].ub */ - dsp =rx_index_addr (ld,RX_MEMORY_BYTE , ctx); -break ; -case 3 : -/* dsp[rs].uw */ - dsp =rx_index_addr (ld,RX_MEMORY_WORD , ctx); -break ; -default : -/* dsp[rs].b */ -/* dsp[rs].w */ -/* dsp[rs].l */ - dsp =rx_index_addr (ld, mi, ctx); -break ; - } -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]%s" , rs, sizes[mi]); +rx_index_addr (ctx, dsp, ld, mi); +prt ("%s[r%d]%s" , dsp, rs, sizes[mi]); }else {prt ("r%d" , rs); }
@@ -235,7 +228,7 @@ static bool trans_MOV_ra(DisasContext *ctx, arg_MOV_ra *a)/* mov.[bwl] rs,rd */ static bool trans_MOV_mm (DisasContext *ctx,arg_MOV_mm *a) { -int dsp; +char dspd[8 ], dsps[8 ];prt ("mov.%c\t" , size[a->sz]);if (a->lds ==3 && a->ldd ==3 ) {
@@ -244,29 +237,15 @@ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a)return true; }if (a->lds ==3 ) { -prt ("r%d, " , a->rd); - dsp =rx_index_addr (a->ldd, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]" , a->rs); +rx_index_addr (ctx, dspd, a->ldd, a->sz); +prt ("r%d, %s[r%d]" , a->rs, dspd, a->rd); }else if (a->ldd ==3 ) { - dsp =rx_index_addr (a->lds, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d], r%d" , a->rs, a->rd); +rx_index_addr (ctx, dsps, a->lds, a->sz); +prt ("%s[r%d], r%d" , dsps, a->rs, a->rd); }else { - dsp =rx_index_addr (a->lds, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d], " , a->rs); - dsp =rx_index_addr (a->ldd, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]" , a->rd); +rx_index_addr (ctx, dsps, a->lds, a->sz); +rx_index_addr (ctx, dspd, a->ldd, a->sz); +prt ("%s[r%d], %s[r%d]" , dsps, a->rs, dspd, a->rd); }return true; }
@@ -357,12 +336,10 @@ static bool trans_PUSH_r(DisasContext *ctx, arg_PUSH_r *a)/* push dsp[rs] */ static bool trans_PUSH_m (DisasContext *ctx,arg_PUSH_m *a) { -prt ("push\t" ); -int dsp =rx_index_addr (a->ld, a->sz, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]" , a->rs); +char dsp[8 ]; + +rx_index_addr (ctx, dsp, a->ld, a->sz); +prt ("push\t%s[r%d]" , dsp, a->rs);return true; }
@@ -389,17 +366,13 @@ static bool trans_XCHG_rr(DisasContext *ctx, arg_XCHG_rr *a)/* xchg dsp[rs].<mi>,rd */ static bool trans_XCHG_mr (DisasContext *ctx,arg_XCHG_mr *a) { -int dsp;static const char msize[][4 ] = {"b" ,"w" ,"l" ,"ub" ,"uw" , }; +char dsp[8 ]; -prt ("xchg\t" ); - dsp =rx_index_addr (a->ld, a->mi, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d].%s, r%d" , a->rs, msize[a->mi], a->rd); +rx_index_addr (ctx, dsp, a->ld, a->mi); +prt ("xchg\t%s[r%d].%s, r%d" , dsp, a->rs, msize[a->mi], a->rd);return true; }
@@ -552,13 +525,10 @@ static bool trans_ADC_rr(DisasContext *ctx, arg_ADC_rr *a)/* adc dsp[rs], rd */ static bool trans_ADC_mr (DisasContext *ctx,arg_ADC_mr *a) { -int dsp; -prt ("adc\t" ); - dsp =rx_index_addr (a->ld,2 , ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d], r%d" , a->rs, a->rd); +char dsp[8 ]; + +rx_index_addr (ctx, dsp, a->ld,2 ); +prt ("adc\t%s[r%d], r%d" , dsp, a->rs, a->rd);return true; }
@@ -1217,25 +1187,17 @@ static bool trans_ITOF(DisasContext *ctx, arg_ITOF *a)#define BOP_IM (name, reg) \ do { \ - int dsp; \ - prt("b%s\t#%d, ", #name, a->imm); \ - dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); \ - if (dsp > 0) { \ - prt("%d", dsp); \ - } \ - prt("[r%d]", reg); \ + char dsp[8]; \ + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); \ + prt("b%s\t#%d, %s[r%d]", #name, a->imm, dsp, reg); \ return true; \ } while (0)#define BOP_RM (name) \ do { \ - int dsp; \ - prt("b%s\tr%d, ", #name, a->rd); \ - dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); \ - if (dsp > 0) { \ - prt("%d", dsp); \ - } \ - prt("[r%d]", a->rs); \ + char dsp[8]; \ + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); \ + prt("b%s\tr%d, %s[r%d]", #name, a->rd, dsp, a->rs); \ return true; \ } while (0)
@@ -1346,12 +1308,10 @@ static bool trans_BNOT_ir(DisasContext *ctx, arg_BNOT_ir *a)/* bmcond #imm, dsp[rd] */ static bool trans_BMCnd_im (DisasContext *ctx,arg_BMCnd_im *a) { -int dsp =rx_index_addr (a->ld,RX_MEMORY_BYTE , ctx); -prt ("bm%s\t#%d, " , cond[a->cd], a->imm); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[%d]" , a->rd); +char dsp[8 ]; + +rx_index_addr (ctx, dsp, a->ld,RX_MEMORY_BYTE ); +prt ("bm%s\t#%d, %s[r%d]" , cond[a->cd], a->imm, dsp, a->rd);return true; }
@@ -1443,16 +1403,12 @@ static bool trans_WAIT(DisasContext *ctx, arg_WAIT *a)/* sccnd.[bwl] dsp:[rd] */ static bool trans_SCCnd (DisasContext *ctx,arg_SCCnd *a) { -int dsp; -prt ("sc%s.%c\t" , cond[a->cd], size[a->sz]);if (a->ld <3 ) { - dsp =rx_index_addr (a->sz, a->ld, ctx); -if (dsp >0 ) { -prt ("%d" , dsp); - } -prt ("[r%d]" , a->rd); +char dsp[8 ]; +rx_index_addr (ctx, dsp, a->sz, a->ld); +prt ("sc%s.%c\t%s[r%d]" , cond[a->cd], size[a->sz], dsp, a->rd); }else { -prt ("r%d" , a->rd); +prt ("sc%s.%c\tr%d" , cond[a->cd], size[a->sz], a->rd); }return true; }
Signature · 1 line
2.20.1
PATCH v19 6/21 target/rx: Replace operand with prt_ldmi in disassembler
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
This has consistency with prt_ri(). It loads all data before beginning output. It uses exactly one call to prt() to emit the full instruction.
Message-Id: <[email protected]>
--- target/rx/disas.c | 77 +++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 50 deletions(-)
target/rx/disas.c +27 -50
@@ -135,18 +135,18 @@ static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi)sprintf (out,"%u" , dsp << (mi <3 ? mi :4 - mi)); } -static void operand (DisasContext *ctx,int ld,int mi,int rs,int rd) +static void prt_ldmi (DisasContext *ctx,const char *insn, +int ld,int mi,int rs,int rd) {static const char sizes[][4 ] = {".b" ,".w" ,".l" ,".uw" ,".ub" };char dsp[8 ];if (ld <3 ) {rx_index_addr (ctx, dsp, ld, mi); -prt ("%s[r%d]%s" , dsp, rs, sizes[mi]); +prt ("%s\t%s[r%d]%s, r%d" , insn, dsp, rs, sizes[mi], rd); }else { -prt ("r%d" , rs); +prt ("%s\tr%d, r%d" , insn, rs, rd); } -prt (", r%d" , rd); }static void prt_ir (DisasContext *ctx,const char *insn,int imm,int rd)
@@ -416,8 +416,7 @@ static bool trans_AND_ir(DisasContext *ctx, arg_AND_ir *a)/* and rs,rd */ static bool trans_AND_mr (DisasContext *ctx,arg_AND_mr *a) { -prt ("and\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"and" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -440,8 +439,7 @@ static bool trans_OR_ir(DisasContext *ctx, arg_OR_ir *a)/* or rs,rd */ static bool trans_OR_mr (DisasContext *ctx,arg_OR_mr *a) { -prt ("or\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"or" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -463,8 +461,7 @@ static bool trans_XOR_ir(DisasContext *ctx, arg_XOR_ir *a)/* xor rs,rd */ static bool trans_XOR_mr (DisasContext *ctx,arg_XOR_mr *a) { -prt ("xor\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"xor" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -479,8 +476,7 @@ static bool trans_TST_ir(DisasContext *ctx, arg_TST_ir *a)/* tst rs, rd */ static bool trans_TST_mr (DisasContext *ctx,arg_TST_mr *a) { -prt ("tst\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"tst" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -548,8 +544,7 @@ static bool trans_ADD_irr(DisasContext *ctx, arg_ADD_irr *a)/* add dsp[rs], rd */ static bool trans_ADD_mr (DisasContext *ctx,arg_ADD_mr *a) { -prt ("add\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"add" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -573,8 +568,7 @@ static bool trans_CMP_ir(DisasContext *ctx, arg_CMP_ir *a)/* cmp dsp[rs], rs2 */ static bool trans_CMP_mr (DisasContext *ctx,arg_CMP_mr *a) { -prt ("cmp\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"cmp" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -589,8 +583,7 @@ static bool trans_SUB_ir(DisasContext *ctx, arg_SUB_ir *a)/* sub dsp[rs], rd */ static bool trans_SUB_mr (DisasContext *ctx,arg_SUB_mr *a) { -prt ("sub\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"sub" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -611,8 +604,7 @@ static bool trans_SBB_rr(DisasContext *ctx, arg_SBB_rr *a)/* sbb dsp[rs], rd */ static bool trans_SBB_mr (DisasContext *ctx,arg_SBB_mr *a) { -prt ("sbb\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"sbb" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -640,8 +632,7 @@ static bool trans_MAX_ir(DisasContext *ctx, arg_MAX_ir *a)/* max dsp[rs], rd */ static bool trans_MAX_mr (DisasContext *ctx,arg_MAX_mr *a) { -prt ("max\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"max" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -656,8 +647,7 @@ static bool trans_MIN_ir(DisasContext *ctx, arg_MIN_ir *a)/* min dsp[rs], rd */ static bool trans_MIN_mr (DisasContext *ctx,arg_MIN_mr *a) { -prt ("max\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"min" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -673,8 +663,7 @@ static bool trans_MUL_ir(DisasContext *ctx, arg_MUL_ir *a)/* mul dsp[rs], rd */ static bool trans_MUL_mr (DisasContext *ctx,arg_MUL_mr *a) { -prt ("mul\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"mul" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -696,8 +685,7 @@ static bool trans_EMUL_ir(DisasContext *ctx, arg_EMUL_ir *a)/* emul dsp[rs], rd */ static bool trans_EMUL_mr (DisasContext *ctx,arg_EMUL_mr *a) { -prt ("emul\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"emul" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -712,8 +700,7 @@ static bool trans_EMULU_ir(DisasContext *ctx, arg_EMULU_ir *a)/* emulu dsp[rs], rd */ static bool trans_EMULU_mr (DisasContext *ctx,arg_EMULU_mr *a) { -prt ("emulu\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"emulu" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -728,8 +715,7 @@ static bool trans_DIV_ir(DisasContext *ctx, arg_DIV_ir *a)/* div dsp[rs], rd */ static bool trans_DIV_mr (DisasContext *ctx,arg_DIV_mr *a) { -prt ("div\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"div" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -744,8 +730,7 @@ static bool trans_DIVU_ir(DisasContext *ctx, arg_DIVU_ir *a)/* divu dsp[rs], rd */ static bool trans_DIVU_mr (DisasContext *ctx,arg_DIVU_mr *a) { -prt ("divu\t" ); -operand (ctx, a->ld, a->mi, a->rs, a->rd); +prt_ldmi (ctx,"divu" , a->ld, a->mi, a->rs, a->rd);return true; }
@@ -1089,8 +1074,7 @@ static bool trans_FADD_ir(DisasContext *ctx, arg_FADD_ir *a)/* fadd rs, rd */ static bool trans_FADD_mr (DisasContext *ctx,arg_FADD_mr *a) { -prt ("fadd\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fadd" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1105,8 +1089,7 @@ static bool trans_FCMP_ir(DisasContext *ctx, arg_FCMP_ir *a)/* fcmp rs, rd */ static bool trans_FCMP_mr (DisasContext *ctx,arg_FCMP_mr *a) { -prt ("fcmp\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fcmp" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1121,8 +1104,7 @@ static bool trans_FSUB_ir(DisasContext *ctx, arg_FSUB_ir *a)/* fsub rs, rd */ static bool trans_FSUB_mr (DisasContext *ctx,arg_FSUB_mr *a) { -prt ("fsub\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fsub" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1130,8 +1112,7 @@ static bool trans_FSUB_mr(DisasContext *ctx, arg_FSUB_mr *a)/* ftoi rs, rd */ static bool trans_FTOI (DisasContext *ctx,arg_FTOI *a) { -prt ("ftoi\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"ftoi" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1146,8 +1127,7 @@ static bool trans_FMUL_ir(DisasContext *ctx, arg_FMUL_ir *a)/* fmul rs, rd */ static bool trans_FMUL_mr (DisasContext *ctx,arg_FMUL_mr *a) { -prt ("fmul\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fmul" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1162,8 +1142,7 @@ static bool trans_FDIV_ir(DisasContext *ctx, arg_FDIV_ir *a)/* fdiv rs, rd */ static bool trans_FDIV_mr (DisasContext *ctx,arg_FDIV_mr *a) { -prt ("fdiv\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"fdiv" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1171,8 +1150,7 @@ static bool trans_FDIV_mr(DisasContext *ctx, arg_FDIV_mr *a)/* round rs, rd */ static bool trans_ROUND (DisasContext *ctx,arg_ROUND *a) { -prt ("round\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"round" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
@@ -1180,8 +1158,7 @@ static bool trans_ROUND(DisasContext *ctx, arg_ROUND *a)/* itof dsp[rs], rd */ static bool trans_ITOF (DisasContext *ctx,arg_ITOF *a) { -prt ("itof\t" ); -operand (ctx, a->ld,RX_IM_LONG , a->rs, a->rd); +prt_ldmi (ctx,"itof" , a->ld,RX_IM_LONG , a->rs, a->rd);return true; }
Signature · 1 line
2.20.1
PATCH v19 7/21 target/rx: Use prt_ldmi for XCHG_mr disassembly
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
Note that the ld == 3 case handled by prt_ldmi is decoded as XCHG_rr and cannot appear here.
Message-Id: <[email protected]>
--- target/rx/disas.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
target/rx/disas.c +1 -7
@@ -366,13 +366,7 @@ static bool trans_XCHG_rr(DisasContext *ctx, arg_XCHG_rr *a)/* xchg dsp[rs].<mi>,rd */ static bool trans_XCHG_mr (DisasContext *ctx,arg_XCHG_mr *a) { -static const char msize[][4 ] = { -"b" ,"w" ,"l" ,"ub" ,"uw" , - }; -char dsp[8 ]; - -rx_index_addr (ctx, dsp, a->ld, a->mi); -prt ("xchg\t%s[r%d].%s, r%d" , dsp, a->rs, msize[a->mi], a->rd); +prt_ldmi (ctx,"xchg" , a->ld, a->mi, a->rs, a->rd);return true; }
Signature · 1 line
2.20.1
PATCH v19 8/21 target/rx: Emit all disassembly in one prt()
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
Many of the multi-part prints have been eliminated by previous patches. Eliminate the rest of them.
Message-Id: <[email protected]>
--- target/rx/disas.c | 75 ++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 36 deletions(-)
target/rx/disas.c +39 -36
@@ -228,24 +228,21 @@ static bool trans_MOV_ra(DisasContext *ctx, arg_MOV_ra *a)/* mov.[bwl] rs,rd */ static bool trans_MOV_mm (DisasContext *ctx,arg_MOV_mm *a) { -char dspd[8 ], dsps[8 ]; +char dspd[8 ], dsps[8 ], szc = size[a->sz]; -prt ("mov.%c\t" , size[a->sz]);if (a->lds ==3 && a->ldd ==3 ) {/* mov.[bwl] rs,rd */ -prt ("r%d, r%d" , a->rs, a->rd); -return true; - } -if (a->lds ==3 ) { +prt ("mov.%c\tr%d, r%d" , szc, a->rs, a->rd); + }else if (a->lds ==3 ) {rx_index_addr (ctx, dspd, a->ldd, a->sz); -prt ("r%d, %s[r%d]" , a->rs, dspd, a->rd); +prt ("mov.%c\tr%d, %s[r%d]" , szc, a->rs, dspd, a->rd); }else if (a->ldd ==3 ) {rx_index_addr (ctx, dsps, a->lds, a->sz); -prt ("%s[r%d], r%d" , dsps, a->rs, a->rd); +prt ("mov.%c\t%s[r%d], r%d" , szc, dsps, a->rs, a->rd); }else {rx_index_addr (ctx, dsps, a->lds, a->sz);rx_index_addr (ctx, dspd, a->ldd, a->sz); -prt ("%s[r%d], %s[r%d]" , dsps, a->rs, dspd, a->rd); +prt ("mov.%c\t%s[r%d], %s[r%d]" , szc, dsps, a->rs, dspd, a->rd); }return true; }
@@ -254,8 +251,11 @@ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a)/* mov.[bwl] rs,[-rd] */ static bool trans_MOV_rp (DisasContext *ctx,arg_MOV_rp *a) { -prt ("mov.%c\tr%d, " , size[a->sz], a->rs); -prt ((a->ad ==0 ) ?"[r%d+]" :"[-r%d]" , a->rd); +if (a->ad) { +prt ("mov.%c\tr%d, [-r%d]" , size[a->sz], a->rs, a->rd); + }else { +prt ("mov.%c\tr%d, [r%d+]" , size[a->sz], a->rs, a->rd); + }return true; }
@@ -263,9 +263,11 @@ static bool trans_MOV_rp(DisasContext *ctx, arg_MOV_rp *a)/* mov.[bwl] [-rd],rs */ static bool trans_MOV_pr (DisasContext *ctx,arg_MOV_pr *a) { -prt ("mov.%c\t" , size[a->sz]); -prt ((a->ad ==0 ) ?"[r%d+]" :"[-r%d]" , a->rd); -prt (", r%d" , a->rs); +if (a->ad) { +prt ("mov.%c\t[-r%d], r%d" , size[a->sz], a->rd, a->rs); + }else { +prt ("mov.%c\t[r%d+], r%d" , size[a->sz], a->rd, a->rs); + }return true; }
@@ -299,9 +301,11 @@ static bool trans_MOVU_ar(DisasContext *ctx, arg_MOVU_ar *a)/* movu.[bw] [-rs],rd */ static bool trans_MOVU_pr (DisasContext *ctx,arg_MOVU_pr *a) { -prt ("movu.%c\t" , size[a->sz]); -prt ((a->ad ==0 ) ?"[r%d+]" :"[-r%d]" , a->rd); -prt (", r%d" , a->rs); +if (a->ad) { +prt ("movu.%c\t[-r%d], r%d" , size[a->sz], a->rd, a->rs); + }else { +prt ("movu.%c\t[r%d+], r%d" , size[a->sz], a->rd, a->rs); + }return true; }
@@ -478,11 +482,11 @@ static bool trans_TST_mr(DisasContext *ctx, arg_TST_mr *a)/* not rs, rd */ static bool trans_NOT_rr (DisasContext *ctx,arg_NOT_rr *a) { -prt ("not\t" );if (a->rs != a->rd) { -prt ("r%d, " , a->rs); +prt ("not\tr%d, r%d" , a->rs, a->rd); + }else { +prt ("not\tr%d" , a->rs); } -prt ("r%d" , a->rd);return true; }
@@ -490,11 +494,11 @@ static bool trans_NOT_rr(DisasContext *ctx, arg_NOT_rr *a)/* neg rs, rd */ static bool trans_NEG_rr (DisasContext *ctx,arg_NEG_rr *a) { -prt ("neg\t" );if (a->rs != a->rd) { -prt ("r%d, " , a->rs); +prt ("neg\tr%d, r%d" , a->rs, a->rd); + }else { +prt ("neg\tr%d" , a->rs); } -prt ("r%d" , a->rd);return true; }
@@ -606,11 +610,10 @@ static bool trans_SBB_mr(DisasContext *ctx, arg_SBB_mr *a)/* abs rs, rd */ static bool trans_ABS_rr (DisasContext *ctx,arg_ABS_rr *a) { -prt ("abs\t" ); -if (a->rs == a->rd) { -prt ("r%d" , a->rd); +if (a->rs != a->rd) { +prt ("abs\tr%d, r%d" , a->rs, a->rd); }else { -prt ("r%d, r%d" , a->rs, a->rd); +prt ("abs\tr%d" , a->rs); }return true; }
@@ -733,11 +736,11 @@ static bool trans_DIVU_mr(DisasContext *ctx, arg_DIVU_mr *a)/* shll #imm:5, rs, rd */ static bool trans_SHLL_irr (DisasContext *ctx,arg_SHLL_irr *a) { -prt ("shll\t#%d, " , a->imm);if (a->rs2 != a->rd) { -prt ("r%d, " , a->rs2); +prt ("shll\t#%d, r%d, r%d" , a->imm, a->rs2, a->rd); + }else { +prt ("shll\t#%d, r%d" , a->imm, a->rd); } -prt ("r%d" , a->rd);return true; }
@@ -752,11 +755,11 @@ static bool trans_SHLL_rr(DisasContext *ctx, arg_SHLL_rr *a)/* shar #imm:5, rs, rd */ static bool trans_SHAR_irr (DisasContext *ctx,arg_SHAR_irr *a) { -prt ("shar\t#%d," , a->imm);if (a->rs2 != a->rd) { -prt ("r%d, " , a->rs2); +prt ("shar\t#%d, r%d, r%d" , a->imm, a->rs2, a->rd); + }else { +prt ("shar\t#%d, r%d" , a->imm, a->rd); } -prt ("r%d" , a->rd);return true; }
@@ -771,11 +774,11 @@ static bool trans_SHAR_rr(DisasContext *ctx, arg_SHAR_rr *a)/* shlr #imm:5, rs, rd */ static bool trans_SHLR_irr (DisasContext *ctx,arg_SHLR_irr *a) { -prt ("shlr\t#%d, " , a->imm);if (a->rs2 != a->rd) { -prt ("r%d, " , a->rs2); +prt ("shlr\t#%d, r%d, r%d" , a->imm, a->rs2, a->rd); + }else { +prt ("shlr\t#%d, r%d" , a->imm, a->rd); } -prt ("r%d" , a->rd);return true; }
Signature · 1 line
2.20.1
PATCH v19 9/21 target/rx: Collect all bytes during disassembly
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
Collected, to be used in the next patch.
Message-Id: <[email protected]>
--- target/rx/disas.c | 62 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 20 deletions(-)
target/rx/disas.c +42 -20
@@ -25,43 +25,59 @@ typedef struct DisasContext {disassemble_info *dis;uint32_t addr;uint32_t pc; +uint8_t len; +uint8_t bytes[8 ]; } DisasContext;static uint32_t decode_load_bytes (DisasContext *ctx,uint32_t insn, -int i,int n) +int i,int n) { -bfd_byte buf; +uint32_t addr = ctx->addr; + +g_assert (ctx->len == i); +g_assert (n <=ARRAY_SIZE (ctx->bytes)); +while (++i <= n) { - ctx->dis->read_memory_func (ctx->addr++, &buf,1 , ctx->dis); - insn |= buf << (32 - i *8 ); + ctx->dis->read_memory_func (addr++, &ctx->bytes[i -1 ],1 , ctx->dis); + insn |= ctx->bytes[i -1 ] << (32 - i *8 ); } + ctx->addr = addr; + ctx->len = n; +return insn; }static int32_t li (DisasContext *ctx,int sz) { -int32_t addr; -bfd_byte buf[4 ]; - addr = ctx->addr; +uint32_t addr = ctx->addr; +uintptr_t len = ctx->len;switch (sz) {case 1 : +g_assert (len +1 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=1 ; - ctx->dis->read_memory_func (addr, buf,1 , ctx->dis); -return (int8_t )buf[0 ]; + ctx->len +=1 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,1 , ctx->dis); +return (int8_t )ctx->bytes[len];case 2 : +g_assert (len +2 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=2 ; - ctx->dis->read_memory_func (addr, buf,2 , ctx->dis); -return ldsw_le_p (buf); + ctx->len +=2 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,2 , ctx->dis); +return ldsw_le_p (ctx->bytes + len);case 3 : +g_assert (len +3 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=3 ; - ctx->dis->read_memory_func (addr, buf,3 , ctx->dis); -return (int8_t )buf[2 ] <<16 |lduw_le_p (buf); + ctx->len +=3 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,3 , ctx->dis); +return (int8_t )ctx->bytes[len +2 ] <<16 |lduw_le_p (ctx->bytes + len);case 0 : +g_assert (len +4 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=4 ; - ctx->dis->read_memory_func (addr, buf,4 , ctx->dis); -return ldl_le_p (buf); + ctx->len +=4 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,4 , ctx->dis); +return ldl_le_p (ctx->bytes + len);default :g_assert_not_reached (); }
@@ -110,7 +126,7 @@ static const char psw[] = {static void rx_index_addr (DisasContext *ctx,char out[8 ],int ld,int mi) {uint32_t addr = ctx->addr; -uint8_t buf[2 ]; +uintptr_t len = ctx->len;uint16_t dsp;switch (ld) {
@@ -119,14 +135,18 @@ static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) out[0 ] ='\0' ;return ;case 1 : +g_assert (len +1 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=1 ; - ctx->dis->read_memory_func (addr, buf,1 , ctx->dis); - dsp = buf[0 ]; + ctx->len +=1 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,1 , ctx->dis); + dsp = ctx->bytes[len];break ;case 2 : +g_assert (len +2 <=ARRAY_SIZE (ctx->bytes)); ctx->addr +=2 ; - ctx->dis->read_memory_func (addr, buf,2 , ctx->dis); - dsp =lduw_le_p (buf); + ctx->len +=2 ; + ctx->dis->read_memory_func (addr, ctx->bytes + len,2 , ctx->dis); + dsp =lduw_le_p (ctx->bytes + len);break ;default :g_assert_not_reached ();
@@ -1392,8 +1412,10 @@ int print_insn_rx(bfd_vma addr, disassemble_info *dis)DisasContext ctx;uint32_t insn;int i; + ctx.dis = dis; ctx.pc = ctx.addr = addr; + ctx.len =0 ; insn =decode_load (&ctx);if (!decode (&ctx, insn)) {
Signature · 1 line
2.20.1
PATCH v19 10/21 target/rx: Dump bytes for each insn during disassembly
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
There are so many different forms of each RX instruction that it will be very useful to be able to look at the bytes to see on which path a bug may lie.
Message-Id: <[email protected]>
--- target/rx/disas.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
target/rx/disas.c +15 -1
@@ -102,7 +102,21 @@ static int bdsp_s(DisasContext *ctx, int d)/* Include the auto-generated decoder. */ #include "decode.inc.c" -#define prt (...) (ctx->dis->fprintf_func)((ctx->dis->stream), __VA_ARGS__) +static void dump_bytes (DisasContext *ctx) +{ +int i, len = ctx->len; + +for (i =0 ; i < len; ++i) { + ctx->dis->fprintf_func (ctx->dis->stream,"%02x " , ctx->bytes[i]); + } + ctx->dis->fprintf_func (ctx->dis->stream,"%*c" , (8 - i) *3 ,'\t' ); +} + +#define prt (...) \ + do { \ + dump_bytes(ctx); \ + ctx->dis->fprintf_func(ctx->dis->stream, __VA_ARGS__); \ + } while (0)#define RX_MEMORY_BYTE 0#define RX_MEMORY_WORD 1
Signature · 1 line
2.20.1
PATCH v19 11/21 hw/intc: RX62N interrupt controller (ICUa)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
This implementation supported only ICUa.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- hw/intc/Kconfig | 3 + hw/intc/Makefile.objs | 1 + hw/intc/rx_icu.c | 376 +++++++++++++++++++++++++++++++++++++++ include/hw/intc/rx_icu.h | 56 ++++++ 4 files changed, 436 insertions(+) create mode 100644 hw/intc/rx_icu.c create mode 100644 include/hw/intc/rx_icu.h
hw/intc/Kconfig +3 -0
@@ -58,3 +58,6 @@ config S390_FLIC_KVM config OMPIC bool + +config RX_ICU + bool
hw/intc/Makefile.objs +1 -0
@@ -49,3 +49,4 @@ obj-$(CONFIG_ARM_GIC) += arm_gicv3_cpuif.o obj-$(CONFIG_MIPS_CPS) += mips_gic.o obj-$(CONFIG_NIOS2) += nios2_iic.o obj-$(CONFIG_OMPIC) += ompic.o +obj-$(CONFIG_RX) += rx_icu.o
hw/intc/rx_icu.c new file +376 -0
376 lines not on this page · raw message
include/hw/intc/rx_icu.h new file +56 -0
56 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v19 12/21 hw/timer: RX62N internal timer modules
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit timer modules.renesas_cmt: 16bit compare match timer modules.
This part use many renesas's CPU.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- hw/timer/Kconfig | 6 + hw/timer/Makefile.objs | 3 + hw/timer/renesas_cmt.c | 275 ++++++++++++++++++++ hw/timer/renesas_tmr.c | 455 +++++++++++++++++++++++++++++++++ include/hw/timer/renesas_cmt.h | 38 +++ include/hw/timer/renesas_tmr.h | 53 ++++ 6 files changed, 830 insertions(+) create mode 100644 hw/timer/renesas_cmt.c create mode 100644 hw/timer/renesas_tmr.c create mode 100644 include/hw/timer/renesas_cmt.h create mode 100644 include/hw/timer/renesas_tmr.h
hw/timer/Kconfig +6 -0
@@ -61,3 +61,9 @@ config CMSDK_APB_TIMER config CMSDK_APB_DUALTIMER bool select PTIMER + +config RENESAS_TMR8 + bool + +config RENESAS_CMT + bool
hw/timer/Makefile.objs +3 -0
@@ -40,6 +40,9 @@ obj-$(CONFIG_MC146818RTC) += mc146818rtc.o obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o +obj-$(CONFIG_RENESAS_TMR8) += renesas_tmr.o +obj-$(CONFIG_RENESAS_CMT) += renesas_cmt.o + common-obj-$(CONFIG_STM32F2XX_TIMER) += stm32f2xx_timer.o common-obj-$(CONFIG_ASPEED_SOC) += aspeed_timer.o
hw/timer/renesas_cmt.c new file +275 -0
275 lines not on this page · raw message
hw/timer/renesas_tmr.c new file +455 -0
455 lines not on this page · raw message
include/hw/timer/renesas_cmt.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Renesas Compare-match timer Object +* +* Copyright (c) 2019 Yoshinori Sato +* +* This code is licensed under the GPL version 2 or later. +* +*/ + +#ifndef HW_RENESAS_CMT_H +#define HW_RENESAS_CMT_H + +#include "hw/sysbus.h" + +#define TYPE_RENESAS_CMT "renesas-cmt" +#define RCMT (obj) OBJECT_CHECK(RCMTState, (obj), TYPE_RENESAS_CMT) + +enum { +CMT_CH =2 , +CMT_NR_IRQ =1 *CMT_CH , +}; + +typedef struct RCMTState { +SysBusDevice parent_obj; + +uint64_t input_freq; +MemoryRegion memory; + +uint16_t cmstr; +uint16_t cmcr[CMT_CH ]; +uint16_t cmcnt[CMT_CH ]; +uint16_t cmcor[CMT_CH ]; +int64_t tick[CMT_CH ]; +qemu_irq cmi[CMT_CH ]; +QEMUTimer *timer[CMT_CH ]; +}RCMTState ; + +#endif
include/hw/timer/renesas_tmr.h new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v19 13/21 hw/char: RX62N serial communication interface (SCI)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
This module supported only non FIFO type.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + hw/char/renesas_sci.c | 340 ++++++++++++++++++++++++++++++++++ include/hw/char/renesas_sci.h | 45 +++++ 4 files changed, 389 insertions(+) create mode 100644 hw/char/renesas_sci.c create mode 100644 include/hw/char/renesas_sci.h
hw/char/Kconfig +3 -0
@@ -46,3 +46,6 @@ config SCLPCONSOLE config TERMINAL3270 bool + +config RENESAS_SCI + bool
hw/char/Makefile.objs +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_PSERIES) += spapr_vty.o obj-$(CONFIG_DIGIC) += digic-uart.o obj-$(CONFIG_STM32F2XX_USART) += stm32f2xx_usart.o obj-$(CONFIG_RASPI) += bcm2835_aux.o +obj-$(CONFIG_RENESAS_SCI) += renesas_sci.o common-obj-$(CONFIG_CMSDK_APB_UART) += cmsdk-apb-uart.o common-obj-$(CONFIG_ETRAXFS) += etraxfs_ser.o
hw/char/renesas_sci.c new file +340 -0
340 lines not on this page · raw message
include/hw/char/renesas_sci.h new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v19 14/21 hw/rx: RX Target hardware definition
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
rx62n - RX62N cpu.
rx-virt - RX QEMU virtual target.
Message-Id: <[email protected]>
[PMD: Use TYPE_RX62N_CPU, use #define for RX62N_NR_TMR/CMT/SCI,
renamed CPU -> MCU, device -> microcontroller]
---
v19: Fixed typo (Peter Maydell)
--- hw/rx/Kconfig | 14 +++ hw/rx/Makefile.objs | 2 + hw/rx/rx-virt.c | 105 +++++++++++++++++++ hw/rx/rx62n.c | 238 ++++++++++++++++++++++++++++++++++++++++++ include/hw/rx/rx.h | 7 ++ include/hw/rx/rx62n.h | 91 ++++++++++++++++ 6 files changed, 457 insertions(+) create mode 100644 hw/rx/Kconfig create mode 100644 hw/rx/Makefile.objs create mode 100644 hw/rx/rx-virt.c create mode 100644 hw/rx/rx62n.c create mode 100644 include/hw/rx/rx.h create mode 100644 include/hw/rx/rx62n.h
hw/rx/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +config RX + bool + +config RX62N + bool + select RX + select RX_ICU + select RENESAS_TMR8 + select RENESAS_CMT + select RENESAS_SCI + +config RX_VIRT + bool + select RX62N
hw/rx/Makefile.objs new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_RX62N) += rx62n.o +obj-$(CONFIG_RX_VIRT) += rx-virt.o
hw/rx/rx-virt.c new file +105 -0
105 lines not on this page · raw message
hw/rx/rx62n.c new file +238 -0
238 lines not on this page · raw message
include/hw/rx/rx.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef QEMU_RX_H +#define QEMU_RX_H +/* Definitions for RX board emulation. */ + +#include "target/rx/cpu-qom.h" + +#endif
include/hw/rx/rx62n.h new file +91 -0
91 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v19 15/21 hw/rx: Honor -accel qtest
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
Issue an error if no kernel, no bios, and not qtest'ing. Fixes make check-qtest-rx: test/qom-test.
Message-Id: <[email protected]>
---
We could squash this with the previous patch
--- hw/rx/rx62n.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
hw/rx/rx62n.c +9 -1
@@ -21,11 +21,13 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/rx/rx62n.h" #include "hw/loader.h" #include "hw/sysbus.h" #include "sysemu/sysemu.h" +#include "sysemu/qtest.h" #include "cpu.h" /*
@@ -190,8 +192,14 @@ static void rx62n_realize(DeviceState *dev, Error **errp)memory_region_init_rom (&s->c_flash,NULL ,"codeflash" ,RX62N_CFLASH_SIZE , errp);memory_region_add_subregion (s->sysmem,RX62N_CFLASH_BASE , &s->c_flash); +if (!s->kernel) { -rom_add_file_fixed (bios_name,RX62N_CFLASH_BASE ,0 ); +if (bios_name) { +rom_add_file_fixed (bios_name,RX62N_CFLASH_BASE ,0 ); + }else if (!qtest_enabled ()) { +error_report ("No bios or kernel specified" ); +exit (1 ); + } }/* Initialize CPU */
Signature · 1 line
2.20.1
PATCH v19 16/21 hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core
In reply to Philippe Mathieu-DaudéWhile the VIRT machine can use different microcontrollers, the RX62N microcontroller is tied to the RX62N CPU core.
--- hw/rx/rx-virt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/rx/rx-virt.c +8 -0
@@ -17,6 +17,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h"
@@ -34,6 +35,7 @@static void rxvirt_init (MachineState *machine) { +MachineClass *mc =MACHINE_GET_CLASS (machine);RX62NState *s =g_new (RX62NState,1 );MemoryRegion *sysmem =get_system_memory ();MemoryRegion *sdram =g_new (MemoryRegion,1 );
@@ -42,6 +44,12 @@ static void rxvirt_init(MachineState *machine)void *dtb =NULL ;int dtb_size; +if (strcmp (machine->cpu_type, mc->default_cpu_type) !=0 ) { +error_report ("This board can only be used with CPU %s" , + mc->default_cpu_type); +exit (1 ); + } +/* Allocate memory space */ memory_region_init_ram (sdram,NULL ,"sdram" ,16 * MiB, &error_fatal);
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH v19 16/21] hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core
Quoted 5 lines · Philippe Mathieu-Daudé
While the VIRT machine can use different microcontrollers, the RX62N microcontroller is tied to the RX62N CPU core.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 40 lines
--- hw/rx/rx-virt.c | 8 ++++++++ 1 file changed, 8 insertions(+)hw/rx/rx-virt.c +8
-0@@ -17,6 +17,7 @@*/ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -34,6 +35,7 @@static void rxvirt_init (MachineState *machine) { +MachineClass *mc =MACHINE_GET_CLASS (machine);RX62NState *s =g_new (RX62NState,1 );MemoryRegion *sysmem =get_system_memory ();MemoryRegion *sdram =g_new (MemoryRegion,1 );@@ -42,6 +44,12 @@ static void rxvirt_init(MachineState *machine)void *dtb =NULL ;int dtb_size; +if (strcmp (machine->cpu_type, mc->default_cpu_type) !=0 ) { +error_report ("This board can only be used with CPU %s" , + mc->default_cpu_type); +exit (1 ); + } +/* Allocate memory space */ memory_region_init_ram (sdram,NULL ,"sdram" ,16 * MiB, &error_fatal);Signature · 1 line
2.20.1
Signature · 1 line
Yosinori Sato
PATCH v19 17/21 qemu/bitops.h: Add extract8 and extract16
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Message-Id: <[email protected]>
--- include/qemu/bitops.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
include/qemu/bitops.h +38 -0
@@ -300,6 +300,44 @@ static inline uint32_t extract32(uint32_t value, int start, int length)return (value >> start) & (~0U >> (32 - length)); } +/** +* extract8: +* @value: the value to extract the bit field from +* @start: the lowest bit in the bit field (numbered from 0) +* @length: the length of the bit field +* +* Extract from the 8 bit input @value the bit field specified by the +* @start and @length parameters, and return it. The bit field must +* lie entirely within the 8 bit word. It is valid to request that +* all 8 bits are returned (ie @length 8 and @start 0). +* +* Returns: the value of the bit field extracted from the input value. +*/ +static inline uint8_t extract8 (uint8_t value,int start,int length) +{ +assert (start >=0 && length >0 && length <=8 - start); +return extract32 (value, start, length); +} + +/** +* extract16: +* @value: the value to extract the bit field from +* @start: the lowest bit in the bit field (numbered from 0) +* @length: the length of the bit field +* +* Extract from the 16 bit input @value the bit field specified by the +* @start and @length parameters, and return it. The bit field must +* lie entirely within the 16 bit word. It is valid to request that +* all 16 bits are returned (ie @length 16 and @start 0). +* +* Returns: the value of the bit field extracted from the input value. +*/ +static inline uint16_t extract16 (uint16_t value,int start,int length) +{ +assert (start >=0 && length >0 && length <=16 - start); +return extract32 (value, start, length); +} +/** * extract64: * @value: the value to extract the bit field from
Signature · 1 line
2.20.1
PATCH v19 18/21 hw/registerfields.h: Add 8bit and 16bit register macros
In reply to Philippe Mathieu-DaudéSome RX peripheral using 8bit and 16bit registers. Added 8bit and 16bit APIs.
Message-Id: <[email protected]>
--- include/hw/registerfields.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
include/hw/registerfields.h +31 -1
@@ -22,6 +22,14 @@ enum { A_ ## reg = (addr) }; \ enum { R_ ## reg = (addr) / 4 }; +#define REG8 (reg, addr) \ + enum { A_ ## reg = (addr) }; \ + enum { R_ ## reg = (addr) }; + +#define REG16 (reg, addr) \ + enum { A_ ## reg = (addr) }; \ + enum { R_ ## reg = (addr) / 2 }; +/* Define SHIFT, LENGTH and MASK constants for a field within a register */ /* This macro will define R_FOO_BAR_MASK, R_FOO_BAR_SHIFT and R_FOO_BAR_LENGTH
@@ -34,6 +42,12 @@ MAKE_64BIT_MASK(shift, length)};/* Extract a field from a register */ +#define FIELD_EX8 (storage, reg, field) \ + extract8((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH) +#define FIELD_EX16 (storage, reg, field) \ + extract16((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH)#define FIELD_EX32 (storage, reg, field) \ extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ R_ ## reg ## _ ## field ## _LENGTH)
@@ -49,6 +63,22 @@* Assigning values larger then the target field will result in * compilation warnings. */ +#define FIELD_DP8 (storage, reg, field, val) ({ \ + struct { \ + unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \ + } v = { .v = val }; \ + uint8_t d; \ + d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH, v.v); \ + d; }) +#define FIELD_DP16 (storage, reg, field, val) ({ \ + struct { \ + unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \ + } v = { .v = val }; \ + uint16_t d; \ + d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH, v.v); \ + d; })#define FIELD_DP32 (storage, reg, field, val) ({ \ struct { \ unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \
@@ -57,7 +87,7 @@ d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ R_ ## reg ## _ ## field ## _LENGTH, v.v); \ d; }) -#define FIELD_DP64 (storage, reg, field, val) ({ \ +#define FIELD_DP64 (storage, reg, field, val) ({ \ struct { \ unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \ } v = { .v = val }; \
Signature · 1 line
2.20.1
PATCH v19 19/21 Add rx-softmmu
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Message-Id: <[email protected]>
pick ed65c02993 target/rx: Add RX to SysEmuTarget pick 01372568ae tests: Add rx to machine-none-test.c [PMD: Squashed patches from Richard Henderson modifying
qapi/common.json and tests/machine-none-test.c]
--- arch_init.c | 2 ++ configure | 8 ++++++++ default-configs/rx-softmmu.mak | 3 +++ hw/Kconfig | 1 + include/exec/poison.h | 1 + include/sysemu/arch_init.h | 1 + qapi/common.json | 3 ++- tests/machine-none-test.c | 1 + 8 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 default-configs/rx-softmmu.mak
arch_init.c +2 -0
@@ -74,6 +74,8 @@ int graphic_depth = 32;#define QEMU_ARCH QEMU_ARCH_PPC#elif defined(TARGET_RISCV )#define QEMU_ARCH QEMU_ARCH_RISCV +#elif defined(TARGET_RX ) +#define QEMU_ARCH QEMU_ARCH_RX#elif defined(TARGET_S390X )#define QEMU_ARCH QEMU_ARCH_S390X#elif defined(TARGET_SH4 )
configure +8 -0
@@ -7595,6 +7595,11 @@ case "$target_name" in gdb_xml_files="riscv-64bit-cpu.xml riscv-64bit-fpu.xml riscv-64bit-csr.xml" target_compiler=$cross_cc_riscv64 ;; + rx) + TARGET_ARCH=rx + bflt="yes" + target_compiler=$cross_cc_rx + ;; sh4|sh4eb) TARGET_ARCH=sh4 bflt="yes"
@@ -7815,6 +7820,9 @@ for i in $ARCH $TARGET_BASE_ARCH ; do riscv*) disas_config "RISCV" ;; + rx) + disas_config "RX" + ;; s390*) disas_config "S390" ;;
default-configs/rx-softmmu.mak new file +3 -0
@@ -0,0 +1,3 @@ +# Default configuration for rx-softmmu + +CONFIG_RX_VIRT=y
hw/Kconfig +1 -0
@@ -54,6 +54,7 @@ source nios2/Kconfig source openrisc/Kconfig source ppc/Kconfig source riscv/Kconfig +source rx/Kconfig source s390x/Kconfig source sh4/Kconfig source sparc/Kconfig
include/exec/poison.h +1 -0
@@ -26,6 +26,7 @@#pragma GCC poison TARGET_PPC#pragma GCC poison TARGET_PPC64#pragma GCC poison TARGET_ABI32 +#pragma GCC poison TARGET_RX#pragma GCC poison TARGET_S390X#pragma GCC poison TARGET_SH4#pragma GCC poison TARGET_SPARC
include/sysemu/arch_init.h +1 -0
@@ -25,6 +25,7 @@ enum {QEMU_ARCH_NIOS2 = (1 <<17 ),QEMU_ARCH_HPPA = (1 <<18 ),QEMU_ARCH_RISCV = (1 <<19 ), + QEMU_ARCH_RX = (1 << 20), };extern const uint32_t arch_type;
qapi/common.json +2 -1
@@ -183,6 +183,7 @@ # is true even for "qemu-system-x86_64". # # ppcemb: dropped in 3.1 +# rx: added in 4.1 # # Since: 3.0 ##
@@ -190,6 +191,6 @@ 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', - 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', + 'ppc64', 'riscv32', 'riscv64', 'rx', 's390x', 'sh4', 'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32', 'x86_64', 'xtensa', 'xtensaeb' ] }
tests/machine-none-test.c +1 -0
@@ -56,6 +56,7 @@ static struct arch2cpu cpus_map[] = { { "hppa", "hppa" }, { "riscv64", "rv64gcsu-v1.10.0" }, { "riscv32", "rv32gcsu-v1.9.1" }, + { "rx", "rx62n" }, };static const char *get_cpu_model_by_arch (const char *arch)
Signature · 1 line
2.20.1
PATCH v19 20/21 MAINTAINERS: Add RX
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Message-Id: <[email protected]>
--- MAINTAINERS | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
MAINTAINERS +19 -0
@@ -273,6 +273,13 @@ F: include/hw/riscv/ F: linux-user/host/riscv32/ F: linux-user/host/riscv64/ +RENESAS RX +M: Yoshinori Sato <[email protected]> +S: Maintained +F: target/rx/ +F: hw/rx/ +F: include/hw/rx/ + S390 M: Richard Henderson <[email protected]> M: David Hildenbrand <[email protected]>
@@ -1109,6 +1116,18 @@ F: pc-bios/canyonlands.dt[sb] F: pc-bios/u-boot-sam460ex-20100605.bin F: roms/u-boot-sam460ex +RX Machines +----------- +RX-QEMU +M: Yoshinori Sato <[email protected]> +S: Maintained +F: hw/rx/rxqemu.c +F: hw/intc/rx_icu.c +F: hw/timer/renesas_*.c +F: hw/char/renesas_sci.c +F: include/hw/timer/renesas_*.h +F: include/hw/char/renesas_sci.h + SH4 Machines ------------ R2D
Signature · 1 line
2.20.1
PATCH v19 21/21 BootLinuxConsoleTest: Test the RX-Virt machine
In reply to Philippe Mathieu-DaudéAdd two tests for the rx-virt machine, based on the recommended test setup from Yoshinori Sato:
https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg03586.html
- U-Boot prompt
- Linux kernel with Sash shell
These are very quick tests:
$ avocado run -t arch:rx tests/acceptance/boot_linux_console.py JOB ID : 84a6ef01c0b87975ecbfcb31a920afd735753ace JOB LOG : /home/phil/avocado/job-results/job-2019-05-24T05.02-84a6ef0/job.log (1/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_uboot: PASS (0.11 s) (2/2) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_rx_linux: PASS (0.45 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
Tests can also be run with:
$ avocado --show=console run -t arch:rx tests/acceptance/boot_linux_console.py console: U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty (Feb 05 2019 - 21:56:06 +0900) console: Linux version 4.19.0+ (yo-satoh@yo-satoh-debian) (gcc version 9.0.0 20181105 (experimental) (GCC)) #137 Wed Feb 20 23:20:02 JST 2019 console: Built 1 zonelists, mobility grouping on. Total pages: 8128 ... console: SuperH (H)SCI(F) driver initialized console: 88240.serial: ttySC0 at MMIO 0x88240 (irq = 215, base_baud = 0) is a sci console: console [ttySC0] enabled console: 88248.serial: ttySC1 at MMIO 0x88248 (irq = 219, base_baud = 0) is a sci
---
Based-on: [email protected] "RX architecture support"
--- tests/acceptance/boot_linux_console.py | 51 ++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
tests/acceptance/boot_linux_console.py +51 -0
@@ -45,6 +45,11 @@ class BootLinuxConsole(Test): fail = 'Failure message found in console: %s' % failure_message self.fail(fail) + def exec_command_and_wait_for_pattern(self, command, success_message): + command += '\n' + self.vm.console_socket.sendall(command.encode()) + self.wait_for_console_pattern(success_message) + def extract_from_deb(self, deb, path): """ Extracts a file from a deb package into the test workdir
@@ -217,3 +222,49 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_rx_uboot(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + uboot_url = ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz') + uboot_hash = '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb' + uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash) + uboot_path = archive.uncompress(uboot_path, self.workdir) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + self.vm.add_args('-bios', uboot_path, + '-no-reboot') + self.vm.launch() + uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' + self.wait_for_console_pattern(uboot_version) + gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)' + # FIXME limit baudrate on chardev, else we type too fast + #self.exec_command_and_wait_for_pattern('version', gcc_version) + + def test_rx_linux(self): + """ + :avocado: tags=arch:rx + :avocado: tags=machine:rx-virt + :avocado: tags=endian:little + """ + dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-qemu.dtb') + dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage') + kernel_hash = '39a81067f8d72faad90866ddfefa19165d68fc99' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_machine('rx-virt') + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon' + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Sash command shell (version 1.1.1)') + self.exec_command_and_wait_for_pattern('printenv', + 'TERM=linux')
Signature · 1 line
2.20.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v19 00/21] Add RX archtecture support
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Switched to a new branch 'test'
54dc0dd BootLinuxConsoleTest: Test the RX-Virt machine a650693 MAINTAINERS: Add RX
bb5922e Add rx-softmmu
57efd99 hw/registerfields.h: Add 8bit and 16bit register macros a043825 qemu/bitops.h: Add extract8 and extract16
b3d9518 hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core dd0b312 hw/rx: Honor -accel qtest
7af162f hw/rx: RX Target hardware definition
52cee25 hw/char: RX62N serial communication interface (SCI) bf4a215 hw/timer: RX62N internal timer modules
51cf815 hw/intc: RX62N interrupt controller (ICUa)
e0a06ae target/rx: Dump bytes for each insn during disassembly cda7b7d target/rx: Collect all bytes during disassembly 75be3f5 target/rx: Emit all disassembly in one prt()
a4bbc9b target/rx: Use prt_ldmi for XCHG_mr disassembly 0d03cf7 target/rx: Replace operand with prt_ldmi in disassembler efe02d6 target/rx: Disassemble rx_index_addr into a string 268ed0e target/rx: RX disassembler
4b87235 target/rx: CPU definition
8893379 target/rx: TCG helper
adee91c target/rx: TCG translation
=== OUTPUT BEGIN ===
1/21 Checking commit adee91cee710 (target/rx: TCG translation)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #20:
new file mode 100644
total: 0 errors, 1 warnings, 3065 lines checked
Patch 1/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
2/21 Checking commit 8893379be728 (target/rx: TCG helper)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644
total: 0 errors, 1 warnings, 649 lines checked
Patch 2/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
3/21 Checking commit 4b8723519d74 (target/rx: CPU definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644
total: 0 errors, 1 warnings, 645 lines checked
Patch 3/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
4/21 Checking commit 268ed0ed5bed (target/rx: RX disassembler)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #38:
new file mode 100644
total: 0 errors, 1 warnings, 1497 lines checked
Patch 4/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
5/21 Checking commit efe02d640116 (target/rx: Disassemble rx_index_addr into a string) 6/21 Checking commit 0d03cf7c4dea (target/rx: Replace operand with prt_ldmi in disassembler) 7/21 Checking commit a4bbc9b6f906 (target/rx: Use prt_ldmi for XCHG_mr disassembly) 8/21 Checking commit 75be3f594a61 (target/rx: Emit all disassembly in one prt()) 9/21 Checking commit cda7b7deb78a (target/rx: Collect all bytes during disassembly) 10/21 Checking commit e0a06ae5bb91 (target/rx: Dump bytes for each insn during disassembly) 11/21 Checking commit 51cf8153697c (hw/intc: RX62N interrupt controller (ICUa))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #40:
new file mode 100644
total: 0 errors, 1 warnings, 442 lines checked
Patch 11/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
12/21 Checking commit bf4a2154e409 (hw/timer: RX62N internal timer modules)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #50:
new file mode 100644
total: 0 errors, 1 warnings, 839 lines checked
Patch 12/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
13/21 Checking commit 52cee25bb159 (hw/char: RX62N serial communication interface (SCI))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #43:
new file mode 100644
total: 0 errors, 1 warnings, 398 lines checked
Patch 13/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
14/21 Checking commit 7af162fcb6fc (hw/rx: RX Target hardware definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #21:
new file mode 100644
total: 0 errors, 1 warnings, 457 lines checked
Patch 14/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
15/21 Checking commit dd0b312cbbf0 (hw/rx: Honor -accel qtest)
16/21 Checking commit b3d951869f12 (hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core) 17/21 Checking commit a043825aeef2 (qemu/bitops.h: Add extract8 and extract16)
18/21 Checking commit 57efd991b11b (hw/registerfields.h: Add 8bit and 16bit register macros) Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 2467.
ERROR: Macros with multiple statements should be enclosed in a do - while loop
#27: FILE: include/hw/registerfields.h:25:
+#define REG8(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) };
ERROR: Macros with multiple statements should be enclosed in a do - while loop #31: FILE: include/hw/registerfields.h:29:
+#define REG16(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) / 2 };
total: 2 errors, 0 warnings, 56 lines checked
Patch 18/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
19/21 Checking commit bb5922e03944 (Add rx-softmmu)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #59:
new file mode 100644
total: 0 errors, 1 warnings, 73 lines checked
Patch 19/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
20/21 Checking commit a650693b9b8f (MAINTAINERS: Add RX)
21/21 Checking commit 54dc0ddfce91 (BootLinuxConsoleTest: Test the RX-Virt machine) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed build test on s390x host. Please find the details below.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with # HEAD pointing to a commit that has the patches applied on top of "base"
# branch set -e CC=$HOME/bin/cc INSTALL=$PWD/install BUILD=$PWD/build mkdir -p $BUILD $INSTALL SRC=$PWD cd $BUILD $SRC/configure --cc=$CC --prefix=$INSTALL make -j4 # XXX: we need reliable clean up # make check -j4 V=1 make install
echo
echo "=== ENV ==="
env
echo
echo "=== PACKAGES ==="
rpm -qa
=== TEST SCRIPT END ===
CC rx-softmmu/exec.o
In file included from /var/tmp/patchew-tester-tmp-qkxrldtb/src/target/rx/cpu.h:31,
from /var/tmp/patchew-tester-tmp-qkxrldtb/src/exec.c:23:/var/tmp/patchew-tester-tmp-qkxrldtb/src/include/exec/cpu-defs.h:38:10: fatal error: cpu-param.h: No such file or directory
38 | #include "cpu-param.h"
| ^~~~~~~~~~~~~
compilation terminated.
The full log is available at
http://patchew.org/logs/[email protected]/testing.s390x/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PATCH v19 00/21] Add RX archtecture support
Type: series
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'e70c9a6cf7 BootLinuxConsoleTest: Test the RX-Virt machine 73390864df MAINTAINERS: Add RXf1c1d89045 Add rx-softmmufe080a5d97 hw/registerfields.h: Add 8bit and 16bit register macros 84492a1c42 qemu/bitops.h: Add extract8 and extract16 ccbd0067c6 hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core 0b80c9380d hw/rx: Honor -accel qtestd4fce4d13b hw/rx: RX Target hardware definition0c06063d0e hw/char: RX62N serial communication interface (SCI) edd009a215 hw/timer: RX62N internal timer modulesa4488f79be hw/intc: RX62N interrupt controller (ICUa) 54c515fb2a target/rx: Dump bytes for each insn during disassembly c982b91035 target/rx: Collect all bytes during disassembly c430ed068c target/rx: Emit all disassembly in one prt() 3da99a6859 target/rx: Use prt_ldmi for XCHG_mr disassembly 50f2803038 target/rx: Replace operand with prt_ldmi in disassembler b8c3705eea target/rx: Disassemble rx_index_addr into a string dc265bd950 target/rx: RX disassemblerced4a3cd43 target/rx: CPU definition4b8d4b55da target/rx: TCG helper589682dbfc target/rx: TCG translation
=== OUTPUT BEGIN ===
1/21 Checking commit 589682dbfc1b (target/rx: TCG translation)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #20:
new file mode 100644
total: 0 errors, 1 warnings, 3065 lines checked
Patch 1/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
2/21 Checking commit 4b8d4b55da67 (target/rx: TCG helper)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644
total: 0 errors, 1 warnings, 649 lines checked
Patch 2/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
3/21 Checking commit ced4a3cd43a8 (target/rx: CPU definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644
total: 0 errors, 1 warnings, 645 lines checked
Patch 3/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
4/21 Checking commit dc265bd95076 (target/rx: RX disassembler)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #38:
new file mode 100644
total: 0 errors, 1 warnings, 1497 lines checked
Patch 4/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
5/21 Checking commit b8c3705eea7f (target/rx: Disassemble rx_index_addr into a string) 6/21 Checking commit 50f280303836 (target/rx: Replace operand with prt_ldmi in disassembler) 7/21 Checking commit 3da99a68592f (target/rx: Use prt_ldmi for XCHG_mr disassembly) 8/21 Checking commit c430ed068cff (target/rx: Emit all disassembly in one prt()) 9/21 Checking commit c982b9103598 (target/rx: Collect all bytes during disassembly) 10/21 Checking commit 54c515fb2a8e (target/rx: Dump bytes for each insn during disassembly) 11/21 Checking commit a4488f79be75 (hw/intc: RX62N interrupt controller (ICUa))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #40:
new file mode 100644
total: 0 errors, 1 warnings, 442 lines checked
Patch 11/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
12/21 Checking commit edd009a21569 (hw/timer: RX62N internal timer modules)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #50:
new file mode 100644
total: 0 errors, 1 warnings, 839 lines checked
Patch 12/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
13/21 Checking commit 0c06063d0e11 (hw/char: RX62N serial communication interface (SCI))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #43:
new file mode 100644
total: 0 errors, 1 warnings, 398 lines checked
Patch 13/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
14/21 Checking commit d4fce4d13bb7 (hw/rx: RX Target hardware definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #21:
new file mode 100644
total: 0 errors, 1 warnings, 457 lines checked
Patch 14/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
15/21 Checking commit 0b80c9380d08 (hw/rx: Honor -accel qtest)
16/21 Checking commit ccbd0067c656 (hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core) 17/21 Checking commit 84492a1c42fa (qemu/bitops.h: Add extract8 and extract16)
18/21 Checking commit fe080a5d9792 (hw/registerfields.h: Add 8bit and 16bit register macros) Use of uninitialized value within @rawlines in concatenation (.) or string at ./scripts/checkpatch.pl line 2467.
ERROR: Macros with multiple statements should be enclosed in a do - while loop
#27: FILE: include/hw/registerfields.h:25:
+#define REG8(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) };
ERROR: Macros with multiple statements should be enclosed in a do - while loop #31: FILE: include/hw/registerfields.h:29:
+#define REG16(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) / 2 };
total: 2 errors, 0 warnings, 56 lines checked
Patch 18/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
19/21 Checking commit f1c1d8904541 (Add rx-softmmu)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #59:
new file mode 100644
total: 0 errors, 1 warnings, 73 lines checked
Patch 19/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
20/21 Checking commit 73390864df77 (MAINTAINERS: Add RX)
21/21 Checking commit e70c9a6cf719 (BootLinuxConsoleTest: Test the RX-Virt machine) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed build test on s390x host. Please find the details below.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with # HEAD pointing to a commit that has the patches applied on top of "base"
# branch set -e CC=$HOME/bin/cc INSTALL=$PWD/install BUILD=$PWD/build mkdir -p $BUILD $INSTALL SRC=$PWD cd $BUILD $SRC/configure --cc=$CC --prefix=$INSTALL make -j4 # XXX: we need reliable clean up # make check -j4 V=1 make install
echo
echo "=== ENV ==="
env
echo
echo "=== PACKAGES ==="
rpm -qa
=== TEST SCRIPT END ===
CC riscv32-softmmu/dump.o
In file included from /var/tmp/patchew-tester-tmp-qtsaqt50/src/target/rx/cpu.h:31,
from /var/tmp/patchew-tester-tmp-qtsaqt50/src/exec.c:23:
/var/tmp/patchew-tester-tmp-qtsaqt50/src/include/exec/cpu-defs.h:38:10: fatal error: cpu-param.h: No such file or directory
38 | #include "cpu-param.h"
| ^~~~~~~~~~~~~compilation terminated.
The full log is available at
http://patchew.org/logs/[email protected]/testing.s390x/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PATCH v19 00/21] Add RX archtecture support
Type: series
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'317f420e9c BootLinuxConsoleTest: Test the RX-Virt machine 46da289cdf MAINTAINERS: Add RX2704b207bd Add rx-softmmuc55f2b26ed hw/registerfields.h: Add 8bit and 16bit register macros 895d810896 qemu/bitops.h: Add extract8 and extract16 0c6f47d495 hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core 2bd3bfc71c hw/rx: Honor -accel qtest95cba7fab4 hw/rx: RX Target hardware definitionc3722db947 hw/char: RX62N serial communication interface (SCI) aac94a1b90 hw/timer: RX62N internal timer modules09c5203a18 hw/intc: RX62N interrupt controller (ICUa) 261816367b target/rx: Dump bytes for each insn during disassembly 65e6b8e8e1 target/rx: Collect all bytes during disassembly b85370af0c target/rx: Emit all disassembly in one prt() 317ee2b1e9 target/rx: Use prt_ldmi for XCHG_mr disassembly ade5bec5af target/rx: Replace operand with prt_ldmi in disassembler 55b02dec27 target/rx: Disassemble rx_index_addr into a string 3313d95145 target/rx: RX disassembler1574eeedc9 target/rx: CPU definitiond55b90871b target/rx: TCG helper9ac51ee4c5 target/rx: TCG translation
=== OUTPUT BEGIN ===
1/21 Checking commit 9ac51ee4c5a9 (target/rx: TCG translation)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #20:
new file mode 100644
total: 0 errors, 1 warnings, 3065 lines checked
Patch 1/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
2/21 Checking commit d55b90871bb6 (target/rx: TCG helper)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644
total: 0 errors, 1 warnings, 649 lines checked
Patch 2/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
3/21 Checking commit 1574eeedc93e (target/rx: CPU definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644
total: 0 errors, 1 warnings, 645 lines checked
Patch 3/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
4/21 Checking commit 3313d951455c (target/rx: RX disassembler)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #38:
new file mode 100644
total: 0 errors, 1 warnings, 1497 lines checked
Patch 4/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
5/21 Checking commit 55b02dec27cc (target/rx: Disassemble rx_index_addr into a string) 6/21 Checking commit ade5bec5af34 (target/rx: Replace operand with prt_ldmi in disassembler) 7/21 Checking commit 317ee2b1e9cb (target/rx: Use prt_ldmi for XCHG_mr disassembly) 8/21 Checking commit b85370af0cee (target/rx: Emit all disassembly in one prt()) 9/21 Checking commit 65e6b8e8e1ec (target/rx: Collect all bytes during disassembly) 10/21 Checking commit 261816367bd9 (target/rx: Dump bytes for each insn during disassembly) 11/21 Checking commit 09c5203a18fa (hw/intc: RX62N interrupt controller (ICUa))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #40:
new file mode 100644
total: 0 errors, 1 warnings, 442 lines checked
Patch 11/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
12/21 Checking commit aac94a1b90a8 (hw/timer: RX62N internal timer modules)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #50:
new file mode 100644
total: 0 errors, 1 warnings, 839 lines checked
Patch 12/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
13/21 Checking commit c3722db9470e (hw/char: RX62N serial communication interface (SCI))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #43:
new file mode 100644
total: 0 errors, 1 warnings, 398 lines checked
Patch 13/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
14/21 Checking commit 95cba7fab4c5 (hw/rx: RX Target hardware definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #21:
new file mode 100644
total: 0 errors, 1 warnings, 457 lines checked
Patch 14/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
15/21 Checking commit 2bd3bfc71cca (hw/rx: Honor -accel qtest)
16/21 Checking commit 0c6f47d495ab (hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core) 17/21 Checking commit 895d8108961c (qemu/bitops.h: Add extract8 and extract16)
18/21 Checking commit c55f2b26ed2d (hw/registerfields.h: Add 8bit and 16bit register macros) Use of uninitialized value within @rawlines in concatenation (.) or string at ./scripts/checkpatch.pl line 2467.
ERROR: Macros with multiple statements should be enclosed in a do - while loop
#27: FILE: include/hw/registerfields.h:25:
+#define REG8(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) };
ERROR: Macros with multiple statements should be enclosed in a do - while loop #31: FILE: include/hw/registerfields.h:29:
+#define REG16(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) / 2 };
total: 2 errors, 0 warnings, 56 lines checked
Patch 18/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
19/21 Checking commit 2704b207bda8 (Add rx-softmmu)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #59:
new file mode 100644
total: 0 errors, 1 warnings, 73 lines checked
Patch 19/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
20/21 Checking commit 46da289cdff8 (MAINTAINERS: Add RX)
21/21 Checking commit 317f420e9c3e (BootLinuxConsoleTest: Test the RX-Virt machine) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PATCH v19 00/21] Add RX archtecture support
Type: series
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
From https://github.com/patchew-project/qemu
t [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'58a573e6f3 BootLinuxConsoleTest: Test the RX-Virt machine 918428885e MAINTAINERS: Add RX89799721e3 Add rx-softmmuf7f4625475 hw/registerfields.h: Add 8bit and 16bit register macros 6daadfe34a qemu/bitops.h: Add extract8 and extract16 0487222cc3 hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core 8a072d9cbd hw/rx: Honor -accel qtest7436a614ae hw/rx: RX Target hardware definition3fe9feaaa1 hw/char: RX62N serial communication interface (SCI) e5fa50acc3 hw/timer: RX62N internal timer modules4d169ff249 hw/intc: RX62N interrupt controller (ICUa) 022078a0f7 target/rx: Dump bytes for each insn during disassembly 45adab31f7 target/rx: Collect all bytes during disassembly 9aff31efc4 target/rx: Emit all disassembly in one prt() 68d849ace3 target/rx: Use prt_ldmi for XCHG_mr disassembly 7e6d45f225 target/rx: Replace operand with prt_ldmi in disassembler 3967775d29 target/rx: Disassemble rx_index_addr into a string b679fbb1df target/rx: RX disassembler2573ca0cc1 target/rx: CPU definition64cf4c358f target/rx: TCG helper694178d9a4 target/rx: TCG translation
=== OUTPUT BEGIN ===
1/21 Checking commit 694178d9a413 (target/rx: TCG translation)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #20:
new file mode 100644
total: 0 errors, 1 warnings, 3065 lines checked
Patch 1/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
2/21 Checking commit 64cf4c358ff3 (target/rx: TCG helper)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644
total: 0 errors, 1 warnings, 649 lines checked
Patch 2/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
3/21 Checking commit 2573ca0cc1e9 (target/rx: CPU definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644
total: 0 errors, 1 warnings, 645 lines checked
Patch 3/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
4/21 Checking commit b679fbb1df50 (target/rx: RX disassembler)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #38:
new file mode 100644
total: 0 errors, 1 warnings, 1497 lines checked
Patch 4/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
5/21 Checking commit 3967775d2986 (target/rx: Disassemble rx_index_addr into a string) 6/21 Checking commit 7e6d45f225f8 (target/rx: Replace operand with prt_ldmi in disassembler) 7/21 Checking commit 68d849ace328 (target/rx: Use prt_ldmi for XCHG_mr disassembly) 8/21 Checking commit 9aff31efc4bc (target/rx: Emit all disassembly in one prt()) 9/21 Checking commit 45adab31f7e4 (target/rx: Collect all bytes during disassembly) 10/21 Checking commit 022078a0f706 (target/rx: Dump bytes for each insn during disassembly) 11/21 Checking commit 4d169ff2494a (hw/intc: RX62N interrupt controller (ICUa))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #40:
new file mode 100644
total: 0 errors, 1 warnings, 442 lines checked
Patch 11/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
12/21 Checking commit e5fa50acc396 (hw/timer: RX62N internal timer modules)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #50:
new file mode 100644
total: 0 errors, 1 warnings, 839 lines checked
Patch 12/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
13/21 Checking commit 3fe9feaaa1d1 (hw/char: RX62N serial communication interface (SCI))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #43:
new file mode 100644
total: 0 errors, 1 warnings, 398 lines checked
Patch 13/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
14/21 Checking commit 7436a614ae29 (hw/rx: RX Target hardware definition)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #21:
new file mode 100644
total: 0 errors, 1 warnings, 457 lines checked
Patch 14/21 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
15/21 Checking commit 8a072d9cbd6d (hw/rx: Honor -accel qtest)
16/21 Checking commit 0487222cc332 (hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core) 17/21 Checking commit 6daadfe34af6 (qemu/bitops.h: Add extract8 and extract16)
18/21 Checking commit f7f4625475a2 (hw/registerfields.h: Add 8bit and 16bit register macros) Use of uninitialized value within @rawlines in concatenation (.) or string at ./scripts/checkpatch.pl line 2467.
ERROR: Macros with multiple statements should be enclosed in a do - while loop
#27: FILE: include/hw/registerfields.h:25:
+#define REG8(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) };
ERROR: Macros with multiple statements should be enclosed in a do - while loop #31: FILE: include/hw/registerfields.h:29:
+#define REG16(reg, addr) \
+ enum { A_ ## reg = (addr) }; \
+ enum { R_ ## reg = (addr) / 2 };
total: 2 errors, 0 warnings, 56 lines checked
Patch 18/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
19/21 Checking commit 89799721e37a (Add rx-softmmu)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #59:
new file mode 100644
total: 0 errors, 1 warnings, 73 lines checked
Patch 19/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
20/21 Checking commit 918428885e8b (MAINTAINERS: Add RX)
21/21 Checking commit 58a573e6f38e (BootLinuxConsoleTest: Test the RX-Virt machine) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed build test on s390x host. Please find the details below.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with # HEAD pointing to a commit that has the patches applied on top of "base"
# branch set -e CC=$HOME/bin/cc INSTALL=$PWD/install BUILD=$PWD/build mkdir -p $BUILD $INSTALL SRC=$PWD cd $BUILD $SRC/configure --cc=$CC --prefix=$INSTALL make -j4 # XXX: we need reliable clean up # make check -j4 V=1 make install
echo
echo "=== ENV ==="
env
echo
echo "=== PACKAGES ==="
rpm -qa
=== TEST SCRIPT END ===
CC ppc64-softmmu/accel/tcg/tcg-runtime-gvec.o
In file included from /var/tmp/patchew-tester-tmp-l4v9bowf/src/target/rx/cpu.h:31,
from /var/tmp/patchew-tester-tmp-l4v9bowf/src/exec.c:23:
/var/tmp/patchew-tester-tmp-l4v9bowf/src/include/exec/cpu-defs.h:38:10: fatal error: cpu-param.h: No such file or directory
38 | #include "cpu-param.h"
| ^~~~~~~~~~~~~compilation terminated.
The full log is available at
http://patchew.org/logs/[email protected]/testing.s390x/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]