@@ -9,6 +9,7 @@
void do_trap(struct cpu_user_regs *cpu_regs);
void handle_trap(void);
+void trap_init(void);
#endif /* __ASSEMBLY__ */
@@ -5,6 +5,7 @@
#include <asm/early_printk.h>
#include <asm/mm.h>
+#include <asm/traps.h>
/* Xen stack for bringing up the first CPU. */
unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
@@ -15,6 +16,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
{
remove_identity_mapping();
+ trap_init();
+
early_printk("Hello from C env\n");
early_printk("All set up\n");
@@ -12,6 +12,18 @@
#include <asm/processor.h>
#include <asm/traps.h>
+/*
+ * Initialize the trap handling.
+ *
+ * The function is called after MMU is enabled.
+ */
+void trap_init(void)
+{
+ unsigned long addr = (unsigned long)&handle_trap;
+
+ csr_write(CSR_STVEC, addr);
+}
+
static const char *decode_trap_cause(unsigned long cause)
{
static const char *const trap_causes[] = {