A follow-up patch will move some parts of traps.c in separate files.
The will require to use helpers that are currently statically defined.
Export the following helpers:
- inject_undef64_exception
- inject_undef_exception
- check_conditional_instr
- advance_pc
- handle_raz_wi
- handle_wo_wi
- handle_ro_raz
Note that asm-arm/arm32/traps.h is empty but it is to keep parity with
the arm64 counterpart.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
#include <asm/monitor.h>
#include <asm/psci.h>
#include <asm/regs.h>
+#include <asm/traps.h>
#include <asm/vgic.h>
#include <asm/vtimer.h>
}
/* Inject an undefined exception into a 64 bit guest */
-static void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len)
+void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len)
{
vaddr_t handler;
const union hsr esr = {
#endif
-static void inject_undef_exception(struct cpu_user_regs *regs,
- const union hsr hsr)
+void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr)
{
if ( is_32bit_domain(current->domain) )
inject_undef32_exception(regs);
0 /* NV */
};
-static int check_conditional_instr(struct cpu_user_regs *regs,
- const union hsr hsr)
+int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr)
{
unsigned long cpsr, cpsr_cond;
int cond;
return 1;
}
-static void advance_pc(struct cpu_user_regs *regs, const union hsr hsr)
+void advance_pc(struct cpu_user_regs *regs, const union hsr hsr)
{
unsigned long itbits, cond, cpsr = regs->cpsr;
}
/* Read as zero and write ignore */
-static void handle_raz_wi(struct cpu_user_regs *regs,
- int regidx,
- bool read,
- const union hsr hsr,
- int min_el)
+void handle_raz_wi(struct cpu_user_regs *regs,
+ int regidx,
+ bool read,
+ const union hsr hsr,
+ int min_el)
{
ASSERT((min_el == 0) || (min_el == 1));
advance_pc(regs, hsr);
}
-/* Write only as write ignore */
-static void handle_wo_wi(struct cpu_user_regs *regs,
- int regidx,
- bool read,
- const union hsr hsr,
- int min_el)
+/* write only as write ignore */
+void handle_wo_wi(struct cpu_user_regs *regs,
+ int regidx,
+ bool read,
+ const union hsr hsr,
+ int min_el)
{
ASSERT((min_el == 0) || (min_el == 1));
}
/* Read only as read as zero */
-static void handle_ro_raz(struct cpu_user_regs *regs,
- int regidx,
- bool read,
- const union hsr hsr,
- int min_el)
+void handle_ro_raz(struct cpu_user_regs *regs,
+ int regidx,
+ bool read,
+ const union hsr hsr,
+ int min_el)
{
ASSERT((min_el == 0) || (min_el == 1));
--- /dev/null
+#ifndef __ASM_ARM32_TRAPS__
+#define __ASM_ARM32_TRAPS__
+
+#endif /* __ASM_ARM32_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
--- /dev/null
+#ifndef __ASM_ARM64_TRAPS__
+#define __ASM_ARM64_TRAPS__
+
+void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len);
+
+#endif /* __ASM_ARM64_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+
--- /dev/null
+#ifndef __ASM_ARM_TRAPS__
+#define __ASM_ARM_TRAPS__
+
+#include <asm/processor.h>
+
+#if defined(CONFIG_ARM_32)
+# include <asm/arm32/traps.h>
+#elif defined(CONFIG_ARM_64)
+# include <asm/arm64/traps.h>
+#endif
+
+int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr);
+
+void advance_pc(struct cpu_user_regs *regs, const union hsr hsr);
+
+void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr);
+
+/* read as zero and write ignore */
+void handle_raz_wi(struct cpu_user_regs *regs, int regidx, bool read,
+ const union hsr hsr, int min_el);
+
+/* write only as write ignore */
+void handle_wo_wi(struct cpu_user_regs *regs, int regidx, bool read,
+ const union hsr hsr, int min_el);
+
+/* read only as read as zero */
+void handle_ro_raz(struct cpu_user_regs *regs, int regidx, bool read,
+ const union hsr hsr, int min_el);
+
+#endif /* __ASM_ARM_TRAPS__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+