AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
isr.c File Reference

x86: exceptions and system calls. More...

#include <core/system.h>
#include <core/arch.h>
#include <core/panic.h>
#include <core/string.h>
#include <cpu/cpu.h>
#include <sys/sched.h>
#include <sys/signal.h>
#include <sys/lock.h>
#include <mm/mm.h>

Go to the source code of this file.

Functions

void __x86_isr0 (void)
void __x86_isr1 (void)
void __x86_isr2 (void)
void __x86_isr3 (void)
void __x86_isr4 (void)
void __x86_isr5 (void)
void __x86_isr6 (void)
void __x86_isr7 (void)
void __x86_isr8 (void)
void __x86_isr9 (void)
void __x86_isr10 (void)
void __x86_isr11 (void)
void __x86_isr12 (void)
void __x86_isr13 (void)
void __x86_isr14 (void)
void __x86_isr15 (void)
void __x86_isr16 (void)
void __x86_isr17 (void)
void __x86_isr18 (void)
void __x86_isr19 (void)
void __x86_isr20 (void)
void __x86_isr21 (void)
void __x86_isr22 (void)
void __x86_isr23 (void)
void __x86_isr24 (void)
void __x86_isr25 (void)
void __x86_isr26 (void)
void __x86_isr27 (void)
void __x86_isr28 (void)
void __x86_isr29 (void)
void __x86_isr30 (void)
void __x86_isr31 (void)
void __x86_isr128 (void)
static int uaccess_fixup (struct x86_regs *regs)
 Handles a fault in one of the user memory copy routines (uaccess.S): the routine resumes at its fixup, which reports the failure to its caller.
static void isr_dispatch (struct x86_regs *regs)
 Handles an exception or a system call, by its vector.
void __x86_isr (struct x86_regs *regs)
 Handles an exception or a system call, which the stubs in cpu.S call.
void x86_isr_setup (void)
 Sets the IDT's gates for the exceptions and the system call vector.

Variables

static const char * int_msg [32]
static const int int_sig [32]

Detailed Description

x86: exceptions and system calls.

The stubs in cpu.S call __x86_isr() for the 32 exception vectors and for int $0x80, the system call. A page fault goes to the memory code, #NM to the FPU code, a system call to arch_syscall(). Any other exception from user mode becomes a signal to the process; from the kernel, it is a bug, and the kernel panics.

Definition in file isr.c.

Function Documentation

◆ __x86_isr()

void __x86_isr ( struct x86_regs * regs)

Handles an exception or a system call, which the stubs in cpu.S call.

It takes the kernel lock if it came from user mode (an exception in the kernel holds it already), and lets go of it on the way back.

Parameters
regsthe interrupted registers, saved on the kernel stack

Definition at line 239 of file isr.c.

References __x86_isr(), curthread, isr_dispatch(), kernel_enter(), kernel_leave(), x86_thread::regs, and sched_thread_killed().

Referenced by __x86_isr().

◆ __x86_isr0()

void __x86_isr0 ( void )
extern

References __x86_isr0().

Referenced by __x86_isr0(), and x86_isr_setup().

◆ __x86_isr1()

void __x86_isr1 ( void )
extern

References __x86_isr1().

Referenced by __x86_isr1(), and x86_isr_setup().

◆ __x86_isr10()

void __x86_isr10 ( void )
extern

References __x86_isr10().

Referenced by __x86_isr10(), and x86_isr_setup().

◆ __x86_isr11()

void __x86_isr11 ( void )
extern

References __x86_isr11().

Referenced by __x86_isr11(), and x86_isr_setup().

◆ __x86_isr12()

void __x86_isr12 ( void )
extern

References __x86_isr12().

Referenced by __x86_isr12(), and x86_isr_setup().

◆ __x86_isr128()

void __x86_isr128 ( void )
extern

References __x86_isr128().

Referenced by __x86_isr128(), and x86_isr_setup().

◆ __x86_isr13()

void __x86_isr13 ( void )
extern

References __x86_isr13().

Referenced by __x86_isr13(), and x86_isr_setup().

◆ __x86_isr14()

void __x86_isr14 ( void )
extern

References __x86_isr14().

Referenced by __x86_isr14(), and x86_isr_setup().

◆ __x86_isr15()

void __x86_isr15 ( void )
extern

References __x86_isr15().

Referenced by __x86_isr15(), and x86_isr_setup().

◆ __x86_isr16()

void __x86_isr16 ( void )
extern

References __x86_isr16().

Referenced by __x86_isr16(), and x86_isr_setup().

◆ __x86_isr17()

void __x86_isr17 ( void )
extern

References __x86_isr17().

Referenced by __x86_isr17(), and x86_isr_setup().

