The function init_traps sets up the handler taken when Xen hits a
BUG_ON/ASSERT.
If an error happen before init_traps is called, we lose the backtrace.
When a trap is taken from HYP mode, we need to:
- get the processor ID, percpu has to be initialized and the
smp_processor_id correctly set.
- initialize current, even though it's not used for the time being. Move
the debug sanity earlier.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Tested-by: Naresh Bhat <naresh.bhat@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- fixed typos and rewrapped commit log ]
percpu_init_areas();
set_processor_id(0); /* needed early, for smp_processor_id() */
+ set_current((struct vcpu *)0xfffff000); /* debug sanity */
+ idle_vcpu[0] = current;
+
+ /* Initialize traps early allow us to get backtrace when an error occurred */
+ init_traps();
+
smp_clear_cpu_maps();
/* This is mapped by head.S */
gic_init();
- set_current((struct vcpu *)0xfffff000); /* debug sanity */
- idle_vcpu[0] = current;
-
- init_traps();
-
setup_virt_paging();
p2m_vmid_allocator_init();