1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 #ifndef _ASMRISCV_PROCESSOR_H_ 3 #define _ASMRISCV_PROCESSOR_H_ 4 #include <asm/csr.h> 5 #include <asm/ptrace.h> 6 7 #define EXCEPTION_CAUSE_MAX 16 8 9 typedef void (*exception_fn)(struct pt_regs *); 10 11 struct thread_info { 12 int cpu; 13 unsigned long hartid; 14 unsigned long isa[1]; 15 exception_fn exception_handlers[EXCEPTION_CAUSE_MAX]; 16 }; 17 18 static inline struct thread_info *current_thread_info(void) 19 { 20 return (struct thread_info *)csr_read(CSR_SSCRATCH); 21 } 22 23 void install_exception_handler(unsigned long cause, void (*handler)(struct pt_regs *)); 24 void do_handle_exception(struct pt_regs *regs); 25 void thread_info_init(void); 26 27 void show_regs(struct pt_regs *regs); 28 29 #endif /* _ASMRISCV_PROCESSOR_H_ */ 30