◆ __x86_isr18()

void __x86_isr18 ( void )
extern

References __x86_isr18().

Referenced by __x86_isr18(), and x86_isr_setup().

◆ __x86_isr19()

void __x86_isr19 ( void )
extern

References __x86_isr19().

Referenced by __x86_isr19(), and x86_isr_setup().

◆ __x86_isr2()

void __x86_isr2 ( void )
extern

References __x86_isr2().

Referenced by __x86_isr2(), and x86_isr_setup().

◆ __x86_isr20()

void __x86_isr20 ( void )
extern

References __x86_isr20().

Referenced by __x86_isr20(), and x86_isr_setup().

◆ __x86_isr21()

void __x86_isr21 ( void )
extern

References __x86_isr21().

Referenced by __x86_isr21(), and x86_isr_setup().

◆ __x86_isr22()

void __x86_isr22 ( void )
extern

References __x86_isr22().

Referenced by __x86_isr22(), and x86_isr_setup().

◆ __x86_isr23()

void __x86_isr23 ( void )
extern

References __x86_isr23().

Referenced by __x86_isr23(), and x86_isr_setup().

◆ __x86_isr24()

void __x86_isr24 ( void )
extern

References __x86_isr24().

Referenced by __x86_isr24(), and x86_isr_setup().

◆ __x86_isr25()

void __x86_isr25 ( void )
extern

References __x86_isr25().

Referenced by __x86_isr25(), and x86_isr_setup().

◆ __x86_isr26()

void __x86_isr26 ( void )
extern

References __x86_isr26().

Referenced by __x86_isr26(), and x86_isr_setup().

◆ __x86_isr27()

void __x86_isr27 ( void )
extern

References __x86_isr27().

Referenced by __x86_isr27(), and x86_isr_setup().

◆ __x86_isr28()

void __x86_isr28 ( void )
extern

References __x86_isr28().

Referenced by __x86_isr28(), and x86_isr_setup().

◆ __x86_isr29()

void __x86_isr29 ( void )
extern

References __x86_isr29().

Referenced by __x86_isr29(), and x86_isr_setup().

◆ __x86_isr3()

void __x86_isr3 ( void )
extern

References __x86_isr3().

Referenced by __x86_isr3(), and x86_isr_setup().

◆ __x86_isr30()

void __x86_isr30 ( void )
extern

References __x86_isr30().

Referenced by __x86_isr30(), and x86_isr_setup().

◆ __x86_isr31()

void __x86_isr31 ( void )
extern

References __x86_isr31().

Referenced by __x86_isr31(), and x86_isr_setup().

◆ __x86_isr4()

void __x86_isr4 ( void )
extern

References __x86_isr4().

Referenced by __x86_isr4(), and x86_isr_setup().

◆ __x86_isr5()

void __x86_isr5 ( void )
extern

References __x86_isr5().

Referenced by __x86_isr5(), and x86_isr_setup().

◆ __x86_isr6()

void __x86_isr6 ( void )
extern

References __x86_isr6().

Referenced by __x86_isr6(), and x86_isr_setup().

◆ __x86_isr7()

void __x86_isr7 ( void )
extern

References __x86_isr7().

Referenced by __x86_isr7(), and x86_isr_setup().

◆ __x86_isr8()

void __x86_isr8 ( void )
extern

References __x86_isr8().

Referenced by __x86_isr8(), and x86_isr_setup().

◆ __x86_isr9()

void __x86_isr9 ( void )
extern

References __x86_isr9().

Referenced by __x86_isr9(), and x86_isr_setup().

◆ isr_dispatch()

void isr_dispatch ( struct x86_regs * regs)
static

◆ uaccess_fixup()

int uaccess_fixup ( struct x86_regs * regs)
static

Handles a fault in one of the user memory copy routines (uaccess.S): the routine resumes at its fixup, which reports the failure to its caller.

Returns 1 if the faulting instruction was one of them, 0 if it wasn't.

Definition at line 124 of file isr.c.

References x86_regs::rip, and uaccess_fixup().

◆ x86_isr_setup()

Variable Documentation

◆ int_msg

const char* int_msg[32]
static

Definition at line 60 of file isr.c.

Referenced by isr_dispatch().

◆ int_sig

const int int_sig[32]
static
Initial value:
= {
SIGFPE,
SIGTRAP,
0,
SIGTRAP,
SIGSEGV,
SIGSEGV,
SIGILL,
0,
0,
SIGFPE,
0,
SIGBUS,
SIGBUS,
SIGSEGV,
SIGSEGV,
0,
SIGFPE,
SIGBUS,
0,
SIGFPE,
}

Definition at line 97 of file isr.c.

Referenced by isr_dispatch().