24#define EC(esr) (((esr) >> 26) & 0x3F)
25#define EC_UNKNOWN 0x00
28#define EC_IABT_LOW 0x20
29#define EC_IABT_CUR 0x21
30#define EC_PC_ALIGN 0x22
31#define EC_DABT_LOW 0x24
32#define EC_DABT_CUR 0x25
33#define EC_SP_ALIGN 0x26
38#define ISS_WNR (1 << 6)
39#define ISS_FSC(esr) ((esr) & 0x3F)
40#define FSC_PERMISSION 0x0C
45 for (
int i = 0; i < 31; i += 2)
46 printk(
"x%d = %p x%d = %p\n", i, (
void *) r->
x[i], i + 1, i + 1 < 31 ? (
void *) r->
x[i + 1] :
NULL);
48 printk(
"sp = %p pc = %p pstate = %p esr = %p far = %p\n", (
void *) r->
sp,
57 extern uintptr_t aarch64_uaccess_fixups[], aarch64_uaccess_fixups_end[];
59 for (
uintptr_t *f = aarch64_uaccess_fixups; f < aarch64_uaccess_fixups_end; f += 2) {
103 printk(
"kernel: page fault at %p%s\n", (
void *) far,
104 far <
USER_STACK ?
" (user memory, outside copyin/copyout)" :
"");
106 panic(
"page fault in the kernel");
117 panic(
"syscall without a current thread");
148 ec ==
EC_BRK ? SIGTRAP : SIGILL;
156 printk(
"kernel: exception, class %x\n", ec);
158 panic(
"exception in the kernel");
218 if (curcpu()->arch.tick_switch) {
219 curcpu()->arch.tick_switch = 0;
245 printk(
"kernel: an exception the vectors don't take (FIQ, SError, aarch32)\n");
247 panic(
"unexpected exception");
void aarch64_return_to_user(struct aarch64_regs *r, int syscall)
Takes the current thread's signals on its way back to user mode, and restarts or fails the system cal...
int aarch64_ctx_save(struct aarch64_ctx *ctx)
void arch_syscall(struct aarch64_regs *r)
int aarch64_fpsimd_trap(void)
Handles the trap of user mode's use of the registers: they get the running thread's values,...
int mm_page_fault(vaddr_t vaddr, int flags)
Handles a page fault in the current process's address space.
void kernel_leave(int took)
Lets go of the kernel lock on leaving the kernel, if kernel_enter() took it.
int kernel_enter(void)
Takes the kernel lock on entering the kernel, unless this CPU holds it already (an exception inside t...
int printk(const char *fmt,...)
Writes a kernel message, to the message buffer and the consoles.
void sched_idle_wakeup(void)
Runs a ready thread now if an interrupt made one ready while this CPU was idle, rather than at the ne...
void sched_thread_killed(void)
Ends the current thread, which was killed while it ran on this CPU (thread->killed).
void schedule(void)
Switches to the next ready thread.
void signal_force(struct proc *proc, int signal)
Sends a signal that can't be blocked or ignored, such as the SIGSEGV of a fault: if the process block...
What an exception saves on the kernel stack (cpu/vectors.S): the context it interrupted.
A thread's aarch64 state (thread->arch).
struct aarch64_regs * regs
static void abort(struct aarch64_regs *r, int ec)
Handles an instruction or data abort: a page fault in the process's memory, or else a SIGSEGV,...
struct aarch64_regs * aarch64_irq_regs
static void sync_dispatch(struct aarch64_regs *r)
Handles a synchronous exception, by its class.
void aarch64_irq(struct aarch64_regs *r)
Handles an interrupt, which cpu/vectors.S calls.
static void dump(struct aarch64_regs *r)
Prints the saved registers, for a panic.
void aarch64_sync(struct aarch64_regs *r)
Handles a synchronous exception (a system call, a fault), which cpu/vectors.S calls.
static int uaccess_fixup(struct aarch64_regs *r)
Handles a fault in a copy from or to user memory (cpu/uaccess.S): the copy goes on at its fixup,...
void aarch64_preempt(void)
Switches away from this CPU's running thread, which stays ready, to the next ready thread.
void aarch64_bad(struct aarch64_regs *r)
Panics on an exception that the vectors don't handle (an FIQ, an SError, or one from aarch32).
void irq_handle(void)
Runs the handlers of the interrupt that came, then tells the GIC it's done, before any thread switch,...