coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
trap_handler.c File Reference
#include <arch/encoding.h>
#include <arch/exception.h>
#include <console/console.h>
#include <vm.h>
#include <mcall.h>
#include <sbi.h>
#include <types.h>
Include dependency graph for trap_handler.c:

Go to the source code of this file.

Functions

static const char * mstatus_to_previous_mode (uintptr_t ms)
 
static void print_trap_information (const trapframe *tf)
 
static void interrupt_handler (trapframe *tf)
 
void trap_handler (trapframe *tf)
 
void redirect_trap (void)
 

Variables

static const char *const exception_names []
 

Function Documentation

◆ interrupt_handler()

static void interrupt_handler ( trapframe tf)
static

Definition at line 71 of file trap_handler.c.

References BIOS_EMERG, trapframe::cause, HLS, IPI_FENCE_I, IPI_SFENCE_VMA, IPI_SFENCE_VMA_ASID, IPI_SHUTDOWN, IPI_SOFT, IRQ_M_SOFT, IRQ_M_TIMER, MIP_MTIP, MIP_SSIP, MIP_STIP, print_trap_information(), and printk.

Referenced by trap_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mstatus_to_previous_mode()

static const char* mstatus_to_previous_mode ( uintptr_t  ms)
static

Definition at line 33 of file trap_handler.c.

References MSTATUS_MPP.

Referenced by print_trap_information().

Here is the caller graph for this function:

◆ print_trap_information()

static void print_trap_information ( const trapframe tf)
static

Definition at line 45 of file trap_handler.c.

References ARRAY_SIZE, trapframe::badvaddr, BIOS_DEBUG, trapframe::cause, trapframe::epc, exception_names, trapframe::gpr, MSTATUS_MPRV, mstatus_to_previous_mode(), printk, and trapframe::status.

Referenced by interrupt_handler(), and trap_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ redirect_trap()

void redirect_trap ( void  )

Definition at line 151 of file trap_handler.c.

References EXTRACT_FIELD, INSERT_FIELD, MSTATUS_MPP, and MSTATUS_SPP.

Referenced by handle_misaligned().

Here is the caller graph for this function:

◆ trap_handler()

Variable Documentation

◆ exception_names

const char* const exception_names[]
static
Initial value:
= {
"Instruction address misaligned",
"Instruction access fault",
"Illegal instruction",
"Breakpoint",
"Load address misaligned",
"Load access fault",
"Store address misaligned",
"Store access fault",
"Environment call from U-mode",
"Environment call from S-mode",
"Reserved (10)",
"Environment call from M-mode",
"Instruction page fault",
"Load page fault",
"Reserved (14)",
"Store page fault",
}

Definition at line 14 of file trap_handler.c.

Referenced by print_trap_information().