@@ -7,6 +7,7 @@
void do_trap(struct cpu_user_regs *cpu_regs);
void handle_trap(void);
+void trap_init(void);
#endif /* __ASSEMBLY__ */
@@ -1,7 +1,9 @@
#include <xen/compile.h>
#include <xen/init.h>
+#include <asm/csr.h>
#include <asm/early_printk.h>
+#include <asm/traps.h>
/* Xen stack for bringing up the first CPU. */
unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
@@ -11,6 +13,8 @@ void __init noreturn start_xen(void)
{
early_printk("Hello from C env\n");
+ trap_init();
+
for ( ;; )
asm volatile ("wfi");
@@ -11,6 +11,13 @@
#include <xen/errno.h>
#include <xen/lib.h>
+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[] = {