1 | Not very much here, but several people have fallen over | 1 | First arm pullreq of 4.2... |
---|---|---|---|
2 | the vector operation segfault bug, so let's get the fix | ||
3 | into master. | ||
4 | 2 | ||
5 | thanks | 3 | thanks |
6 | -- PMM | 4 | -- PMM |
7 | 5 | ||
8 | The following changes since commit d418238dca7b4e0b124135827ead3076233052b1: | 6 | The following changes since commit 27608c7c66bd923eb5e5faab80e795408cbe2b51: |
9 | 7 | ||
10 | Merge remote-tracking branch 'remotes/rth/tags/pull-rng-20190522' into staging (2019-05-23 12:57:17 +0100) | 8 | Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20190814a' into staging (2019-08-16 12:00:18 +0100) |
11 | 9 | ||
12 | are available in the Git repository at: | 10 | are available in the Git repository at: |
13 | 11 | ||
14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190523 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190816 |
15 | 13 | ||
16 | for you to fetch changes up to 98e4f4fdb8ea05d840f51f47125924c2bb9df2df: | 14 | for you to fetch changes up to 664b7e3b97d6376f3329986c465b3782458b0f8b: |
17 | 15 | ||
18 | hw/arm/exynos4210: QOM'ify the Exynos4210 SoC (2019-05-23 14:47:44 +0100) | 16 | target/arm: Use tcg_gen_extrh_i64_i32 to extract the high word (2019-08-16 14:02:53 +0100) |
19 | 17 | ||
20 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
21 | target-arm queue: | 19 | target-arm queue: |
22 | * exynos4210: QOM'ify the Exynos4210 SoC | 20 | * target/arm: generate a custom MIDR for -cpu max |
23 | * exynos4210: Add DMA support for the Exynos4210 | 21 | * hw/misc/zynq_slcr: refactor to use standard register definition |
24 | * arm_gicv3: Fix writes to ICC_CTLR_EL3 | 22 | * Set ENET_BD_BDU in I.MX FEC controller |
25 | * arm_gicv3: Fix write of ICH_VMCR_EL2.{VBPR0, VBPR1} | 23 | * target/arm: Fix routing of singlestep exceptions |
26 | * target/arm: Fix vector operation segfault | 24 | * refactor a32/t32 decoder handling of PC |
27 | * target/arm: Minor improvements to BFXIL, EXTR | 25 | * minor optimisations/cleanups of some a32/t32 codegen |
26 | * target/arm/cpu64: Ensure kvm really supports aarch64=off | ||
27 | * target/arm/cpu: Ensure we can use the pmu with kvm | ||
28 | * target/arm: Minor cleanups preparatory to KVM SVE support | ||
28 | 29 | ||
29 | ---------------------------------------------------------------- | 30 | ---------------------------------------------------------------- |
30 | Alistair Francis (1): | 31 | Aaron Hill (1): |
31 | target/arm: Fix vector operation segfault | 32 | Set ENET_BD_BDU in I.MX FEC controller |
32 | 33 | ||
33 | Guenter Roeck (1): | 34 | Alex Bennée (1): |
34 | hw/arm/exynos4210: Add DMA support for the Exynos4210 | 35 | target/arm: generate a custom MIDR for -cpu max |
35 | 36 | ||
36 | Peter Maydell (5): | 37 | Andrew Jones (6): |
37 | arm: Move system_clock_scale to armv7m_systick.h | 38 | target/arm/cpu64: Ensure kvm really supports aarch64=off |
38 | arm: Remove unnecessary includes of hw/arm/arm.h | 39 | target/arm/cpu: Ensure we can use the pmu with kvm |
39 | arm: Rename hw/arm/arm.h to hw/arm/boot.h | 40 | target/arm/helper: zcr: Add build bug next to value range assumption |
40 | hw/intc/arm_gicv3: Fix write of ICH_VMCR_EL2.{VBPR0, VBPR1} | 41 | target/arm/cpu: Use div-round-up to determine predicate register array size |
41 | hw/intc/arm_gicv3: Fix writes to ICC_CTLR_EL3 | 42 | target/arm/kvm64: Fix error returns |
43 | target/arm/kvm64: Move the get/put of fpsimd registers out | ||
42 | 44 | ||
43 | Philippe Mathieu-Daudé (3): | 45 | Damien Hedde (1): |
44 | hw/arm/exynos4: Remove unuseful debug code | 46 | hw/misc/zynq_slcr: use standard register definition |
45 | hw/arm/exynos4: Use the IEC binary prefix definitions | ||
46 | hw/arm/exynos4210: QOM'ify the Exynos4210 SoC | ||
47 | 47 | ||
48 | Richard Henderson (2): | 48 | Peter Maydell (2): |
49 | target/arm: Use extract2 for EXTR | 49 | target/arm: Factor out 'generate singlestep exception' function |
50 | target/arm: Simplify BFXIL expansion | 50 | target/arm: Fix routing of singlestep exceptions |
51 | 51 | ||
52 | include/hw/arm/allwinner-a10.h | 2 +- | 52 | Richard Henderson (18): |
53 | include/hw/arm/aspeed_soc.h | 1 - | 53 | target/arm: Pass in pc to thumb_insn_is_16bit |
54 | include/hw/arm/bcm2836.h | 1 - | 54 | target/arm: Introduce pc_curr |
55 | include/hw/arm/{arm.h => boot.h} | 12 +++------ | 55 | target/arm: Introduce read_pc |
56 | include/hw/arm/exynos4210.h | 9 +++++-- | 56 | target/arm: Introduce add_reg_for_lit |
57 | include/hw/arm/fsl-imx25.h | 2 +- | 57 | target/arm: Remove redundant s->pc & ~1 |
58 | include/hw/arm/fsl-imx31.h | 2 +- | 58 | target/arm: Replace s->pc with s->base.pc_next |
59 | include/hw/arm/fsl-imx6.h | 2 +- | 59 | target/arm: Replace offset with pc in gen_exception_insn |
60 | include/hw/arm/fsl-imx6ul.h | 2 +- | 60 | target/arm: Replace offset with pc in gen_exception_internal_insn |
61 | include/hw/arm/fsl-imx7.h | 2 +- | 61 | target/arm: Remove offset argument to gen_exception_bkpt_insn |
62 | include/hw/arm/virt.h | 2 +- | 62 | target/arm: Use unallocated_encoding for aarch32 |
63 | include/hw/arm/xlnx-versal.h | 2 +- | 63 | target/arm: Remove helper_double_saturate |
64 | include/hw/arm/xlnx-zynqmp.h | 2 +- | 64 | target/arm: Use tcg_gen_extract_i32 for shifter_out_im |
65 | include/hw/timer/armv7m_systick.h | 22 ++++++++++++++++ | 65 | target/arm: Use tcg_gen_deposit_i32 for PKHBT, PKHTB |
66 | hw/arm/armsse.c | 2 +- | 66 | target/arm: Remove redundant shift tests |
67 | hw/arm/armv7m.c | 2 +- | 67 | target/arm: Use ror32 instead of open-coding the operation |
68 | hw/arm/aspeed.c | 2 +- | 68 | target/arm: Use tcg_gen_rotri_i32 for gen_swap_half |
69 | hw/arm/boot.c | 2 +- | 69 | target/arm: Simplify SMMLA, SMMLAR, SMMLS, SMMLSR |
70 | hw/arm/collie.c | 2 +- | 70 | target/arm: Use tcg_gen_extrh_i64_i32 to extract the high word |
71 | hw/arm/exynos4210.c | 54 ++++++++++++++++++++++++++++++++++++--- | ||
72 | hw/arm/exynos4_boards.c | 40 ++++++++--------------------- | ||
73 | hw/arm/highbank.c | 2 +- | ||
74 | hw/arm/integratorcp.c | 2 +- | ||
75 | hw/arm/mainstone.c | 2 +- | ||
76 | hw/arm/microbit.c | 2 +- | ||
77 | hw/arm/mps2-tz.c | 2 +- | ||
78 | hw/arm/mps2.c | 2 +- | ||
79 | hw/arm/msf2-soc.c | 1 - | ||
80 | hw/arm/msf2-som.c | 2 +- | ||
81 | hw/arm/musca.c | 2 +- | ||
82 | hw/arm/musicpal.c | 2 +- | ||
83 | hw/arm/netduino2.c | 2 +- | ||
84 | hw/arm/nrf51_soc.c | 2 +- | ||
85 | hw/arm/nseries.c | 2 +- | ||
86 | hw/arm/omap1.c | 2 +- | ||
87 | hw/arm/omap2.c | 2 +- | ||
88 | hw/arm/omap_sx1.c | 2 +- | ||
89 | hw/arm/palm.c | 2 +- | ||
90 | hw/arm/raspi.c | 2 +- | ||
91 | hw/arm/realview.c | 2 +- | ||
92 | hw/arm/spitz.c | 2 +- | ||
93 | hw/arm/stellaris.c | 2 +- | ||
94 | hw/arm/stm32f205_soc.c | 2 +- | ||
95 | hw/arm/strongarm.c | 2 +- | ||
96 | hw/arm/tosa.c | 2 +- | ||
97 | hw/arm/versatilepb.c | 2 +- | ||
98 | hw/arm/vexpress.c | 2 +- | ||
99 | hw/arm/virt.c | 2 +- | ||
100 | hw/arm/xilinx_zynq.c | 2 +- | ||
101 | hw/arm/xlnx-versal.c | 2 +- | ||
102 | hw/arm/z2.c | 2 +- | ||
103 | hw/intc/arm_gicv3_cpuif.c | 6 ++--- | ||
104 | hw/intc/armv7m_nvic.c | 1 - | ||
105 | target/arm/arm-semi.c | 1 - | ||
106 | target/arm/cpu.c | 1 - | ||
107 | target/arm/cpu64.c | 1 - | ||
108 | target/arm/kvm.c | 1 - | ||
109 | target/arm/kvm32.c | 1 - | ||
110 | target/arm/kvm64.c | 1 - | ||
111 | target/arm/translate-a64.c | 44 ++++++++++++++++--------------- | ||
112 | target/arm/translate.c | 4 +-- | ||
113 | 61 files changed, 164 insertions(+), 123 deletions(-) | ||
114 | rename include/hw/arm/{arm.h => boot.h} (96%) | ||
115 | 71 | ||
72 | target/arm/cpu.h | 13 +- | ||
73 | target/arm/helper.h | 1 - | ||
74 | target/arm/kvm_arm.h | 28 ++ | ||
75 | target/arm/translate-a64.h | 4 +- | ||
76 | target/arm/translate.h | 39 ++- | ||
77 | hw/misc/zynq_slcr.c | 450 ++++++++++++++++---------------- | ||
78 | hw/net/imx_fec.c | 4 + | ||
79 | target/arm/cpu.c | 30 ++- | ||
80 | target/arm/cpu64.c | 31 ++- | ||
81 | target/arm/helper.c | 7 + | ||
82 | target/arm/kvm.c | 7 + | ||
83 | target/arm/kvm64.c | 161 +++++++----- | ||
84 | target/arm/op_helper.c | 15 -- | ||
85 | target/arm/translate-a64.c | 130 ++++------ | ||
86 | target/arm/translate-vfp.inc.c | 45 +--- | ||
87 | target/arm/translate.c | 572 +++++++++++++++++------------------------ | ||
88 | 16 files changed, 771 insertions(+), 766 deletions(-) | ||
89 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Alex Bennée <alex.bennee@linaro.org> | ||
1 | 2 | ||
3 | While most features are now detected by probing the ID_* registers | ||
4 | kernels can (and do) use MIDR_EL1 for working out of they have to | ||
5 | apply errata. This can trip up warnings in the kernel as it tries to | ||
6 | work out if it should apply workarounds to features that don't | ||
7 | actually exist in the reported CPU type. | ||
8 | |||
9 | Avoid this problem by synthesising our own MIDR value. | ||
10 | |||
11 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20190726113950.7499-1-alex.bennee@linaro.org | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | --- | ||
17 | target/arm/cpu.h | 6 ++++++ | ||
18 | target/arm/cpu64.c | 19 +++++++++++++++++++ | ||
19 | 2 files changed, 25 insertions(+) | ||
20 | |||
21 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/target/arm/cpu.h | ||
24 | +++ b/target/arm/cpu.h | ||
25 | @@ -XXX,XX +XXX,XX @@ FIELD(V7M_FPCCR, ASPEN, 31, 1) | ||
26 | /* | ||
27 | * System register ID fields. | ||
28 | */ | ||
29 | +FIELD(MIDR_EL1, REVISION, 0, 4) | ||
30 | +FIELD(MIDR_EL1, PARTNUM, 4, 12) | ||
31 | +FIELD(MIDR_EL1, ARCHITECTURE, 16, 4) | ||
32 | +FIELD(MIDR_EL1, VARIANT, 20, 4) | ||
33 | +FIELD(MIDR_EL1, IMPLEMENTER, 24, 8) | ||
34 | + | ||
35 | FIELD(ID_ISAR0, SWAP, 0, 4) | ||
36 | FIELD(ID_ISAR0, BITCOUNT, 4, 4) | ||
37 | FIELD(ID_ISAR0, BITFIELD, 8, 4) | ||
38 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/cpu64.c | ||
41 | +++ b/target/arm/cpu64.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
43 | uint32_t u; | ||
44 | aarch64_a57_initfn(obj); | ||
45 | |||
46 | + /* | ||
47 | + * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real | ||
48 | + * one and try to apply errata workarounds or use impdef features we | ||
49 | + * don't provide. | ||
50 | + * An IMPLEMENTER field of 0 means "reserved for software use"; | ||
51 | + * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers | ||
52 | + * to see which features are present"; | ||
53 | + * the VARIANT, PARTNUM and REVISION fields are all implementation | ||
54 | + * defined and we choose to define PARTNUM just in case guest | ||
55 | + * code needs to distinguish this QEMU CPU from other software | ||
56 | + * implementations, though this shouldn't be needed. | ||
57 | + */ | ||
58 | + t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0); | ||
59 | + t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf); | ||
60 | + t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q'); | ||
61 | + t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0); | ||
62 | + t = FIELD_DP64(t, MIDR_EL1, REVISION, 0); | ||
63 | + cpu->midr = t; | ||
64 | + | ||
65 | t = cpu->isar.id_aa64isar0; | ||
66 | t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */ | ||
67 | t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); | ||
68 | -- | ||
69 | 2.20.1 | ||
70 | |||
71 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Damien Hedde <damien.hedde@greensocs.com> | ||
1 | 2 | ||
3 | Replace the zynq_slcr registers enum and macros using the | ||
4 | hw/registerfields.h macros. | ||
5 | |||
6 | Signed-off-by: Damien Hedde <damien.hedde@greensocs.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-id: 20190729145654.14644-30-damien.hedde@greensocs.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/misc/zynq_slcr.c | 450 ++++++++++++++++++++++---------------------- | ||
13 | 1 file changed, 225 insertions(+), 225 deletions(-) | ||
14 | |||
15 | diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/misc/zynq_slcr.c | ||
18 | +++ b/hw/misc/zynq_slcr.c | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | #include "sysemu/sysemu.h" | ||
21 | #include "qemu/log.h" | ||
22 | #include "qemu/module.h" | ||
23 | +#include "hw/registerfields.h" | ||
24 | |||
25 | #ifndef ZYNQ_SLCR_ERR_DEBUG | ||
26 | #define ZYNQ_SLCR_ERR_DEBUG 0 | ||
27 | @@ -XXX,XX +XXX,XX @@ | ||
28 | #define XILINX_LOCK_KEY 0x767b | ||
29 | #define XILINX_UNLOCK_KEY 0xdf0d | ||
30 | |||
31 | -#define R_PSS_RST_CTRL_SOFT_RST 0x1 | ||
32 | +REG32(SCL, 0x000) | ||
33 | +REG32(LOCK, 0x004) | ||
34 | +REG32(UNLOCK, 0x008) | ||
35 | +REG32(LOCKSTA, 0x00c) | ||
36 | |||
37 | -enum { | ||
38 | - SCL = 0x000 / 4, | ||
39 | - LOCK, | ||
40 | - UNLOCK, | ||
41 | - LOCKSTA, | ||
42 | +REG32(ARM_PLL_CTRL, 0x100) | ||
43 | +REG32(DDR_PLL_CTRL, 0x104) | ||
44 | +REG32(IO_PLL_CTRL, 0x108) | ||
45 | +REG32(PLL_STATUS, 0x10c) | ||
46 | +REG32(ARM_PLL_CFG, 0x110) | ||
47 | +REG32(DDR_PLL_CFG, 0x114) | ||
48 | +REG32(IO_PLL_CFG, 0x118) | ||
49 | |||
50 | - ARM_PLL_CTRL = 0x100 / 4, | ||
51 | - DDR_PLL_CTRL, | ||
52 | - IO_PLL_CTRL, | ||
53 | - PLL_STATUS, | ||
54 | - ARM_PLL_CFG, | ||
55 | - DDR_PLL_CFG, | ||
56 | - IO_PLL_CFG, | ||
57 | - | ||
58 | - ARM_CLK_CTRL = 0x120 / 4, | ||
59 | - DDR_CLK_CTRL, | ||
60 | - DCI_CLK_CTRL, | ||
61 | - APER_CLK_CTRL, | ||
62 | - USB0_CLK_CTRL, | ||
63 | - USB1_CLK_CTRL, | ||
64 | - GEM0_RCLK_CTRL, | ||
65 | - GEM1_RCLK_CTRL, | ||
66 | - GEM0_CLK_CTRL, | ||
67 | - GEM1_CLK_CTRL, | ||
68 | - SMC_CLK_CTRL, | ||
69 | - LQSPI_CLK_CTRL, | ||
70 | - SDIO_CLK_CTRL, | ||
71 | - UART_CLK_CTRL, | ||
72 | - SPI_CLK_CTRL, | ||
73 | - CAN_CLK_CTRL, | ||
74 | - CAN_MIOCLK_CTRL, | ||
75 | - DBG_CLK_CTRL, | ||
76 | - PCAP_CLK_CTRL, | ||
77 | - TOPSW_CLK_CTRL, | ||
78 | +REG32(ARM_CLK_CTRL, 0x120) | ||
79 | +REG32(DDR_CLK_CTRL, 0x124) | ||
80 | +REG32(DCI_CLK_CTRL, 0x128) | ||
81 | +REG32(APER_CLK_CTRL, 0x12c) | ||
82 | +REG32(USB0_CLK_CTRL, 0x130) | ||
83 | +REG32(USB1_CLK_CTRL, 0x134) | ||
84 | +REG32(GEM0_RCLK_CTRL, 0x138) | ||
85 | +REG32(GEM1_RCLK_CTRL, 0x13c) | ||
86 | +REG32(GEM0_CLK_CTRL, 0x140) | ||
87 | +REG32(GEM1_CLK_CTRL, 0x144) | ||
88 | +REG32(SMC_CLK_CTRL, 0x148) | ||
89 | +REG32(LQSPI_CLK_CTRL, 0x14c) | ||
90 | +REG32(SDIO_CLK_CTRL, 0x150) | ||
91 | +REG32(UART_CLK_CTRL, 0x154) | ||
92 | +REG32(SPI_CLK_CTRL, 0x158) | ||
93 | +REG32(CAN_CLK_CTRL, 0x15c) | ||
94 | +REG32(CAN_MIOCLK_CTRL, 0x160) | ||
95 | +REG32(DBG_CLK_CTRL, 0x164) | ||
96 | +REG32(PCAP_CLK_CTRL, 0x168) | ||
97 | +REG32(TOPSW_CLK_CTRL, 0x16c) | ||
98 | |||
99 | #define FPGA_CTRL_REGS(n, start) \ | ||
100 | - FPGA ## n ## _CLK_CTRL = (start) / 4, \ | ||
101 | - FPGA ## n ## _THR_CTRL, \ | ||
102 | - FPGA ## n ## _THR_CNT, \ | ||
103 | - FPGA ## n ## _THR_STA, | ||
104 | - FPGA_CTRL_REGS(0, 0x170) | ||
105 | - FPGA_CTRL_REGS(1, 0x180) | ||
106 | - FPGA_CTRL_REGS(2, 0x190) | ||
107 | - FPGA_CTRL_REGS(3, 0x1a0) | ||
108 | + REG32(FPGA ## n ## _CLK_CTRL, (start)) \ | ||
109 | + REG32(FPGA ## n ## _THR_CTRL, (start) + 0x4)\ | ||
110 | + REG32(FPGA ## n ## _THR_CNT, (start) + 0x8)\ | ||
111 | + REG32(FPGA ## n ## _THR_STA, (start) + 0xc) | ||
112 | +FPGA_CTRL_REGS(0, 0x170) | ||
113 | +FPGA_CTRL_REGS(1, 0x180) | ||
114 | +FPGA_CTRL_REGS(2, 0x190) | ||
115 | +FPGA_CTRL_REGS(3, 0x1a0) | ||
116 | |||
117 | - BANDGAP_TRIP = 0x1b8 / 4, | ||
118 | - PLL_PREDIVISOR = 0x1c0 / 4, | ||
119 | - CLK_621_TRUE, | ||
120 | +REG32(BANDGAP_TRIP, 0x1b8) | ||
121 | +REG32(PLL_PREDIVISOR, 0x1c0) | ||
122 | +REG32(CLK_621_TRUE, 0x1c4) | ||
123 | |||
124 | - PSS_RST_CTRL = 0x200 / 4, | ||
125 | - DDR_RST_CTRL, | ||
126 | - TOPSW_RESET_CTRL, | ||
127 | - DMAC_RST_CTRL, | ||
128 | - USB_RST_CTRL, | ||
129 | - GEM_RST_CTRL, | ||
130 | - SDIO_RST_CTRL, | ||
131 | - SPI_RST_CTRL, | ||
132 | - CAN_RST_CTRL, | ||
133 | - I2C_RST_CTRL, | ||
134 | - UART_RST_CTRL, | ||
135 | - GPIO_RST_CTRL, | ||
136 | - LQSPI_RST_CTRL, | ||
137 | - SMC_RST_CTRL, | ||
138 | - OCM_RST_CTRL, | ||
139 | - FPGA_RST_CTRL = 0x240 / 4, | ||
140 | - A9_CPU_RST_CTRL, | ||
141 | +REG32(PSS_RST_CTRL, 0x200) | ||
142 | + FIELD(PSS_RST_CTRL, SOFT_RST, 0, 1) | ||
143 | +REG32(DDR_RST_CTRL, 0x204) | ||
144 | +REG32(TOPSW_RESET_CTRL, 0x208) | ||
145 | +REG32(DMAC_RST_CTRL, 0x20c) | ||
146 | +REG32(USB_RST_CTRL, 0x210) | ||
147 | +REG32(GEM_RST_CTRL, 0x214) | ||
148 | +REG32(SDIO_RST_CTRL, 0x218) | ||
149 | +REG32(SPI_RST_CTRL, 0x21c) | ||
150 | +REG32(CAN_RST_CTRL, 0x220) | ||
151 | +REG32(I2C_RST_CTRL, 0x224) | ||
152 | +REG32(UART_RST_CTRL, 0x228) | ||
153 | +REG32(GPIO_RST_CTRL, 0x22c) | ||
154 | +REG32(LQSPI_RST_CTRL, 0x230) | ||
155 | +REG32(SMC_RST_CTRL, 0x234) | ||
156 | +REG32(OCM_RST_CTRL, 0x238) | ||
157 | +REG32(FPGA_RST_CTRL, 0x240) | ||
158 | +REG32(A9_CPU_RST_CTRL, 0x244) | ||
159 | |||
160 | - RS_AWDT_CTRL = 0x24c / 4, | ||
161 | - RST_REASON, | ||
162 | +REG32(RS_AWDT_CTRL, 0x24c) | ||
163 | +REG32(RST_REASON, 0x250) | ||
164 | |||
165 | - REBOOT_STATUS = 0x258 / 4, | ||
166 | - BOOT_MODE, | ||
167 | +REG32(REBOOT_STATUS, 0x258) | ||
168 | +REG32(BOOT_MODE, 0x25c) | ||
169 | |||
170 | - APU_CTRL = 0x300 / 4, | ||
171 | - WDT_CLK_SEL, | ||
172 | +REG32(APU_CTRL, 0x300) | ||
173 | +REG32(WDT_CLK_SEL, 0x304) | ||
174 | |||
175 | - TZ_DMA_NS = 0x440 / 4, | ||
176 | - TZ_DMA_IRQ_NS, | ||
177 | - TZ_DMA_PERIPH_NS, | ||
178 | +REG32(TZ_DMA_NS, 0x440) | ||
179 | +REG32(TZ_DMA_IRQ_NS, 0x444) | ||
180 | +REG32(TZ_DMA_PERIPH_NS, 0x448) | ||
181 | |||
182 | - PSS_IDCODE = 0x530 / 4, | ||
183 | +REG32(PSS_IDCODE, 0x530) | ||
184 | |||
185 | - DDR_URGENT = 0x600 / 4, | ||
186 | - DDR_CAL_START = 0x60c / 4, | ||
187 | - DDR_REF_START = 0x614 / 4, | ||
188 | - DDR_CMD_STA, | ||
189 | - DDR_URGENT_SEL, | ||
190 | - DDR_DFI_STATUS, | ||
191 | +REG32(DDR_URGENT, 0x600) | ||
192 | +REG32(DDR_CAL_START, 0x60c) | ||
193 | +REG32(DDR_REF_START, 0x614) | ||
194 | +REG32(DDR_CMD_STA, 0x618) | ||
195 | +REG32(DDR_URGENT_SEL, 0x61c) | ||
196 | +REG32(DDR_DFI_STATUS, 0x620) | ||
197 | |||
198 | - MIO = 0x700 / 4, | ||
199 | +REG32(MIO, 0x700) | ||
200 | #define MIO_LENGTH 54 | ||
201 | |||
202 | - MIO_LOOPBACK = 0x804 / 4, | ||
203 | - MIO_MST_TRI0, | ||
204 | - MIO_MST_TRI1, | ||
205 | +REG32(MIO_LOOPBACK, 0x804) | ||
206 | +REG32(MIO_MST_TRI0, 0x808) | ||
207 | +REG32(MIO_MST_TRI1, 0x80c) | ||
208 | |||
209 | - SD0_WP_CD_SEL = 0x830 / 4, | ||
210 | - SD1_WP_CD_SEL, | ||
211 | +REG32(SD0_WP_CD_SEL, 0x830) | ||
212 | +REG32(SD1_WP_CD_SEL, 0x834) | ||
213 | |||
214 | - LVL_SHFTR_EN = 0x900 / 4, | ||
215 | - OCM_CFG = 0x910 / 4, | ||
216 | +REG32(LVL_SHFTR_EN, 0x900) | ||
217 | +REG32(OCM_CFG, 0x910) | ||
218 | |||
219 | - CPU_RAM = 0xa00 / 4, | ||
220 | +REG32(CPU_RAM, 0xa00) | ||
221 | |||
222 | - IOU = 0xa30 / 4, | ||
223 | +REG32(IOU, 0xa30) | ||
224 | |||
225 | - DMAC_RAM = 0xa50 / 4, | ||
226 | +REG32(DMAC_RAM, 0xa50) | ||
227 | |||
228 | - AFI0 = 0xa60 / 4, | ||
229 | - AFI1 = AFI0 + 3, | ||
230 | - AFI2 = AFI1 + 3, | ||
231 | - AFI3 = AFI2 + 3, | ||
232 | +REG32(AFI0, 0xa60) | ||
233 | +REG32(AFI1, 0xa6c) | ||
234 | +REG32(AFI2, 0xa78) | ||
235 | +REG32(AFI3, 0xa84) | ||
236 | #define AFI_LENGTH 3 | ||
237 | |||
238 | - OCM = 0xa90 / 4, | ||
239 | +REG32(OCM, 0xa90) | ||
240 | |||
241 | - DEVCI_RAM = 0xaa0 / 4, | ||
242 | +REG32(DEVCI_RAM, 0xaa0) | ||
243 | |||
244 | - CSG_RAM = 0xab0 / 4, | ||
245 | +REG32(CSG_RAM, 0xab0) | ||
246 | |||
247 | - GPIOB_CTRL = 0xb00 / 4, | ||
248 | - GPIOB_CFG_CMOS18, | ||
249 | - GPIOB_CFG_CMOS25, | ||
250 | - GPIOB_CFG_CMOS33, | ||
251 | - GPIOB_CFG_HSTL = 0xb14 / 4, | ||
252 | - GPIOB_DRVR_BIAS_CTRL, | ||
253 | +REG32(GPIOB_CTRL, 0xb00) | ||
254 | +REG32(GPIOB_CFG_CMOS18, 0xb04) | ||
255 | +REG32(GPIOB_CFG_CMOS25, 0xb08) | ||
256 | +REG32(GPIOB_CFG_CMOS33, 0xb0c) | ||
257 | +REG32(GPIOB_CFG_HSTL, 0xb14) | ||
258 | +REG32(GPIOB_DRVR_BIAS_CTRL, 0xb18) | ||
259 | |||
260 | - DDRIOB = 0xb40 / 4, | ||
261 | +REG32(DDRIOB, 0xb40) | ||
262 | #define DDRIOB_LENGTH 14 | ||
263 | -}; | ||
264 | |||
265 | #define ZYNQ_SLCR_MMIO_SIZE 0x1000 | ||
266 | #define ZYNQ_SLCR_NUM_REGS (ZYNQ_SLCR_MMIO_SIZE / 4) | ||
267 | @@ -XXX,XX +XXX,XX @@ static void zynq_slcr_reset(DeviceState *d) | ||
268 | |||
269 | DB_PRINT("RESET\n"); | ||
270 | |||
271 | - s->regs[LOCKSTA] = 1; | ||
272 | + s->regs[R_LOCKSTA] = 1; | ||
273 | /* 0x100 - 0x11C */ | ||
274 | - s->regs[ARM_PLL_CTRL] = 0x0001A008; | ||
275 | - s->regs[DDR_PLL_CTRL] = 0x0001A008; | ||
276 | - s->regs[IO_PLL_CTRL] = 0x0001A008; | ||
277 | - s->regs[PLL_STATUS] = 0x0000003F; | ||
278 | - s->regs[ARM_PLL_CFG] = 0x00014000; | ||
279 | - s->regs[DDR_PLL_CFG] = 0x00014000; | ||
280 | - s->regs[IO_PLL_CFG] = 0x00014000; | ||
281 | + s->regs[R_ARM_PLL_CTRL] = 0x0001A008; | ||
282 | + s->regs[R_DDR_PLL_CTRL] = 0x0001A008; | ||
283 | + s->regs[R_IO_PLL_CTRL] = 0x0001A008; | ||
284 | + s->regs[R_PLL_STATUS] = 0x0000003F; | ||
285 | + s->regs[R_ARM_PLL_CFG] = 0x00014000; | ||
286 | + s->regs[R_DDR_PLL_CFG] = 0x00014000; | ||
287 | + s->regs[R_IO_PLL_CFG] = 0x00014000; | ||
288 | |||
289 | /* 0x120 - 0x16C */ | ||
290 | - s->regs[ARM_CLK_CTRL] = 0x1F000400; | ||
291 | - s->regs[DDR_CLK_CTRL] = 0x18400003; | ||
292 | - s->regs[DCI_CLK_CTRL] = 0x01E03201; | ||
293 | - s->regs[APER_CLK_CTRL] = 0x01FFCCCD; | ||
294 | - s->regs[USB0_CLK_CTRL] = s->regs[USB1_CLK_CTRL] = 0x00101941; | ||
295 | - s->regs[GEM0_RCLK_CTRL] = s->regs[GEM1_RCLK_CTRL] = 0x00000001; | ||
296 | - s->regs[GEM0_CLK_CTRL] = s->regs[GEM1_CLK_CTRL] = 0x00003C01; | ||
297 | - s->regs[SMC_CLK_CTRL] = 0x00003C01; | ||
298 | - s->regs[LQSPI_CLK_CTRL] = 0x00002821; | ||
299 | - s->regs[SDIO_CLK_CTRL] = 0x00001E03; | ||
300 | - s->regs[UART_CLK_CTRL] = 0x00003F03; | ||
301 | - s->regs[SPI_CLK_CTRL] = 0x00003F03; | ||
302 | - s->regs[CAN_CLK_CTRL] = 0x00501903; | ||
303 | - s->regs[DBG_CLK_CTRL] = 0x00000F03; | ||
304 | - s->regs[PCAP_CLK_CTRL] = 0x00000F01; | ||
305 | + s->regs[R_ARM_CLK_CTRL] = 0x1F000400; | ||
306 | + s->regs[R_DDR_CLK_CTRL] = 0x18400003; | ||
307 | + s->regs[R_DCI_CLK_CTRL] = 0x01E03201; | ||
308 | + s->regs[R_APER_CLK_CTRL] = 0x01FFCCCD; | ||
309 | + s->regs[R_USB0_CLK_CTRL] = s->regs[R_USB1_CLK_CTRL] = 0x00101941; | ||
310 | + s->regs[R_GEM0_RCLK_CTRL] = s->regs[R_GEM1_RCLK_CTRL] = 0x00000001; | ||
311 | + s->regs[R_GEM0_CLK_CTRL] = s->regs[R_GEM1_CLK_CTRL] = 0x00003C01; | ||
312 | + s->regs[R_SMC_CLK_CTRL] = 0x00003C01; | ||
313 | + s->regs[R_LQSPI_CLK_CTRL] = 0x00002821; | ||
314 | + s->regs[R_SDIO_CLK_CTRL] = 0x00001E03; | ||
315 | + s->regs[R_UART_CLK_CTRL] = 0x00003F03; | ||
316 | + s->regs[R_SPI_CLK_CTRL] = 0x00003F03; | ||
317 | + s->regs[R_CAN_CLK_CTRL] = 0x00501903; | ||
318 | + s->regs[R_DBG_CLK_CTRL] = 0x00000F03; | ||
319 | + s->regs[R_PCAP_CLK_CTRL] = 0x00000F01; | ||
320 | |||
321 | /* 0x170 - 0x1AC */ | ||
322 | - s->regs[FPGA0_CLK_CTRL] = s->regs[FPGA1_CLK_CTRL] = s->regs[FPGA2_CLK_CTRL] | ||
323 | - = s->regs[FPGA3_CLK_CTRL] = 0x00101800; | ||
324 | - s->regs[FPGA0_THR_STA] = s->regs[FPGA1_THR_STA] = s->regs[FPGA2_THR_STA] | ||
325 | - = s->regs[FPGA3_THR_STA] = 0x00010000; | ||
326 | + s->regs[R_FPGA0_CLK_CTRL] = s->regs[R_FPGA1_CLK_CTRL] | ||
327 | + = s->regs[R_FPGA2_CLK_CTRL] | ||
328 | + = s->regs[R_FPGA3_CLK_CTRL] = 0x00101800; | ||
329 | + s->regs[R_FPGA0_THR_STA] = s->regs[R_FPGA1_THR_STA] | ||
330 | + = s->regs[R_FPGA2_THR_STA] | ||
331 | + = s->regs[R_FPGA3_THR_STA] = 0x00010000; | ||
332 | |||
333 | /* 0x1B0 - 0x1D8 */ | ||
334 | - s->regs[BANDGAP_TRIP] = 0x0000001F; | ||
335 | - s->regs[PLL_PREDIVISOR] = 0x00000001; | ||
336 | - s->regs[CLK_621_TRUE] = 0x00000001; | ||
337 | + s->regs[R_BANDGAP_TRIP] = 0x0000001F; | ||
338 | + s->regs[R_PLL_PREDIVISOR] = 0x00000001; | ||
339 | + s->regs[R_CLK_621_TRUE] = 0x00000001; | ||
340 | |||
341 | /* 0x200 - 0x25C */ | ||
342 | - s->regs[FPGA_RST_CTRL] = 0x01F33F0F; | ||
343 | - s->regs[RST_REASON] = 0x00000040; | ||
344 | + s->regs[R_FPGA_RST_CTRL] = 0x01F33F0F; | ||
345 | + s->regs[R_RST_REASON] = 0x00000040; | ||
346 | |||
347 | - s->regs[BOOT_MODE] = 0x00000001; | ||
348 | + s->regs[R_BOOT_MODE] = 0x00000001; | ||
349 | |||
350 | /* 0x700 - 0x7D4 */ | ||
351 | for (i = 0; i < 54; i++) { | ||
352 | - s->regs[MIO + i] = 0x00001601; | ||
353 | + s->regs[R_MIO + i] = 0x00001601; | ||
354 | } | ||
355 | for (i = 2; i <= 8; i++) { | ||
356 | - s->regs[MIO + i] = 0x00000601; | ||
357 | + s->regs[R_MIO + i] = 0x00000601; | ||
358 | } | ||
359 | |||
360 | - s->regs[MIO_MST_TRI0] = s->regs[MIO_MST_TRI1] = 0xFFFFFFFF; | ||
361 | + s->regs[R_MIO_MST_TRI0] = s->regs[R_MIO_MST_TRI1] = 0xFFFFFFFF; | ||
362 | |||
363 | - s->regs[CPU_RAM + 0] = s->regs[CPU_RAM + 1] = s->regs[CPU_RAM + 3] | ||
364 | - = s->regs[CPU_RAM + 4] = s->regs[CPU_RAM + 7] | ||
365 | - = 0x00010101; | ||
366 | - s->regs[CPU_RAM + 2] = s->regs[CPU_RAM + 5] = 0x01010101; | ||
367 | - s->regs[CPU_RAM + 6] = 0x00000001; | ||
368 | + s->regs[R_CPU_RAM + 0] = s->regs[R_CPU_RAM + 1] = s->regs[R_CPU_RAM + 3] | ||
369 | + = s->regs[R_CPU_RAM + 4] = s->regs[R_CPU_RAM + 7] | ||
370 | + = 0x00010101; | ||
371 | + s->regs[R_CPU_RAM + 2] = s->regs[R_CPU_RAM + 5] = 0x01010101; | ||
372 | + s->regs[R_CPU_RAM + 6] = 0x00000001; | ||
373 | |||
374 | - s->regs[IOU + 0] = s->regs[IOU + 1] = s->regs[IOU + 2] = s->regs[IOU + 3] | ||
375 | - = 0x09090909; | ||
376 | - s->regs[IOU + 4] = s->regs[IOU + 5] = 0x00090909; | ||
377 | - s->regs[IOU + 6] = 0x00000909; | ||
378 | + s->regs[R_IOU + 0] = s->regs[R_IOU + 1] = s->regs[R_IOU + 2] | ||
379 | + = s->regs[R_IOU + 3] = 0x09090909; | ||
380 | + s->regs[R_IOU + 4] = s->regs[R_IOU + 5] = 0x00090909; | ||
381 | + s->regs[R_IOU + 6] = 0x00000909; | ||
382 | |||
383 | - s->regs[DMAC_RAM] = 0x00000009; | ||
384 | + s->regs[R_DMAC_RAM] = 0x00000009; | ||
385 | |||
386 | - s->regs[AFI0 + 0] = s->regs[AFI0 + 1] = 0x09090909; | ||
387 | - s->regs[AFI1 + 0] = s->regs[AFI1 + 1] = 0x09090909; | ||
388 | - s->regs[AFI2 + 0] = s->regs[AFI2 + 1] = 0x09090909; | ||
389 | - s->regs[AFI3 + 0] = s->regs[AFI3 + 1] = 0x09090909; | ||
390 | - s->regs[AFI0 + 2] = s->regs[AFI1 + 2] = s->regs[AFI2 + 2] | ||
391 | - = s->regs[AFI3 + 2] = 0x00000909; | ||
392 | + s->regs[R_AFI0 + 0] = s->regs[R_AFI0 + 1] = 0x09090909; | ||
393 | + s->regs[R_AFI1 + 0] = s->regs[R_AFI1 + 1] = 0x09090909; | ||
394 | + s->regs[R_AFI2 + 0] = s->regs[R_AFI2 + 1] = 0x09090909; | ||
395 | + s->regs[R_AFI3 + 0] = s->regs[R_AFI3 + 1] = 0x09090909; | ||
396 | + s->regs[R_AFI0 + 2] = s->regs[R_AFI1 + 2] = s->regs[R_AFI2 + 2] | ||
397 | + = s->regs[R_AFI3 + 2] = 0x00000909; | ||
398 | |||
399 | - s->regs[OCM + 0] = 0x01010101; | ||
400 | - s->regs[OCM + 1] = s->regs[OCM + 2] = 0x09090909; | ||
401 | + s->regs[R_OCM + 0] = 0x01010101; | ||
402 | + s->regs[R_OCM + 1] = s->regs[R_OCM + 2] = 0x09090909; | ||
403 | |||
404 | - s->regs[DEVCI_RAM] = 0x00000909; | ||
405 | - s->regs[CSG_RAM] = 0x00000001; | ||
406 | + s->regs[R_DEVCI_RAM] = 0x00000909; | ||
407 | + s->regs[R_CSG_RAM] = 0x00000001; | ||
408 | |||
409 | - s->regs[DDRIOB + 0] = s->regs[DDRIOB + 1] = s->regs[DDRIOB + 2] | ||
410 | - = s->regs[DDRIOB + 3] = 0x00000e00; | ||
411 | - s->regs[DDRIOB + 4] = s->regs[DDRIOB + 5] = s->regs[DDRIOB + 6] | ||
412 | - = 0x00000e00; | ||
413 | - s->regs[DDRIOB + 12] = 0x00000021; | ||
414 | + s->regs[R_DDRIOB + 0] = s->regs[R_DDRIOB + 1] = s->regs[R_DDRIOB + 2] | ||
415 | + = s->regs[R_DDRIOB + 3] = 0x00000e00; | ||
416 | + s->regs[R_DDRIOB + 4] = s->regs[R_DDRIOB + 5] = s->regs[R_DDRIOB + 6] | ||
417 | + = 0x00000e00; | ||
418 | + s->regs[R_DDRIOB + 12] = 0x00000021; | ||
419 | } | ||
420 | |||
421 | |||
422 | static bool zynq_slcr_check_offset(hwaddr offset, bool rnw) | ||
423 | { | ||
424 | switch (offset) { | ||
425 | - case LOCK: | ||
426 | - case UNLOCK: | ||
427 | - case DDR_CAL_START: | ||
428 | - case DDR_REF_START: | ||
429 | + case R_LOCK: | ||
430 | + case R_UNLOCK: | ||
431 | + case R_DDR_CAL_START: | ||
432 | + case R_DDR_REF_START: | ||
433 | return !rnw; /* Write only */ | ||
434 | - case LOCKSTA: | ||
435 | - case FPGA0_THR_STA: | ||
436 | - case FPGA1_THR_STA: | ||
437 | - case FPGA2_THR_STA: | ||
438 | - case FPGA3_THR_STA: | ||
439 | - case BOOT_MODE: | ||
440 | - case PSS_IDCODE: | ||
441 | - case DDR_CMD_STA: | ||
442 | - case DDR_DFI_STATUS: | ||
443 | - case PLL_STATUS: | ||
444 | + case R_LOCKSTA: | ||
445 | + case R_FPGA0_THR_STA: | ||
446 | + case R_FPGA1_THR_STA: | ||
447 | + case R_FPGA2_THR_STA: | ||
448 | + case R_FPGA3_THR_STA: | ||
449 | + case R_BOOT_MODE: | ||
450 | + case R_PSS_IDCODE: | ||
451 | + case R_DDR_CMD_STA: | ||
452 | + case R_DDR_DFI_STATUS: | ||
453 | + case R_PLL_STATUS: | ||
454 | return rnw;/* read only */ | ||
455 | - case SCL: | ||
456 | - case ARM_PLL_CTRL ... IO_PLL_CTRL: | ||
457 | - case ARM_PLL_CFG ... IO_PLL_CFG: | ||
458 | - case ARM_CLK_CTRL ... TOPSW_CLK_CTRL: | ||
459 | - case FPGA0_CLK_CTRL ... FPGA0_THR_CNT: | ||
460 | - case FPGA1_CLK_CTRL ... FPGA1_THR_CNT: | ||
461 | - case FPGA2_CLK_CTRL ... FPGA2_THR_CNT: | ||
462 | - case FPGA3_CLK_CTRL ... FPGA3_THR_CNT: | ||
463 | - case BANDGAP_TRIP: | ||
464 | - case PLL_PREDIVISOR: | ||
465 | - case CLK_621_TRUE: | ||
466 | - case PSS_RST_CTRL ... A9_CPU_RST_CTRL: | ||
467 | - case RS_AWDT_CTRL: | ||
468 | - case RST_REASON: | ||
469 | - case REBOOT_STATUS: | ||
470 | - case APU_CTRL: | ||
471 | - case WDT_CLK_SEL: | ||
472 | - case TZ_DMA_NS ... TZ_DMA_PERIPH_NS: | ||
473 | - case DDR_URGENT: | ||
474 | - case DDR_URGENT_SEL: | ||
475 | - case MIO ... MIO + MIO_LENGTH - 1: | ||
476 | - case MIO_LOOPBACK ... MIO_MST_TRI1: | ||
477 | - case SD0_WP_CD_SEL: | ||
478 | - case SD1_WP_CD_SEL: | ||
479 | - case LVL_SHFTR_EN: | ||
480 | - case OCM_CFG: | ||
481 | - case CPU_RAM: | ||
482 | - case IOU: | ||
483 | - case DMAC_RAM: | ||
484 | - case AFI0 ... AFI3 + AFI_LENGTH - 1: | ||
485 | - case OCM: | ||
486 | - case DEVCI_RAM: | ||
487 | - case CSG_RAM: | ||
488 | - case GPIOB_CTRL ... GPIOB_CFG_CMOS33: | ||
489 | - case GPIOB_CFG_HSTL: | ||
490 | - case GPIOB_DRVR_BIAS_CTRL: | ||
491 | - case DDRIOB ... DDRIOB + DDRIOB_LENGTH - 1: | ||
492 | + case R_SCL: | ||
493 | + case R_ARM_PLL_CTRL ... R_IO_PLL_CTRL: | ||
494 | + case R_ARM_PLL_CFG ... R_IO_PLL_CFG: | ||
495 | + case R_ARM_CLK_CTRL ... R_TOPSW_CLK_CTRL: | ||
496 | + case R_FPGA0_CLK_CTRL ... R_FPGA0_THR_CNT: | ||
497 | + case R_FPGA1_CLK_CTRL ... R_FPGA1_THR_CNT: | ||
498 | + case R_FPGA2_CLK_CTRL ... R_FPGA2_THR_CNT: | ||
499 | + case R_FPGA3_CLK_CTRL ... R_FPGA3_THR_CNT: | ||
500 | + case R_BANDGAP_TRIP: | ||
501 | + case R_PLL_PREDIVISOR: | ||
502 | + case R_CLK_621_TRUE: | ||
503 | + case R_PSS_RST_CTRL ... R_A9_CPU_RST_CTRL: | ||
504 | + case R_RS_AWDT_CTRL: | ||
505 | + case R_RST_REASON: | ||
506 | + case R_REBOOT_STATUS: | ||
507 | + case R_APU_CTRL: | ||
508 | + case R_WDT_CLK_SEL: | ||
509 | + case R_TZ_DMA_NS ... R_TZ_DMA_PERIPH_NS: | ||
510 | + case R_DDR_URGENT: | ||
511 | + case R_DDR_URGENT_SEL: | ||
512 | + case R_MIO ... R_MIO + MIO_LENGTH - 1: | ||
513 | + case R_MIO_LOOPBACK ... R_MIO_MST_TRI1: | ||
514 | + case R_SD0_WP_CD_SEL: | ||
515 | + case R_SD1_WP_CD_SEL: | ||
516 | + case R_LVL_SHFTR_EN: | ||
517 | + case R_OCM_CFG: | ||
518 | + case R_CPU_RAM: | ||
519 | + case R_IOU: | ||
520 | + case R_DMAC_RAM: | ||
521 | + case R_AFI0 ... R_AFI3 + AFI_LENGTH - 1: | ||
522 | + case R_OCM: | ||
523 | + case R_DEVCI_RAM: | ||
524 | + case R_CSG_RAM: | ||
525 | + case R_GPIOB_CTRL ... R_GPIOB_CFG_CMOS33: | ||
526 | + case R_GPIOB_CFG_HSTL: | ||
527 | + case R_GPIOB_DRVR_BIAS_CTRL: | ||
528 | + case R_DDRIOB ... R_DDRIOB + DDRIOB_LENGTH - 1: | ||
529 | return true; | ||
530 | default: | ||
531 | return false; | ||
532 | @@ -XXX,XX +XXX,XX @@ static void zynq_slcr_write(void *opaque, hwaddr offset, | ||
533 | } | ||
534 | |||
535 | switch (offset) { | ||
536 | - case SCL: | ||
537 | - s->regs[SCL] = val & 0x1; | ||
538 | + case R_SCL: | ||
539 | + s->regs[R_SCL] = val & 0x1; | ||
540 | return; | ||
541 | - case LOCK: | ||
542 | + case R_LOCK: | ||
543 | if ((val & 0xFFFF) == XILINX_LOCK_KEY) { | ||
544 | DB_PRINT("XILINX LOCK 0xF8000000 + 0x%x <= 0x%x\n", (int)offset, | ||
545 | (unsigned)val & 0xFFFF); | ||
546 | - s->regs[LOCKSTA] = 1; | ||
547 | + s->regs[R_LOCKSTA] = 1; | ||
548 | } else { | ||
549 | DB_PRINT("WRONG XILINX LOCK KEY 0xF8000000 + 0x%x <= 0x%x\n", | ||
550 | (int)offset, (unsigned)val & 0xFFFF); | ||
551 | } | ||
552 | return; | ||
553 | - case UNLOCK: | ||
554 | + case R_UNLOCK: | ||
555 | if ((val & 0xFFFF) == XILINX_UNLOCK_KEY) { | ||
556 | DB_PRINT("XILINX UNLOCK 0xF8000000 + 0x%x <= 0x%x\n", (int)offset, | ||
557 | (unsigned)val & 0xFFFF); | ||
558 | - s->regs[LOCKSTA] = 0; | ||
559 | + s->regs[R_LOCKSTA] = 0; | ||
560 | } else { | ||
561 | DB_PRINT("WRONG XILINX UNLOCK KEY 0xF8000000 + 0x%x <= 0x%x\n", | ||
562 | (int)offset, (unsigned)val & 0xFFFF); | ||
563 | @@ -XXX,XX +XXX,XX @@ static void zynq_slcr_write(void *opaque, hwaddr offset, | ||
564 | return; | ||
565 | } | ||
566 | |||
567 | - if (s->regs[LOCKSTA]) { | ||
568 | + if (s->regs[R_LOCKSTA]) { | ||
569 | qemu_log_mask(LOG_GUEST_ERROR, | ||
570 | "SCLR registers are locked. Unlock them first\n"); | ||
571 | return; | ||
572 | @@ -XXX,XX +XXX,XX @@ static void zynq_slcr_write(void *opaque, hwaddr offset, | ||
573 | s->regs[offset] = val; | ||
574 | |||
575 | switch (offset) { | ||
576 | - case PSS_RST_CTRL: | ||
577 | - if (val & R_PSS_RST_CTRL_SOFT_RST) { | ||
578 | + case R_PSS_RST_CTRL: | ||
579 | + if (FIELD_EX32(val, PSS_RST_CTRL, SOFT_RST)) { | ||
580 | qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
581 | } | ||
582 | break; | ||
583 | -- | ||
584 | 2.20.1 | ||
585 | |||
586 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Aaron Hill <aa1ronham@gmail.com> | ||
1 | 2 | ||
3 | This commit properly sets the ENET_BD_BDU flag once the emulated FEC controller | ||
4 | has finished processing the last descriptor. This is done for both transmit | ||
5 | and receive descriptors. | ||
6 | |||
7 | This allows the QNX 7.0.0 BSP for the Sabrelite board (which can be | ||
8 | found at http://blackberry.qnx.com/en/developers/bsp) to properly | ||
9 | control the FEC. Without this patch, the BSP ethernet driver will never | ||
10 | re-use FEC descriptors, as the unset ENET_BD_BDU flag will cause | ||
11 | it to believe that the descriptors are still in use by the NIC. | ||
12 | |||
13 | Note that Linux does not appear to use this field at all, and is | ||
14 | unaffected by this patch. | ||
15 | |||
16 | Without this patch, QNX will think that the NIC is still processing its | ||
17 | transaction descriptors, and won't send any more data over the network. | ||
18 | |||
19 | For reference: | ||
20 | |||
21 | On page 1192 of the I.MX 6DQ reference manual revision (Rev. 5, 06/2018), | ||
22 | which can be found at https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/i.mx-applications-processors/i.mx-6-processors/i.mx-6quad-processors-high-performance-3d-graphics-hd-video-arm-cortex-a9-core:i.MX6Q?&tab=Documentation_Tab&linkline=Application-Note | ||
23 | |||
24 | the 'BDU' field is described as follows for the 'Enhanced transmit | ||
25 | buffer descriptor': | ||
26 | |||
27 | 'Last buffer descriptor update done. Indicates that the last BD data has been updated by | ||
28 | uDMA. This field is written by the user (=0) and uDMA (=1).' | ||
29 | |||
30 | The same description is used for the receive buffer descriptor. | ||
31 | |||
32 | Signed-off-by: Aaron Hill <aa1ronham@gmail.com> | ||
33 | Message-id: 20190805142417.10433-1-aaron.hill@alertinnovation.com | ||
34 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
35 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
36 | --- | ||
37 | hw/net/imx_fec.c | 4 ++++ | ||
38 | 1 file changed, 4 insertions(+) | ||
39 | |||
40 | diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/net/imx_fec.c | ||
43 | +++ b/hw/net/imx_fec.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static void imx_enet_do_tx(IMXFECState *s, uint32_t index) | ||
45 | if (bd.option & ENET_BD_TX_INT) { | ||
46 | s->regs[ENET_EIR] |= int_txf; | ||
47 | } | ||
48 | + /* Indicate that we've updated the last buffer descriptor. */ | ||
49 | + bd.last_buffer = ENET_BD_BDU; | ||
50 | } | ||
51 | if (bd.option & ENET_BD_TX_INT) { | ||
52 | s->regs[ENET_EIR] |= int_txb; | ||
53 | @@ -XXX,XX +XXX,XX @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf, | ||
54 | /* Last buffer in frame. */ | ||
55 | bd.flags |= flags | ENET_BD_L; | ||
56 | FEC_PRINTF("rx frame flags %04x\n", bd.flags); | ||
57 | + /* Indicate that we've updated the last buffer descriptor. */ | ||
58 | + bd.last_buffer = ENET_BD_BDU; | ||
59 | if (bd.option & ENET_BD_RX_INT) { | ||
60 | s->regs[ENET_EIR] |= ENET_INT_RXF; | ||
61 | } | ||
62 | -- | ||
63 | 2.20.1 | ||
64 | |||
65 | diff view generated by jsdifflib |
1 | The header file hw/arm/arm.h now includes only declarations | 1 | Factor out code to 'generate a singlestep exception', which is |
---|---|---|---|
2 | relating to hw/arm/boot.c functionality. Rename it accordingly, | 2 | currently repeated in four places. |
3 | and adjust its header comment. | ||
4 | 3 | ||
5 | The bulk of this commit was created via | 4 | To do this we need to also pull the identical copies of the |
6 | perl -pi -e 's|hw/arm/arm.h|hw/arm/boot.h|' hw/arm/*.c include/hw/arm/*.h | 5 | gen-exception() function out of translate-a64.c and translate.c |
6 | into translate.h. | ||
7 | 7 | ||
8 | In a few cases we can just delete the #include: | 8 | (There is a bug in the code: we're taking the exception to the wrong |
9 | hw/arm/msf2-soc.c, include/hw/arm/aspeed_soc.h and | 9 | target EL. This will be simpler to fix if there's only one place to |
10 | include/hw/arm/bcm2836.h did not require it. | 10 | do it.) |
11 | 11 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
14 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 14 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
15 | Message-id: 20190516163857.6430-4-peter.maydell@linaro.org | 15 | Message-id: 20190805130952.4415-2-peter.maydell@linaro.org |
16 | --- | 16 | --- |
17 | include/hw/arm/allwinner-a10.h | 2 +- | 17 | target/arm/translate.h | 23 +++++++++++++++++++++++ |
18 | include/hw/arm/aspeed_soc.h | 1 - | 18 | target/arm/translate-a64.c | 19 ++----------------- |
19 | include/hw/arm/bcm2836.h | 1 - | 19 | target/arm/translate.c | 20 ++------------------ |
20 | include/hw/arm/{arm.h => boot.h} | 8 ++++---- | 20 | 3 files changed, 27 insertions(+), 35 deletions(-) |
21 | include/hw/arm/fsl-imx25.h | 2 +- | ||
22 | include/hw/arm/fsl-imx31.h | 2 +- | ||
23 | include/hw/arm/fsl-imx6.h | 2 +- | ||
24 | include/hw/arm/fsl-imx6ul.h | 2 +- | ||
25 | include/hw/arm/fsl-imx7.h | 2 +- | ||
26 | include/hw/arm/virt.h | 2 +- | ||
27 | include/hw/arm/xlnx-versal.h | 2 +- | ||
28 | include/hw/arm/xlnx-zynqmp.h | 2 +- | ||
29 | hw/arm/armsse.c | 2 +- | ||
30 | hw/arm/armv7m.c | 2 +- | ||
31 | hw/arm/aspeed.c | 2 +- | ||
32 | hw/arm/boot.c | 2 +- | ||
33 | hw/arm/collie.c | 2 +- | ||
34 | hw/arm/exynos4210.c | 2 +- | ||
35 | hw/arm/exynos4_boards.c | 2 +- | ||
36 | hw/arm/highbank.c | 2 +- | ||
37 | hw/arm/integratorcp.c | 2 +- | ||
38 | hw/arm/mainstone.c | 2 +- | ||
39 | hw/arm/microbit.c | 2 +- | ||
40 | hw/arm/mps2-tz.c | 2 +- | ||
41 | hw/arm/mps2.c | 2 +- | ||
42 | hw/arm/msf2-soc.c | 1 - | ||
43 | hw/arm/msf2-som.c | 2 +- | ||
44 | hw/arm/musca.c | 2 +- | ||
45 | hw/arm/musicpal.c | 2 +- | ||
46 | hw/arm/netduino2.c | 2 +- | ||
47 | hw/arm/nrf51_soc.c | 2 +- | ||
48 | hw/arm/nseries.c | 2 +- | ||
49 | hw/arm/omap1.c | 2 +- | ||
50 | hw/arm/omap2.c | 2 +- | ||
51 | hw/arm/omap_sx1.c | 2 +- | ||
52 | hw/arm/palm.c | 2 +- | ||
53 | hw/arm/raspi.c | 2 +- | ||
54 | hw/arm/realview.c | 2 +- | ||
55 | hw/arm/spitz.c | 2 +- | ||
56 | hw/arm/stellaris.c | 2 +- | ||
57 | hw/arm/stm32f205_soc.c | 2 +- | ||
58 | hw/arm/strongarm.c | 2 +- | ||
59 | hw/arm/tosa.c | 2 +- | ||
60 | hw/arm/versatilepb.c | 2 +- | ||
61 | hw/arm/vexpress.c | 2 +- | ||
62 | hw/arm/virt.c | 2 +- | ||
63 | hw/arm/xilinx_zynq.c | 2 +- | ||
64 | hw/arm/xlnx-versal.c | 2 +- | ||
65 | hw/arm/z2.c | 2 +- | ||
66 | 49 files changed, 49 insertions(+), 52 deletions(-) | ||
67 | rename include/hw/arm/{arm.h => boot.h} (98%) | ||
68 | 21 | ||
69 | diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h | 22 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
70 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
71 | --- a/include/hw/arm/allwinner-a10.h | 24 | --- a/target/arm/translate.h |
72 | +++ b/include/hw/arm/allwinner-a10.h | 25 | +++ b/target/arm/translate.h |
73 | @@ -XXX,XX +XXX,XX @@ | 26 | @@ -XXX,XX +XXX,XX @@ |
74 | #include "qemu-common.h" | 27 | #define TARGET_ARM_TRANSLATE_H |
75 | #include "qemu/error-report.h" | 28 | |
76 | #include "hw/char/serial.h" | 29 | #include "exec/translator.h" |
77 | -#include "hw/arm/arm.h" | 30 | +#include "internals.h" |
78 | +#include "hw/arm/boot.h" | 31 | |
79 | #include "hw/timer/allwinner-a10-pit.h" | 32 | |
80 | #include "hw/intc/allwinner-a10-pic.h" | 33 | /* internal defines */ |
81 | #include "hw/net/allwinner_emac.h" | 34 | @@ -XXX,XX +XXX,XX @@ static inline void gen_ss_advance(DisasContext *s) |
82 | diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h | 35 | } |
36 | } | ||
37 | |||
38 | +static inline void gen_exception(int excp, uint32_t syndrome, | ||
39 | + uint32_t target_el) | ||
40 | +{ | ||
41 | + TCGv_i32 tcg_excp = tcg_const_i32(excp); | ||
42 | + TCGv_i32 tcg_syn = tcg_const_i32(syndrome); | ||
43 | + TCGv_i32 tcg_el = tcg_const_i32(target_el); | ||
44 | + | ||
45 | + gen_helper_exception_with_syndrome(cpu_env, tcg_excp, | ||
46 | + tcg_syn, tcg_el); | ||
47 | + | ||
48 | + tcg_temp_free_i32(tcg_el); | ||
49 | + tcg_temp_free_i32(tcg_syn); | ||
50 | + tcg_temp_free_i32(tcg_excp); | ||
51 | +} | ||
52 | + | ||
53 | +/* Generate an architectural singlestep exception */ | ||
54 | +static inline void gen_swstep_exception(DisasContext *s, int isv, int ex) | ||
55 | +{ | ||
56 | + gen_exception(EXCP_UDEF, syn_swstep(s->ss_same_el, isv, ex), | ||
57 | + default_exception_el(s)); | ||
58 | +} | ||
59 | + | ||
60 | /* | ||
61 | * Given a VFP floating point constant encoded into an 8 bit immediate in an | ||
62 | * instruction, expand it to the actual constant value of the specified | ||
63 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
83 | index XXXXXXX..XXXXXXX 100644 | 64 | index XXXXXXX..XXXXXXX 100644 |
84 | --- a/include/hw/arm/aspeed_soc.h | 65 | --- a/target/arm/translate-a64.c |
85 | +++ b/include/hw/arm/aspeed_soc.h | 66 | +++ b/target/arm/translate-a64.c |
86 | @@ -XXX,XX +XXX,XX @@ | 67 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal(int excp) |
87 | #ifndef ASPEED_SOC_H | 68 | tcg_temp_free_i32(tcg_excp); |
88 | #define ASPEED_SOC_H | 69 | } |
89 | 70 | ||
90 | -#include "hw/arm/arm.h" | 71 | -static void gen_exception(int excp, uint32_t syndrome, uint32_t target_el) |
91 | #include "hw/intc/aspeed_vic.h" | 72 | -{ |
92 | #include "hw/misc/aspeed_scu.h" | 73 | - TCGv_i32 tcg_excp = tcg_const_i32(excp); |
93 | #include "hw/misc/aspeed_sdmc.h" | 74 | - TCGv_i32 tcg_syn = tcg_const_i32(syndrome); |
94 | diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h | 75 | - TCGv_i32 tcg_el = tcg_const_i32(target_el); |
76 | - | ||
77 | - gen_helper_exception_with_syndrome(cpu_env, tcg_excp, | ||
78 | - tcg_syn, tcg_el); | ||
79 | - tcg_temp_free_i32(tcg_el); | ||
80 | - tcg_temp_free_i32(tcg_syn); | ||
81 | - tcg_temp_free_i32(tcg_excp); | ||
82 | -} | ||
83 | - | ||
84 | static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) | ||
85 | { | ||
86 | gen_a64_set_pc_im(s->pc - offset); | ||
87 | @@ -XXX,XX +XXX,XX @@ static void gen_step_complete_exception(DisasContext *s) | ||
88 | * of the exception, and our syndrome information is always correct. | ||
89 | */ | ||
90 | gen_ss_advance(s); | ||
91 | - gen_exception(EXCP_UDEF, syn_swstep(s->ss_same_el, 1, s->is_ldex), | ||
92 | - default_exception_el(s)); | ||
93 | + gen_swstep_exception(s, 1, s->is_ldex); | ||
94 | s->base.is_jmp = DISAS_NORETURN; | ||
95 | } | ||
96 | |||
97 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
98 | * bits should be zero. | ||
99 | */ | ||
100 | assert(dc->base.num_insns == 1); | ||
101 | - gen_exception(EXCP_UDEF, syn_swstep(dc->ss_same_el, 0, 0), | ||
102 | - default_exception_el(dc)); | ||
103 | + gen_swstep_exception(dc, 0, 0); | ||
104 | dc->base.is_jmp = DISAS_NORETURN; | ||
105 | } else { | ||
106 | disas_a64_insn(env, dc); | ||
107 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
95 | index XXXXXXX..XXXXXXX 100644 | 108 | index XXXXXXX..XXXXXXX 100644 |
96 | --- a/include/hw/arm/bcm2836.h | 109 | --- a/target/arm/translate.c |
97 | +++ b/include/hw/arm/bcm2836.h | 110 | +++ b/target/arm/translate.c |
98 | @@ -XXX,XX +XXX,XX @@ | 111 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal(int excp) |
99 | #ifndef BCM2836_H | 112 | tcg_temp_free_i32(tcg_excp); |
100 | #define BCM2836_H | 113 | } |
101 | 114 | ||
102 | -#include "hw/arm/arm.h" | 115 | -static void gen_exception(int excp, uint32_t syndrome, uint32_t target_el) |
103 | #include "hw/arm/bcm2835_peripherals.h" | 116 | -{ |
104 | #include "hw/intc/bcm2836_control.h" | 117 | - TCGv_i32 tcg_excp = tcg_const_i32(excp); |
105 | 118 | - TCGv_i32 tcg_syn = tcg_const_i32(syndrome); | |
106 | diff --git a/include/hw/arm/arm.h b/include/hw/arm/boot.h | 119 | - TCGv_i32 tcg_el = tcg_const_i32(target_el); |
107 | similarity index 98% | 120 | - |
108 | rename from include/hw/arm/arm.h | 121 | - gen_helper_exception_with_syndrome(cpu_env, tcg_excp, |
109 | rename to include/hw/arm/boot.h | 122 | - tcg_syn, tcg_el); |
110 | index XXXXXXX..XXXXXXX 100644 | 123 | - |
111 | --- a/include/hw/arm/arm.h | 124 | - tcg_temp_free_i32(tcg_el); |
112 | +++ b/include/hw/arm/boot.h | 125 | - tcg_temp_free_i32(tcg_syn); |
113 | @@ -XXX,XX +XXX,XX @@ | 126 | - tcg_temp_free_i32(tcg_excp); |
114 | /* | 127 | -} |
115 | - * Misc ARM declarations | 128 | - |
116 | + * ARM kernel loader. | 129 | static void gen_step_complete_exception(DisasContext *s) |
117 | * | ||
118 | * Copyright (c) 2006 CodeSourcery. | ||
119 | * Written by Paul Brook | ||
120 | @@ -XXX,XX +XXX,XX @@ | ||
121 | * | ||
122 | */ | ||
123 | |||
124 | -#ifndef HW_ARM_H | ||
125 | -#define HW_ARM_H | ||
126 | +#ifndef HW_ARM_BOOT_H | ||
127 | +#define HW_ARM_BOOT_H | ||
128 | |||
129 | #include "exec/memory.h" | ||
130 | #include "target/arm/cpu-qom.h" | ||
131 | @@ -XXX,XX +XXX,XX @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, | ||
132 | const struct arm_boot_info *info, | ||
133 | hwaddr mvbar_addr); | ||
134 | |||
135 | -#endif /* HW_ARM_H */ | ||
136 | +#endif /* HW_ARM_BOOT_H */ | ||
137 | diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h | ||
138 | index XXXXXXX..XXXXXXX 100644 | ||
139 | --- a/include/hw/arm/fsl-imx25.h | ||
140 | +++ b/include/hw/arm/fsl-imx25.h | ||
141 | @@ -XXX,XX +XXX,XX @@ | ||
142 | #ifndef FSL_IMX25_H | ||
143 | #define FSL_IMX25_H | ||
144 | |||
145 | -#include "hw/arm/arm.h" | ||
146 | +#include "hw/arm/boot.h" | ||
147 | #include "hw/intc/imx_avic.h" | ||
148 | #include "hw/misc/imx25_ccm.h" | ||
149 | #include "hw/char/imx_serial.h" | ||
150 | diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h | ||
151 | index XXXXXXX..XXXXXXX 100644 | ||
152 | --- a/include/hw/arm/fsl-imx31.h | ||
153 | +++ b/include/hw/arm/fsl-imx31.h | ||
154 | @@ -XXX,XX +XXX,XX @@ | ||
155 | #ifndef FSL_IMX31_H | ||
156 | #define FSL_IMX31_H | ||
157 | |||
158 | -#include "hw/arm/arm.h" | ||
159 | +#include "hw/arm/boot.h" | ||
160 | #include "hw/intc/imx_avic.h" | ||
161 | #include "hw/misc/imx31_ccm.h" | ||
162 | #include "hw/char/imx_serial.h" | ||
163 | diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h | ||
164 | index XXXXXXX..XXXXXXX 100644 | ||
165 | --- a/include/hw/arm/fsl-imx6.h | ||
166 | +++ b/include/hw/arm/fsl-imx6.h | ||
167 | @@ -XXX,XX +XXX,XX @@ | ||
168 | #ifndef FSL_IMX6_H | ||
169 | #define FSL_IMX6_H | ||
170 | |||
171 | -#include "hw/arm/arm.h" | ||
172 | +#include "hw/arm/boot.h" | ||
173 | #include "hw/cpu/a9mpcore.h" | ||
174 | #include "hw/misc/imx6_ccm.h" | ||
175 | #include "hw/misc/imx6_src.h" | ||
176 | diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h | ||
177 | index XXXXXXX..XXXXXXX 100644 | ||
178 | --- a/include/hw/arm/fsl-imx6ul.h | ||
179 | +++ b/include/hw/arm/fsl-imx6ul.h | ||
180 | @@ -XXX,XX +XXX,XX @@ | ||
181 | #ifndef FSL_IMX6UL_H | ||
182 | #define FSL_IMX6UL_H | ||
183 | |||
184 | -#include "hw/arm/arm.h" | ||
185 | +#include "hw/arm/boot.h" | ||
186 | #include "hw/cpu/a15mpcore.h" | ||
187 | #include "hw/misc/imx6ul_ccm.h" | ||
188 | #include "hw/misc/imx6_src.h" | ||
189 | diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h | ||
190 | index XXXXXXX..XXXXXXX 100644 | ||
191 | --- a/include/hw/arm/fsl-imx7.h | ||
192 | +++ b/include/hw/arm/fsl-imx7.h | ||
193 | @@ -XXX,XX +XXX,XX @@ | ||
194 | #ifndef FSL_IMX7_H | ||
195 | #define FSL_IMX7_H | ||
196 | |||
197 | -#include "hw/arm/arm.h" | ||
198 | +#include "hw/arm/boot.h" | ||
199 | #include "hw/cpu/a15mpcore.h" | ||
200 | #include "hw/intc/imx_gpcv2.h" | ||
201 | #include "hw/misc/imx7_ccm.h" | ||
202 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
203 | index XXXXXXX..XXXXXXX 100644 | ||
204 | --- a/include/hw/arm/virt.h | ||
205 | +++ b/include/hw/arm/virt.h | ||
206 | @@ -XXX,XX +XXX,XX @@ | ||
207 | #include "exec/hwaddr.h" | ||
208 | #include "qemu/notify.h" | ||
209 | #include "hw/boards.h" | ||
210 | -#include "hw/arm/arm.h" | ||
211 | +#include "hw/arm/boot.h" | ||
212 | #include "hw/block/flash.h" | ||
213 | #include "sysemu/kvm.h" | ||
214 | #include "hw/intc/arm_gicv3_common.h" | ||
215 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
216 | index XXXXXXX..XXXXXXX 100644 | ||
217 | --- a/include/hw/arm/xlnx-versal.h | ||
218 | +++ b/include/hw/arm/xlnx-versal.h | ||
219 | @@ -XXX,XX +XXX,XX @@ | ||
220 | #define XLNX_VERSAL_H | ||
221 | |||
222 | #include "hw/sysbus.h" | ||
223 | -#include "hw/arm/arm.h" | ||
224 | +#include "hw/arm/boot.h" | ||
225 | #include "hw/intc/arm_gicv3.h" | ||
226 | |||
227 | #define TYPE_XLNX_VERSAL "xlnx-versal" | ||
228 | diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h | ||
229 | index XXXXXXX..XXXXXXX 100644 | ||
230 | --- a/include/hw/arm/xlnx-zynqmp.h | ||
231 | +++ b/include/hw/arm/xlnx-zynqmp.h | ||
232 | @@ -XXX,XX +XXX,XX @@ | ||
233 | #ifndef XLNX_ZYNQMP_H | ||
234 | |||
235 | #include "qemu-common.h" | ||
236 | -#include "hw/arm/arm.h" | ||
237 | +#include "hw/arm/boot.h" | ||
238 | #include "hw/intc/arm_gic.h" | ||
239 | #include "hw/net/cadence_gem.h" | ||
240 | #include "hw/char/cadence_uart.h" | ||
241 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | ||
242 | index XXXXXXX..XXXXXXX 100644 | ||
243 | --- a/hw/arm/armsse.c | ||
244 | +++ b/hw/arm/armsse.c | ||
245 | @@ -XXX,XX +XXX,XX @@ | ||
246 | #include "hw/sysbus.h" | ||
247 | #include "hw/registerfields.h" | ||
248 | #include "hw/arm/armsse.h" | ||
249 | -#include "hw/arm/arm.h" | ||
250 | +#include "hw/arm/boot.h" | ||
251 | |||
252 | /* Format of the System Information block SYS_CONFIG register */ | ||
253 | typedef enum SysConfigFormat { | ||
254 | diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c | ||
255 | index XXXXXXX..XXXXXXX 100644 | ||
256 | --- a/hw/arm/armv7m.c | ||
257 | +++ b/hw/arm/armv7m.c | ||
258 | @@ -XXX,XX +XXX,XX @@ | ||
259 | #include "qemu-common.h" | ||
260 | #include "cpu.h" | ||
261 | #include "hw/sysbus.h" | ||
262 | -#include "hw/arm/arm.h" | ||
263 | +#include "hw/arm/boot.h" | ||
264 | #include "hw/loader.h" | ||
265 | #include "elf.h" | ||
266 | #include "sysemu/qtest.h" | ||
267 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | ||
268 | index XXXXXXX..XXXXXXX 100644 | ||
269 | --- a/hw/arm/aspeed.c | ||
270 | +++ b/hw/arm/aspeed.c | ||
271 | @@ -XXX,XX +XXX,XX @@ | ||
272 | #include "qemu-common.h" | ||
273 | #include "cpu.h" | ||
274 | #include "exec/address-spaces.h" | ||
275 | -#include "hw/arm/arm.h" | ||
276 | +#include "hw/arm/boot.h" | ||
277 | #include "hw/arm/aspeed.h" | ||
278 | #include "hw/arm/aspeed_soc.h" | ||
279 | #include "hw/boards.h" | ||
280 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | ||
281 | index XXXXXXX..XXXXXXX 100644 | ||
282 | --- a/hw/arm/boot.c | ||
283 | +++ b/hw/arm/boot.c | ||
284 | @@ -XXX,XX +XXX,XX @@ | ||
285 | #include "qapi/error.h" | ||
286 | #include <libfdt.h> | ||
287 | #include "hw/hw.h" | ||
288 | -#include "hw/arm/arm.h" | ||
289 | +#include "hw/arm/boot.h" | ||
290 | #include "hw/arm/linux-boot-if.h" | ||
291 | #include "sysemu/kvm.h" | ||
292 | #include "sysemu/sysemu.h" | ||
293 | diff --git a/hw/arm/collie.c b/hw/arm/collie.c | ||
294 | index XXXXXXX..XXXXXXX 100644 | ||
295 | --- a/hw/arm/collie.c | ||
296 | +++ b/hw/arm/collie.c | ||
297 | @@ -XXX,XX +XXX,XX @@ | ||
298 | #include "hw/sysbus.h" | ||
299 | #include "hw/boards.h" | ||
300 | #include "strongarm.h" | ||
301 | -#include "hw/arm/arm.h" | ||
302 | +#include "hw/arm/boot.h" | ||
303 | #include "hw/block/flash.h" | ||
304 | #include "exec/address-spaces.h" | ||
305 | #include "cpu.h" | ||
306 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
307 | index XXXXXXX..XXXXXXX 100644 | ||
308 | --- a/hw/arm/exynos4210.c | ||
309 | +++ b/hw/arm/exynos4210.c | ||
310 | @@ -XXX,XX +XXX,XX @@ | ||
311 | #include "hw/boards.h" | ||
312 | #include "sysemu/sysemu.h" | ||
313 | #include "hw/sysbus.h" | ||
314 | -#include "hw/arm/arm.h" | ||
315 | +#include "hw/arm/boot.h" | ||
316 | #include "hw/loader.h" | ||
317 | #include "hw/arm/exynos4210.h" | ||
318 | #include "hw/sd/sdhci.h" | ||
319 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | ||
320 | index XXXXXXX..XXXXXXX 100644 | ||
321 | --- a/hw/arm/exynos4_boards.c | ||
322 | +++ b/hw/arm/exynos4_boards.c | ||
323 | @@ -XXX,XX +XXX,XX @@ | ||
324 | #include "sysemu/sysemu.h" | ||
325 | #include "hw/sysbus.h" | ||
326 | #include "net/net.h" | ||
327 | -#include "hw/arm/arm.h" | ||
328 | +#include "hw/arm/boot.h" | ||
329 | #include "exec/address-spaces.h" | ||
330 | #include "hw/arm/exynos4210.h" | ||
331 | #include "hw/net/lan9118.h" | ||
332 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | ||
333 | index XXXXXXX..XXXXXXX 100644 | ||
334 | --- a/hw/arm/highbank.c | ||
335 | +++ b/hw/arm/highbank.c | ||
336 | @@ -XXX,XX +XXX,XX @@ | ||
337 | #include "qemu/osdep.h" | ||
338 | #include "qapi/error.h" | ||
339 | #include "hw/sysbus.h" | ||
340 | -#include "hw/arm/arm.h" | ||
341 | +#include "hw/arm/boot.h" | ||
342 | #include "hw/loader.h" | ||
343 | #include "net/net.h" | ||
344 | #include "sysemu/kvm.h" | ||
345 | diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c | ||
346 | index XXXXXXX..XXXXXXX 100644 | ||
347 | --- a/hw/arm/integratorcp.c | ||
348 | +++ b/hw/arm/integratorcp.c | ||
349 | @@ -XXX,XX +XXX,XX @@ | ||
350 | #include "cpu.h" | ||
351 | #include "hw/sysbus.h" | ||
352 | #include "hw/boards.h" | ||
353 | -#include "hw/arm/arm.h" | ||
354 | +#include "hw/arm/boot.h" | ||
355 | #include "hw/misc/arm_integrator_debug.h" | ||
356 | #include "hw/net/smc91c111.h" | ||
357 | #include "net/net.h" | ||
358 | diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c | ||
359 | index XXXXXXX..XXXXXXX 100644 | ||
360 | --- a/hw/arm/mainstone.c | ||
361 | +++ b/hw/arm/mainstone.c | ||
362 | @@ -XXX,XX +XXX,XX @@ | ||
363 | #include "qapi/error.h" | ||
364 | #include "hw/hw.h" | ||
365 | #include "hw/arm/pxa.h" | ||
366 | -#include "hw/arm/arm.h" | ||
367 | +#include "hw/arm/boot.h" | ||
368 | #include "net/net.h" | ||
369 | #include "hw/net/smc91c111.h" | ||
370 | #include "hw/boards.h" | ||
371 | diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c | ||
372 | index XXXXXXX..XXXXXXX 100644 | ||
373 | --- a/hw/arm/microbit.c | ||
374 | +++ b/hw/arm/microbit.c | ||
375 | @@ -XXX,XX +XXX,XX @@ | ||
376 | #include "qemu/osdep.h" | ||
377 | #include "qapi/error.h" | ||
378 | #include "hw/boards.h" | ||
379 | -#include "hw/arm/arm.h" | ||
380 | +#include "hw/arm/boot.h" | ||
381 | #include "sysemu/sysemu.h" | ||
382 | #include "exec/address-spaces.h" | ||
383 | |||
384 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | ||
385 | index XXXXXXX..XXXXXXX 100644 | ||
386 | --- a/hw/arm/mps2-tz.c | ||
387 | +++ b/hw/arm/mps2-tz.c | ||
388 | @@ -XXX,XX +XXX,XX @@ | ||
389 | #include "qemu/osdep.h" | ||
390 | #include "qapi/error.h" | ||
391 | #include "qemu/error-report.h" | ||
392 | -#include "hw/arm/arm.h" | ||
393 | +#include "hw/arm/boot.h" | ||
394 | #include "hw/arm/armv7m.h" | ||
395 | #include "hw/or-irq.h" | ||
396 | #include "hw/boards.h" | ||
397 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
398 | index XXXXXXX..XXXXXXX 100644 | ||
399 | --- a/hw/arm/mps2.c | ||
400 | +++ b/hw/arm/mps2.c | ||
401 | @@ -XXX,XX +XXX,XX @@ | ||
402 | #include "qemu/osdep.h" | ||
403 | #include "qapi/error.h" | ||
404 | #include "qemu/error-report.h" | ||
405 | -#include "hw/arm/arm.h" | ||
406 | +#include "hw/arm/boot.h" | ||
407 | #include "hw/arm/armv7m.h" | ||
408 | #include "hw/or-irq.h" | ||
409 | #include "hw/boards.h" | ||
410 | diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c | ||
411 | index XXXXXXX..XXXXXXX 100644 | ||
412 | --- a/hw/arm/msf2-soc.c | ||
413 | +++ b/hw/arm/msf2-soc.c | ||
414 | @@ -XXX,XX +XXX,XX @@ | ||
415 | #include "qemu/units.h" | ||
416 | #include "qapi/error.h" | ||
417 | #include "qemu-common.h" | ||
418 | -#include "hw/arm/arm.h" | ||
419 | #include "exec/address-spaces.h" | ||
420 | #include "hw/char/serial.h" | ||
421 | #include "hw/boards.h" | ||
422 | diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c | ||
423 | index XXXXXXX..XXXXXXX 100644 | ||
424 | --- a/hw/arm/msf2-som.c | ||
425 | +++ b/hw/arm/msf2-som.c | ||
426 | @@ -XXX,XX +XXX,XX @@ | ||
427 | #include "qapi/error.h" | ||
428 | #include "qemu/error-report.h" | ||
429 | #include "hw/boards.h" | ||
430 | -#include "hw/arm/arm.h" | ||
431 | +#include "hw/arm/boot.h" | ||
432 | #include "exec/address-spaces.h" | ||
433 | #include "hw/arm/msf2-soc.h" | ||
434 | #include "cpu.h" | ||
435 | diff --git a/hw/arm/musca.c b/hw/arm/musca.c | ||
436 | index XXXXXXX..XXXXXXX 100644 | ||
437 | --- a/hw/arm/musca.c | ||
438 | +++ b/hw/arm/musca.c | ||
439 | @@ -XXX,XX +XXX,XX @@ | ||
440 | #include "qapi/error.h" | ||
441 | #include "exec/address-spaces.h" | ||
442 | #include "sysemu/sysemu.h" | ||
443 | -#include "hw/arm/arm.h" | ||
444 | +#include "hw/arm/boot.h" | ||
445 | #include "hw/arm/armsse.h" | ||
446 | #include "hw/boards.h" | ||
447 | #include "hw/char/pl011.h" | ||
448 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c | ||
449 | index XXXXXXX..XXXXXXX 100644 | ||
450 | --- a/hw/arm/musicpal.c | ||
451 | +++ b/hw/arm/musicpal.c | ||
452 | @@ -XXX,XX +XXX,XX @@ | ||
453 | #include "qemu-common.h" | ||
454 | #include "cpu.h" | ||
455 | #include "hw/sysbus.h" | ||
456 | -#include "hw/arm/arm.h" | ||
457 | +#include "hw/arm/boot.h" | ||
458 | #include "net/net.h" | ||
459 | #include "sysemu/sysemu.h" | ||
460 | #include "hw/boards.h" | ||
461 | diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c | ||
462 | index XXXXXXX..XXXXXXX 100644 | ||
463 | --- a/hw/arm/netduino2.c | ||
464 | +++ b/hw/arm/netduino2.c | ||
465 | @@ -XXX,XX +XXX,XX @@ | ||
466 | #include "hw/boards.h" | ||
467 | #include "qemu/error-report.h" | ||
468 | #include "hw/arm/stm32f205_soc.h" | ||
469 | -#include "hw/arm/arm.h" | ||
470 | +#include "hw/arm/boot.h" | ||
471 | |||
472 | static void netduino2_init(MachineState *machine) | ||
473 | { | 130 | { |
474 | diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c | 131 | /* We just completed step of an insn. Move from Active-not-pending |
475 | index XXXXXXX..XXXXXXX 100644 | 132 | @@ -XXX,XX +XXX,XX @@ static void gen_step_complete_exception(DisasContext *s) |
476 | --- a/hw/arm/nrf51_soc.c | 133 | * of the exception, and our syndrome information is always correct. |
477 | +++ b/hw/arm/nrf51_soc.c | 134 | */ |
478 | @@ -XXX,XX +XXX,XX @@ | 135 | gen_ss_advance(s); |
479 | #include "qemu/osdep.h" | 136 | - gen_exception(EXCP_UDEF, syn_swstep(s->ss_same_el, 1, s->is_ldex), |
480 | #include "qapi/error.h" | 137 | - default_exception_el(s)); |
481 | #include "qemu-common.h" | 138 | + gen_swstep_exception(s, 1, s->is_ldex); |
482 | -#include "hw/arm/arm.h" | 139 | s->base.is_jmp = DISAS_NORETURN; |
483 | +#include "hw/arm/boot.h" | 140 | } |
484 | #include "hw/sysbus.h" | 141 | |
485 | #include "hw/boards.h" | 142 | @@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc) |
486 | #include "hw/misc/unimp.h" | 143 | * bits should be zero. |
487 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | 144 | */ |
488 | index XXXXXXX..XXXXXXX 100644 | 145 | assert(dc->base.num_insns == 1); |
489 | --- a/hw/arm/nseries.c | 146 | - gen_exception(EXCP_UDEF, syn_swstep(dc->ss_same_el, 0, 0), |
490 | +++ b/hw/arm/nseries.c | 147 | - default_exception_el(dc)); |
491 | @@ -XXX,XX +XXX,XX @@ | 148 | + gen_swstep_exception(dc, 0, 0); |
492 | #include "qemu/bswap.h" | 149 | dc->base.is_jmp = DISAS_NORETURN; |
493 | #include "sysemu/sysemu.h" | 150 | return true; |
494 | #include "hw/arm/omap.h" | 151 | } |
495 | -#include "hw/arm/arm.h" | ||
496 | +#include "hw/arm/boot.h" | ||
497 | #include "hw/irq.h" | ||
498 | #include "ui/console.h" | ||
499 | #include "hw/boards.h" | ||
500 | diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c | ||
501 | index XXXXXXX..XXXXXXX 100644 | ||
502 | --- a/hw/arm/omap1.c | ||
503 | +++ b/hw/arm/omap1.c | ||
504 | @@ -XXX,XX +XXX,XX @@ | ||
505 | #include "cpu.h" | ||
506 | #include "hw/boards.h" | ||
507 | #include "hw/hw.h" | ||
508 | -#include "hw/arm/arm.h" | ||
509 | +#include "hw/arm/boot.h" | ||
510 | #include "hw/arm/omap.h" | ||
511 | #include "sysemu/sysemu.h" | ||
512 | #include "hw/arm/soc_dma.h" | ||
513 | diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c | ||
514 | index XXXXXXX..XXXXXXX 100644 | ||
515 | --- a/hw/arm/omap2.c | ||
516 | +++ b/hw/arm/omap2.c | ||
517 | @@ -XXX,XX +XXX,XX @@ | ||
518 | #include "sysemu/qtest.h" | ||
519 | #include "hw/boards.h" | ||
520 | #include "hw/hw.h" | ||
521 | -#include "hw/arm/arm.h" | ||
522 | +#include "hw/arm/boot.h" | ||
523 | #include "hw/arm/omap.h" | ||
524 | #include "sysemu/sysemu.h" | ||
525 | #include "qemu/timer.h" | ||
526 | diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c | ||
527 | index XXXXXXX..XXXXXXX 100644 | ||
528 | --- a/hw/arm/omap_sx1.c | ||
529 | +++ b/hw/arm/omap_sx1.c | ||
530 | @@ -XXX,XX +XXX,XX @@ | ||
531 | #include "ui/console.h" | ||
532 | #include "hw/arm/omap.h" | ||
533 | #include "hw/boards.h" | ||
534 | -#include "hw/arm/arm.h" | ||
535 | +#include "hw/arm/boot.h" | ||
536 | #include "hw/block/flash.h" | ||
537 | #include "sysemu/qtest.h" | ||
538 | #include "exec/address-spaces.h" | ||
539 | diff --git a/hw/arm/palm.c b/hw/arm/palm.c | ||
540 | index XXXXXXX..XXXXXXX 100644 | ||
541 | --- a/hw/arm/palm.c | ||
542 | +++ b/hw/arm/palm.c | ||
543 | @@ -XXX,XX +XXX,XX @@ | ||
544 | #include "ui/console.h" | ||
545 | #include "hw/arm/omap.h" | ||
546 | #include "hw/boards.h" | ||
547 | -#include "hw/arm/arm.h" | ||
548 | +#include "hw/arm/boot.h" | ||
549 | #include "hw/input/tsc2xxx.h" | ||
550 | #include "hw/loader.h" | ||
551 | #include "exec/address-spaces.h" | ||
552 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
553 | index XXXXXXX..XXXXXXX 100644 | ||
554 | --- a/hw/arm/raspi.c | ||
555 | +++ b/hw/arm/raspi.c | ||
556 | @@ -XXX,XX +XXX,XX @@ | ||
557 | #include "qemu/error-report.h" | ||
558 | #include "hw/boards.h" | ||
559 | #include "hw/loader.h" | ||
560 | -#include "hw/arm/arm.h" | ||
561 | +#include "hw/arm/boot.h" | ||
562 | #include "sysemu/sysemu.h" | ||
563 | |||
564 | #define SMPBOOT_ADDR 0x300 /* this should leave enough space for ATAGS */ | ||
565 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c | ||
566 | index XXXXXXX..XXXXXXX 100644 | ||
567 | --- a/hw/arm/realview.c | ||
568 | +++ b/hw/arm/realview.c | ||
569 | @@ -XXX,XX +XXX,XX @@ | ||
570 | #include "qemu-common.h" | ||
571 | #include "cpu.h" | ||
572 | #include "hw/sysbus.h" | ||
573 | -#include "hw/arm/arm.h" | ||
574 | +#include "hw/arm/boot.h" | ||
575 | #include "hw/arm/primecell.h" | ||
576 | #include "hw/net/lan9118.h" | ||
577 | #include "hw/net/smc91c111.h" | ||
578 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | ||
579 | index XXXXXXX..XXXXXXX 100644 | ||
580 | --- a/hw/arm/spitz.c | ||
581 | +++ b/hw/arm/spitz.c | ||
582 | @@ -XXX,XX +XXX,XX @@ | ||
583 | #include "qapi/error.h" | ||
584 | #include "hw/hw.h" | ||
585 | #include "hw/arm/pxa.h" | ||
586 | -#include "hw/arm/arm.h" | ||
587 | +#include "hw/arm/boot.h" | ||
588 | #include "sysemu/sysemu.h" | ||
589 | #include "hw/pcmcia.h" | ||
590 | #include "hw/i2c/i2c.h" | ||
591 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | ||
592 | index XXXXXXX..XXXXXXX 100644 | ||
593 | --- a/hw/arm/stellaris.c | ||
594 | +++ b/hw/arm/stellaris.c | ||
595 | @@ -XXX,XX +XXX,XX @@ | ||
596 | #include "qapi/error.h" | ||
597 | #include "hw/sysbus.h" | ||
598 | #include "hw/ssi/ssi.h" | ||
599 | -#include "hw/arm/arm.h" | ||
600 | +#include "hw/arm/boot.h" | ||
601 | #include "qemu/timer.h" | ||
602 | #include "hw/i2c/i2c.h" | ||
603 | #include "net/net.h" | ||
604 | diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c | ||
605 | index XXXXXXX..XXXXXXX 100644 | ||
606 | --- a/hw/arm/stm32f205_soc.c | ||
607 | +++ b/hw/arm/stm32f205_soc.c | ||
608 | @@ -XXX,XX +XXX,XX @@ | ||
609 | #include "qemu/osdep.h" | ||
610 | #include "qapi/error.h" | ||
611 | #include "qemu-common.h" | ||
612 | -#include "hw/arm/arm.h" | ||
613 | +#include "hw/arm/boot.h" | ||
614 | #include "exec/address-spaces.h" | ||
615 | #include "hw/arm/stm32f205_soc.h" | ||
616 | |||
617 | diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c | ||
618 | index XXXXXXX..XXXXXXX 100644 | ||
619 | --- a/hw/arm/strongarm.c | ||
620 | +++ b/hw/arm/strongarm.c | ||
621 | @@ -XXX,XX +XXX,XX @@ | ||
622 | #include "hw/sysbus.h" | ||
623 | #include "strongarm.h" | ||
624 | #include "qemu/error-report.h" | ||
625 | -#include "hw/arm/arm.h" | ||
626 | +#include "hw/arm/boot.h" | ||
627 | #include "chardev/char-fe.h" | ||
628 | #include "chardev/char-serial.h" | ||
629 | #include "sysemu/sysemu.h" | ||
630 | diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c | ||
631 | index XXXXXXX..XXXXXXX 100644 | ||
632 | --- a/hw/arm/tosa.c | ||
633 | +++ b/hw/arm/tosa.c | ||
634 | @@ -XXX,XX +XXX,XX @@ | ||
635 | #include "qapi/error.h" | ||
636 | #include "hw/hw.h" | ||
637 | #include "hw/arm/pxa.h" | ||
638 | -#include "hw/arm/arm.h" | ||
639 | +#include "hw/arm/boot.h" | ||
640 | #include "hw/arm/sharpsl.h" | ||
641 | #include "hw/pcmcia.h" | ||
642 | #include "hw/boards.h" | ||
643 | diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c | ||
644 | index XXXXXXX..XXXXXXX 100644 | ||
645 | --- a/hw/arm/versatilepb.c | ||
646 | +++ b/hw/arm/versatilepb.c | ||
647 | @@ -XXX,XX +XXX,XX @@ | ||
648 | #include "qemu-common.h" | ||
649 | #include "cpu.h" | ||
650 | #include "hw/sysbus.h" | ||
651 | -#include "hw/arm/arm.h" | ||
652 | +#include "hw/arm/boot.h" | ||
653 | #include "hw/net/smc91c111.h" | ||
654 | #include "net/net.h" | ||
655 | #include "sysemu/sysemu.h" | ||
656 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
657 | index XXXXXXX..XXXXXXX 100644 | ||
658 | --- a/hw/arm/vexpress.c | ||
659 | +++ b/hw/arm/vexpress.c | ||
660 | @@ -XXX,XX +XXX,XX @@ | ||
661 | #include "qemu-common.h" | ||
662 | #include "cpu.h" | ||
663 | #include "hw/sysbus.h" | ||
664 | -#include "hw/arm/arm.h" | ||
665 | +#include "hw/arm/boot.h" | ||
666 | #include "hw/arm/primecell.h" | ||
667 | #include "hw/net/lan9118.h" | ||
668 | #include "hw/i2c/i2c.h" | ||
669 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
670 | index XXXXXXX..XXXXXXX 100644 | ||
671 | --- a/hw/arm/virt.c | ||
672 | +++ b/hw/arm/virt.c | ||
673 | @@ -XXX,XX +XXX,XX @@ | ||
674 | #include "qemu/option.h" | ||
675 | #include "qapi/error.h" | ||
676 | #include "hw/sysbus.h" | ||
677 | -#include "hw/arm/arm.h" | ||
678 | +#include "hw/arm/boot.h" | ||
679 | #include "hw/arm/primecell.h" | ||
680 | #include "hw/arm/virt.h" | ||
681 | #include "hw/block/flash.h" | ||
682 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c | ||
683 | index XXXXXXX..XXXXXXX 100644 | ||
684 | --- a/hw/arm/xilinx_zynq.c | ||
685 | +++ b/hw/arm/xilinx_zynq.c | ||
686 | @@ -XXX,XX +XXX,XX @@ | ||
687 | #include "qemu-common.h" | ||
688 | #include "cpu.h" | ||
689 | #include "hw/sysbus.h" | ||
690 | -#include "hw/arm/arm.h" | ||
691 | +#include "hw/arm/boot.h" | ||
692 | #include "net/net.h" | ||
693 | #include "exec/address-spaces.h" | ||
694 | #include "sysemu/sysemu.h" | ||
695 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | ||
696 | index XXXXXXX..XXXXXXX 100644 | ||
697 | --- a/hw/arm/xlnx-versal.c | ||
698 | +++ b/hw/arm/xlnx-versal.c | ||
699 | @@ -XXX,XX +XXX,XX @@ | ||
700 | #include "net/net.h" | ||
701 | #include "sysemu/sysemu.h" | ||
702 | #include "sysemu/kvm.h" | ||
703 | -#include "hw/arm/arm.h" | ||
704 | +#include "hw/arm/boot.h" | ||
705 | #include "kvm_arm.h" | ||
706 | #include "hw/misc/unimp.h" | ||
707 | #include "hw/intc/arm_gicv3_common.h" | ||
708 | diff --git a/hw/arm/z2.c b/hw/arm/z2.c | ||
709 | index XXXXXXX..XXXXXXX 100644 | ||
710 | --- a/hw/arm/z2.c | ||
711 | +++ b/hw/arm/z2.c | ||
712 | @@ -XXX,XX +XXX,XX @@ | ||
713 | #include "qemu/osdep.h" | ||
714 | #include "hw/hw.h" | ||
715 | #include "hw/arm/pxa.h" | ||
716 | -#include "hw/arm/arm.h" | ||
717 | +#include "hw/arm/boot.h" | ||
718 | #include "hw/i2c/i2c.h" | ||
719 | #include "hw/ssi/ssi.h" | ||
720 | #include "hw/boards.h" | ||
721 | -- | 152 | -- |
722 | 2.20.1 | 153 | 2.20.1 |
723 | 154 | ||
724 | 155 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | When generating an architectural single-step exception we were | ||
2 | routing it to the "default exception level", which is to say | ||
3 | the same exception level we execute at except that EL0 exceptions | ||
4 | go to EL1. This is incorrect because the debug exception level | ||
5 | can be configured by the guest for situations such as single | ||
6 | stepping of EL0 and EL1 code by EL2. | ||
1 | 7 | ||
8 | We have to track the target debug exception level in the TB | ||
9 | flags, because it is dependent on CPU state like HCR_EL2.TGE | ||
10 | and MDCR_EL2.TDE. (That we were previously calling the | ||
11 | arm_debug_target_el() function to determine dc->ss_same_el | ||
12 | is itself a bug, though one that would only have manifested | ||
13 | as incorrect syndrome information.) Since we are out of TB | ||
14 | flag bits unless we want to expand into the cs_base field, | ||
15 | we share some bits with the M-profile only HANDLER and | ||
16 | STACKCHECK bits, since only A-profile has this singlestep. | ||
17 | |||
18 | Fixes: https://bugs.launchpad.net/qemu/+bug/1838913 | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
21 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
22 | Message-id: 20190805130952.4415-3-peter.maydell@linaro.org | ||
23 | --- | ||
24 | target/arm/cpu.h | 5 +++++ | ||
25 | target/arm/translate.h | 15 +++++++++++---- | ||
26 | target/arm/helper.c | 6 ++++++ | ||
27 | target/arm/translate-a64.c | 2 +- | ||
28 | target/arm/translate.c | 4 +++- | ||
29 | 5 files changed, 26 insertions(+), 6 deletions(-) | ||
30 | |||
31 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/target/arm/cpu.h | ||
34 | +++ b/target/arm/cpu.h | ||
35 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, PSTATE_SS, 26, 1) | ||
36 | /* Target EL if we take a floating-point-disabled exception */ | ||
37 | FIELD(TBFLAG_ANY, FPEXC_EL, 24, 2) | ||
38 | FIELD(TBFLAG_ANY, BE_DATA, 23, 1) | ||
39 | +/* | ||
40 | + * For A-profile only, target EL for debug exceptions. | ||
41 | + * Note that this overlaps with the M-profile-only HANDLER and STACKCHECK bits. | ||
42 | + */ | ||
43 | +FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 21, 2) | ||
44 | |||
45 | /* Bit usage when in AArch32 state: */ | ||
46 | FIELD(TBFLAG_A32, THUMB, 0, 1) | ||
47 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/target/arm/translate.h | ||
50 | +++ b/target/arm/translate.h | ||
51 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | ||
52 | uint32_t svc_imm; | ||
53 | int aarch64; | ||
54 | int current_el; | ||
55 | + /* Debug target exception level for single-step exceptions */ | ||
56 | + int debug_target_el; | ||
57 | GHashTable *cp_regs; | ||
58 | uint64_t features; /* CPU features bits */ | ||
59 | /* Because unallocated encodings generate different exception syndrome | ||
60 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | ||
61 | * ie A64 LDX*, LDAX*, A32/T32 LDREX*, LDAEX*. | ||
62 | */ | ||
63 | bool is_ldex; | ||
64 | - /* True if a single-step exception will be taken to the current EL */ | ||
65 | - bool ss_same_el; | ||
66 | /* True if v8.3-PAuth is active. */ | ||
67 | bool pauth_active; | ||
68 | /* True with v8.5-BTI and SCTLR_ELx.BT* set. */ | ||
69 | @@ -XXX,XX +XXX,XX @@ static inline void gen_exception(int excp, uint32_t syndrome, | ||
70 | /* Generate an architectural singlestep exception */ | ||
71 | static inline void gen_swstep_exception(DisasContext *s, int isv, int ex) | ||
72 | { | ||
73 | - gen_exception(EXCP_UDEF, syn_swstep(s->ss_same_el, isv, ex), | ||
74 | - default_exception_el(s)); | ||
75 | + bool same_el = (s->debug_target_el == s->current_el); | ||
76 | + | ||
77 | + /* | ||
78 | + * If singlestep is targeting a lower EL than the current one, | ||
79 | + * then s->ss_active must be false and we can never get here. | ||
80 | + */ | ||
81 | + assert(s->debug_target_el >= s->current_el); | ||
82 | + | ||
83 | + gen_exception(EXCP_UDEF, syn_swstep(same_el, isv, ex), s->debug_target_el); | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
88 | index XXXXXXX..XXXXXXX 100644 | ||
89 | --- a/target/arm/helper.c | ||
90 | +++ b/target/arm/helper.c | ||
91 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
92 | } | ||
93 | } | ||
94 | |||
95 | + if (!arm_feature(env, ARM_FEATURE_M)) { | ||
96 | + int target_el = arm_debug_target_el(env); | ||
97 | + | ||
98 | + flags = FIELD_DP32(flags, TBFLAG_ANY, DEBUG_TARGET_EL, target_el); | ||
99 | + } | ||
100 | + | ||
101 | *pflags = flags; | ||
102 | *cs_base = 0; | ||
103 | } | ||
104 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | --- a/target/arm/translate-a64.c | ||
107 | +++ b/target/arm/translate-a64.c | ||
108 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
109 | dc->ss_active = FIELD_EX32(tb_flags, TBFLAG_ANY, SS_ACTIVE); | ||
110 | dc->pstate_ss = FIELD_EX32(tb_flags, TBFLAG_ANY, PSTATE_SS); | ||
111 | dc->is_ldex = false; | ||
112 | - dc->ss_same_el = (arm_debug_target_el(env) == dc->current_el); | ||
113 | + dc->debug_target_el = FIELD_EX32(tb_flags, TBFLAG_ANY, DEBUG_TARGET_EL); | ||
114 | |||
115 | /* Bound the number of insns to execute to those left on the page. */ | ||
116 | bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4; | ||
117 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
118 | index XXXXXXX..XXXXXXX 100644 | ||
119 | --- a/target/arm/translate.c | ||
120 | +++ b/target/arm/translate.c | ||
121 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
122 | dc->ss_active = FIELD_EX32(tb_flags, TBFLAG_ANY, SS_ACTIVE); | ||
123 | dc->pstate_ss = FIELD_EX32(tb_flags, TBFLAG_ANY, PSTATE_SS); | ||
124 | dc->is_ldex = false; | ||
125 | - dc->ss_same_el = false; /* Can't be true since EL_d must be AArch64 */ | ||
126 | + if (!arm_feature(env, ARM_FEATURE_M)) { | ||
127 | + dc->debug_target_el = FIELD_EX32(tb_flags, TBFLAG_ANY, DEBUG_TARGET_EL); | ||
128 | + } | ||
129 | |||
130 | dc->page_start = dc->base.pc_first & TARGET_PAGE_MASK; | ||
131 | |||
132 | -- | ||
133 | 2.20.1 | ||
134 | |||
135 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | This function is used in two different contexts, and it will be | ||
4 | clearer if the function is given the address to which it applies. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190807045335.1361-2-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/translate.c | 14 +++++++------- | ||
13 | 1 file changed, 7 insertions(+), 7 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate.c | ||
18 | +++ b/target/arm/translate.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
20 | } | ||
21 | } | ||
22 | |||
23 | -static bool thumb_insn_is_16bit(DisasContext *s, uint32_t insn) | ||
24 | +static bool thumb_insn_is_16bit(DisasContext *s, uint32_t pc, uint32_t insn) | ||
25 | { | ||
26 | - /* Return true if this is a 16 bit instruction. We must be precise | ||
27 | - * about this (matching the decode). We assume that s->pc still | ||
28 | - * points to the first 16 bits of the insn. | ||
29 | + /* | ||
30 | + * Return true if this is a 16 bit instruction. We must be precise | ||
31 | + * about this (matching the decode). | ||
32 | */ | ||
33 | if ((insn >> 11) < 0x1d) { | ||
34 | /* Definitely a 16-bit instruction */ | ||
35 | @@ -XXX,XX +XXX,XX @@ static bool thumb_insn_is_16bit(DisasContext *s, uint32_t insn) | ||
36 | return false; | ||
37 | } | ||
38 | |||
39 | - if ((insn >> 11) == 0x1e && s->pc - s->page_start < TARGET_PAGE_SIZE - 3) { | ||
40 | + if ((insn >> 11) == 0x1e && pc - s->page_start < TARGET_PAGE_SIZE - 3) { | ||
41 | /* 0b1111_0xxx_xxxx_xxxx : BL/BLX prefix, and the suffix | ||
42 | * is not on the next page; we merge this into a 32-bit | ||
43 | * insn. | ||
44 | @@ -XXX,XX +XXX,XX @@ static bool insn_crosses_page(CPUARMState *env, DisasContext *s) | ||
45 | */ | ||
46 | uint16_t insn = arm_lduw_code(env, s->pc, s->sctlr_b); | ||
47 | |||
48 | - return !thumb_insn_is_16bit(s, insn); | ||
49 | + return !thumb_insn_is_16bit(s, s->pc, insn); | ||
50 | } | ||
51 | |||
52 | static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
53 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
54 | } | ||
55 | |||
56 | insn = arm_lduw_code(env, dc->pc, dc->sctlr_b); | ||
57 | - is_16bit = thumb_insn_is_16bit(dc, insn); | ||
58 | + is_16bit = thumb_insn_is_16bit(dc, dc->pc, insn); | ||
59 | dc->pc += 2; | ||
60 | if (!is_16bit) { | ||
61 | uint32_t insn2 = arm_lduw_code(env, dc->pc, dc->sctlr_b); | ||
62 | -- | ||
63 | 2.20.1 | ||
64 | |||
65 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Richard Henderson <richard.henderson@linaro.org> | |
2 | |||
3 | Add a new field to retain the address of the instruction currently | ||
4 | being translated. The 32-bit uses are all within subroutines used | ||
5 | by a32 and t32. This will become less obvious when t16 support is | ||
6 | merged with a32+t32, and having a clear definition will help. | ||
7 | |||
8 | Convert aarch64 as well for consistency. Note that there is one | ||
9 | instance of a pre-assert fprintf that used the wrong value for the | ||
10 | address of the current instruction. | ||
11 | |||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Message-id: 20190807045335.1361-3-richard.henderson@linaro.org | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | --- | ||
18 | target/arm/translate-a64.h | 2 +- | ||
19 | target/arm/translate.h | 2 ++ | ||
20 | target/arm/translate-a64.c | 21 +++++++++++---------- | ||
21 | target/arm/translate.c | 14 ++++++++------ | ||
22 | 4 files changed, 22 insertions(+), 17 deletions(-) | ||
23 | |||
24 | diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/target/arm/translate-a64.h | ||
27 | +++ b/target/arm/translate-a64.h | ||
28 | @@ -XXX,XX +XXX,XX @@ void unallocated_encoding(DisasContext *s); | ||
29 | qemu_log_mask(LOG_UNIMP, \ | ||
30 | "%s:%d: unsupported instruction encoding 0x%08x " \ | ||
31 | "at pc=%016" PRIx64 "\n", \ | ||
32 | - __FILE__, __LINE__, insn, s->pc - 4); \ | ||
33 | + __FILE__, __LINE__, insn, s->pc_curr); \ | ||
34 | unallocated_encoding(s); \ | ||
35 | } while (0) | ||
36 | |||
37 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/translate.h | ||
40 | +++ b/target/arm/translate.h | ||
41 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | ||
42 | const ARMISARegisters *isar; | ||
43 | |||
44 | target_ulong pc; | ||
45 | + /* The address of the current instruction being translated. */ | ||
46 | + target_ulong pc_curr; | ||
47 | target_ulong page_start; | ||
48 | uint32_t insn; | ||
49 | /* Nonzero if this instruction has been conditionally skipped. */ | ||
50 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/target/arm/translate-a64.c | ||
53 | +++ b/target/arm/translate-a64.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static inline AArch64DecodeFn *lookup_disas_fn(const AArch64DecodeTable *table, | ||
55 | */ | ||
56 | static void disas_uncond_b_imm(DisasContext *s, uint32_t insn) | ||
57 | { | ||
58 | - uint64_t addr = s->pc + sextract32(insn, 0, 26) * 4 - 4; | ||
59 | + uint64_t addr = s->pc_curr + sextract32(insn, 0, 26) * 4; | ||
60 | |||
61 | if (insn & (1U << 31)) { | ||
62 | /* BL Branch with link */ | ||
63 | @@ -XXX,XX +XXX,XX @@ static void disas_comp_b_imm(DisasContext *s, uint32_t insn) | ||
64 | sf = extract32(insn, 31, 1); | ||
65 | op = extract32(insn, 24, 1); /* 0: CBZ; 1: CBNZ */ | ||
66 | rt = extract32(insn, 0, 5); | ||
67 | - addr = s->pc + sextract32(insn, 5, 19) * 4 - 4; | ||
68 | + addr = s->pc_curr + sextract32(insn, 5, 19) * 4; | ||
69 | |||
70 | tcg_cmp = read_cpu_reg(s, rt, sf); | ||
71 | label_match = gen_new_label(); | ||
72 | @@ -XXX,XX +XXX,XX @@ static void disas_test_b_imm(DisasContext *s, uint32_t insn) | ||
73 | |||
74 | bit_pos = (extract32(insn, 31, 1) << 5) | extract32(insn, 19, 5); | ||
75 | op = extract32(insn, 24, 1); /* 0: TBZ; 1: TBNZ */ | ||
76 | - addr = s->pc + sextract32(insn, 5, 14) * 4 - 4; | ||
77 | + addr = s->pc_curr + sextract32(insn, 5, 14) * 4; | ||
78 | rt = extract32(insn, 0, 5); | ||
79 | |||
80 | tcg_cmp = tcg_temp_new_i64(); | ||
81 | @@ -XXX,XX +XXX,XX @@ static void disas_cond_b_imm(DisasContext *s, uint32_t insn) | ||
82 | unallocated_encoding(s); | ||
83 | return; | ||
84 | } | ||
85 | - addr = s->pc + sextract32(insn, 5, 19) * 4 - 4; | ||
86 | + addr = s->pc_curr + sextract32(insn, 5, 19) * 4; | ||
87 | cond = extract32(insn, 0, 4); | ||
88 | |||
89 | reset_btype(s); | ||
90 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, | ||
91 | TCGv_i32 tcg_syn, tcg_isread; | ||
92 | uint32_t syndrome; | ||
93 | |||
94 | - gen_a64_set_pc_im(s->pc - 4); | ||
95 | + gen_a64_set_pc_im(s->pc_curr); | ||
96 | tmpptr = tcg_const_ptr(ri); | ||
97 | syndrome = syn_aa64_sysregtrap(op0, op1, op2, crn, crm, rt, isread); | ||
98 | tcg_syn = tcg_const_i32(syndrome); | ||
99 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
100 | /* The pre HVC helper handles cases when HVC gets trapped | ||
101 | * as an undefined insn by runtime configuration. | ||
102 | */ | ||
103 | - gen_a64_set_pc_im(s->pc - 4); | ||
104 | + gen_a64_set_pc_im(s->pc_curr); | ||
105 | gen_helper_pre_hvc(cpu_env); | ||
106 | gen_ss_advance(s); | ||
107 | gen_exception_insn(s, 0, EXCP_HVC, syn_aa64_hvc(imm16), 2); | ||
108 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
109 | unallocated_encoding(s); | ||
110 | break; | ||
111 | } | ||
112 | - gen_a64_set_pc_im(s->pc - 4); | ||
113 | + gen_a64_set_pc_im(s->pc_curr); | ||
114 | tmp = tcg_const_i32(syn_aa64_smc(imm16)); | ||
115 | gen_helper_pre_smc(cpu_env, tmp); | ||
116 | tcg_temp_free_i32(tmp); | ||
117 | @@ -XXX,XX +XXX,XX @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) | ||
118 | |||
119 | tcg_rt = cpu_reg(s, rt); | ||
120 | |||
121 | - clean_addr = tcg_const_i64((s->pc - 4) + imm); | ||
122 | + clean_addr = tcg_const_i64(s->pc_curr + imm); | ||
123 | if (is_vector) { | ||
124 | do_fp_ld(s, rt, clean_addr, size); | ||
125 | } else { | ||
126 | @@ -XXX,XX +XXX,XX @@ static void disas_pc_rel_adr(DisasContext *s, uint32_t insn) | ||
127 | offset = sextract64(insn, 5, 19); | ||
128 | offset = offset << 2 | extract32(insn, 29, 2); | ||
129 | rd = extract32(insn, 0, 5); | ||
130 | - base = s->pc - 4; | ||
131 | + base = s->pc_curr; | ||
132 | |||
133 | if (page) { | ||
134 | /* ADRP (page based) */ | ||
135 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) | ||
136 | break; | ||
137 | default: | ||
138 | fprintf(stderr, "%s: insn %#04x, fpop %#2x @ %#" PRIx64 "\n", | ||
139 | - __func__, insn, fpopcode, s->pc); | ||
140 | + __func__, insn, fpopcode, s->pc_curr); | ||
141 | g_assert_not_reached(); | ||
142 | } | ||
143 | |||
144 | @@ -XXX,XX +XXX,XX @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s) | ||
145 | { | ||
146 | uint32_t insn; | ||
147 | |||
148 | + s->pc_curr = s->pc; | ||
149 | insn = arm_ldl_code(env, s->pc, s->sctlr_b); | ||
150 | s->insn = insn; | ||
151 | s->pc += 4; | ||
152 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
153 | index XXXXXXX..XXXXXXX 100644 | ||
154 | --- a/target/arm/translate.c | ||
155 | +++ b/target/arm/translate.c | ||
156 | @@ -XXX,XX +XXX,XX @@ static inline void gen_hvc(DisasContext *s, int imm16) | ||
157 | * as an undefined insn by runtime configuration (ie before | ||
158 | * the insn really executes). | ||
159 | */ | ||
160 | - gen_set_pc_im(s, s->pc - 4); | ||
161 | + gen_set_pc_im(s, s->pc_curr); | ||
162 | gen_helper_pre_hvc(cpu_env); | ||
163 | /* Otherwise we will treat this as a real exception which | ||
164 | * happens after execution of the insn. (The distinction matters | ||
165 | @@ -XXX,XX +XXX,XX @@ static inline void gen_smc(DisasContext *s) | ||
166 | */ | ||
167 | TCGv_i32 tmp; | ||
168 | |||
169 | - gen_set_pc_im(s, s->pc - 4); | ||
170 | + gen_set_pc_im(s, s->pc_curr); | ||
171 | tmp = tcg_const_i32(syn_aa32_smc()); | ||
172 | gen_helper_pre_smc(cpu_env, tmp); | ||
173 | tcg_temp_free_i32(tmp); | ||
174 | @@ -XXX,XX +XXX,XX @@ static void gen_msr_banked(DisasContext *s, int r, int sysm, int rn) | ||
175 | |||
176 | /* Sync state because msr_banked() can raise exceptions */ | ||
177 | gen_set_condexec(s); | ||
178 | - gen_set_pc_im(s, s->pc - 4); | ||
179 | + gen_set_pc_im(s, s->pc_curr); | ||
180 | tcg_reg = load_reg(s, rn); | ||
181 | tcg_tgtmode = tcg_const_i32(tgtmode); | ||
182 | tcg_regno = tcg_const_i32(regno); | ||
183 | @@ -XXX,XX +XXX,XX @@ static void gen_mrs_banked(DisasContext *s, int r, int sysm, int rn) | ||
184 | |||
185 | /* Sync state because mrs_banked() can raise exceptions */ | ||
186 | gen_set_condexec(s); | ||
187 | - gen_set_pc_im(s, s->pc - 4); | ||
188 | + gen_set_pc_im(s, s->pc_curr); | ||
189 | tcg_reg = tcg_temp_new_i32(); | ||
190 | tcg_tgtmode = tcg_const_i32(tgtmode); | ||
191 | tcg_regno = tcg_const_i32(regno); | ||
192 | @@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) | ||
193 | } | ||
194 | |||
195 | gen_set_condexec(s); | ||
196 | - gen_set_pc_im(s, s->pc - 4); | ||
197 | + gen_set_pc_im(s, s->pc_curr); | ||
198 | tmpptr = tcg_const_ptr(ri); | ||
199 | tcg_syn = tcg_const_i32(syndrome); | ||
200 | tcg_isread = tcg_const_i32(isread); | ||
201 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, | ||
202 | tmp = tcg_const_i32(mode); | ||
203 | /* get_r13_banked() will raise an exception if called from System mode */ | ||
204 | gen_set_condexec(s); | ||
205 | - gen_set_pc_im(s, s->pc - 4); | ||
206 | + gen_set_pc_im(s, s->pc_curr); | ||
207 | gen_helper_get_r13_banked(addr, cpu_env, tmp); | ||
208 | tcg_temp_free_i32(tmp); | ||
209 | switch (amode) { | ||
210 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
211 | return; | ||
212 | } | ||
213 | |||
214 | + dc->pc_curr = dc->pc; | ||
215 | insn = arm_ldl_code(env, dc->pc, dc->sctlr_b); | ||
216 | dc->insn = insn; | ||
217 | dc->pc += 4; | ||
218 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
219 | return; | ||
220 | } | ||
221 | |||
222 | + dc->pc_curr = dc->pc; | ||
223 | insn = arm_lduw_code(env, dc->pc, dc->sctlr_b); | ||
224 | is_16bit = thumb_insn_is_16bit(dc, dc->pc, insn); | ||
225 | dc->pc += 2; | ||
226 | -- | ||
227 | 2.20.1 | ||
228 | |||
229 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Richard Henderson <richard.henderson@linaro.org> | |
2 | |||
3 | We currently have 3 different ways of computing the architectural | ||
4 | value of "PC" as seen in the ARM ARM. | ||
5 | |||
6 | The value of s->pc has been incremented past the current insn, | ||
7 | but that is all. Thus for a32, PC = s->pc + 4; for t32, PC = s->pc; | ||
8 | for t16, PC = s->pc + 2. These differing computations make it | ||
9 | impossible at present to unify the various code paths. | ||
10 | |||
11 | With the newly introduced s->pc_curr, we can compute the correct | ||
12 | value for all cases, using the formula given in the ARM ARM. | ||
13 | |||
14 | This changes the behaviour for load_reg() and load_reg_var() | ||
15 | when called with reg==15 from a 32-bit Thumb instruction: | ||
16 | previously they would have returned the incorrect value | ||
17 | of pc_curr + 6, and now they will return the architecturally | ||
18 | correct value of PC, which is pc_curr + 4. This will not | ||
19 | affect well-behaved guest software, because all of the places | ||
20 | we call these functions from T32 code are instructions where | ||
21 | using r15 is UNPREDICTABLE. Using the architectural PC value | ||
22 | here is more consistent with the T16 and A32 behaviour. | ||
23 | |||
24 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
25 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
26 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
27 | Message-id: 20190807045335.1361-4-richard.henderson@linaro.org | ||
28 | [PMM: added commit message note about UNPREDICTABLE T32 cases] | ||
29 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
30 | --- | ||
31 | target/arm/translate.c | 59 ++++++++++++++++-------------------------- | ||
32 | 1 file changed, 23 insertions(+), 36 deletions(-) | ||
33 | |||
34 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/target/arm/translate.c | ||
37 | +++ b/target/arm/translate.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static inline void store_cpu_offset(TCGv_i32 var, int offset) | ||
39 | #define store_cpu_field(var, name) \ | ||
40 | store_cpu_offset(var, offsetof(CPUARMState, name)) | ||
41 | |||
42 | +/* The architectural value of PC. */ | ||
43 | +static uint32_t read_pc(DisasContext *s) | ||
44 | +{ | ||
45 | + return s->pc_curr + (s->thumb ? 4 : 8); | ||
46 | +} | ||
47 | + | ||
48 | /* Set a variable to the value of a CPU register. */ | ||
49 | static void load_reg_var(DisasContext *s, TCGv_i32 var, int reg) | ||
50 | { | ||
51 | if (reg == 15) { | ||
52 | - uint32_t addr; | ||
53 | - /* normally, since we updated PC, we need only to add one insn */ | ||
54 | - if (s->thumb) | ||
55 | - addr = (long)s->pc + 2; | ||
56 | - else | ||
57 | - addr = (long)s->pc + 4; | ||
58 | - tcg_gen_movi_i32(var, addr); | ||
59 | + tcg_gen_movi_i32(var, read_pc(s)); | ||
60 | } else { | ||
61 | tcg_gen_mov_i32(var, cpu_R[reg]); | ||
62 | } | ||
63 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
64 | /* branch link and change to thumb (blx <offset>) */ | ||
65 | int32_t offset; | ||
66 | |||
67 | - val = (uint32_t)s->pc; | ||
68 | tmp = tcg_temp_new_i32(); | ||
69 | - tcg_gen_movi_i32(tmp, val); | ||
70 | + tcg_gen_movi_i32(tmp, s->pc); | ||
71 | store_reg(s, 14, tmp); | ||
72 | /* Sign-extend the 24-bit offset */ | ||
73 | offset = (((int32_t)insn) << 8) >> 8; | ||
74 | + val = read_pc(s); | ||
75 | /* offset * 4 + bit24 * 2 + (thumb bit) */ | ||
76 | val += (offset << 2) | ((insn >> 23) & 2) | 1; | ||
77 | - /* pipeline offset */ | ||
78 | - val += 4; | ||
79 | /* protected by ARCH(5); above, near the start of uncond block */ | ||
80 | gen_bx_im(s, val); | ||
81 | return; | ||
82 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
83 | } else { | ||
84 | /* store */ | ||
85 | if (i == 15) { | ||
86 | - /* special case: r15 = PC + 8 */ | ||
87 | - val = (long)s->pc + 4; | ||
88 | tmp = tcg_temp_new_i32(); | ||
89 | - tcg_gen_movi_i32(tmp, val); | ||
90 | + tcg_gen_movi_i32(tmp, read_pc(s)); | ||
91 | } else if (user) { | ||
92 | tmp = tcg_temp_new_i32(); | ||
93 | tmp2 = tcg_const_i32(i); | ||
94 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
95 | int32_t offset; | ||
96 | |||
97 | /* branch (and link) */ | ||
98 | - val = (int32_t)s->pc; | ||
99 | if (insn & (1 << 24)) { | ||
100 | tmp = tcg_temp_new_i32(); | ||
101 | - tcg_gen_movi_i32(tmp, val); | ||
102 | + tcg_gen_movi_i32(tmp, s->pc); | ||
103 | store_reg(s, 14, tmp); | ||
104 | } | ||
105 | offset = sextract32(insn << 2, 0, 26); | ||
106 | - val += offset + 4; | ||
107 | - gen_jmp(s, val); | ||
108 | + gen_jmp(s, read_pc(s) + offset); | ||
109 | } | ||
110 | break; | ||
111 | case 0xc: | ||
112 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
113 | tcg_temp_free_i32(addr); | ||
114 | } else if ((insn & (7 << 5)) == 0) { | ||
115 | /* Table Branch. */ | ||
116 | - if (rn == 15) { | ||
117 | - addr = tcg_temp_new_i32(); | ||
118 | - tcg_gen_movi_i32(addr, s->pc); | ||
119 | - } else { | ||
120 | - addr = load_reg(s, rn); | ||
121 | - } | ||
122 | + addr = load_reg(s, rn); | ||
123 | tmp = load_reg(s, rm); | ||
124 | tcg_gen_add_i32(addr, addr, tmp); | ||
125 | if (insn & (1 << 4)) { | ||
126 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
127 | } | ||
128 | tcg_temp_free_i32(addr); | ||
129 | tcg_gen_shli_i32(tmp, tmp, 1); | ||
130 | - tcg_gen_addi_i32(tmp, tmp, s->pc); | ||
131 | + tcg_gen_addi_i32(tmp, tmp, read_pc(s)); | ||
132 | store_reg(s, 15, tmp); | ||
133 | } else { | ||
134 | bool is_lasr = false; | ||
135 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
136 | tcg_gen_movi_i32(cpu_R[14], s->pc | 1); | ||
137 | } | ||
138 | |||
139 | - offset += s->pc; | ||
140 | + offset += read_pc(s); | ||
141 | if (insn & (1 << 12)) { | ||
142 | /* b/bl */ | ||
143 | gen_jmp(s, offset); | ||
144 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
145 | offset |= (insn & (1 << 11)) << 8; | ||
146 | |||
147 | /* jump to the offset */ | ||
148 | - gen_jmp(s, s->pc + offset); | ||
149 | + gen_jmp(s, read_pc(s) + offset); | ||
150 | } | ||
151 | } else { | ||
152 | /* | ||
153 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
154 | if (insn & (1 << 11)) { | ||
155 | rd = (insn >> 8) & 7; | ||
156 | /* load pc-relative. Bit 1 of PC is ignored. */ | ||
157 | - val = s->pc + 2 + ((insn & 0xff) * 4); | ||
158 | + val = read_pc(s) + ((insn & 0xff) * 4); | ||
159 | val &= ~(uint32_t)2; | ||
160 | addr = tcg_temp_new_i32(); | ||
161 | tcg_gen_movi_i32(addr, val); | ||
162 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
163 | } else { | ||
164 | /* PC. bit 1 is ignored. */ | ||
165 | tmp = tcg_temp_new_i32(); | ||
166 | - tcg_gen_movi_i32(tmp, (s->pc + 2) & ~(uint32_t)2); | ||
167 | + tcg_gen_movi_i32(tmp, read_pc(s) & ~(uint32_t)2); | ||
168 | } | ||
169 | val = (insn & 0xff) * 4; | ||
170 | tcg_gen_addi_i32(tmp, tmp, val); | ||
171 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
172 | tcg_gen_brcondi_i32(TCG_COND_NE, tmp, 0, s->condlabel); | ||
173 | tcg_temp_free_i32(tmp); | ||
174 | offset = ((insn & 0xf8) >> 2) | (insn & 0x200) >> 3; | ||
175 | - val = (uint32_t)s->pc + 2; | ||
176 | - val += offset; | ||
177 | - gen_jmp(s, val); | ||
178 | + gen_jmp(s, read_pc(s) + offset); | ||
179 | break; | ||
180 | |||
181 | case 15: /* IT, nop-hint. */ | ||
182 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
183 | arm_skip_unless(s, cond); | ||
184 | |||
185 | /* jump to the offset */ | ||
186 | - val = (uint32_t)s->pc + 2; | ||
187 | + val = read_pc(s); | ||
188 | offset = ((int32_t)insn << 24) >> 24; | ||
189 | val += offset << 1; | ||
190 | gen_jmp(s, val); | ||
191 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
192 | break; | ||
193 | } | ||
194 | /* unconditional branch */ | ||
195 | - val = (uint32_t)s->pc; | ||
196 | + val = read_pc(s); | ||
197 | offset = ((int32_t)insn << 21) >> 21; | ||
198 | - val += (offset << 1) + 2; | ||
199 | + val += offset << 1; | ||
200 | gen_jmp(s, val); | ||
201 | break; | ||
202 | |||
203 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
204 | /* 0b1111_0xxx_xxxx_xxxx : BL/BLX prefix */ | ||
205 | uint32_t uoffset = ((int32_t)insn << 21) >> 9; | ||
206 | |||
207 | - tcg_gen_movi_i32(cpu_R[14], s->pc + 2 + uoffset); | ||
208 | + tcg_gen_movi_i32(cpu_R[14], read_pc(s) + uoffset); | ||
209 | } | ||
210 | break; | ||
211 | } | ||
212 | -- | ||
213 | 2.20.1 | ||
214 | |||
215 | diff view generated by jsdifflib |
1 | The system_clock_scale global is used only by the armv7m systick | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | device; move the extern declaration to the armv7m_systick.h header, | 2 | |
3 | and expand the comment to explain what it is and that it should | 3 | Provide a common routine for the places that require ALIGN(PC, 4) |
4 | ideally be replaced with a different approach. | 4 | as the base address as opposed to plain PC. The two are always |
5 | 5 | the same for A32, but the difference is meaningful for thumb mode. | |
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Message-id: 20190807045335.1361-5-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190516163857.6430-2-peter.maydell@linaro.org | ||
10 | --- | 12 | --- |
11 | include/hw/arm/arm.h | 4 ---- | 13 | target/arm/translate-vfp.inc.c | 38 ++------ |
12 | include/hw/timer/armv7m_systick.h | 22 ++++++++++++++++++++++ | 14 | target/arm/translate.c | 166 +++++++++++++++------------------ |
13 | 2 files changed, 22 insertions(+), 4 deletions(-) | 15 | 2 files changed, 82 insertions(+), 122 deletions(-) |
14 | 16 | ||
15 | diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h | 17 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/include/hw/arm/arm.h | 19 | --- a/target/arm/translate-vfp.inc.c |
18 | +++ b/include/hw/arm/arm.h | 20 | +++ b/target/arm/translate-vfp.inc.c |
19 | @@ -XXX,XX +XXX,XX @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, | 21 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a) |
20 | const struct arm_boot_info *info, | 22 | offset = -offset; |
21 | hwaddr mvbar_addr); | 23 | } |
22 | 24 | ||
23 | -/* Multiplication factor to convert from system clock ticks to qemu timer | 25 | - if (s->thumb && a->rn == 15) { |
24 | - ticks. */ | 26 | - /* This is actually UNPREDICTABLE */ |
25 | -extern int system_clock_scale; | 27 | - addr = tcg_temp_new_i32(); |
26 | - | 28 | - tcg_gen_movi_i32(addr, s->pc & ~2); |
27 | #endif /* HW_ARM_H */ | 29 | - } else { |
28 | diff --git a/include/hw/timer/armv7m_systick.h b/include/hw/timer/armv7m_systick.h | 30 | - addr = load_reg(s, a->rn); |
31 | - } | ||
32 | - tcg_gen_addi_i32(addr, addr, offset); | ||
33 | + /* For thumb, use of PC is UNPREDICTABLE. */ | ||
34 | + addr = add_reg_for_lit(s, a->rn, offset); | ||
35 | tmp = tcg_temp_new_i32(); | ||
36 | if (a->l) { | ||
37 | gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); | ||
38 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_dp *a) | ||
39 | offset = -offset; | ||
40 | } | ||
41 | |||
42 | - if (s->thumb && a->rn == 15) { | ||
43 | - /* This is actually UNPREDICTABLE */ | ||
44 | - addr = tcg_temp_new_i32(); | ||
45 | - tcg_gen_movi_i32(addr, s->pc & ~2); | ||
46 | - } else { | ||
47 | - addr = load_reg(s, a->rn); | ||
48 | - } | ||
49 | - tcg_gen_addi_i32(addr, addr, offset); | ||
50 | + /* For thumb, use of PC is UNPREDICTABLE. */ | ||
51 | + addr = add_reg_for_lit(s, a->rn, offset); | ||
52 | tmp = tcg_temp_new_i64(); | ||
53 | if (a->l) { | ||
54 | gen_aa32_ld64(s, tmp, addr, get_mem_index(s)); | ||
55 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a) | ||
56 | return true; | ||
57 | } | ||
58 | |||
59 | - if (s->thumb && a->rn == 15) { | ||
60 | - /* This is actually UNPREDICTABLE */ | ||
61 | - addr = tcg_temp_new_i32(); | ||
62 | - tcg_gen_movi_i32(addr, s->pc & ~2); | ||
63 | - } else { | ||
64 | - addr = load_reg(s, a->rn); | ||
65 | - } | ||
66 | + /* For thumb, use of PC is UNPREDICTABLE. */ | ||
67 | + addr = add_reg_for_lit(s, a->rn, 0); | ||
68 | if (a->p) { | ||
69 | /* pre-decrement */ | ||
70 | tcg_gen_addi_i32(addr, addr, -(a->imm << 2)); | ||
71 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) | ||
72 | return true; | ||
73 | } | ||
74 | |||
75 | - if (s->thumb && a->rn == 15) { | ||
76 | - /* This is actually UNPREDICTABLE */ | ||
77 | - addr = tcg_temp_new_i32(); | ||
78 | - tcg_gen_movi_i32(addr, s->pc & ~2); | ||
79 | - } else { | ||
80 | - addr = load_reg(s, a->rn); | ||
81 | - } | ||
82 | + /* For thumb, use of PC is UNPREDICTABLE. */ | ||
83 | + addr = add_reg_for_lit(s, a->rn, 0); | ||
84 | if (a->p) { | ||
85 | /* pre-decrement */ | ||
86 | tcg_gen_addi_i32(addr, addr, -(a->imm << 2)); | ||
87 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | 88 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/include/hw/timer/armv7m_systick.h | 89 | --- a/target/arm/translate.c |
31 | +++ b/include/hw/timer/armv7m_systick.h | 90 | +++ b/target/arm/translate.c |
32 | @@ -XXX,XX +XXX,XX @@ typedef struct SysTickState { | 91 | @@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_reg(DisasContext *s, int reg) |
33 | qemu_irq irq; | 92 | return tmp; |
34 | } SysTickState; | 93 | } |
35 | 94 | ||
36 | +/* | 95 | +/* |
37 | + * Multiplication factor to convert from system clock ticks to qemu timer | 96 | + * Create a new temp, REG + OFS, except PC is ALIGN(PC, 4). |
38 | + * ticks. This should be set (by board code, usually) to a value | 97 | + * This is used for load/store for which use of PC implies (literal), |
39 | + * equal to NANOSECONDS_PER_SECOND / frq, where frq is the clock frequency | 98 | + * or ADD that implies ADR. |
40 | + * in Hz of the CPU. | ||
41 | + * | ||
42 | + * This value is used by the systick device when it is running in | ||
43 | + * its "use the CPU clock" mode (ie when SYST_CSR.CLKSOURCE == 1) to | ||
44 | + * set how fast the timer should tick. | ||
45 | + * | ||
46 | + * TODO: we should refactor this so that rather than using a global | ||
47 | + * we use a device property or something similar. This is complicated | ||
48 | + * because (a) the property would need to be plumbed through from the | ||
49 | + * board code down through various layers to the systick device | ||
50 | + * and (b) the property needs to be modifiable after realize, because | ||
51 | + * the stellaris board uses this to implement the behaviour where the | ||
52 | + * guest can reprogram the PLL registers to downclock the CPU, and the | ||
53 | + * systick device needs to react accordingly. Possibly this should | ||
54 | + * be deferred until we have a good API for modelling clock trees. | ||
55 | + */ | 99 | + */ |
56 | +extern int system_clock_scale; | 100 | +static TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs) |
101 | +{ | ||
102 | + TCGv_i32 tmp = tcg_temp_new_i32(); | ||
57 | + | 103 | + |
58 | #endif | 104 | + if (reg == 15) { |
105 | + tcg_gen_movi_i32(tmp, (read_pc(s) & ~3) + ofs); | ||
106 | + } else { | ||
107 | + tcg_gen_addi_i32(tmp, cpu_R[reg], ofs); | ||
108 | + } | ||
109 | + return tmp; | ||
110 | +} | ||
111 | + | ||
112 | /* Set a CPU register. The source must be a temporary and will be | ||
113 | marked as dead. */ | ||
114 | static void store_reg(DisasContext *s, int reg, TCGv_i32 var) | ||
115 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
116 | */ | ||
117 | bool wback = extract32(insn, 21, 1); | ||
118 | |||
119 | - if (rn == 15) { | ||
120 | - if (insn & (1 << 21)) { | ||
121 | - /* UNPREDICTABLE */ | ||
122 | - goto illegal_op; | ||
123 | - } | ||
124 | - addr = tcg_temp_new_i32(); | ||
125 | - tcg_gen_movi_i32(addr, s->pc & ~3); | ||
126 | - } else { | ||
127 | - addr = load_reg(s, rn); | ||
128 | + if (rn == 15 && (insn & (1 << 21))) { | ||
129 | + /* UNPREDICTABLE */ | ||
130 | + goto illegal_op; | ||
131 | } | ||
132 | + | ||
133 | + addr = add_reg_for_lit(s, rn, 0); | ||
134 | offset = (insn & 0xff) * 4; | ||
135 | if ((insn & (1 << 23)) == 0) { | ||
136 | offset = -offset; | ||
137 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
138 | store_reg(s, rd, tmp); | ||
139 | } else { | ||
140 | /* Add/sub 12-bit immediate. */ | ||
141 | - if (rn == 15) { | ||
142 | - offset = s->pc & ~(uint32_t)3; | ||
143 | - if (insn & (1 << 23)) | ||
144 | - offset -= imm; | ||
145 | - else | ||
146 | - offset += imm; | ||
147 | - tmp = tcg_temp_new_i32(); | ||
148 | - tcg_gen_movi_i32(tmp, offset); | ||
149 | - store_reg(s, rd, tmp); | ||
150 | + if (insn & (1 << 23)) { | ||
151 | + imm = -imm; | ||
152 | + } | ||
153 | + tmp = add_reg_for_lit(s, rn, imm); | ||
154 | + if (rn == 13 && rd == 13) { | ||
155 | + /* ADD SP, SP, imm or SUB SP, SP, imm */ | ||
156 | + store_sp_checked(s, tmp); | ||
157 | } else { | ||
158 | - tmp = load_reg(s, rn); | ||
159 | - if (insn & (1 << 23)) | ||
160 | - tcg_gen_subi_i32(tmp, tmp, imm); | ||
161 | - else | ||
162 | - tcg_gen_addi_i32(tmp, tmp, imm); | ||
163 | - if (rn == 13 && rd == 13) { | ||
164 | - /* ADD SP, SP, imm or SUB SP, SP, imm */ | ||
165 | - store_sp_checked(s, tmp); | ||
166 | - } else { | ||
167 | - store_reg(s, rd, tmp); | ||
168 | - } | ||
169 | + store_reg(s, rd, tmp); | ||
170 | } | ||
171 | } | ||
172 | } | ||
173 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
174 | } | ||
175 | } | ||
176 | memidx = get_mem_index(s); | ||
177 | - if (rn == 15) { | ||
178 | - addr = tcg_temp_new_i32(); | ||
179 | - /* PC relative. */ | ||
180 | - /* s->pc has already been incremented by 4. */ | ||
181 | - imm = s->pc & 0xfffffffc; | ||
182 | - if (insn & (1 << 23)) | ||
183 | - imm += insn & 0xfff; | ||
184 | - else | ||
185 | - imm -= insn & 0xfff; | ||
186 | - tcg_gen_movi_i32(addr, imm); | ||
187 | + imm = insn & 0xfff; | ||
188 | + if (insn & (1 << 23)) { | ||
189 | + /* PC relative or Positive offset. */ | ||
190 | + addr = add_reg_for_lit(s, rn, imm); | ||
191 | + } else if (rn == 15) { | ||
192 | + /* PC relative with negative offset. */ | ||
193 | + addr = add_reg_for_lit(s, rn, -imm); | ||
194 | } else { | ||
195 | addr = load_reg(s, rn); | ||
196 | - if (insn & (1 << 23)) { | ||
197 | - /* Positive offset. */ | ||
198 | - imm = insn & 0xfff; | ||
199 | - tcg_gen_addi_i32(addr, addr, imm); | ||
200 | - } else { | ||
201 | - imm = insn & 0xff; | ||
202 | - switch ((insn >> 8) & 0xf) { | ||
203 | - case 0x0: /* Shifted Register. */ | ||
204 | - shift = (insn >> 4) & 0xf; | ||
205 | - if (shift > 3) { | ||
206 | - tcg_temp_free_i32(addr); | ||
207 | - goto illegal_op; | ||
208 | - } | ||
209 | - tmp = load_reg(s, rm); | ||
210 | - if (shift) | ||
211 | - tcg_gen_shli_i32(tmp, tmp, shift); | ||
212 | - tcg_gen_add_i32(addr, addr, tmp); | ||
213 | - tcg_temp_free_i32(tmp); | ||
214 | - break; | ||
215 | - case 0xc: /* Negative offset. */ | ||
216 | - tcg_gen_addi_i32(addr, addr, -imm); | ||
217 | - break; | ||
218 | - case 0xe: /* User privilege. */ | ||
219 | - tcg_gen_addi_i32(addr, addr, imm); | ||
220 | - memidx = get_a32_user_mem_index(s); | ||
221 | - break; | ||
222 | - case 0x9: /* Post-decrement. */ | ||
223 | - imm = -imm; | ||
224 | - /* Fall through. */ | ||
225 | - case 0xb: /* Post-increment. */ | ||
226 | - postinc = 1; | ||
227 | - writeback = 1; | ||
228 | - break; | ||
229 | - case 0xd: /* Pre-decrement. */ | ||
230 | - imm = -imm; | ||
231 | - /* Fall through. */ | ||
232 | - case 0xf: /* Pre-increment. */ | ||
233 | - writeback = 1; | ||
234 | - break; | ||
235 | - default: | ||
236 | + imm = insn & 0xff; | ||
237 | + switch ((insn >> 8) & 0xf) { | ||
238 | + case 0x0: /* Shifted Register. */ | ||
239 | + shift = (insn >> 4) & 0xf; | ||
240 | + if (shift > 3) { | ||
241 | tcg_temp_free_i32(addr); | ||
242 | goto illegal_op; | ||
243 | } | ||
244 | + tmp = load_reg(s, rm); | ||
245 | + if (shift) { | ||
246 | + tcg_gen_shli_i32(tmp, tmp, shift); | ||
247 | + } | ||
248 | + tcg_gen_add_i32(addr, addr, tmp); | ||
249 | + tcg_temp_free_i32(tmp); | ||
250 | + break; | ||
251 | + case 0xc: /* Negative offset. */ | ||
252 | + tcg_gen_addi_i32(addr, addr, -imm); | ||
253 | + break; | ||
254 | + case 0xe: /* User privilege. */ | ||
255 | + tcg_gen_addi_i32(addr, addr, imm); | ||
256 | + memidx = get_a32_user_mem_index(s); | ||
257 | + break; | ||
258 | + case 0x9: /* Post-decrement. */ | ||
259 | + imm = -imm; | ||
260 | + /* Fall through. */ | ||
261 | + case 0xb: /* Post-increment. */ | ||
262 | + postinc = 1; | ||
263 | + writeback = 1; | ||
264 | + break; | ||
265 | + case 0xd: /* Pre-decrement. */ | ||
266 | + imm = -imm; | ||
267 | + /* Fall through. */ | ||
268 | + case 0xf: /* Pre-increment. */ | ||
269 | + writeback = 1; | ||
270 | + break; | ||
271 | + default: | ||
272 | + tcg_temp_free_i32(addr); | ||
273 | + goto illegal_op; | ||
274 | } | ||
275 | } | ||
276 | |||
277 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
278 | if (insn & (1 << 11)) { | ||
279 | rd = (insn >> 8) & 7; | ||
280 | /* load pc-relative. Bit 1 of PC is ignored. */ | ||
281 | - val = read_pc(s) + ((insn & 0xff) * 4); | ||
282 | - val &= ~(uint32_t)2; | ||
283 | - addr = tcg_temp_new_i32(); | ||
284 | - tcg_gen_movi_i32(addr, val); | ||
285 | + addr = add_reg_for_lit(s, 15, (insn & 0xff) * 4); | ||
286 | tmp = tcg_temp_new_i32(); | ||
287 | gen_aa32_ld32u_iss(s, tmp, addr, get_mem_index(s), | ||
288 | rd | ISSIs16Bit); | ||
289 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
290 | * - Add PC/SP (immediate) | ||
291 | */ | ||
292 | rd = (insn >> 8) & 7; | ||
293 | - if (insn & (1 << 11)) { | ||
294 | - /* SP */ | ||
295 | - tmp = load_reg(s, 13); | ||
296 | - } else { | ||
297 | - /* PC. bit 1 is ignored. */ | ||
298 | - tmp = tcg_temp_new_i32(); | ||
299 | - tcg_gen_movi_i32(tmp, read_pc(s) & ~(uint32_t)2); | ||
300 | - } | ||
301 | val = (insn & 0xff) * 4; | ||
302 | - tcg_gen_addi_i32(tmp, tmp, val); | ||
303 | + tmp = add_reg_for_lit(s, insn & (1 << 11) ? 13 : 15, val); | ||
304 | store_reg(s, rd, tmp); | ||
305 | break; | ||
306 | |||
59 | -- | 307 | -- |
60 | 2.20.1 | 308 | 2.20.1 |
61 | 309 | ||
62 | 310 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | The thumb bit has already been removed from s->pc, and is always even. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Message-id: 20190807045335.1361-6-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate.c | 10 +++++----- | ||
12 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate.c | ||
17 | +++ b/target/arm/translate.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, int offset, uint32_t syn) | ||
19 | /* Force a TB lookup after an instruction that changes the CPU state. */ | ||
20 | static inline void gen_lookup_tb(DisasContext *s) | ||
21 | { | ||
22 | - tcg_gen_movi_i32(cpu_R[15], s->pc & ~1); | ||
23 | + tcg_gen_movi_i32(cpu_R[15], s->pc); | ||
24 | s->base.is_jmp = DISAS_EXIT; | ||
25 | } | ||
26 | |||
27 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
28 | * self-modifying code correctly and also to take | ||
29 | * any pending interrupts immediately. | ||
30 | */ | ||
31 | - gen_goto_tb(s, 0, s->pc & ~1); | ||
32 | + gen_goto_tb(s, 0, s->pc); | ||
33 | return; | ||
34 | case 7: /* sb */ | ||
35 | if ((insn & 0xf) || !dc_isar_feature(aa32_sb, s)) { | ||
36 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
37 | * for TCG; MB and end the TB instead. | ||
38 | */ | ||
39 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); | ||
40 | - gen_goto_tb(s, 0, s->pc & ~1); | ||
41 | + gen_goto_tb(s, 0, s->pc); | ||
42 | return; | ||
43 | default: | ||
44 | goto illegal_op; | ||
45 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
46 | * and also to take any pending interrupts | ||
47 | * immediately. | ||
48 | */ | ||
49 | - gen_goto_tb(s, 0, s->pc & ~1); | ||
50 | + gen_goto_tb(s, 0, s->pc); | ||
51 | break; | ||
52 | case 7: /* sb */ | ||
53 | if ((insn & 0xf) || !dc_isar_feature(aa32_sb, s)) { | ||
54 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
55 | * for TCG; MB and end the TB instead. | ||
56 | */ | ||
57 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); | ||
58 | - gen_goto_tb(s, 0, s->pc & ~1); | ||
59 | + gen_goto_tb(s, 0, s->pc); | ||
60 | break; | ||
61 | default: | ||
62 | goto illegal_op; | ||
63 | -- | ||
64 | 2.20.1 | ||
65 | |||
66 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | We must update s->base.pc_next when we return from the translate_insn | ||
4 | hook to the main translator loop. By incrementing s->base.pc_next | ||
5 | immediately after reading the insn word, "pc_next" contains the address | ||
6 | of the next instruction throughout translation. | ||
7 | |||
8 | All remaining uses of s->pc are referencing the address of the next insn, | ||
9 | so this is now a simple global replacement. Remove the "s->pc" field. | ||
10 | |||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | Message-id: 20190807045335.1361-7-richard.henderson@linaro.org | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | --- | ||
17 | target/arm/translate.h | 1 - | ||
18 | target/arm/translate-a64.c | 51 +++++++++--------- | ||
19 | target/arm/translate.c | 103 ++++++++++++++++++------------------- | ||
20 | 3 files changed, 72 insertions(+), 83 deletions(-) | ||
21 | |||
22 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/target/arm/translate.h | ||
25 | +++ b/target/arm/translate.h | ||
26 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | ||
27 | DisasContextBase base; | ||
28 | const ARMISARegisters *isar; | ||
29 | |||
30 | - target_ulong pc; | ||
31 | /* The address of the current instruction being translated. */ | ||
32 | target_ulong pc_curr; | ||
33 | target_ulong page_start; | ||
34 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/target/arm/translate-a64.c | ||
37 | +++ b/target/arm/translate-a64.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal(int excp) | ||
39 | |||
40 | static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) | ||
41 | { | ||
42 | - gen_a64_set_pc_im(s->pc - offset); | ||
43 | + gen_a64_set_pc_im(s->base.pc_next - offset); | ||
44 | gen_exception_internal(excp); | ||
45 | s->base.is_jmp = DISAS_NORETURN; | ||
46 | } | ||
47 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) | ||
48 | static void gen_exception_insn(DisasContext *s, int offset, int excp, | ||
49 | uint32_t syndrome, uint32_t target_el) | ||
50 | { | ||
51 | - gen_a64_set_pc_im(s->pc - offset); | ||
52 | + gen_a64_set_pc_im(s->base.pc_next - offset); | ||
53 | gen_exception(excp, syndrome, target_el); | ||
54 | s->base.is_jmp = DISAS_NORETURN; | ||
55 | } | ||
56 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, int offset, | ||
57 | { | ||
58 | TCGv_i32 tcg_syn; | ||
59 | |||
60 | - gen_a64_set_pc_im(s->pc - offset); | ||
61 | + gen_a64_set_pc_im(s->base.pc_next - offset); | ||
62 | tcg_syn = tcg_const_i32(syndrome); | ||
63 | gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); | ||
64 | tcg_temp_free_i32(tcg_syn); | ||
65 | @@ -XXX,XX +XXX,XX @@ static void disas_uncond_b_imm(DisasContext *s, uint32_t insn) | ||
66 | |||
67 | if (insn & (1U << 31)) { | ||
68 | /* BL Branch with link */ | ||
69 | - tcg_gen_movi_i64(cpu_reg(s, 30), s->pc); | ||
70 | + tcg_gen_movi_i64(cpu_reg(s, 30), s->base.pc_next); | ||
71 | } | ||
72 | |||
73 | /* B Branch / BL Branch with link */ | ||
74 | @@ -XXX,XX +XXX,XX @@ static void disas_comp_b_imm(DisasContext *s, uint32_t insn) | ||
75 | tcg_gen_brcondi_i64(op ? TCG_COND_NE : TCG_COND_EQ, | ||
76 | tcg_cmp, 0, label_match); | ||
77 | |||
78 | - gen_goto_tb(s, 0, s->pc); | ||
79 | + gen_goto_tb(s, 0, s->base.pc_next); | ||
80 | gen_set_label(label_match); | ||
81 | gen_goto_tb(s, 1, addr); | ||
82 | } | ||
83 | @@ -XXX,XX +XXX,XX @@ static void disas_test_b_imm(DisasContext *s, uint32_t insn) | ||
84 | tcg_gen_brcondi_i64(op ? TCG_COND_NE : TCG_COND_EQ, | ||
85 | tcg_cmp, 0, label_match); | ||
86 | tcg_temp_free_i64(tcg_cmp); | ||
87 | - gen_goto_tb(s, 0, s->pc); | ||
88 | + gen_goto_tb(s, 0, s->base.pc_next); | ||
89 | gen_set_label(label_match); | ||
90 | gen_goto_tb(s, 1, addr); | ||
91 | } | ||
92 | @@ -XXX,XX +XXX,XX @@ static void disas_cond_b_imm(DisasContext *s, uint32_t insn) | ||
93 | /* genuinely conditional branches */ | ||
94 | TCGLabel *label_match = gen_new_label(); | ||
95 | arm_gen_test_cc(cond, label_match); | ||
96 | - gen_goto_tb(s, 0, s->pc); | ||
97 | + gen_goto_tb(s, 0, s->base.pc_next); | ||
98 | gen_set_label(label_match); | ||
99 | gen_goto_tb(s, 1, addr); | ||
100 | } else { | ||
101 | @@ -XXX,XX +XXX,XX @@ static void handle_sync(DisasContext *s, uint32_t insn, | ||
102 | * any pending interrupts immediately. | ||
103 | */ | ||
104 | reset_btype(s); | ||
105 | - gen_goto_tb(s, 0, s->pc); | ||
106 | + gen_goto_tb(s, 0, s->base.pc_next); | ||
107 | return; | ||
108 | |||
109 | case 7: /* SB */ | ||
110 | @@ -XXX,XX +XXX,XX @@ static void handle_sync(DisasContext *s, uint32_t insn, | ||
111 | * MB and end the TB instead. | ||
112 | */ | ||
113 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); | ||
114 | - gen_goto_tb(s, 0, s->pc); | ||
115 | + gen_goto_tb(s, 0, s->base.pc_next); | ||
116 | return; | ||
117 | |||
118 | default: | ||
119 | @@ -XXX,XX +XXX,XX @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) | ||
120 | gen_a64_set_pc(s, dst); | ||
121 | /* BLR also needs to load return address */ | ||
122 | if (opc == 1) { | ||
123 | - tcg_gen_movi_i64(cpu_reg(s, 30), s->pc); | ||
124 | + tcg_gen_movi_i64(cpu_reg(s, 30), s->base.pc_next); | ||
125 | } | ||
126 | break; | ||
127 | |||
128 | @@ -XXX,XX +XXX,XX @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) | ||
129 | gen_a64_set_pc(s, dst); | ||
130 | /* BLRAA also needs to load return address */ | ||
131 | if (opc == 9) { | ||
132 | - tcg_gen_movi_i64(cpu_reg(s, 30), s->pc); | ||
133 | + tcg_gen_movi_i64(cpu_reg(s, 30), s->base.pc_next); | ||
134 | } | ||
135 | break; | ||
136 | |||
137 | @@ -XXX,XX +XXX,XX @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s) | ||
138 | { | ||
139 | uint32_t insn; | ||
140 | |||
141 | - s->pc_curr = s->pc; | ||
142 | - insn = arm_ldl_code(env, s->pc, s->sctlr_b); | ||
143 | + s->pc_curr = s->base.pc_next; | ||
144 | + insn = arm_ldl_code(env, s->base.pc_next, s->sctlr_b); | ||
145 | s->insn = insn; | ||
146 | - s->pc += 4; | ||
147 | + s->base.pc_next += 4; | ||
148 | |||
149 | s->fp_access_checked = false; | ||
150 | |||
151 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
152 | int bound, core_mmu_idx; | ||
153 | |||
154 | dc->isar = &arm_cpu->isar; | ||
155 | - dc->pc = dc->base.pc_first; | ||
156 | dc->condjmp = 0; | ||
157 | |||
158 | dc->aarch64 = 1; | ||
159 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) | ||
160 | { | ||
161 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
162 | |||
163 | - tcg_gen_insn_start(dc->pc, 0, 0); | ||
164 | + tcg_gen_insn_start(dc->base.pc_next, 0, 0); | ||
165 | dc->insn_start = tcg_last_op(); | ||
166 | } | ||
167 | |||
168 | @@ -XXX,XX +XXX,XX @@ static bool aarch64_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, | ||
169 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
170 | |||
171 | if (bp->flags & BP_CPU) { | ||
172 | - gen_a64_set_pc_im(dc->pc); | ||
173 | + gen_a64_set_pc_im(dc->base.pc_next); | ||
174 | gen_helper_check_breakpoints(cpu_env); | ||
175 | /* End the TB early; it likely won't be executed */ | ||
176 | dc->base.is_jmp = DISAS_TOO_MANY; | ||
177 | @@ -XXX,XX +XXX,XX @@ static bool aarch64_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, | ||
178 | to for it to be properly cleared -- thus we | ||
179 | increment the PC here so that the logic setting | ||
180 | tb->size below does the right thing. */ | ||
181 | - dc->pc += 4; | ||
182 | + dc->base.pc_next += 4; | ||
183 | dc->base.is_jmp = DISAS_NORETURN; | ||
184 | } | ||
185 | |||
186 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
187 | disas_a64_insn(env, dc); | ||
188 | } | ||
189 | |||
190 | - dc->base.pc_next = dc->pc; | ||
191 | translator_loop_temp_check(&dc->base); | ||
192 | } | ||
193 | |||
194 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
195 | */ | ||
196 | switch (dc->base.is_jmp) { | ||
197 | default: | ||
198 | - gen_a64_set_pc_im(dc->pc); | ||
199 | + gen_a64_set_pc_im(dc->base.pc_next); | ||
200 | /* fall through */ | ||
201 | case DISAS_EXIT: | ||
202 | case DISAS_JUMP: | ||
203 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
204 | switch (dc->base.is_jmp) { | ||
205 | case DISAS_NEXT: | ||
206 | case DISAS_TOO_MANY: | ||
207 | - gen_goto_tb(dc, 1, dc->pc); | ||
208 | + gen_goto_tb(dc, 1, dc->base.pc_next); | ||
209 | break; | ||
210 | default: | ||
211 | case DISAS_UPDATE: | ||
212 | - gen_a64_set_pc_im(dc->pc); | ||
213 | + gen_a64_set_pc_im(dc->base.pc_next); | ||
214 | /* fall through */ | ||
215 | case DISAS_EXIT: | ||
216 | tcg_gen_exit_tb(NULL, 0); | ||
217 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
218 | case DISAS_SWI: | ||
219 | break; | ||
220 | case DISAS_WFE: | ||
221 | - gen_a64_set_pc_im(dc->pc); | ||
222 | + gen_a64_set_pc_im(dc->base.pc_next); | ||
223 | gen_helper_wfe(cpu_env); | ||
224 | break; | ||
225 | case DISAS_YIELD: | ||
226 | - gen_a64_set_pc_im(dc->pc); | ||
227 | + gen_a64_set_pc_im(dc->base.pc_next); | ||
228 | gen_helper_yield(cpu_env); | ||
229 | break; | ||
230 | case DISAS_WFI: | ||
231 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
232 | */ | ||
233 | TCGv_i32 tmp = tcg_const_i32(4); | ||
234 | |||
235 | - gen_a64_set_pc_im(dc->pc); | ||
236 | + gen_a64_set_pc_im(dc->base.pc_next); | ||
237 | gen_helper_wfi(cpu_env, tmp); | ||
238 | tcg_temp_free_i32(tmp); | ||
239 | /* The helper doesn't necessarily throw an exception, but we | ||
240 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
241 | } | ||
242 | } | ||
243 | } | ||
244 | - | ||
245 | - /* Functions above can change dc->pc, so re-align db->pc_next */ | ||
246 | - dc->base.pc_next = dc->pc; | ||
247 | } | ||
248 | |||
249 | static void aarch64_tr_disas_log(const DisasContextBase *dcbase, | ||
250 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
251 | index XXXXXXX..XXXXXXX 100644 | ||
252 | --- a/target/arm/translate.c | ||
253 | +++ b/target/arm/translate.c | ||
254 | @@ -XXX,XX +XXX,XX @@ static inline void gen_blxns(DisasContext *s, int rm) | ||
255 | * We do however need to set the PC, because the blxns helper reads it. | ||
256 | * The blxns helper may throw an exception. | ||
257 | */ | ||
258 | - gen_set_pc_im(s, s->pc); | ||
259 | + gen_set_pc_im(s, s->base.pc_next); | ||
260 | gen_helper_v7m_blxns(cpu_env, var); | ||
261 | tcg_temp_free_i32(var); | ||
262 | s->base.is_jmp = DISAS_EXIT; | ||
263 | @@ -XXX,XX +XXX,XX @@ static inline void gen_hvc(DisasContext *s, int imm16) | ||
264 | * for single stepping.) | ||
265 | */ | ||
266 | s->svc_imm = imm16; | ||
267 | - gen_set_pc_im(s, s->pc); | ||
268 | + gen_set_pc_im(s, s->base.pc_next); | ||
269 | s->base.is_jmp = DISAS_HVC; | ||
270 | } | ||
271 | |||
272 | @@ -XXX,XX +XXX,XX @@ static inline void gen_smc(DisasContext *s) | ||
273 | tmp = tcg_const_i32(syn_aa32_smc()); | ||
274 | gen_helper_pre_smc(cpu_env, tmp); | ||
275 | tcg_temp_free_i32(tmp); | ||
276 | - gen_set_pc_im(s, s->pc); | ||
277 | + gen_set_pc_im(s, s->base.pc_next); | ||
278 | s->base.is_jmp = DISAS_SMC; | ||
279 | } | ||
280 | |||
281 | static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) | ||
282 | { | ||
283 | gen_set_condexec(s); | ||
284 | - gen_set_pc_im(s, s->pc - offset); | ||
285 | + gen_set_pc_im(s, s->base.pc_next - offset); | ||
286 | gen_exception_internal(excp); | ||
287 | s->base.is_jmp = DISAS_NORETURN; | ||
288 | } | ||
289 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_insn(DisasContext *s, int offset, int excp, | ||
290 | int syn, uint32_t target_el) | ||
291 | { | ||
292 | gen_set_condexec(s); | ||
293 | - gen_set_pc_im(s, s->pc - offset); | ||
294 | + gen_set_pc_im(s, s->base.pc_next - offset); | ||
295 | gen_exception(excp, syn, target_el); | ||
296 | s->base.is_jmp = DISAS_NORETURN; | ||
297 | } | ||
298 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, int offset, uint32_t syn) | ||
299 | TCGv_i32 tcg_syn; | ||
300 | |||
301 | gen_set_condexec(s); | ||
302 | - gen_set_pc_im(s, s->pc - offset); | ||
303 | + gen_set_pc_im(s, s->base.pc_next - offset); | ||
304 | tcg_syn = tcg_const_i32(syn); | ||
305 | gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); | ||
306 | tcg_temp_free_i32(tcg_syn); | ||
307 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, int offset, uint32_t syn) | ||
308 | /* Force a TB lookup after an instruction that changes the CPU state. */ | ||
309 | static inline void gen_lookup_tb(DisasContext *s) | ||
310 | { | ||
311 | - tcg_gen_movi_i32(cpu_R[15], s->pc); | ||
312 | + tcg_gen_movi_i32(cpu_R[15], s->base.pc_next); | ||
313 | s->base.is_jmp = DISAS_EXIT; | ||
314 | } | ||
315 | |||
316 | @@ -XXX,XX +XXX,XX @@ static inline bool use_goto_tb(DisasContext *s, target_ulong dest) | ||
317 | { | ||
318 | #ifndef CONFIG_USER_ONLY | ||
319 | return (s->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) || | ||
320 | - ((s->pc - 1) & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK); | ||
321 | + ((s->base.pc_next - 1) & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK); | ||
322 | #else | ||
323 | return true; | ||
324 | #endif | ||
325 | @@ -XXX,XX +XXX,XX @@ static void gen_nop_hint(DisasContext *s, int val) | ||
326 | */ | ||
327 | case 1: /* yield */ | ||
328 | if (!(tb_cflags(s->base.tb) & CF_PARALLEL)) { | ||
329 | - gen_set_pc_im(s, s->pc); | ||
330 | + gen_set_pc_im(s, s->base.pc_next); | ||
331 | s->base.is_jmp = DISAS_YIELD; | ||
332 | } | ||
333 | break; | ||
334 | case 3: /* wfi */ | ||
335 | - gen_set_pc_im(s, s->pc); | ||
336 | + gen_set_pc_im(s, s->base.pc_next); | ||
337 | s->base.is_jmp = DISAS_WFI; | ||
338 | break; | ||
339 | case 2: /* wfe */ | ||
340 | if (!(tb_cflags(s->base.tb) & CF_PARALLEL)) { | ||
341 | - gen_set_pc_im(s, s->pc); | ||
342 | + gen_set_pc_im(s, s->base.pc_next); | ||
343 | s->base.is_jmp = DISAS_WFE; | ||
344 | } | ||
345 | break; | ||
346 | @@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) | ||
347 | if (isread) { | ||
348 | return 1; | ||
349 | } | ||
350 | - gen_set_pc_im(s, s->pc); | ||
351 | + gen_set_pc_im(s, s->base.pc_next); | ||
352 | s->base.is_jmp = DISAS_WFI; | ||
353 | return 0; | ||
354 | default: | ||
355 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
356 | * self-modifying code correctly and also to take | ||
357 | * any pending interrupts immediately. | ||
358 | */ | ||
359 | - gen_goto_tb(s, 0, s->pc); | ||
360 | + gen_goto_tb(s, 0, s->base.pc_next); | ||
361 | return; | ||
362 | case 7: /* sb */ | ||
363 | if ((insn & 0xf) || !dc_isar_feature(aa32_sb, s)) { | ||
364 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
365 | * for TCG; MB and end the TB instead. | ||
366 | */ | ||
367 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); | ||
368 | - gen_goto_tb(s, 0, s->pc); | ||
369 | + gen_goto_tb(s, 0, s->base.pc_next); | ||
370 | return; | ||
371 | default: | ||
372 | goto illegal_op; | ||
373 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
374 | int32_t offset; | ||
375 | |||
376 | tmp = tcg_temp_new_i32(); | ||
377 | - tcg_gen_movi_i32(tmp, s->pc); | ||
378 | + tcg_gen_movi_i32(tmp, s->base.pc_next); | ||
379 | store_reg(s, 14, tmp); | ||
380 | /* Sign-extend the 24-bit offset */ | ||
381 | offset = (((int32_t)insn) << 8) >> 8; | ||
382 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
383 | /* branch link/exchange thumb (blx) */ | ||
384 | tmp = load_reg(s, rm); | ||
385 | tmp2 = tcg_temp_new_i32(); | ||
386 | - tcg_gen_movi_i32(tmp2, s->pc); | ||
387 | + tcg_gen_movi_i32(tmp2, s->base.pc_next); | ||
388 | store_reg(s, 14, tmp2); | ||
389 | gen_bx(s, tmp); | ||
390 | break; | ||
391 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
392 | /* branch (and link) */ | ||
393 | if (insn & (1 << 24)) { | ||
394 | tmp = tcg_temp_new_i32(); | ||
395 | - tcg_gen_movi_i32(tmp, s->pc); | ||
396 | + tcg_gen_movi_i32(tmp, s->base.pc_next); | ||
397 | store_reg(s, 14, tmp); | ||
398 | } | ||
399 | offset = sextract32(insn << 2, 0, 26); | ||
400 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
401 | break; | ||
402 | case 0xf: | ||
403 | /* swi */ | ||
404 | - gen_set_pc_im(s, s->pc); | ||
405 | + gen_set_pc_im(s, s->base.pc_next); | ||
406 | s->svc_imm = extract32(insn, 0, 24); | ||
407 | s->base.is_jmp = DISAS_SWI; | ||
408 | break; | ||
409 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
410 | |||
411 | if (insn & (1 << 14)) { | ||
412 | /* Branch and link. */ | ||
413 | - tcg_gen_movi_i32(cpu_R[14], s->pc | 1); | ||
414 | + tcg_gen_movi_i32(cpu_R[14], s->base.pc_next | 1); | ||
415 | } | ||
416 | |||
417 | offset += read_pc(s); | ||
418 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
419 | * and also to take any pending interrupts | ||
420 | * immediately. | ||
421 | */ | ||
422 | - gen_goto_tb(s, 0, s->pc); | ||
423 | + gen_goto_tb(s, 0, s->base.pc_next); | ||
424 | break; | ||
425 | case 7: /* sb */ | ||
426 | if ((insn & 0xf) || !dc_isar_feature(aa32_sb, s)) { | ||
427 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
428 | * for TCG; MB and end the TB instead. | ||
429 | */ | ||
430 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); | ||
431 | - gen_goto_tb(s, 0, s->pc); | ||
432 | + gen_goto_tb(s, 0, s->base.pc_next); | ||
433 | break; | ||
434 | default: | ||
435 | goto illegal_op; | ||
436 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
437 | /* BLX/BX */ | ||
438 | tmp = load_reg(s, rm); | ||
439 | if (link) { | ||
440 | - val = (uint32_t)s->pc | 1; | ||
441 | + val = (uint32_t)s->base.pc_next | 1; | ||
442 | tmp2 = tcg_temp_new_i32(); | ||
443 | tcg_gen_movi_i32(tmp2, val); | ||
444 | store_reg(s, 14, tmp2); | ||
445 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
446 | |||
447 | if (cond == 0xf) { | ||
448 | /* swi */ | ||
449 | - gen_set_pc_im(s, s->pc); | ||
450 | + gen_set_pc_im(s, s->base.pc_next); | ||
451 | s->svc_imm = extract32(insn, 0, 8); | ||
452 | s->base.is_jmp = DISAS_SWI; | ||
453 | break; | ||
454 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
455 | tcg_gen_andi_i32(tmp, tmp, 0xfffffffc); | ||
456 | |||
457 | tmp2 = tcg_temp_new_i32(); | ||
458 | - tcg_gen_movi_i32(tmp2, s->pc | 1); | ||
459 | + tcg_gen_movi_i32(tmp2, s->base.pc_next | 1); | ||
460 | store_reg(s, 14, tmp2); | ||
461 | gen_bx(s, tmp); | ||
462 | break; | ||
463 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
464 | tcg_gen_addi_i32(tmp, tmp, offset); | ||
465 | |||
466 | tmp2 = tcg_temp_new_i32(); | ||
467 | - tcg_gen_movi_i32(tmp2, s->pc | 1); | ||
468 | + tcg_gen_movi_i32(tmp2, s->base.pc_next | 1); | ||
469 | store_reg(s, 14, tmp2); | ||
470 | gen_bx(s, tmp); | ||
471 | } else { | ||
472 | @@ -XXX,XX +XXX,XX @@ undef: | ||
473 | |||
474 | static bool insn_crosses_page(CPUARMState *env, DisasContext *s) | ||
475 | { | ||
476 | - /* Return true if the insn at dc->pc might cross a page boundary. | ||
477 | + /* Return true if the insn at dc->base.pc_next might cross a page boundary. | ||
478 | * (False positives are OK, false negatives are not.) | ||
479 | * We know this is a Thumb insn, and our caller ensures we are | ||
480 | - * only called if dc->pc is less than 4 bytes from the page | ||
481 | + * only called if dc->base.pc_next is less than 4 bytes from the page | ||
482 | * boundary, so we cross the page if the first 16 bits indicate | ||
483 | * that this is a 32 bit insn. | ||
484 | */ | ||
485 | - uint16_t insn = arm_lduw_code(env, s->pc, s->sctlr_b); | ||
486 | + uint16_t insn = arm_lduw_code(env, s->base.pc_next, s->sctlr_b); | ||
487 | |||
488 | - return !thumb_insn_is_16bit(s, s->pc, insn); | ||
489 | + return !thumb_insn_is_16bit(s, s->base.pc_next, insn); | ||
490 | } | ||
491 | |||
492 | static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
493 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
494 | uint32_t condexec, core_mmu_idx; | ||
495 | |||
496 | dc->isar = &cpu->isar; | ||
497 | - dc->pc = dc->base.pc_first; | ||
498 | dc->condjmp = 0; | ||
499 | |||
500 | dc->aarch64 = 0; | ||
501 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) | ||
502 | { | ||
503 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
504 | |||
505 | - tcg_gen_insn_start(dc->pc, | ||
506 | + tcg_gen_insn_start(dc->base.pc_next, | ||
507 | (dc->condexec_cond << 4) | (dc->condexec_mask >> 1), | ||
508 | 0); | ||
509 | dc->insn_start = tcg_last_op(); | ||
510 | @@ -XXX,XX +XXX,XX @@ static bool arm_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, | ||
511 | |||
512 | if (bp->flags & BP_CPU) { | ||
513 | gen_set_condexec(dc); | ||
514 | - gen_set_pc_im(dc, dc->pc); | ||
515 | + gen_set_pc_im(dc, dc->base.pc_next); | ||
516 | gen_helper_check_breakpoints(cpu_env); | ||
517 | /* End the TB early; it's likely not going to be executed */ | ||
518 | dc->base.is_jmp = DISAS_TOO_MANY; | ||
519 | @@ -XXX,XX +XXX,XX @@ static bool arm_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, | ||
520 | tb->size below does the right thing. */ | ||
521 | /* TODO: Advance PC by correct instruction length to | ||
522 | * avoid disassembler error messages */ | ||
523 | - dc->pc += 2; | ||
524 | + dc->base.pc_next += 2; | ||
525 | dc->base.is_jmp = DISAS_NORETURN; | ||
526 | } | ||
527 | |||
528 | @@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc) | ||
529 | { | ||
530 | #ifdef CONFIG_USER_ONLY | ||
531 | /* Intercept jump to the magic kernel page. */ | ||
532 | - if (dc->pc >= 0xffff0000) { | ||
533 | + if (dc->base.pc_next >= 0xffff0000) { | ||
534 | /* We always get here via a jump, so know we are not in a | ||
535 | conditional execution block. */ | ||
536 | gen_exception_internal(EXCP_KERNEL_TRAP); | ||
537 | @@ -XXX,XX +XXX,XX @@ static void arm_post_translate_insn(DisasContext *dc) | ||
538 | gen_set_label(dc->condlabel); | ||
539 | dc->condjmp = 0; | ||
540 | } | ||
541 | - dc->base.pc_next = dc->pc; | ||
542 | translator_loop_temp_check(&dc->base); | ||
543 | } | ||
544 | |||
545 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
546 | return; | ||
547 | } | ||
548 | |||
549 | - dc->pc_curr = dc->pc; | ||
550 | - insn = arm_ldl_code(env, dc->pc, dc->sctlr_b); | ||
551 | + dc->pc_curr = dc->base.pc_next; | ||
552 | + insn = arm_ldl_code(env, dc->base.pc_next, dc->sctlr_b); | ||
553 | dc->insn = insn; | ||
554 | - dc->pc += 4; | ||
555 | + dc->base.pc_next += 4; | ||
556 | disas_arm_insn(dc, insn); | ||
557 | |||
558 | arm_post_translate_insn(dc); | ||
559 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
560 | return; | ||
561 | } | ||
562 | |||
563 | - dc->pc_curr = dc->pc; | ||
564 | - insn = arm_lduw_code(env, dc->pc, dc->sctlr_b); | ||
565 | - is_16bit = thumb_insn_is_16bit(dc, dc->pc, insn); | ||
566 | - dc->pc += 2; | ||
567 | + dc->pc_curr = dc->base.pc_next; | ||
568 | + insn = arm_lduw_code(env, dc->base.pc_next, dc->sctlr_b); | ||
569 | + is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn); | ||
570 | + dc->base.pc_next += 2; | ||
571 | if (!is_16bit) { | ||
572 | - uint32_t insn2 = arm_lduw_code(env, dc->pc, dc->sctlr_b); | ||
573 | + uint32_t insn2 = arm_lduw_code(env, dc->base.pc_next, dc->sctlr_b); | ||
574 | |||
575 | insn = insn << 16 | insn2; | ||
576 | - dc->pc += 2; | ||
577 | + dc->base.pc_next += 2; | ||
578 | } | ||
579 | dc->insn = insn; | ||
580 | |||
581 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
582 | * but isn't very efficient). | ||
583 | */ | ||
584 | if (dc->base.is_jmp == DISAS_NEXT | ||
585 | - && (dc->pc - dc->page_start >= TARGET_PAGE_SIZE | ||
586 | - || (dc->pc - dc->page_start >= TARGET_PAGE_SIZE - 3 | ||
587 | + && (dc->base.pc_next - dc->page_start >= TARGET_PAGE_SIZE | ||
588 | + || (dc->base.pc_next - dc->page_start >= TARGET_PAGE_SIZE - 3 | ||
589 | && insn_crosses_page(env, dc)))) { | ||
590 | dc->base.is_jmp = DISAS_TOO_MANY; | ||
591 | } | ||
592 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
593 | case DISAS_NEXT: | ||
594 | case DISAS_TOO_MANY: | ||
595 | case DISAS_UPDATE: | ||
596 | - gen_set_pc_im(dc, dc->pc); | ||
597 | + gen_set_pc_im(dc, dc->base.pc_next); | ||
598 | /* fall through */ | ||
599 | default: | ||
600 | /* FIXME: Single stepping a WFI insn will not halt the CPU. */ | ||
601 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
602 | switch(dc->base.is_jmp) { | ||
603 | case DISAS_NEXT: | ||
604 | case DISAS_TOO_MANY: | ||
605 | - gen_goto_tb(dc, 1, dc->pc); | ||
606 | + gen_goto_tb(dc, 1, dc->base.pc_next); | ||
607 | break; | ||
608 | case DISAS_JUMP: | ||
609 | gen_goto_ptr(); | ||
610 | break; | ||
611 | case DISAS_UPDATE: | ||
612 | - gen_set_pc_im(dc, dc->pc); | ||
613 | + gen_set_pc_im(dc, dc->base.pc_next); | ||
614 | /* fall through */ | ||
615 | default: | ||
616 | /* indicate that the hash table must be used to find the next TB */ | ||
617 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
618 | gen_set_label(dc->condlabel); | ||
619 | gen_set_condexec(dc); | ||
620 | if (unlikely(is_singlestepping(dc))) { | ||
621 | - gen_set_pc_im(dc, dc->pc); | ||
622 | + gen_set_pc_im(dc, dc->base.pc_next); | ||
623 | gen_singlestep_exception(dc); | ||
624 | } else { | ||
625 | - gen_goto_tb(dc, 1, dc->pc); | ||
626 | + gen_goto_tb(dc, 1, dc->base.pc_next); | ||
627 | } | ||
628 | } | ||
629 | - | ||
630 | - /* Functions above can change dc->pc, so re-align db->pc_next */ | ||
631 | - dc->base.pc_next = dc->pc; | ||
632 | } | ||
633 | |||
634 | static void arm_tr_disas_log(const DisasContextBase *dcbase, CPUState *cpu) | ||
635 | -- | ||
636 | 2.20.1 | ||
637 | |||
638 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Richard Henderson <richard.henderson@linaro.org> | |
2 | |||
3 | The offset is variable depending on the instruction set, whereas | ||
4 | we have stored values for the current pc and the next pc. Passing | ||
5 | in the actual value is clearer in intent. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Message-id: 20190807045335.1361-8-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | target/arm/translate-a64.c | 25 ++++++++++++++----------- | ||
14 | target/arm/translate-vfp.inc.c | 6 +++--- | ||
15 | target/arm/translate.c | 31 ++++++++++++++++--------------- | ||
16 | 3 files changed, 33 insertions(+), 29 deletions(-) | ||
17 | |||
18 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/translate-a64.c | ||
21 | +++ b/target/arm/translate-a64.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) | ||
23 | s->base.is_jmp = DISAS_NORETURN; | ||
24 | } | ||
25 | |||
26 | -static void gen_exception_insn(DisasContext *s, int offset, int excp, | ||
27 | +static void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, | ||
28 | uint32_t syndrome, uint32_t target_el) | ||
29 | { | ||
30 | - gen_a64_set_pc_im(s->base.pc_next - offset); | ||
31 | + gen_a64_set_pc_im(pc); | ||
32 | gen_exception(excp, syndrome, target_el); | ||
33 | s->base.is_jmp = DISAS_NORETURN; | ||
34 | } | ||
35 | @@ -XXX,XX +XXX,XX @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest) | ||
36 | void unallocated_encoding(DisasContext *s) | ||
37 | { | ||
38 | /* Unallocated and reserved encodings are uncategorized */ | ||
39 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), | ||
40 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
41 | default_exception_el(s)); | ||
42 | } | ||
43 | |||
44 | @@ -XXX,XX +XXX,XX @@ static inline bool fp_access_check(DisasContext *s) | ||
45 | return true; | ||
46 | } | ||
47 | |||
48 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_fp_access_trap(1, 0xe, false), | ||
49 | - s->fp_excp_el); | ||
50 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
51 | + syn_fp_access_trap(1, 0xe, false), s->fp_excp_el); | ||
52 | return false; | ||
53 | } | ||
54 | |||
55 | @@ -XXX,XX +XXX,XX @@ static inline bool fp_access_check(DisasContext *s) | ||
56 | bool sve_access_check(DisasContext *s) | ||
57 | { | ||
58 | if (s->sve_excp_el) { | ||
59 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_sve_access_trap(), | ||
60 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_sve_access_trap(), | ||
61 | s->sve_excp_el); | ||
62 | return false; | ||
63 | } | ||
64 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
65 | switch (op2_ll) { | ||
66 | case 1: /* SVC */ | ||
67 | gen_ss_advance(s); | ||
68 | - gen_exception_insn(s, 0, EXCP_SWI, syn_aa64_svc(imm16), | ||
69 | - default_exception_el(s)); | ||
70 | + gen_exception_insn(s, s->base.pc_next, EXCP_SWI, | ||
71 | + syn_aa64_svc(imm16), default_exception_el(s)); | ||
72 | break; | ||
73 | case 2: /* HVC */ | ||
74 | if (s->current_el == 0) { | ||
75 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
76 | gen_a64_set_pc_im(s->pc_curr); | ||
77 | gen_helper_pre_hvc(cpu_env); | ||
78 | gen_ss_advance(s); | ||
79 | - gen_exception_insn(s, 0, EXCP_HVC, syn_aa64_hvc(imm16), 2); | ||
80 | + gen_exception_insn(s, s->base.pc_next, EXCP_HVC, | ||
81 | + syn_aa64_hvc(imm16), 2); | ||
82 | break; | ||
83 | case 3: /* SMC */ | ||
84 | if (s->current_el == 0) { | ||
85 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
86 | gen_helper_pre_smc(cpu_env, tmp); | ||
87 | tcg_temp_free_i32(tmp); | ||
88 | gen_ss_advance(s); | ||
89 | - gen_exception_insn(s, 0, EXCP_SMC, syn_aa64_smc(imm16), 3); | ||
90 | + gen_exception_insn(s, s->base.pc_next, EXCP_SMC, | ||
91 | + syn_aa64_smc(imm16), 3); | ||
92 | break; | ||
93 | default: | ||
94 | unallocated_encoding(s); | ||
95 | @@ -XXX,XX +XXX,XX @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s) | ||
96 | if (s->btype != 0 | ||
97 | && s->guarded_page | ||
98 | && !btype_destination_ok(insn, s->bt, s->btype)) { | ||
99 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_btitrap(s->btype), | ||
100 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
101 | + syn_btitrap(s->btype), | ||
102 | default_exception_el(s)); | ||
103 | return; | ||
104 | } | ||
105 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c | ||
106 | index XXXXXXX..XXXXXXX 100644 | ||
107 | --- a/target/arm/translate-vfp.inc.c | ||
108 | +++ b/target/arm/translate-vfp.inc.c | ||
109 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) | ||
110 | { | ||
111 | if (s->fp_excp_el) { | ||
112 | if (arm_dc_feature(s, ARM_FEATURE_M)) { | ||
113 | - gen_exception_insn(s, 4, EXCP_NOCP, syn_uncategorized(), | ||
114 | + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, syn_uncategorized(), | ||
115 | s->fp_excp_el); | ||
116 | } else { | ||
117 | - gen_exception_insn(s, 4, EXCP_UDEF, | ||
118 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
119 | syn_fp_access_trap(1, 0xe, false), | ||
120 | s->fp_excp_el); | ||
121 | } | ||
122 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) | ||
123 | |||
124 | if (!s->vfp_enabled && !ignore_vfp_enabled) { | ||
125 | assert(!arm_dc_feature(s, ARM_FEATURE_M)); | ||
126 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), | ||
127 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
128 | default_exception_el(s)); | ||
129 | return false; | ||
130 | } | ||
131 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
132 | index XXXXXXX..XXXXXXX 100644 | ||
133 | --- a/target/arm/translate.c | ||
134 | +++ b/target/arm/translate.c | ||
135 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) | ||
136 | s->base.is_jmp = DISAS_NORETURN; | ||
137 | } | ||
138 | |||
139 | -static void gen_exception_insn(DisasContext *s, int offset, int excp, | ||
140 | +static void gen_exception_insn(DisasContext *s, uint32_t pc, int excp, | ||
141 | int syn, uint32_t target_el) | ||
142 | { | ||
143 | gen_set_condexec(s); | ||
144 | - gen_set_pc_im(s, s->base.pc_next - offset); | ||
145 | + gen_set_pc_im(s, pc); | ||
146 | gen_exception(excp, syn, target_el); | ||
147 | s->base.is_jmp = DISAS_NORETURN; | ||
148 | } | ||
149 | @@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm) | ||
150 | return; | ||
151 | } | ||
152 | |||
153 | - gen_exception_insn(s, s->thumb ? 2 : 4, EXCP_UDEF, syn_uncategorized(), | ||
154 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
155 | default_exception_el(s)); | ||
156 | } | ||
157 | |||
158 | @@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn, | ||
159 | |||
160 | undef: | ||
161 | /* If we get here then some access check did not pass */ | ||
162 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), exc_target); | ||
163 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
164 | + syn_uncategorized(), exc_target); | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn) | ||
169 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | ||
170 | */ | ||
171 | if (s->fp_excp_el) { | ||
172 | - gen_exception_insn(s, 4, EXCP_UDEF, | ||
173 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
174 | syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
175 | return 0; | ||
176 | } | ||
177 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | ||
178 | * for attempts to execute invalid vfp/neon encodings with FP disabled. | ||
179 | */ | ||
180 | if (s->fp_excp_el) { | ||
181 | - gen_exception_insn(s, 4, EXCP_UDEF, | ||
182 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
183 | syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
184 | return 0; | ||
185 | } | ||
186 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) | ||
187 | } | ||
188 | |||
189 | if (s->fp_excp_el) { | ||
190 | - gen_exception_insn(s, 4, EXCP_UDEF, | ||
191 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
192 | syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
193 | return 0; | ||
194 | } | ||
195 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) | ||
196 | off_rm = vfp_reg_offset(0, rm); | ||
197 | } | ||
198 | if (s->fp_excp_el) { | ||
199 | - gen_exception_insn(s, 4, EXCP_UDEF, | ||
200 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, | ||
201 | syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); | ||
202 | return 0; | ||
203 | } | ||
204 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, | ||
205 | * For the UNPREDICTABLE cases we choose to UNDEF. | ||
206 | */ | ||
207 | if (s->current_el == 1 && !s->ns && mode == ARM_CPU_MODE_MON) { | ||
208 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), 3); | ||
209 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), 3); | ||
210 | return; | ||
211 | } | ||
212 | |||
213 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, | ||
214 | } | ||
215 | |||
216 | if (undef) { | ||
217 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), | ||
218 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
219 | default_exception_el(s)); | ||
220 | return; | ||
221 | } | ||
222 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
223 | * UsageFault exception. | ||
224 | */ | ||
225 | if (arm_dc_feature(s, ARM_FEATURE_M)) { | ||
226 | - gen_exception_insn(s, 4, EXCP_INVSTATE, syn_uncategorized(), | ||
227 | + gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(), | ||
228 | default_exception_el(s)); | ||
229 | return; | ||
230 | } | ||
231 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
232 | break; | ||
233 | default: | ||
234 | illegal_op: | ||
235 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), | ||
236 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
237 | default_exception_el(s)); | ||
238 | break; | ||
239 | } | ||
240 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
241 | } | ||
242 | |||
243 | /* All other insns: NOCP */ | ||
244 | - gen_exception_insn(s, 4, EXCP_NOCP, syn_uncategorized(), | ||
245 | + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, syn_uncategorized(), | ||
246 | default_exception_el(s)); | ||
247 | break; | ||
248 | } | ||
249 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
250 | } | ||
251 | return; | ||
252 | illegal_op: | ||
253 | - gen_exception_insn(s, 4, EXCP_UDEF, syn_uncategorized(), | ||
254 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
255 | default_exception_el(s)); | ||
256 | } | ||
257 | |||
258 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
259 | return; | ||
260 | illegal_op: | ||
261 | undef: | ||
262 | - gen_exception_insn(s, 2, EXCP_UDEF, syn_uncategorized(), | ||
263 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
264 | default_exception_el(s)); | ||
265 | } | ||
266 | |||
267 | -- | ||
268 | 2.20.1 | ||
269 | |||
270 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The mask implied by the extract is redundant with the one | 3 | The offset is variable depending on the instruction set. |
4 | implied by the deposit. Also, fix spelling of BFXIL. | 4 | Passing in the actual value is clearer in intent. |
5 | 5 | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20190514011129.11330-3-richard.henderson@linaro.org | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190807045335.1361-9-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | target/arm/translate-a64.c | 6 +++--- | 12 | target/arm/translate-a64.c | 8 ++++---- |
12 | 1 file changed, 3 insertions(+), 3 deletions(-) | 13 | target/arm/translate.c | 8 ++++---- |
14 | 2 files changed, 8 insertions(+), 8 deletions(-) | ||
13 | 15 | ||
14 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 16 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate-a64.c | 18 | --- a/target/arm/translate-a64.c |
17 | +++ b/target/arm/translate-a64.c | 19 | +++ b/target/arm/translate-a64.c |
18 | @@ -XXX,XX +XXX,XX @@ static void disas_bitfield(DisasContext *s, uint32_t insn) | 20 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal(int excp) |
19 | tcg_gen_extract_i64(tcg_rd, tcg_tmp, ri, len); | 21 | tcg_temp_free_i32(tcg_excp); |
20 | return; | 22 | } |
23 | |||
24 | -static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) | ||
25 | +static void gen_exception_internal_insn(DisasContext *s, uint64_t pc, int excp) | ||
26 | { | ||
27 | - gen_a64_set_pc_im(s->base.pc_next - offset); | ||
28 | + gen_a64_set_pc_im(pc); | ||
29 | gen_exception_internal(excp); | ||
30 | s->base.is_jmp = DISAS_NORETURN; | ||
31 | } | ||
32 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
33 | break; | ||
34 | } | ||
35 | #endif | ||
36 | - gen_exception_internal_insn(s, 0, EXCP_SEMIHOST); | ||
37 | + gen_exception_internal_insn(s, s->base.pc_next, EXCP_SEMIHOST); | ||
38 | } else { | ||
39 | unsupported_encoding(s, insn); | ||
21 | } | 40 | } |
22 | - /* opc == 1, BXFIL fall through to deposit */ | 41 | @@ -XXX,XX +XXX,XX @@ static bool aarch64_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, |
23 | - tcg_gen_extract_i64(tcg_tmp, tcg_tmp, ri, len); | 42 | /* End the TB early; it likely won't be executed */ |
24 | + /* opc == 1, BFXIL fall through to deposit */ | 43 | dc->base.is_jmp = DISAS_TOO_MANY; |
25 | + tcg_gen_shri_i64(tcg_tmp, tcg_tmp, ri); | ||
26 | pos = 0; | ||
27 | } else { | 44 | } else { |
28 | /* Handle the ri > si case with a deposit | 45 | - gen_exception_internal_insn(dc, 0, EXCP_DEBUG); |
29 | @@ -XXX,XX +XXX,XX @@ static void disas_bitfield(DisasContext *s, uint32_t insn) | 46 | + gen_exception_internal_insn(dc, dc->base.pc_next, EXCP_DEBUG); |
30 | len = ri; | 47 | /* The address covered by the breakpoint must be |
48 | included in [tb->pc, tb->pc + tb->size) in order | ||
49 | to for it to be properly cleared -- thus we | ||
50 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/target/arm/translate.c | ||
53 | +++ b/target/arm/translate.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static inline void gen_smc(DisasContext *s) | ||
55 | s->base.is_jmp = DISAS_SMC; | ||
56 | } | ||
57 | |||
58 | -static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) | ||
59 | +static void gen_exception_internal_insn(DisasContext *s, uint32_t pc, int excp) | ||
60 | { | ||
61 | gen_set_condexec(s); | ||
62 | - gen_set_pc_im(s, s->base.pc_next - offset); | ||
63 | + gen_set_pc_im(s, pc); | ||
64 | gen_exception_internal(excp); | ||
65 | s->base.is_jmp = DISAS_NORETURN; | ||
66 | } | ||
67 | @@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm) | ||
68 | s->current_el != 0 && | ||
69 | #endif | ||
70 | (imm == (s->thumb ? 0x3c : 0xf000))) { | ||
71 | - gen_exception_internal_insn(s, 0, EXCP_SEMIHOST); | ||
72 | + gen_exception_internal_insn(s, s->base.pc_next, EXCP_SEMIHOST); | ||
73 | return; | ||
31 | } | 74 | } |
32 | 75 | ||
33 | - if (opc == 1) { /* BFM, BXFIL */ | 76 | @@ -XXX,XX +XXX,XX @@ static bool arm_tr_breakpoint_check(DisasContextBase *dcbase, CPUState *cpu, |
34 | + if (opc == 1) { /* BFM, BFXIL */ | 77 | /* End the TB early; it's likely not going to be executed */ |
35 | tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_tmp, pos, len); | 78 | dc->base.is_jmp = DISAS_TOO_MANY; |
36 | } else { | 79 | } else { |
37 | /* SBFM or UBFM: We start with zero, and we haven't modified | 80 | - gen_exception_internal_insn(dc, 0, EXCP_DEBUG); |
81 | + gen_exception_internal_insn(dc, dc->base.pc_next, EXCP_DEBUG); | ||
82 | /* The address covered by the breakpoint must be | ||
83 | included in [tb->pc, tb->pc + tb->size) in order | ||
84 | to for it to be properly cleared -- thus we | ||
38 | -- | 85 | -- |
39 | 2.20.1 | 86 | 2.20.1 |
40 | 87 | ||
41 | 88 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Unlike the other more generic gen_exception{,_internal}_insn | ||
4 | interfaces, breakpoints always refer to the current instruction. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190807045335.1361-10-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/translate-a64.c | 7 +++---- | ||
13 | target/arm/translate.c | 8 ++++---- | ||
14 | 2 files changed, 7 insertions(+), 8 deletions(-) | ||
15 | |||
16 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/translate-a64.c | ||
19 | +++ b/target/arm/translate-a64.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, | ||
21 | s->base.is_jmp = DISAS_NORETURN; | ||
22 | } | ||
23 | |||
24 | -static void gen_exception_bkpt_insn(DisasContext *s, int offset, | ||
25 | - uint32_t syndrome) | ||
26 | +static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syndrome) | ||
27 | { | ||
28 | TCGv_i32 tcg_syn; | ||
29 | |||
30 | - gen_a64_set_pc_im(s->base.pc_next - offset); | ||
31 | + gen_a64_set_pc_im(s->pc_curr); | ||
32 | tcg_syn = tcg_const_i32(syndrome); | ||
33 | gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); | ||
34 | tcg_temp_free_i32(tcg_syn); | ||
35 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | ||
36 | break; | ||
37 | } | ||
38 | /* BRK */ | ||
39 | - gen_exception_bkpt_insn(s, 4, syn_aa64_bkpt(imm16)); | ||
40 | + gen_exception_bkpt_insn(s, syn_aa64_bkpt(imm16)); | ||
41 | break; | ||
42 | case 2: | ||
43 | if (op2_ll != 0) { | ||
44 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/target/arm/translate.c | ||
47 | +++ b/target/arm/translate.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_insn(DisasContext *s, uint32_t pc, int excp, | ||
49 | s->base.is_jmp = DISAS_NORETURN; | ||
50 | } | ||
51 | |||
52 | -static void gen_exception_bkpt_insn(DisasContext *s, int offset, uint32_t syn) | ||
53 | +static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) | ||
54 | { | ||
55 | TCGv_i32 tcg_syn; | ||
56 | |||
57 | gen_set_condexec(s); | ||
58 | - gen_set_pc_im(s, s->base.pc_next - offset); | ||
59 | + gen_set_pc_im(s, s->pc_curr); | ||
60 | tcg_syn = tcg_const_i32(syn); | ||
61 | gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); | ||
62 | tcg_temp_free_i32(tcg_syn); | ||
63 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
64 | case 1: | ||
65 | /* bkpt */ | ||
66 | ARCH(5); | ||
67 | - gen_exception_bkpt_insn(s, 4, syn_aa32_bkpt(imm16, false)); | ||
68 | + gen_exception_bkpt_insn(s, syn_aa32_bkpt(imm16, false)); | ||
69 | break; | ||
70 | case 2: | ||
71 | /* Hypervisor call (v7) */ | ||
72 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
73 | { | ||
74 | int imm8 = extract32(insn, 0, 8); | ||
75 | ARCH(5); | ||
76 | - gen_exception_bkpt_insn(s, 2, syn_aa32_bkpt(imm8, true)); | ||
77 | + gen_exception_bkpt_insn(s, syn_aa32_bkpt(imm8, true)); | ||
78 | break; | ||
79 | } | ||
80 | |||
81 | -- | ||
82 | 2.20.1 | ||
83 | |||
84 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This is, after all, how we implement extract2 in tcg/aarch64. | 3 | Promote this function from aarch64 to fully general use. |
4 | Use it to unify the code sequences for generating illegal | ||
5 | opcode exceptions. | ||
4 | 6 | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
7 | Message-id: 20190514011129.11330-2-richard.henderson@linaro.org | 10 | Message-id: 20190807045335.1361-11-richard.henderson@linaro.org |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 12 | --- |
10 | target/arm/translate-a64.c | 38 ++++++++++++++++++++------------------ | 13 | target/arm/translate-a64.h | 2 -- |
11 | 1 file changed, 20 insertions(+), 18 deletions(-) | 14 | target/arm/translate.h | 2 ++ |
15 | target/arm/translate-a64.c | 7 ------- | ||
16 | target/arm/translate-vfp.inc.c | 3 +-- | ||
17 | target/arm/translate.c | 22 ++++++++++++---------- | ||
18 | 5 files changed, 15 insertions(+), 21 deletions(-) | ||
12 | 19 | ||
20 | diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/target/arm/translate-a64.h | ||
23 | +++ b/target/arm/translate-a64.h | ||
24 | @@ -XXX,XX +XXX,XX @@ | ||
25 | #ifndef TARGET_ARM_TRANSLATE_A64_H | ||
26 | #define TARGET_ARM_TRANSLATE_A64_H | ||
27 | |||
28 | -void unallocated_encoding(DisasContext *s); | ||
29 | - | ||
30 | #define unsupported_encoding(s, insn) \ | ||
31 | do { \ | ||
32 | qemu_log_mask(LOG_UNIMP, \ | ||
33 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/target/arm/translate.h | ||
36 | +++ b/target/arm/translate.h | ||
37 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasCompare { | ||
38 | bool value_global; | ||
39 | } DisasCompare; | ||
40 | |||
41 | +void unallocated_encoding(DisasContext *s); | ||
42 | + | ||
43 | /* Share the TCG temporaries common between 32 and 64 bit modes. */ | ||
44 | extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF; | ||
45 | extern TCGv_i64 cpu_exclusive_addr; | ||
13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 46 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
14 | index XXXXXXX..XXXXXXX 100644 | 47 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-a64.c | 48 | --- a/target/arm/translate-a64.c |
16 | +++ b/target/arm/translate-a64.c | 49 | +++ b/target/arm/translate-a64.c |
17 | @@ -XXX,XX +XXX,XX @@ static void disas_extract(DisasContext *s, uint32_t insn) | 50 | @@ -XXX,XX +XXX,XX @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest) |
18 | } else { | 51 | } |
19 | tcg_gen_ext32u_i64(tcg_rd, cpu_reg(s, rm)); | 52 | } |
20 | } | 53 | |
21 | - } else if (rm == rn) { /* ROR */ | 54 | -void unallocated_encoding(DisasContext *s) |
22 | - tcg_rm = cpu_reg(s, rm); | 55 | -{ |
23 | - if (sf) { | 56 | - /* Unallocated and reserved encodings are uncategorized */ |
24 | - tcg_gen_rotri_i64(tcg_rd, tcg_rm, imm); | 57 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), |
25 | - } else { | 58 | - default_exception_el(s)); |
26 | - TCGv_i32 tmp = tcg_temp_new_i32(); | 59 | -} |
27 | - tcg_gen_extrl_i64_i32(tmp, tcg_rm); | 60 | - |
28 | - tcg_gen_rotri_i32(tmp, tmp, imm); | 61 | static void init_tmp_a64_array(DisasContext *s) |
29 | - tcg_gen_extu_i32_i64(tcg_rd, tmp); | 62 | { |
30 | - tcg_temp_free_i32(tmp); | 63 | #ifdef CONFIG_DEBUG_TCG |
31 | - } | 64 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c |
32 | } else { | 65 | index XXXXXXX..XXXXXXX 100644 |
33 | - tcg_rm = read_cpu_reg(s, rm, sf); | 66 | --- a/target/arm/translate-vfp.inc.c |
34 | - tcg_rn = read_cpu_reg(s, rn, sf); | 67 | +++ b/target/arm/translate-vfp.inc.c |
35 | - tcg_gen_shri_i64(tcg_rm, tcg_rm, imm); | 68 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) |
36 | - tcg_gen_shli_i64(tcg_rn, tcg_rn, bitsize - imm); | 69 | |
37 | - tcg_gen_or_i64(tcg_rd, tcg_rm, tcg_rn); | 70 | if (!s->vfp_enabled && !ignore_vfp_enabled) { |
38 | - if (!sf) { | 71 | assert(!arm_dc_feature(s, ARM_FEATURE_M)); |
39 | - tcg_gen_ext32u_i64(tcg_rd, tcg_rd); | 72 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), |
40 | + tcg_rm = cpu_reg(s, rm); | 73 | - default_exception_el(s)); |
41 | + tcg_rn = cpu_reg(s, rn); | 74 | + unallocated_encoding(s); |
75 | return false; | ||
76 | } | ||
77 | |||
78 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
79 | index XXXXXXX..XXXXXXX 100644 | ||
80 | --- a/target/arm/translate.c | ||
81 | +++ b/target/arm/translate.c | ||
82 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) | ||
83 | s->base.is_jmp = DISAS_NORETURN; | ||
84 | } | ||
85 | |||
86 | +void unallocated_encoding(DisasContext *s) | ||
87 | +{ | ||
88 | + /* Unallocated and reserved encodings are uncategorized */ | ||
89 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
90 | + default_exception_el(s)); | ||
91 | +} | ||
42 | + | 92 | + |
43 | + if (sf) { | 93 | /* Force a TB lookup after an instruction that changes the CPU state. */ |
44 | + /* Specialization to ROR happens in EXTRACT2. */ | 94 | static inline void gen_lookup_tb(DisasContext *s) |
45 | + tcg_gen_extract2_i64(tcg_rd, tcg_rm, tcg_rn, imm); | 95 | { |
46 | + } else { | 96 | @@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm) |
47 | + TCGv_i32 t0 = tcg_temp_new_i32(); | 97 | return; |
48 | + | 98 | } |
49 | + tcg_gen_extrl_i64_i32(t0, tcg_rm); | 99 | |
50 | + if (rm == rn) { | 100 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), |
51 | + tcg_gen_rotri_i32(t0, t0, imm); | 101 | - default_exception_el(s)); |
52 | + } else { | 102 | + unallocated_encoding(s); |
53 | + TCGv_i32 t1 = tcg_temp_new_i32(); | 103 | } |
54 | + tcg_gen_extrl_i64_i32(t1, tcg_rn); | 104 | |
55 | + tcg_gen_extract2_i32(t0, t0, t1, imm); | 105 | static inline void gen_add_data_offset(DisasContext *s, unsigned int insn, |
56 | + tcg_temp_free_i32(t1); | 106 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, |
57 | + } | 107 | } |
58 | + tcg_gen_extu_i32_i64(tcg_rd, t0); | 108 | |
59 | + tcg_temp_free_i32(t0); | 109 | if (undef) { |
60 | } | 110 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), |
111 | - default_exception_el(s)); | ||
112 | + unallocated_encoding(s); | ||
113 | return; | ||
114 | } | ||
115 | |||
116 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
117 | break; | ||
118 | default: | ||
119 | illegal_op: | ||
120 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
121 | - default_exception_el(s)); | ||
122 | + unallocated_encoding(s); | ||
123 | break; | ||
61 | } | 124 | } |
62 | } | 125 | } |
126 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
127 | } | ||
128 | return; | ||
129 | illegal_op: | ||
130 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
131 | - default_exception_el(s)); | ||
132 | + unallocated_encoding(s); | ||
133 | } | ||
134 | |||
135 | static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
136 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
137 | return; | ||
138 | illegal_op: | ||
139 | undef: | ||
140 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
141 | - default_exception_el(s)); | ||
142 | + unallocated_encoding(s); | ||
143 | } | ||
144 | |||
145 | static bool insn_crosses_page(CPUARMState *env, DisasContext *s) | ||
63 | -- | 146 | -- |
64 | 2.20.1 | 147 | 2.20.1 |
65 | 148 | ||
66 | 149 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Replace x = double_saturate(y) with x = add_saturate(y, y). | ||
4 | There is no need for a separate more specialized helper. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190807045335.1361-12-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/helper.h | 1 - | ||
13 | target/arm/op_helper.c | 15 --------------- | ||
14 | target/arm/translate.c | 4 ++-- | ||
15 | 3 files changed, 2 insertions(+), 18 deletions(-) | ||
16 | |||
17 | diff --git a/target/arm/helper.h b/target/arm/helper.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/helper.h | ||
20 | +++ b/target/arm/helper.h | ||
21 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(add_saturate, i32, env, i32, i32) | ||
22 | DEF_HELPER_3(sub_saturate, i32, env, i32, i32) | ||
23 | DEF_HELPER_3(add_usaturate, i32, env, i32, i32) | ||
24 | DEF_HELPER_3(sub_usaturate, i32, env, i32, i32) | ||
25 | -DEF_HELPER_2(double_saturate, i32, env, s32) | ||
26 | DEF_HELPER_FLAGS_2(sdiv, TCG_CALL_NO_RWG_SE, s32, s32, s32) | ||
27 | DEF_HELPER_FLAGS_2(udiv, TCG_CALL_NO_RWG_SE, i32, i32, i32) | ||
28 | DEF_HELPER_FLAGS_1(rbit, TCG_CALL_NO_RWG_SE, i32, i32) | ||
29 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/target/arm/op_helper.c | ||
32 | +++ b/target/arm/op_helper.c | ||
33 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(sub_saturate)(CPUARMState *env, uint32_t a, uint32_t b) | ||
34 | return res; | ||
35 | } | ||
36 | |||
37 | -uint32_t HELPER(double_saturate)(CPUARMState *env, int32_t val) | ||
38 | -{ | ||
39 | - uint32_t res; | ||
40 | - if (val >= 0x40000000) { | ||
41 | - res = ~SIGNBIT; | ||
42 | - env->QF = 1; | ||
43 | - } else if (val <= (int32_t)0xc0000000) { | ||
44 | - res = SIGNBIT; | ||
45 | - env->QF = 1; | ||
46 | - } else { | ||
47 | - res = val << 1; | ||
48 | - } | ||
49 | - return res; | ||
50 | -} | ||
51 | - | ||
52 | uint32_t HELPER(add_usaturate)(CPUARMState *env, uint32_t a, uint32_t b) | ||
53 | { | ||
54 | uint32_t res = a + b; | ||
55 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/target/arm/translate.c | ||
58 | +++ b/target/arm/translate.c | ||
59 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
60 | tmp = load_reg(s, rm); | ||
61 | tmp2 = load_reg(s, rn); | ||
62 | if (op1 & 2) | ||
63 | - gen_helper_double_saturate(tmp2, cpu_env, tmp2); | ||
64 | + gen_helper_add_saturate(tmp2, cpu_env, tmp2, tmp2); | ||
65 | if (op1 & 1) | ||
66 | gen_helper_sub_saturate(tmp, cpu_env, tmp, tmp2); | ||
67 | else | ||
68 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
69 | tmp = load_reg(s, rn); | ||
70 | tmp2 = load_reg(s, rm); | ||
71 | if (op & 1) | ||
72 | - gen_helper_double_saturate(tmp, cpu_env, tmp); | ||
73 | + gen_helper_add_saturate(tmp, cpu_env, tmp, tmp); | ||
74 | if (op & 2) | ||
75 | gen_helper_sub_saturate(tmp, cpu_env, tmp2, tmp); | ||
76 | else | ||
77 | -- | ||
78 | 2.20.1 | ||
79 | |||
80 | diff view generated by jsdifflib |
1 | The hw/arm/arm.h header now only includes declarations relating | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | to boot.c code, so it is only needed by Arm board or SoC code. | ||
3 | Remove some unnecessary inclusions of it from target/arm files | ||
4 | and from hw/intc/armv7m_nvic.c. | ||
5 | 2 | ||
3 | If -cpu <cpu>,aarch64=off is used then KVM must also be used, and it | ||
4 | and the host must support running the vcpu in 32-bit mode. Also, if | ||
5 | -cpu <cpu>,aarch64=on is used, then it doesn't matter if kvm is | ||
6 | enabled or not. | ||
7 | |||
8 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
9 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190516163857.6430-3-peter.maydell@linaro.org | ||
10 | --- | 11 | --- |
11 | hw/intc/armv7m_nvic.c | 1 - | 12 | target/arm/kvm_arm.h | 14 ++++++++++++++ |
12 | target/arm/arm-semi.c | 1 - | 13 | target/arm/cpu64.c | 12 ++++++------ |
13 | target/arm/cpu.c | 1 - | 14 | target/arm/kvm64.c | 9 +++++++++ |
14 | target/arm/cpu64.c | 1 - | 15 | 3 files changed, 29 insertions(+), 6 deletions(-) |
15 | target/arm/kvm.c | 1 - | ||
16 | target/arm/kvm32.c | 1 - | ||
17 | target/arm/kvm64.c | 1 - | ||
18 | 7 files changed, 7 deletions(-) | ||
19 | 16 | ||
20 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | 17 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h |
21 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/intc/armv7m_nvic.c | 19 | --- a/target/arm/kvm_arm.h |
23 | +++ b/hw/intc/armv7m_nvic.c | 20 | +++ b/target/arm/kvm_arm.h |
24 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf); |
25 | #include "cpu.h" | 22 | */ |
26 | #include "hw/sysbus.h" | 23 | void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu); |
27 | #include "qemu/timer.h" | 24 | |
28 | -#include "hw/arm/arm.h" | 25 | +/** |
29 | #include "hw/intc/armv7m_nvic.h" | 26 | + * kvm_arm_aarch32_supported: |
30 | #include "target/arm/cpu.h" | 27 | + * @cs: CPUState |
31 | #include "exec/exec-all.h" | 28 | + * |
32 | diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c | 29 | + * Returns: true if the KVM VCPU can enable AArch32 mode |
33 | index XXXXXXX..XXXXXXX 100644 | 30 | + * and false otherwise. |
34 | --- a/target/arm/arm-semi.c | 31 | + */ |
35 | +++ b/target/arm/arm-semi.c | 32 | +bool kvm_arm_aarch32_supported(CPUState *cs); |
36 | @@ -XXX,XX +XXX,XX @@ | 33 | + |
37 | #else | 34 | /** |
38 | #include "qemu-common.h" | 35 | * kvm_arm_get_max_vm_ipa_size - Returns the number of bits in the |
39 | #include "exec/gdbstub.h" | 36 | * IPA address space supported by KVM |
40 | -#include "hw/arm/arm.h" | 37 | @@ -XXX,XX +XXX,XX @@ static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) |
41 | #include "qemu/cutils.h" | 38 | cpu->host_cpu_probe_failed = true; |
42 | #endif | 39 | } |
43 | 40 | ||
44 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 41 | +static inline bool kvm_arm_aarch32_supported(CPUState *cs) |
45 | index XXXXXXX..XXXXXXX 100644 | 42 | +{ |
46 | --- a/target/arm/cpu.c | 43 | + return false; |
47 | +++ b/target/arm/cpu.c | 44 | +} |
48 | @@ -XXX,XX +XXX,XX @@ | 45 | + |
49 | #if !defined(CONFIG_USER_ONLY) | 46 | static inline int kvm_arm_get_max_vm_ipa_size(MachineState *ms) |
50 | #include "hw/loader.h" | 47 | { |
51 | #endif | 48 | return -ENOENT; |
52 | -#include "hw/arm/arm.h" | ||
53 | #include "sysemu/sysemu.h" | ||
54 | #include "sysemu/hw_accel.h" | ||
55 | #include "kvm_arm.h" | ||
56 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 49 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
57 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
58 | --- a/target/arm/cpu64.c | 51 | --- a/target/arm/cpu64.c |
59 | +++ b/target/arm/cpu64.c | 52 | +++ b/target/arm/cpu64.c |
60 | @@ -XXX,XX +XXX,XX @@ | 53 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp) |
61 | #if !defined(CONFIG_USER_ONLY) | 54 | * restriction allows us to avoid fixing up functionality that assumes a |
62 | #include "hw/loader.h" | 55 | * uniform execution state like do_interrupt. |
63 | #endif | 56 | */ |
64 | -#include "hw/arm/arm.h" | 57 | - if (!kvm_enabled()) { |
65 | #include "sysemu/sysemu.h" | 58 | - error_setg(errp, "'aarch64' feature cannot be disabled " |
66 | #include "sysemu/kvm.h" | 59 | - "unless KVM is enabled"); |
67 | #include "kvm_arm.h" | 60 | - return; |
68 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c | 61 | - } |
69 | index XXXXXXX..XXXXXXX 100644 | 62 | - |
70 | --- a/target/arm/kvm.c | 63 | if (value == false) { |
71 | +++ b/target/arm/kvm.c | 64 | + if (!kvm_enabled() || !kvm_arm_aarch32_supported(CPU(cpu))) { |
72 | @@ -XXX,XX +XXX,XX @@ | 65 | + error_setg(errp, "'aarch64' feature cannot be disabled " |
73 | #include "cpu.h" | 66 | + "unless KVM is enabled and 32-bit EL1 " |
74 | #include "trace.h" | 67 | + "is supported"); |
75 | #include "internals.h" | 68 | + return; |
76 | -#include "hw/arm/arm.h" | 69 | + } |
77 | #include "hw/pci/pci.h" | 70 | unset_feature(&cpu->env, ARM_FEATURE_AARCH64); |
78 | #include "exec/memattrs.h" | 71 | } else { |
79 | #include "exec/address-spaces.h" | 72 | set_feature(&cpu->env, ARM_FEATURE_AARCH64); |
80 | diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c | ||
81 | index XXXXXXX..XXXXXXX 100644 | ||
82 | --- a/target/arm/kvm32.c | ||
83 | +++ b/target/arm/kvm32.c | ||
84 | @@ -XXX,XX +XXX,XX @@ | ||
85 | #include "sysemu/kvm.h" | ||
86 | #include "kvm_arm.h" | ||
87 | #include "internals.h" | ||
88 | -#include "hw/arm/arm.h" | ||
89 | #include "qemu/log.h" | ||
90 | |||
91 | static inline void set_feature(uint64_t *features, int feature) | ||
92 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | 73 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
93 | index XXXXXXX..XXXXXXX 100644 | 74 | index XXXXXXX..XXXXXXX 100644 |
94 | --- a/target/arm/kvm64.c | 75 | --- a/target/arm/kvm64.c |
95 | +++ b/target/arm/kvm64.c | 76 | +++ b/target/arm/kvm64.c |
96 | @@ -XXX,XX +XXX,XX @@ | 77 | @@ -XXX,XX +XXX,XX @@ |
78 | #include "exec/gdbstub.h" | ||
79 | #include "sysemu/sysemu.h" | ||
97 | #include "sysemu/kvm.h" | 80 | #include "sysemu/kvm.h" |
81 | +#include "sysemu/kvm_int.h" | ||
98 | #include "kvm_arm.h" | 82 | #include "kvm_arm.h" |
83 | +#include "hw/boards.h" | ||
99 | #include "internals.h" | 84 | #include "internals.h" |
100 | -#include "hw/arm/arm.h" | ||
101 | 85 | ||
102 | static bool have_guest_debug; | 86 | static bool have_guest_debug; |
103 | 87 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | |
88 | return true; | ||
89 | } | ||
90 | |||
91 | +bool kvm_arm_aarch32_supported(CPUState *cpu) | ||
92 | +{ | ||
93 | + KVMState *s = KVM_STATE(current_machine->accelerator); | ||
94 | + | ||
95 | + return kvm_check_extension(s, KVM_CAP_ARM_EL1_32BIT); | ||
96 | +} | ||
97 | + | ||
98 | #define ARM_CPU_ID_MPIDR 3, 0, 0, 0, 5 | ||
99 | |||
100 | int kvm_arch_init_vcpu(CPUState *cs) | ||
104 | -- | 101 | -- |
105 | 2.20.1 | 102 | 2.20.1 |
106 | 103 | ||
107 | 104 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | We first convert the pmu property from a static property to one with |
4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 4 | its own accessors. Then we use the set accessor to check if the PMU is |
5 | Message-id: 20190520214342.13709-5-philmd@redhat.com | 5 | supported when using KVM. Indeed a 32-bit KVM host does not support |
6 | the PMU, so this check will catch an attempt to use it at property-set | ||
7 | time. | ||
8 | |||
9 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
10 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 12 | --- |
8 | include/hw/arm/exynos4210.h | 9 +++++++-- | 13 | target/arm/kvm_arm.h | 14 ++++++++++++++ |
9 | hw/arm/exynos4210.c | 28 ++++++++++++++++++++++++---- | 14 | target/arm/cpu.c | 30 +++++++++++++++++++++++++----- |
10 | hw/arm/exynos4_boards.c | 9 ++++++--- | 15 | target/arm/kvm.c | 7 +++++++ |
11 | 3 files changed, 37 insertions(+), 9 deletions(-) | 16 | 3 files changed, 46 insertions(+), 5 deletions(-) |
12 | 17 | ||
13 | diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h | 18 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h |
14 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/arm/exynos4210.h | 20 | --- a/target/arm/kvm_arm.h |
16 | +++ b/include/hw/arm/exynos4210.h | 21 | +++ b/target/arm/kvm_arm.h |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210Irq { | 22 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu); |
18 | } Exynos4210Irq; | 23 | */ |
19 | 24 | bool kvm_arm_aarch32_supported(CPUState *cs); | |
20 | typedef struct Exynos4210State { | 25 | |
21 | + /*< private >*/ | 26 | +/** |
22 | + SysBusDevice parent_obj; | 27 | + * bool kvm_arm_pmu_supported: |
23 | + /*< public >*/ | 28 | + * @cs: CPUState |
24 | ARMCPU *cpu[EXYNOS4210_NCPUS]; | 29 | + * |
25 | Exynos4210Irq irqs; | 30 | + * Returns: true if the KVM VCPU can enable its PMU |
26 | qemu_irq *irq_table; | 31 | + * and false otherwise. |
27 | @@ -XXX,XX +XXX,XX @@ typedef struct Exynos4210State { | 32 | + */ |
28 | I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER]; | 33 | +bool kvm_arm_pmu_supported(CPUState *cs); |
29 | } Exynos4210State; | ||
30 | |||
31 | +#define TYPE_EXYNOS4210_SOC "exynos4210" | ||
32 | +#define EXYNOS4210_SOC(obj) \ | ||
33 | + OBJECT_CHECK(Exynos4210State, obj, TYPE_EXYNOS4210_SOC) | ||
34 | + | 34 | + |
35 | void exynos4210_write_secondary(ARMCPU *cpu, | 35 | /** |
36 | const struct arm_boot_info *info); | 36 | * kvm_arm_get_max_vm_ipa_size - Returns the number of bits in the |
37 | 37 | * IPA address space supported by KVM | |
38 | -Exynos4210State *exynos4210_init(MemoryRegion *system_mem); | 38 | @@ -XXX,XX +XXX,XX @@ static inline bool kvm_arm_aarch32_supported(CPUState *cs) |
39 | - | 39 | return false; |
40 | /* Initialize exynos4210 IRQ subsystem stub */ | ||
41 | qemu_irq *exynos4210_init_irq(Exynos4210Irq *env); | ||
42 | |||
43 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/hw/arm/exynos4210.c | ||
46 | +++ b/hw/arm/exynos4210.c | ||
47 | @@ -XXX,XX +XXX,XX @@ static void pl330_create(uint32_t base, qemu_irq irq, int nreq) | ||
48 | sysbus_connect_irq(busdev, 0, irq); | ||
49 | } | 40 | } |
50 | 41 | ||
51 | -Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | 42 | +static inline bool kvm_arm_pmu_supported(CPUState *cs) |
52 | +static void exynos4210_realize(DeviceState *socdev, Error **errp) | ||
53 | { | ||
54 | - Exynos4210State *s = g_new0(Exynos4210State, 1); | ||
55 | + Exynos4210State *s = EXYNOS4210_SOC(socdev); | ||
56 | + MemoryRegion *system_mem = get_system_memory(); | ||
57 | qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS]; | ||
58 | SysBusDevice *busdev; | ||
59 | DeviceState *dev; | ||
60 | @@ -XXX,XX +XXX,XX @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | ||
61 | qemu_irq_invert(s->irq_table[exynos4210_get_irq(36, 1)]), 32); | ||
62 | pl330_create(EXYNOS4210_PL330_BASE2_ADDR, | ||
63 | qemu_irq_invert(s->irq_table[exynos4210_get_irq(34, 1)]), 1); | ||
64 | - | ||
65 | - return s; | ||
66 | } | ||
67 | + | ||
68 | +static void exynos4210_class_init(ObjectClass *klass, void *data) | ||
69 | +{ | 43 | +{ |
70 | + DeviceClass *dc = DEVICE_CLASS(klass); | 44 | + return false; |
71 | + | ||
72 | + dc->realize = exynos4210_realize; | ||
73 | +} | 45 | +} |
74 | + | 46 | + |
75 | +static const TypeInfo exynos4210_info = { | 47 | static inline int kvm_arm_get_max_vm_ipa_size(MachineState *ms) |
76 | + .name = TYPE_EXYNOS4210_SOC, | 48 | { |
77 | + .parent = TYPE_SYS_BUS_DEVICE, | 49 | return -ENOENT; |
78 | + .instance_size = sizeof(Exynos4210State), | 50 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
79 | + .class_init = exynos4210_class_init, | 51 | index XXXXXXX..XXXXXXX 100644 |
80 | +}; | 52 | --- a/target/arm/cpu.c |
53 | +++ b/target/arm/cpu.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static Property arm_cpu_has_el3_property = | ||
55 | static Property arm_cpu_cfgend_property = | ||
56 | DEFINE_PROP_BOOL("cfgend", ARMCPU, cfgend, false); | ||
57 | |||
58 | -/* use property name "pmu" to match other archs and virt tools */ | ||
59 | -static Property arm_cpu_has_pmu_property = | ||
60 | - DEFINE_PROP_BOOL("pmu", ARMCPU, has_pmu, true); | ||
61 | - | ||
62 | static Property arm_cpu_has_vfp_property = | ||
63 | DEFINE_PROP_BOOL("vfp", ARMCPU, has_vfp, true); | ||
64 | |||
65 | @@ -XXX,XX +XXX,XX @@ static Property arm_cpu_pmsav7_dregion_property = | ||
66 | pmsav7_dregion, | ||
67 | qdev_prop_uint32, uint32_t); | ||
68 | |||
69 | +static bool arm_get_pmu(Object *obj, Error **errp) | ||
70 | +{ | ||
71 | + ARMCPU *cpu = ARM_CPU(obj); | ||
81 | + | 72 | + |
82 | +static void exynos4210_register_types(void) | 73 | + return cpu->has_pmu; |
83 | +{ | ||
84 | + type_register_static(&exynos4210_info); | ||
85 | +} | 74 | +} |
86 | + | 75 | + |
87 | +type_init(exynos4210_register_types) | 76 | +static void arm_set_pmu(Object *obj, bool value, Error **errp) |
88 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | 77 | +{ |
78 | + ARMCPU *cpu = ARM_CPU(obj); | ||
79 | + | ||
80 | + if (value) { | ||
81 | + if (kvm_enabled() && !kvm_arm_pmu_supported(CPU(cpu))) { | ||
82 | + error_setg(errp, "'pmu' feature not supported by KVM on this host"); | ||
83 | + return; | ||
84 | + } | ||
85 | + set_feature(&cpu->env, ARM_FEATURE_PMU); | ||
86 | + } else { | ||
87 | + unset_feature(&cpu->env, ARM_FEATURE_PMU); | ||
88 | + } | ||
89 | + cpu->has_pmu = value; | ||
90 | +} | ||
91 | + | ||
92 | static void arm_get_init_svtor(Object *obj, Visitor *v, const char *name, | ||
93 | void *opaque, Error **errp) | ||
94 | { | ||
95 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj) | ||
96 | } | ||
97 | |||
98 | if (arm_feature(&cpu->env, ARM_FEATURE_PMU)) { | ||
99 | - qdev_property_add_static(DEVICE(obj), &arm_cpu_has_pmu_property, | ||
100 | + cpu->has_pmu = true; | ||
101 | + object_property_add_bool(obj, "pmu", arm_get_pmu, arm_set_pmu, | ||
102 | &error_abort); | ||
103 | } | ||
104 | |||
105 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c | ||
89 | index XXXXXXX..XXXXXXX 100644 | 106 | index XXXXXXX..XXXXXXX 100644 |
90 | --- a/hw/arm/exynos4_boards.c | 107 | --- a/target/arm/kvm.c |
91 | +++ b/hw/arm/exynos4_boards.c | 108 | +++ b/target/arm/kvm.c |
92 | @@ -XXX,XX +XXX,XX @@ typedef enum Exynos4BoardType { | 109 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) |
93 | } Exynos4BoardType; | 110 | env->features = arm_host_cpu_features.features; |
94 | |||
95 | typedef struct Exynos4BoardState { | ||
96 | - Exynos4210State *soc; | ||
97 | + Exynos4210State soc; | ||
98 | MemoryRegion dram0_mem; | ||
99 | MemoryRegion dram1_mem; | ||
100 | } Exynos4BoardState; | ||
101 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, | ||
102 | exynos4_boards_init_ram(s, get_system_memory(), | ||
103 | exynos4_board_ram_size[board_type]); | ||
104 | |||
105 | - s->soc = exynos4210_init(get_system_memory()); | ||
106 | + object_initialize(&s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC); | ||
107 | + qdev_set_parent_bus(DEVICE(&s->soc), sysbus_get_default()); | ||
108 | + object_property_set_bool(OBJECT(&s->soc), true, "realized", | ||
109 | + &error_fatal); | ||
110 | |||
111 | return s; | ||
112 | } | 111 | } |
113 | @@ -XXX,XX +XXX,XX @@ static void smdkc210_init(MachineState *machine) | 112 | |
114 | EXYNOS4_BOARD_SMDKC210); | 113 | +bool kvm_arm_pmu_supported(CPUState *cpu) |
115 | 114 | +{ | |
116 | lan9215_init(SMDK_LAN9118_BASE_ADDR, | 115 | + KVMState *s = KVM_STATE(current_machine->accelerator); |
117 | - qemu_irq_invert(s->soc->irq_table[exynos4210_get_irq(37, 1)])); | 116 | + |
118 | + qemu_irq_invert(s->soc.irq_table[exynos4210_get_irq(37, 1)])); | 117 | + return kvm_check_extension(s, KVM_CAP_ARM_PMU_V3); |
119 | arm_load_kernel(ARM_CPU(first_cpu), &exynos4_board_binfo); | 118 | +} |
120 | } | 119 | + |
121 | 120 | int kvm_arm_get_max_vm_ipa_size(MachineState *ms) | |
121 | { | ||
122 | KVMState *s = KVM_STATE(ms->accelerator); | ||
122 | -- | 123 | -- |
123 | 2.20.1 | 124 | 2.20.1 |
124 | 125 | ||
125 | 126 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
1 | 2 | ||
3 | The current implementation of ZCR_ELx matches the architecture, only | ||
4 | implementing the lower four bits, with the rest RAZ/WI. This puts | ||
5 | a strict limit on ARM_MAX_VQ of 16. Make sure we don't let ARM_MAX_VQ | ||
6 | grow without a corresponding update here. | ||
7 | |||
8 | Suggested-by: Dave Martin <Dave.Martin@arm.com> | ||
9 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/helper.c | 1 + | ||
15 | 1 file changed, 1 insertion(+) | ||
16 | |||
17 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/helper.c | ||
20 | +++ b/target/arm/helper.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
22 | int new_len; | ||
23 | |||
24 | /* Bits other than [3:0] are RAZ/WI. */ | ||
25 | + QEMU_BUILD_BUG_ON(ARM_MAX_VQ > 16); | ||
26 | raw_write(env, ri, value & 0xf); | ||
27 | |||
28 | /* | ||
29 | -- | ||
30 | 2.20.1 | ||
31 | |||
32 | diff view generated by jsdifflib |
1 | In ich_vmcr_write() we enforce "writes of BPR fields to less than | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | their minimum sets them to the minimum" by doing a "read vbpr and | ||
3 | write it back" operation. A typo here meant that we weren't handling | ||
4 | writes to these fields correctly, because we were reading from VBPR0 | ||
5 | but writing to VBPR1. | ||
6 | 2 | ||
3 | Unless we're guaranteed to always increase ARM_MAX_VQ by a multiple of | ||
4 | four, then we should use DIV_ROUND_UP to ensure we get an appropriate | ||
5 | array size. | ||
6 | |||
7 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20190520162809.2677-4-peter.maydell@linaro.org | ||
10 | --- | 10 | --- |
11 | hw/intc/arm_gicv3_cpuif.c | 2 +- | 11 | target/arm/cpu.h | 2 +- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
13 | 13 | ||
14 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 14 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/intc/arm_gicv3_cpuif.c | 16 | --- a/target/arm/cpu.h |
17 | +++ b/hw/intc/arm_gicv3_cpuif.c | 17 | +++ b/target/arm/cpu.h |
18 | @@ -XXX,XX +XXX,XX @@ static void ich_vmcr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 18 | @@ -XXX,XX +XXX,XX @@ typedef struct ARMVectorReg { |
19 | /* Enforce "writing BPRs to less than minimum sets them to the minimum" | 19 | #ifdef TARGET_AARCH64 |
20 | * by reading and writing back the fields. | 20 | /* In AArch32 mode, predicate registers do not exist at all. */ |
21 | */ | 21 | typedef struct ARMPredicateReg { |
22 | - write_vbpr(cs, GICV3_G1, read_vbpr(cs, GICV3_G0)); | 22 | - uint64_t p[2 * ARM_MAX_VQ / 8] QEMU_ALIGNED(16); |
23 | + write_vbpr(cs, GICV3_G0, read_vbpr(cs, GICV3_G0)); | 23 | + uint64_t p[DIV_ROUND_UP(2 * ARM_MAX_VQ, 8)] QEMU_ALIGNED(16); |
24 | write_vbpr(cs, GICV3_G1, read_vbpr(cs, GICV3_G1)); | 24 | } ARMPredicateReg; |
25 | 25 | ||
26 | gicv3_cpuif_virt_update(cs); | 26 | /* In AArch32 mode, PAC keys do not exist at all. */ |
27 | -- | 27 | -- |
28 | 2.20.1 | 28 | 2.20.1 |
29 | 29 | ||
30 | 30 | diff view generated by jsdifflib |
1 | The ICC_CTLR_EL3 register includes some bits which are aliases | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | of bits in the ICC_CTLR_EL1(S) and (NS) registers. QEMU chooses | ||
3 | to keep those bits in the cs->icc_ctlr_el1[] struct fields. | ||
4 | Unfortunately a missing '~' in the code to update the bits | ||
5 | in those fields meant that writing to ICC_CTLR_EL3 would corrupt | ||
6 | the ICC_CLTR_EL1 register values. | ||
7 | 2 | ||
3 | A couple return -EINVAL's forgot their '-'s. | ||
4 | |||
5 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Message-id: 20190520162809.2677-5-peter.maydell@linaro.org | ||
11 | --- | 9 | --- |
12 | hw/intc/arm_gicv3_cpuif.c | 4 ++-- | 10 | target/arm/kvm64.c | 4 ++-- |
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | 11 | 1 file changed, 2 insertions(+), 2 deletions(-) |
14 | 12 | ||
15 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 13 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/intc/arm_gicv3_cpuif.c | 15 | --- a/target/arm/kvm64.c |
18 | +++ b/hw/intc/arm_gicv3_cpuif.c | 16 | +++ b/target/arm/kvm64.c |
19 | @@ -XXX,XX +XXX,XX @@ static void icc_ctlr_el3_write(CPUARMState *env, const ARMCPRegInfo *ri, | 17 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_put_registers(CPUState *cs, int level) |
20 | trace_gicv3_icc_ctlr_el3_write(gicv3_redist_affid(cs), value); | 18 | write_cpustate_to_list(cpu, true); |
21 | 19 | ||
22 | /* *_EL1NS and *_EL1S bits are aliases into the ICC_CTLR_EL1 bits. */ | 20 | if (!write_list_to_kvmstate(cpu, level)) { |
23 | - cs->icc_ctlr_el1[GICV3_NS] &= (ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | 21 | - return EINVAL; |
24 | + cs->icc_ctlr_el1[GICV3_NS] &= ~(ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | 22 | + return -EINVAL; |
25 | if (value & ICC_CTLR_EL3_EOIMODE_EL1NS) { | ||
26 | cs->icc_ctlr_el1[GICV3_NS] |= ICC_CTLR_EL1_EOIMODE; | ||
27 | } | 23 | } |
28 | @@ -XXX,XX +XXX,XX @@ static void icc_ctlr_el3_write(CPUARMState *env, const ARMCPRegInfo *ri, | 24 | |
29 | cs->icc_ctlr_el1[GICV3_NS] |= ICC_CTLR_EL1_CBPR; | 25 | kvm_arm_sync_mpstate_to_kvm(cpu); |
26 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_get_registers(CPUState *cs) | ||
30 | } | 27 | } |
31 | 28 | ||
32 | - cs->icc_ctlr_el1[GICV3_S] &= (ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | 29 | if (!write_kvmstate_to_list(cpu)) { |
33 | + cs->icc_ctlr_el1[GICV3_S] &= ~(ICC_CTLR_EL1_CBPR | ICC_CTLR_EL1_EOIMODE); | 30 | - return EINVAL; |
34 | if (value & ICC_CTLR_EL3_EOIMODE_EL1S) { | 31 | + return -EINVAL; |
35 | cs->icc_ctlr_el1[GICV3_S] |= ICC_CTLR_EL1_EOIMODE; | ||
36 | } | 32 | } |
33 | /* Note that it's OK to have registers which aren't in CPUState, | ||
34 | * so we can ignore a failure return here. | ||
37 | -- | 35 | -- |
38 | 2.20.1 | 36 | 2.20.1 |
39 | 37 | ||
40 | 38 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Andrew Jones <drjones@redhat.com> | |
2 | |||
3 | Move the getting/putting of the fpsimd registers out of | ||
4 | kvm_arch_get/put_registers() into their own helper functions | ||
5 | to prepare for alternatively getting/putting SVE registers. | ||
6 | |||
7 | No functional change. | ||
8 | |||
9 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
10 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/kvm64.c | 148 +++++++++++++++++++++++++++------------------ | ||
15 | 1 file changed, 88 insertions(+), 60 deletions(-) | ||
16 | |||
17 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/kvm64.c | ||
20 | +++ b/target/arm/kvm64.c | ||
21 | @@ -XXX,XX +XXX,XX @@ int kvm_arm_cpreg_level(uint64_t regidx) | ||
22 | #define AARCH64_SIMD_CTRL_REG(x) (KVM_REG_ARM64 | KVM_REG_SIZE_U32 | \ | ||
23 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(x)) | ||
24 | |||
25 | +static int kvm_arch_put_fpsimd(CPUState *cs) | ||
26 | +{ | ||
27 | + ARMCPU *cpu = ARM_CPU(cs); | ||
28 | + CPUARMState *env = &cpu->env; | ||
29 | + struct kvm_one_reg reg; | ||
30 | + uint32_t fpr; | ||
31 | + int i, ret; | ||
32 | + | ||
33 | + for (i = 0; i < 32; i++) { | ||
34 | + uint64_t *q = aa64_vfp_qreg(env, i); | ||
35 | +#ifdef HOST_WORDS_BIGENDIAN | ||
36 | + uint64_t fp_val[2] = { q[1], q[0] }; | ||
37 | + reg.addr = (uintptr_t)fp_val; | ||
38 | +#else | ||
39 | + reg.addr = (uintptr_t)q; | ||
40 | +#endif | ||
41 | + reg.id = AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]); | ||
42 | + ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); | ||
43 | + if (ret) { | ||
44 | + return ret; | ||
45 | + } | ||
46 | + } | ||
47 | + | ||
48 | + reg.addr = (uintptr_t)(&fpr); | ||
49 | + fpr = vfp_get_fpsr(env); | ||
50 | + reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpsr); | ||
51 | + ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); | ||
52 | + if (ret) { | ||
53 | + return ret; | ||
54 | + } | ||
55 | + | ||
56 | + reg.addr = (uintptr_t)(&fpr); | ||
57 | + fpr = vfp_get_fpcr(env); | ||
58 | + reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpcr); | ||
59 | + ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); | ||
60 | + if (ret) { | ||
61 | + return ret; | ||
62 | + } | ||
63 | + | ||
64 | + return 0; | ||
65 | +} | ||
66 | + | ||
67 | int kvm_arch_put_registers(CPUState *cs, int level) | ||
68 | { | ||
69 | struct kvm_one_reg reg; | ||
70 | - uint32_t fpr; | ||
71 | uint64_t val; | ||
72 | - int i; | ||
73 | - int ret; | ||
74 | + int i, ret; | ||
75 | unsigned int el; | ||
76 | |||
77 | ARMCPU *cpu = ARM_CPU(cs); | ||
78 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_put_registers(CPUState *cs, int level) | ||
79 | } | ||
80 | } | ||
81 | |||
82 | - /* Advanced SIMD and FP registers. */ | ||
83 | - for (i = 0; i < 32; i++) { | ||
84 | - uint64_t *q = aa64_vfp_qreg(env, i); | ||
85 | -#ifdef HOST_WORDS_BIGENDIAN | ||
86 | - uint64_t fp_val[2] = { q[1], q[0] }; | ||
87 | - reg.addr = (uintptr_t)fp_val; | ||
88 | -#else | ||
89 | - reg.addr = (uintptr_t)q; | ||
90 | -#endif | ||
91 | - reg.id = AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]); | ||
92 | - ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); | ||
93 | - if (ret) { | ||
94 | - return ret; | ||
95 | - } | ||
96 | - } | ||
97 | - | ||
98 | - reg.addr = (uintptr_t)(&fpr); | ||
99 | - fpr = vfp_get_fpsr(env); | ||
100 | - reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpsr); | ||
101 | - ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); | ||
102 | - if (ret) { | ||
103 | - return ret; | ||
104 | - } | ||
105 | - | ||
106 | - fpr = vfp_get_fpcr(env); | ||
107 | - reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpcr); | ||
108 | - ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); | ||
109 | + ret = kvm_arch_put_fpsimd(cs); | ||
110 | if (ret) { | ||
111 | return ret; | ||
112 | } | ||
113 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_put_registers(CPUState *cs, int level) | ||
114 | return ret; | ||
115 | } | ||
116 | |||
117 | +static int kvm_arch_get_fpsimd(CPUState *cs) | ||
118 | +{ | ||
119 | + ARMCPU *cpu = ARM_CPU(cs); | ||
120 | + CPUARMState *env = &cpu->env; | ||
121 | + struct kvm_one_reg reg; | ||
122 | + uint32_t fpr; | ||
123 | + int i, ret; | ||
124 | + | ||
125 | + for (i = 0; i < 32; i++) { | ||
126 | + uint64_t *q = aa64_vfp_qreg(env, i); | ||
127 | + reg.id = AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]); | ||
128 | + reg.addr = (uintptr_t)q; | ||
129 | + ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); | ||
130 | + if (ret) { | ||
131 | + return ret; | ||
132 | + } else { | ||
133 | +#ifdef HOST_WORDS_BIGENDIAN | ||
134 | + uint64_t t; | ||
135 | + t = q[0], q[0] = q[1], q[1] = t; | ||
136 | +#endif | ||
137 | + } | ||
138 | + } | ||
139 | + | ||
140 | + reg.addr = (uintptr_t)(&fpr); | ||
141 | + reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpsr); | ||
142 | + ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); | ||
143 | + if (ret) { | ||
144 | + return ret; | ||
145 | + } | ||
146 | + vfp_set_fpsr(env, fpr); | ||
147 | + | ||
148 | + reg.addr = (uintptr_t)(&fpr); | ||
149 | + reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpcr); | ||
150 | + ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); | ||
151 | + if (ret) { | ||
152 | + return ret; | ||
153 | + } | ||
154 | + vfp_set_fpcr(env, fpr); | ||
155 | + | ||
156 | + return 0; | ||
157 | +} | ||
158 | + | ||
159 | int kvm_arch_get_registers(CPUState *cs) | ||
160 | { | ||
161 | struct kvm_one_reg reg; | ||
162 | uint64_t val; | ||
163 | - uint32_t fpr; | ||
164 | unsigned int el; | ||
165 | - int i; | ||
166 | - int ret; | ||
167 | + int i, ret; | ||
168 | |||
169 | ARMCPU *cpu = ARM_CPU(cs); | ||
170 | CPUARMState *env = &cpu->env; | ||
171 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_get_registers(CPUState *cs) | ||
172 | env->spsr = env->banked_spsr[i]; | ||
173 | } | ||
174 | |||
175 | - /* Advanced SIMD and FP registers */ | ||
176 | - for (i = 0; i < 32; i++) { | ||
177 | - uint64_t *q = aa64_vfp_qreg(env, i); | ||
178 | - reg.id = AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]); | ||
179 | - reg.addr = (uintptr_t)q; | ||
180 | - ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); | ||
181 | - if (ret) { | ||
182 | - return ret; | ||
183 | - } else { | ||
184 | -#ifdef HOST_WORDS_BIGENDIAN | ||
185 | - uint64_t t; | ||
186 | - t = q[0], q[0] = q[1], q[1] = t; | ||
187 | -#endif | ||
188 | - } | ||
189 | - } | ||
190 | - | ||
191 | - reg.addr = (uintptr_t)(&fpr); | ||
192 | - reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpsr); | ||
193 | - ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); | ||
194 | + ret = kvm_arch_get_fpsimd(cs); | ||
195 | if (ret) { | ||
196 | return ret; | ||
197 | } | ||
198 | - vfp_set_fpsr(env, fpr); | ||
199 | - | ||
200 | - reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpcr); | ||
201 | - ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); | ||
202 | - if (ret) { | ||
203 | - return ret; | ||
204 | - } | ||
205 | - vfp_set_fpcr(env, fpr); | ||
206 | |||
207 | ret = kvm_get_vcpu_events(cpu); | ||
208 | if (ret) { | ||
209 | -- | ||
210 | 2.20.1 | ||
211 | |||
212 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Extract is a compact combination of shift + and. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20190808202616.13782-2-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/translate.c | 9 +-------- | ||
11 | 1 file changed, 1 insertion(+), 8 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate.c | ||
16 | +++ b/target/arm/translate.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void gen_sar(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) | ||
18 | |||
19 | static void shifter_out_im(TCGv_i32 var, int shift) | ||
20 | { | ||
21 | - if (shift == 0) { | ||
22 | - tcg_gen_andi_i32(cpu_CF, var, 1); | ||
23 | - } else { | ||
24 | - tcg_gen_shri_i32(cpu_CF, var, shift); | ||
25 | - if (shift != 31) { | ||
26 | - tcg_gen_andi_i32(cpu_CF, cpu_CF, 1); | ||
27 | - } | ||
28 | - } | ||
29 | + tcg_gen_extract_i32(cpu_CF, var, shift, 1); | ||
30 | } | ||
31 | |||
32 | /* Shift by immediate. Includes special handling for shift == 0. */ | ||
33 | -- | ||
34 | 2.20.1 | ||
35 | |||
36 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Use deposit as the composit operation to merge the | ||
4 | bits from the two inputs. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20190808202616.13782-3-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate.c | 26 ++++++++++---------------- | ||
12 | 1 file changed, 10 insertions(+), 16 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate.c | ||
17 | +++ b/target/arm/translate.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
19 | shift = (insn >> 7) & 0x1f; | ||
20 | if (insn & (1 << 6)) { | ||
21 | /* pkhtb */ | ||
22 | - if (shift == 0) | ||
23 | + if (shift == 0) { | ||
24 | shift = 31; | ||
25 | + } | ||
26 | tcg_gen_sari_i32(tmp2, tmp2, shift); | ||
27 | - tcg_gen_andi_i32(tmp, tmp, 0xffff0000); | ||
28 | - tcg_gen_ext16u_i32(tmp2, tmp2); | ||
29 | + tcg_gen_deposit_i32(tmp, tmp, tmp2, 0, 16); | ||
30 | } else { | ||
31 | /* pkhbt */ | ||
32 | - if (shift) | ||
33 | - tcg_gen_shli_i32(tmp2, tmp2, shift); | ||
34 | - tcg_gen_ext16u_i32(tmp, tmp); | ||
35 | - tcg_gen_andi_i32(tmp2, tmp2, 0xffff0000); | ||
36 | + tcg_gen_shli_i32(tmp2, tmp2, shift); | ||
37 | + tcg_gen_deposit_i32(tmp, tmp2, tmp, 0, 16); | ||
38 | } | ||
39 | - tcg_gen_or_i32(tmp, tmp, tmp2); | ||
40 | tcg_temp_free_i32(tmp2); | ||
41 | store_reg(s, rd, tmp); | ||
42 | } else if ((insn & 0x00200020) == 0x00200000) { | ||
43 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
44 | shift = ((insn >> 10) & 0x1c) | ((insn >> 6) & 0x3); | ||
45 | if (insn & (1 << 5)) { | ||
46 | /* pkhtb */ | ||
47 | - if (shift == 0) | ||
48 | + if (shift == 0) { | ||
49 | shift = 31; | ||
50 | + } | ||
51 | tcg_gen_sari_i32(tmp2, tmp2, shift); | ||
52 | - tcg_gen_andi_i32(tmp, tmp, 0xffff0000); | ||
53 | - tcg_gen_ext16u_i32(tmp2, tmp2); | ||
54 | + tcg_gen_deposit_i32(tmp, tmp, tmp2, 0, 16); | ||
55 | } else { | ||
56 | /* pkhbt */ | ||
57 | - if (shift) | ||
58 | - tcg_gen_shli_i32(tmp2, tmp2, shift); | ||
59 | - tcg_gen_ext16u_i32(tmp, tmp); | ||
60 | - tcg_gen_andi_i32(tmp2, tmp2, 0xffff0000); | ||
61 | + tcg_gen_shli_i32(tmp2, tmp2, shift); | ||
62 | + tcg_gen_deposit_i32(tmp, tmp2, tmp, 0, 16); | ||
63 | } | ||
64 | - tcg_gen_or_i32(tmp, tmp, tmp2); | ||
65 | tcg_temp_free_i32(tmp2); | ||
66 | store_reg(s, rd, tmp); | ||
67 | } else { | ||
68 | -- | ||
69 | 2.20.1 | ||
70 | |||
71 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | The immediate shift generator functions already test for, | ||
4 | and eliminate, the case of a shift by zero. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20190808202616.13782-4-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate.c | 19 +++++++------------ | ||
12 | 1 file changed, 7 insertions(+), 12 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate.c | ||
17 | +++ b/target/arm/translate.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
19 | shift = (insn >> 10) & 3; | ||
20 | /* ??? In many cases it's not necessary to do a | ||
21 | rotate, a shift is sufficient. */ | ||
22 | - if (shift != 0) | ||
23 | - tcg_gen_rotri_i32(tmp, tmp, shift * 8); | ||
24 | + tcg_gen_rotri_i32(tmp, tmp, shift * 8); | ||
25 | op1 = (insn >> 20) & 7; | ||
26 | switch (op1) { | ||
27 | case 0: gen_sxtb16(tmp); break; | ||
28 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
29 | shift = (insn >> 4) & 3; | ||
30 | /* ??? In many cases it's not necessary to do a | ||
31 | rotate, a shift is sufficient. */ | ||
32 | - if (shift != 0) | ||
33 | - tcg_gen_rotri_i32(tmp, tmp, shift * 8); | ||
34 | + tcg_gen_rotri_i32(tmp, tmp, shift * 8); | ||
35 | op = (insn >> 20) & 7; | ||
36 | switch (op) { | ||
37 | case 0: gen_sxth(tmp); break; | ||
38 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
39 | case 7: | ||
40 | goto illegal_op; | ||
41 | default: /* Saturate. */ | ||
42 | - if (shift) { | ||
43 | - if (op & 1) | ||
44 | - tcg_gen_sari_i32(tmp, tmp, shift); | ||
45 | - else | ||
46 | - tcg_gen_shli_i32(tmp, tmp, shift); | ||
47 | + if (op & 1) { | ||
48 | + tcg_gen_sari_i32(tmp, tmp, shift); | ||
49 | + } else { | ||
50 | + tcg_gen_shli_i32(tmp, tmp, shift); | ||
51 | } | ||
52 | tmp2 = tcg_const_i32(imm); | ||
53 | if (op & 4) { | ||
54 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
55 | goto illegal_op; | ||
56 | } | ||
57 | tmp = load_reg(s, rm); | ||
58 | - if (shift) { | ||
59 | - tcg_gen_shli_i32(tmp, tmp, shift); | ||
60 | - } | ||
61 | + tcg_gen_shli_i32(tmp, tmp, shift); | ||
62 | tcg_gen_add_i32(addr, addr, tmp); | ||
63 | tcg_temp_free_i32(tmp); | ||
64 | break; | ||
65 | -- | ||
66 | 2.20.1 | ||
67 | |||
68 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | It eases code review, unit is explicit. | 3 | The helper function is more documentary, and also already |
4 | handles the case of rotate by zero. | ||
4 | 5 | ||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Message-id: 20190808202616.13782-5-richard.henderson@linaro.org |
7 | Message-id: 20190520214342.13709-3-philmd@redhat.com | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 10 | --- |
10 | hw/arm/exynos4_boards.c | 5 +++-- | 11 | target/arm/translate.c | 7 ++----- |
11 | 1 file changed, 3 insertions(+), 2 deletions(-) | 12 | 1 file changed, 2 insertions(+), 5 deletions(-) |
12 | 13 | ||
13 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | 14 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/exynos4_boards.c | 16 | --- a/target/arm/translate.c |
16 | +++ b/hw/arm/exynos4_boards.c | 17 | +++ b/target/arm/translate.c |
17 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) |
18 | */ | 19 | /* CPSR = immediate */ |
19 | 20 | val = insn & 0xff; | |
20 | #include "qemu/osdep.h" | 21 | shift = ((insn >> 8) & 0xf) * 2; |
21 | +#include "qemu/units.h" | 22 | - if (shift) |
22 | #include "qapi/error.h" | 23 | - val = (val >> shift) | (val << (32 - shift)); |
23 | #include "qemu/error-report.h" | 24 | + val = ror32(val, shift); |
24 | #include "qemu-common.h" | 25 | i = ((insn & (1 << 22)) != 0); |
25 | @@ -XXX,XX +XXX,XX @@ static int exynos4_board_smp_bootreg_addr[EXYNOS4_NUM_OF_BOARDS] = { | 26 | if (gen_set_psr_im(s, msr_mask(s, (insn >> 16) & 0xf, i), |
26 | }; | 27 | i, val)) { |
27 | 28 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | |
28 | static unsigned long exynos4_board_ram_size[EXYNOS4_NUM_OF_BOARDS] = { | 29 | /* immediate operand */ |
29 | - [EXYNOS4_BOARD_NURI] = 0x40000000, | 30 | val = insn & 0xff; |
30 | - [EXYNOS4_BOARD_SMDKC210] = 0x40000000, | 31 | shift = ((insn >> 8) & 0xf) * 2; |
31 | + [EXYNOS4_BOARD_NURI] = 1 * GiB, | 32 | - if (shift) { |
32 | + [EXYNOS4_BOARD_SMDKC210] = 1 * GiB, | 33 | - val = (val >> shift) | (val << (32 - shift)); |
33 | }; | 34 | - } |
34 | 35 | + val = ror32(val, shift); | |
35 | static struct arm_boot_info exynos4_board_binfo = { | 36 | tmp2 = tcg_temp_new_i32(); |
37 | tcg_gen_movi_i32(tmp2, val); | ||
38 | if (logic_cc && shift) { | ||
36 | -- | 39 | -- |
37 | 2.20.1 | 40 | 2.20.1 |
38 | 41 | ||
39 | 42 | diff view generated by jsdifflib |
1 | From: Guenter Roeck <linux@roeck-us.net> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | QEMU already supports pl330. Instantiate it for Exynos4210. | 3 | Rotate is the more compact and obvious way to swap 16-bit |
4 | elements of a 32-bit word. | ||
4 | 5 | ||
5 | Relevant part of Linux arch/arm/boot/dts/exynos4.dtsi: | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | 7 | Message-id: 20190808202616.13782-6-richard.henderson@linaro.org | |
7 | / { | ||
8 | soc: soc { | ||
9 | amba { | ||
10 | pdma0: pdma@12680000 { | ||
11 | compatible = "arm,pl330", "arm,primecell"; | ||
12 | reg = <0x12680000 0x1000>; | ||
13 | interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; | ||
14 | clocks = <&clock CLK_PDMA0>; | ||
15 | clock-names = "apb_pclk"; | ||
16 | #dma-cells = <1>; | ||
17 | #dma-channels = <8>; | ||
18 | #dma-requests = <32>; | ||
19 | }; | ||
20 | pdma1: pdma@12690000 { | ||
21 | compatible = "arm,pl330", "arm,primecell"; | ||
22 | reg = <0x12690000 0x1000>; | ||
23 | interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; | ||
24 | clocks = <&clock CLK_PDMA1>; | ||
25 | clock-names = "apb_pclk"; | ||
26 | #dma-cells = <1>; | ||
27 | #dma-channels = <8>; | ||
28 | #dma-requests = <32>; | ||
29 | }; | ||
30 | mdma1: mdma@12850000 { | ||
31 | compatible = "arm,pl330", "arm,primecell"; | ||
32 | reg = <0x12850000 0x1000>; | ||
33 | interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; | ||
34 | clocks = <&clock CLK_MDMA>; | ||
35 | clock-names = "apb_pclk"; | ||
36 | #dma-cells = <1>; | ||
37 | #dma-channels = <8>; | ||
38 | #dma-requests = <1>; | ||
39 | }; | ||
40 | }; | ||
41 | }; | ||
42 | }; | ||
43 | |||
44 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
45 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
46 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
47 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
48 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
49 | Message-id: 20190520214342.13709-4-philmd@redhat.com | ||
50 | [PMD: Do not set default qdev properties, create the controllers in the SoC | ||
51 | rather than the board (Peter Maydell), add dtsi in commit message] | ||
52 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
53 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
54 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
55 | --- | 10 | --- |
56 | hw/arm/exynos4210.c | 26 ++++++++++++++++++++++++++ | 11 | target/arm/translate.c | 6 +----- |
57 | 1 file changed, 26 insertions(+) | 12 | 1 file changed, 1 insertion(+), 5 deletions(-) |
58 | 13 | ||
59 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | 14 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
60 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
61 | --- a/hw/arm/exynos4210.c | 16 | --- a/target/arm/translate.c |
62 | +++ b/hw/arm/exynos4210.c | 17 | +++ b/target/arm/translate.c |
63 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static TCGv_i64 gen_muls_i64_i32(TCGv_i32 a, TCGv_i32 b) |
64 | /* EHCI */ | 19 | /* Swap low and high halfwords. */ |
65 | #define EXYNOS4210_EHCI_BASE_ADDR 0x12580000 | 20 | static void gen_swap_half(TCGv_i32 var) |
66 | 21 | { | |
67 | +/* DMA */ | 22 | - TCGv_i32 tmp = tcg_temp_new_i32(); |
68 | +#define EXYNOS4210_PL330_BASE0_ADDR 0x12680000 | 23 | - tcg_gen_shri_i32(tmp, var, 16); |
69 | +#define EXYNOS4210_PL330_BASE1_ADDR 0x12690000 | 24 | - tcg_gen_shli_i32(var, var, 16); |
70 | +#define EXYNOS4210_PL330_BASE2_ADDR 0x12850000 | 25 | - tcg_gen_or_i32(var, var, tmp); |
71 | + | 26 | - tcg_temp_free_i32(tmp); |
72 | static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43, | 27 | + tcg_gen_rotri_i32(var, var, 16); |
73 | 0x09, 0x00, 0x00, 0x00 }; | ||
74 | |||
75 | @@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_calc_affinity(int cpu) | ||
76 | return (0x9 << ARM_AFF1_SHIFT) | cpu; | ||
77 | } | 28 | } |
78 | 29 | ||
79 | +static void pl330_create(uint32_t base, qemu_irq irq, int nreq) | 30 | /* Dual 16-bit add. Result placed in t0 and t1 is marked as dead. |
80 | +{ | ||
81 | + SysBusDevice *busdev; | ||
82 | + DeviceState *dev; | ||
83 | + | ||
84 | + dev = qdev_create(NULL, "pl330"); | ||
85 | + qdev_prop_set_uint8(dev, "num_periph_req", nreq); | ||
86 | + qdev_init_nofail(dev); | ||
87 | + busdev = SYS_BUS_DEVICE(dev); | ||
88 | + sysbus_mmio_map(busdev, 0, base); | ||
89 | + sysbus_connect_irq(busdev, 0, irq); | ||
90 | +} | ||
91 | + | ||
92 | Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | ||
93 | { | ||
94 | Exynos4210State *s = g_new0(Exynos4210State, 1); | ||
95 | @@ -XXX,XX +XXX,XX @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | ||
96 | sysbus_create_simple(TYPE_EXYNOS4210_EHCI, EXYNOS4210_EHCI_BASE_ADDR, | ||
97 | s->irq_table[exynos4210_get_irq(28, 3)]); | ||
98 | |||
99 | + /*** DMA controllers ***/ | ||
100 | + pl330_create(EXYNOS4210_PL330_BASE0_ADDR, | ||
101 | + qemu_irq_invert(s->irq_table[exynos4210_get_irq(35, 1)]), 32); | ||
102 | + pl330_create(EXYNOS4210_PL330_BASE1_ADDR, | ||
103 | + qemu_irq_invert(s->irq_table[exynos4210_get_irq(36, 1)]), 32); | ||
104 | + pl330_create(EXYNOS4210_PL330_BASE2_ADDR, | ||
105 | + qemu_irq_invert(s->irq_table[exynos4210_get_irq(34, 1)]), 1); | ||
106 | + | ||
107 | return s; | ||
108 | } | ||
109 | -- | 31 | -- |
110 | 2.20.1 | 32 | 2.20.1 |
111 | 33 | ||
112 | 34 | diff view generated by jsdifflib |
1 | From: Alistair Francis <alistair.francis@wdc.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Commit 89e68b575 "target/arm: Use vector operations for saturation" | 3 | All of the inputs to these instructions are 32-bits. Rather than |
4 | causes this abort() when booting QEMU ARM with a Cortex-A15: | 4 | extend each input to 64-bits and then extract the high 32-bits of |
5 | the output, use tcg_gen_muls2_i32 and other 32-bit generator functions. | ||
5 | 6 | ||
6 | 0 0x00007ffff4c2382f in raise () at /usr/lib/libc.so.6 | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | 1 0x00007ffff4c0e672 in abort () at /usr/lib/libc.so.6 | 8 | Message-id: 20190808202616.13782-7-richard.henderson@linaro.org |
8 | 2 0x00005555559c1839 in disas_neon_data_insn (insn=<optimized out>, s=<optimized out>) at ./target/arm/translate.c:6673 | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | 3 0x00005555559c1839 in disas_neon_data_insn (s=<optimized out>, insn=<optimized out>) at ./target/arm/translate.c:6386 | ||
10 | 4 0x00005555559cd8a4 in disas_arm_insn (insn=4081107068, s=0x7fffe59a9510) at ./target/arm/translate.c:9289 | ||
11 | 5 0x00005555559cd8a4 in arm_tr_translate_insn (dcbase=0x7fffe59a9510, cpu=<optimized out>) at ./target/arm/translate.c:13612 | ||
12 | 6 0x00005555558d1d39 in translator_loop (ops=0x5555561cc580 <arm_translator_ops>, db=0x7fffe59a9510, cpu=0x55555686a2f0, tb=<optimized out>, max_insns=<optimized out>) at ./accel/tcg/translator.c:96 | ||
13 | 7 0x00005555559d10d4 in gen_intermediate_code (cpu=cpu@entry=0x55555686a2f0, tb=tb@entry=0x7fffd7840080 <code_gen_buffer+126091347>, max_insns=max_insns@entry=512) at ./target/arm/translate.c:13901 | ||
14 | 8 0x00005555558d06b9 in tb_gen_code (cpu=cpu@entry=0x55555686a2f0, pc=3067096216, cs_base=0, flags=192, cflags=-16252928, cflags@entry=524288) at ./accel/tcg/translate-all.c:1736 | ||
15 | 9 0x00005555558ce467 in tb_find (cf_mask=524288, tb_exit=1, last_tb=0x7fffd783e640 <code_gen_buffer+126084627>, cpu=0x1) at ./accel/tcg/cpu-exec.c:407 | ||
16 | 10 0x00005555558ce467 in cpu_exec (cpu=cpu@entry=0x55555686a2f0) at ./accel/tcg/cpu-exec.c:728 | ||
17 | 11 0x000055555588b0cf in tcg_cpu_exec (cpu=0x55555686a2f0) at ./cpus.c:1431 | ||
18 | 12 0x000055555588d223 in qemu_tcg_cpu_thread_fn (arg=0x55555686a2f0) at ./cpus.c:1735 | ||
19 | 13 0x000055555588d223 in qemu_tcg_cpu_thread_fn (arg=arg@entry=0x55555686a2f0) at ./cpus.c:1709 | ||
20 | 14 0x0000555555d2629a in qemu_thread_start (args=<optimized out>) at ./util/qemu-thread-posix.c:502 | ||
21 | 15 0x00007ffff4db8a92 in start_thread () at /usr/lib/libpthread. | ||
22 | |||
23 | This patch ensures that we don't hit the abort() in the second switch | ||
24 | case in disas_neon_data_insn() as we will return from the first case. | ||
25 | |||
26 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
27 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
28 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
29 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
30 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
31 | Message-id: ad91b397f360b2fc7f4087e476f7df5b04d42ddb.1558021877.git.alistair.francis@wdc.com | ||
32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
33 | --- | 11 | --- |
34 | target/arm/translate.c | 4 ++-- | 12 | target/arm/translate.c | 72 +++++++++++++++--------------------------- |
35 | 1 file changed, 2 insertions(+), 2 deletions(-) | 13 | 1 file changed, 26 insertions(+), 46 deletions(-) |
36 | 14 | ||
37 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 15 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
38 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/translate.c | 17 | --- a/target/arm/translate.c |
40 | +++ b/target/arm/translate.c | 18 | +++ b/target/arm/translate.c |
41 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) | 19 | @@ -XXX,XX +XXX,XX @@ static void gen_revsh(TCGv_i32 var) |
42 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 20 | tcg_gen_ext16s_i32(var, var); |
43 | rn_ofs, rm_ofs, vec_size, vec_size, | 21 | } |
44 | (u ? uqadd_op : sqadd_op) + size); | 22 | |
45 | - break; | 23 | -/* Return (b << 32) + a. Mark inputs as dead */ |
46 | + return 0; | 24 | -static TCGv_i64 gen_addq_msw(TCGv_i64 a, TCGv_i32 b) |
47 | 25 | -{ | |
48 | case NEON_3R_VQSUB: | 26 | - TCGv_i64 tmp64 = tcg_temp_new_i64(); |
49 | tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), | 27 | - |
50 | rn_ofs, rm_ofs, vec_size, vec_size, | 28 | - tcg_gen_extu_i32_i64(tmp64, b); |
51 | (u ? uqsub_op : sqsub_op) + size); | 29 | - tcg_temp_free_i32(b); |
52 | - break; | 30 | - tcg_gen_shli_i64(tmp64, tmp64, 32); |
53 | + return 0; | 31 | - tcg_gen_add_i64(a, tmp64, a); |
54 | 32 | - | |
55 | case NEON_3R_VMUL: /* VMUL */ | 33 | - tcg_temp_free_i64(tmp64); |
56 | if (u) { | 34 | - return a; |
35 | -} | ||
36 | - | ||
37 | -/* Return (b << 32) - a. Mark inputs as dead. */ | ||
38 | -static TCGv_i64 gen_subq_msw(TCGv_i64 a, TCGv_i32 b) | ||
39 | -{ | ||
40 | - TCGv_i64 tmp64 = tcg_temp_new_i64(); | ||
41 | - | ||
42 | - tcg_gen_extu_i32_i64(tmp64, b); | ||
43 | - tcg_temp_free_i32(b); | ||
44 | - tcg_gen_shli_i64(tmp64, tmp64, 32); | ||
45 | - tcg_gen_sub_i64(a, tmp64, a); | ||
46 | - | ||
47 | - tcg_temp_free_i64(tmp64); | ||
48 | - return a; | ||
49 | -} | ||
50 | - | ||
51 | /* 32x32->64 multiply. Marks inputs as dead. */ | ||
52 | static TCGv_i64 gen_mulu_i64_i32(TCGv_i32 a, TCGv_i32 b) | ||
53 | { | ||
54 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
55 | (SMMUL, SMMLA, SMMLS) */ | ||
56 | tmp = load_reg(s, rm); | ||
57 | tmp2 = load_reg(s, rs); | ||
58 | - tmp64 = gen_muls_i64_i32(tmp, tmp2); | ||
59 | + tcg_gen_muls2_i32(tmp2, tmp, tmp, tmp2); | ||
60 | |||
61 | if (rd != 15) { | ||
62 | - tmp = load_reg(s, rd); | ||
63 | + tmp3 = load_reg(s, rd); | ||
64 | if (insn & (1 << 6)) { | ||
65 | - tmp64 = gen_subq_msw(tmp64, tmp); | ||
66 | + tcg_gen_sub_i32(tmp, tmp, tmp3); | ||
67 | } else { | ||
68 | - tmp64 = gen_addq_msw(tmp64, tmp); | ||
69 | + tcg_gen_add_i32(tmp, tmp, tmp3); | ||
70 | } | ||
71 | + tcg_temp_free_i32(tmp3); | ||
72 | } | ||
73 | if (insn & (1 << 5)) { | ||
74 | - tcg_gen_addi_i64(tmp64, tmp64, 0x80000000u); | ||
75 | + /* | ||
76 | + * Adding 0x80000000 to the 64-bit quantity | ||
77 | + * means that we have carry in to the high | ||
78 | + * word when the low word has the high bit set. | ||
79 | + */ | ||
80 | + tcg_gen_shri_i32(tmp2, tmp2, 31); | ||
81 | + tcg_gen_add_i32(tmp, tmp, tmp2); | ||
82 | } | ||
83 | - tcg_gen_shri_i64(tmp64, tmp64, 32); | ||
84 | - tmp = tcg_temp_new_i32(); | ||
85 | - tcg_gen_extrl_i64_i32(tmp, tmp64); | ||
86 | - tcg_temp_free_i64(tmp64); | ||
87 | + tcg_temp_free_i32(tmp2); | ||
88 | store_reg(s, rn, tmp); | ||
89 | break; | ||
90 | case 0: | ||
91 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
92 | } | ||
93 | break; | ||
94 | case 5: case 6: /* 32 * 32 -> 32msb (SMMUL, SMMLA, SMMLS) */ | ||
95 | - tmp64 = gen_muls_i64_i32(tmp, tmp2); | ||
96 | + tcg_gen_muls2_i32(tmp2, tmp, tmp, tmp2); | ||
97 | if (rs != 15) { | ||
98 | - tmp = load_reg(s, rs); | ||
99 | + tmp3 = load_reg(s, rs); | ||
100 | if (insn & (1 << 20)) { | ||
101 | - tmp64 = gen_addq_msw(tmp64, tmp); | ||
102 | + tcg_gen_add_i32(tmp, tmp, tmp3); | ||
103 | } else { | ||
104 | - tmp64 = gen_subq_msw(tmp64, tmp); | ||
105 | + tcg_gen_sub_i32(tmp, tmp, tmp3); | ||
106 | } | ||
107 | + tcg_temp_free_i32(tmp3); | ||
108 | } | ||
109 | if (insn & (1 << 4)) { | ||
110 | - tcg_gen_addi_i64(tmp64, tmp64, 0x80000000u); | ||
111 | + /* | ||
112 | + * Adding 0x80000000 to the 64-bit quantity | ||
113 | + * means that we have carry in to the high | ||
114 | + * word when the low word has the high bit set. | ||
115 | + */ | ||
116 | + tcg_gen_shri_i32(tmp2, tmp2, 31); | ||
117 | + tcg_gen_add_i32(tmp, tmp, tmp2); | ||
118 | } | ||
119 | - tcg_gen_shri_i64(tmp64, tmp64, 32); | ||
120 | - tmp = tcg_temp_new_i32(); | ||
121 | - tcg_gen_extrl_i64_i32(tmp, tmp64); | ||
122 | - tcg_temp_free_i64(tmp64); | ||
123 | + tcg_temp_free_i32(tmp2); | ||
124 | break; | ||
125 | case 7: /* Unsigned sum of absolute differences. */ | ||
126 | gen_helper_usad8(tmp, tmp, tmp2); | ||
57 | -- | 127 | -- |
58 | 2.20.1 | 128 | 2.20.1 |
59 | 129 | ||
60 | 130 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | Separate shift + extract low will result in one extra insn |
4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 4 | for hosts like RISC-V, MIPS, and Sparc. |
5 | Message-id: 20190520214342.13709-2-philmd@redhat.com | 5 | |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20190808202616.13782-8-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 10 | --- |
8 | hw/arm/exynos4_boards.c | 24 ------------------------ | 11 | target/arm/translate.c | 18 ++++++------------ |
9 | 1 file changed, 24 deletions(-) | 12 | 1 file changed, 6 insertions(+), 12 deletions(-) |
10 | 13 | ||
11 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | 14 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
12 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/arm/exynos4_boards.c | 16 | --- a/target/arm/translate.c |
14 | +++ b/hw/arm/exynos4_boards.c | 17 | +++ b/target/arm/translate.c |
15 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) |
16 | #include "hw/net/lan9118.h" | 19 | if (insn & ARM_CP_RW_BIT) { /* TMRRC */ |
17 | #include "hw/boards.h" | 20 | iwmmxt_load_reg(cpu_V0, wrd); |
18 | 21 | tcg_gen_extrl_i64_i32(cpu_R[rdlo], cpu_V0); | |
19 | -#undef DEBUG | 22 | - tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); |
20 | - | 23 | - tcg_gen_extrl_i64_i32(cpu_R[rdhi], cpu_V0); |
21 | -//#define DEBUG | 24 | + tcg_gen_extrh_i64_i32(cpu_R[rdhi], cpu_V0); |
22 | - | 25 | } else { /* TMCRR */ |
23 | -#ifdef DEBUG | 26 | tcg_gen_concat_i32_i64(cpu_V0, cpu_R[rdlo], cpu_R[rdhi]); |
24 | - #undef PRINT_DEBUG | 27 | iwmmxt_store_reg(cpu_V0, wrd); |
25 | - #define PRINT_DEBUG(fmt, args...) \ | 28 | @@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn) |
26 | - do { \ | 29 | if (insn & ARM_CP_RW_BIT) { /* MRA */ |
27 | - fprintf(stderr, " [%s:%d] "fmt, __func__, __LINE__, ##args); \ | 30 | iwmmxt_load_reg(cpu_V0, acc); |
28 | - } while (0) | 31 | tcg_gen_extrl_i64_i32(cpu_R[rdlo], cpu_V0); |
29 | -#else | 32 | - tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); |
30 | - #define PRINT_DEBUG(fmt, args...) do {} while (0) | 33 | - tcg_gen_extrl_i64_i32(cpu_R[rdhi], cpu_V0); |
31 | -#endif | 34 | + tcg_gen_extrh_i64_i32(cpu_R[rdhi], cpu_V0); |
32 | - | 35 | tcg_gen_andi_i32(cpu_R[rdhi], cpu_R[rdhi], (1 << (40 - 32)) - 1); |
33 | #define SMDK_LAN9118_BASE_ADDR 0x05000000 | 36 | } else { /* MAR */ |
34 | 37 | tcg_gen_concat_i32_i64(cpu_V0, cpu_R[rdlo], cpu_R[rdhi]); | |
35 | typedef enum Exynos4BoardType { | 38 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
36 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, | 39 | gen_helper_neon_narrow_high_u16(tmp, cpu_V0); |
37 | exynos4_board_binfo.gic_cpu_if_addr = | 40 | break; |
38 | EXYNOS4210_SMP_PRIVATE_BASE_ADDR + 0x100; | 41 | case 2: |
39 | 42 | - tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); | |
40 | - PRINT_DEBUG("\n ram_size: %luMiB [0x%08lx]\n" | 43 | - tcg_gen_extrl_i64_i32(tmp, cpu_V0); |
41 | - " kernel_filename: %s\n" | 44 | + tcg_gen_extrh_i64_i32(tmp, cpu_V0); |
42 | - " kernel_cmdline: %s\n" | 45 | break; |
43 | - " initrd_filename: %s\n", | 46 | default: abort(); |
44 | - exynos4_board_ram_size[board_type] / 1048576, | 47 | } |
45 | - exynos4_board_ram_size[board_type], | 48 | @@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) |
46 | - machine->kernel_filename, | 49 | break; |
47 | - machine->kernel_cmdline, | 50 | case 2: |
48 | - machine->initrd_filename); | 51 | tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31); |
49 | - | 52 | - tcg_gen_shri_i64(cpu_V0, cpu_V0, 32); |
50 | exynos4_boards_init_ram(s, get_system_memory(), | 53 | - tcg_gen_extrl_i64_i32(tmp, cpu_V0); |
51 | exynos4_board_ram_size[board_type]); | 54 | + tcg_gen_extrh_i64_i32(tmp, cpu_V0); |
55 | break; | ||
56 | default: abort(); | ||
57 | } | ||
58 | @@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) | ||
59 | tmp = tcg_temp_new_i32(); | ||
60 | tcg_gen_extrl_i64_i32(tmp, tmp64); | ||
61 | store_reg(s, rt, tmp); | ||
62 | - tcg_gen_shri_i64(tmp64, tmp64, 32); | ||
63 | tmp = tcg_temp_new_i32(); | ||
64 | - tcg_gen_extrl_i64_i32(tmp, tmp64); | ||
65 | + tcg_gen_extrh_i64_i32(tmp, tmp64); | ||
66 | tcg_temp_free_i64(tmp64); | ||
67 | store_reg(s, rt2, tmp); | ||
68 | } else { | ||
69 | @@ -XXX,XX +XXX,XX @@ static void gen_storeq_reg(DisasContext *s, int rlow, int rhigh, TCGv_i64 val) | ||
70 | tcg_gen_extrl_i64_i32(tmp, val); | ||
71 | store_reg(s, rlow, tmp); | ||
72 | tmp = tcg_temp_new_i32(); | ||
73 | - tcg_gen_shri_i64(val, val, 32); | ||
74 | - tcg_gen_extrl_i64_i32(tmp, val); | ||
75 | + tcg_gen_extrh_i64_i32(tmp, val); | ||
76 | store_reg(s, rhigh, tmp); | ||
77 | } | ||
52 | 78 | ||
53 | -- | 79 | -- |
54 | 2.20.1 | 80 | 2.20.1 |
55 | 81 | ||
56 | 82 | diff view generated by jsdifflib |