[Qemu-devel] [RFC PATCH 3/3] target/arm: Make m_helper.c optional via CONFIG_ARM_V7M

Thomas Huth posted 3 patches 6 years, 2 months ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>
[Qemu-devel] [RFC PATCH 3/3] target/arm: Make m_helper.c optional via CONFIG_ARM_V7M
Posted by Thomas Huth 6 years, 2 months ago
We've already got the CONFIG_ARM_V7M switch, but it currently can
not be disabled yet. The m_helper.c code should not be compiled
into the binary if the switch is not enabled. We also have to
provide some stubs in a separate file to make sure that we still
can link the other code without CONFIG_ARM_V7M.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/arm/Makefile.objs   |  3 +-
 target/arm/m_helper-stub.c | 58 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 target/arm/m_helper-stub.c

diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
index 5cafc1eb6c..225e7a70a9 100644
--- a/target/arm/Makefile.objs
+++ b/target/arm/Makefile.objs
@@ -36,7 +36,8 @@ obj-y += tlb_helper.o debug_helper.o
 obj-y += translate.o op_helper.o
 obj-y += crypto_helper.o
 obj-y += iwmmxt_helper.o vec_helper.o neon_helper.o
-obj-y += m_helper.o
+obj-$(CONFIG_ARM_V7M) += m_helper.o
+obj-$(call lnot,$(CONFIG_ARM_V7M)) += m_helper-stub.o
 
 obj-$(CONFIG_SOFTMMU) += psci.o
 
diff --git a/target/arm/m_helper-stub.c b/target/arm/m_helper-stub.c
new file mode 100644
index 0000000000..8ec9de0fb6
--- /dev/null
+++ b/target/arm/m_helper-stub.c
@@ -0,0 +1,58 @@
+/*
+ * ARM V7M related stubs.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "exec/helper-proto.h"
+
+void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
+{
+    abort();
+}
+
+void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
+{
+    abort();
+}
+
+uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
+{
+    abort();
+}
+
+void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
+{
+    abort();
+}
+
+uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
+{
+    abort();
+}
+
+void HELPER(v7m_preserve_fp_state)(CPUARMState *env)
+{
+    abort();
+}
+
+void write_v7m_exception(CPUARMState *env, uint32_t new_exc)
+{
+    abort();
+}
+
+void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr)
+{
+    abort();
+}
+
+void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr)
+{
+    abort();
+}
+
+ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
+{
+    abort();
+}
-- 
2.18.1


Re: [Qemu-devel] [RFC PATCH 3/3] target/arm: Make m_helper.c optional via CONFIG_ARM_V7M
Posted by Philippe Mathieu-Daudé 6 years, 2 months ago
On 9/3/19 5:48 PM, Thomas Huth wrote:
> We've already got the CONFIG_ARM_V7M switch, but it currently can
> not be disabled yet. The m_helper.c code should not be compiled
> into the binary if the switch is not enabled. We also have to
> provide some stubs in a separate file to make sure that we still
> can link the other code without CONFIG_ARM_V7M.

If there is no M support, the translate code shouldn't even generate M
calls, so the stub shouldn't be necessary.
Anyhow I guess this code will be simplified by the ongoing decodetree
conversion from Richard.

> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  target/arm/Makefile.objs   |  3 +-
>  target/arm/m_helper-stub.c | 58 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 60 insertions(+), 1 deletion(-)
>  create mode 100644 target/arm/m_helper-stub.c
> 
> diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
> index 5cafc1eb6c..225e7a70a9 100644
> --- a/target/arm/Makefile.objs
> +++ b/target/arm/Makefile.objs
> @@ -36,7 +36,8 @@ obj-y += tlb_helper.o debug_helper.o
>  obj-y += translate.o op_helper.o
>  obj-y += crypto_helper.o
>  obj-y += iwmmxt_helper.o vec_helper.o neon_helper.o
> -obj-y += m_helper.o
> +obj-$(CONFIG_ARM_V7M) += m_helper.o
> +obj-$(call lnot,$(CONFIG_ARM_V7M)) += m_helper-stub.o
>  
>  obj-$(CONFIG_SOFTMMU) += psci.o
>  
> diff --git a/target/arm/m_helper-stub.c b/target/arm/m_helper-stub.c
> new file mode 100644
> index 0000000000..8ec9de0fb6
> --- /dev/null
> +++ b/target/arm/m_helper-stub.c
> @@ -0,0 +1,58 @@
> +/*
> + * ARM V7M related stubs.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +#include "qemu/osdep.h"
> +#include "cpu.h"
> +#include "exec/helper-proto.h"
> +
> +void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
> +{
> +    abort();
> +}
> +
> +void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
> +{
> +    abort();
> +}
> +
> +uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
> +{
> +    abort();
> +}
> +
> +void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
> +{
> +    abort();
> +}
> +
> +uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
> +{
> +    abort();
> +}
> +
> +void HELPER(v7m_preserve_fp_state)(CPUARMState *env)
> +{
> +    abort();
> +}
> +
> +void write_v7m_exception(CPUARMState *env, uint32_t new_exc)
> +{
> +    abort();
> +}
> +
> +void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr)
> +{
> +    abort();
> +}
> +
> +void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr)
> +{
> +    abort();
> +}
> +
> +ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
> +{
> +    abort();
> +}
> 

Re: [Qemu-devel] [RFC PATCH 3/3] target/arm: Make m_helper.c optional via CONFIG_ARM_V7M
Posted by Richard Henderson 6 years, 2 months ago
On 9/3/19 9:19 AM, Philippe Mathieu-Daudé wrote:
> On 9/3/19 5:48 PM, Thomas Huth wrote:
>> We've already got the CONFIG_ARM_V7M switch, but it currently can
>> not be disabled yet. The m_helper.c code should not be compiled
>> into the binary if the switch is not enabled. We also have to
>> provide some stubs in a separate file to make sure that we still
>> can link the other code without CONFIG_ARM_V7M.
> 
> If there is no M support, the translate code shouldn't even generate M
> calls, so the stub shouldn't be necessary.

No, the symbols are still required for link.

> Anyhow I guess this code will be simplified by the ongoing decodetree
> conversion from Richard.

No, the decodetree conversion will not affect this at all.


r~