Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 501c26e8 authored by Max Filippov's avatar Max Filippov
Browse files

xtensa: implement early_trap_init



Paging on xtensa architecture requires functioning exception handling
because hardware cannot transparently access page tables that are not
currently mapped by TLB. Exception handling is set up late in the
initialization process, but working paging is needed for KASAN.

Provide early_trap_init that sets up minimal exception handling
sufficient for KASAN to work.

Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent f21a79ca
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,18 @@ struct exc_table {
 */
 */
extern void * __init trap_set_handler(int cause, void *handler);
extern void * __init trap_set_handler(int cause, void *handler);
extern void do_unhandled(struct pt_regs *regs, unsigned long exccause);
extern void do_unhandled(struct pt_regs *regs, unsigned long exccause);
void fast_second_level_miss(void);

/* Initialize minimal exc_table structure sufficient for basic paging */
static inline void __init early_trap_init(void)
{
	static struct exc_table exc_table __initdata = {
		.fast_kernel_handler[EXCCAUSE_DTLB_MISS] =
			fast_second_level_miss,
	};
	__asm__ __volatile__("wsr  %0, excsave1\n" : : "a" (&exc_table));
}

void secondary_trap_init(void);
void secondary_trap_init(void);


static inline void spill_registers(void)
static inline void spill_registers(void)