coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
exception.c File Reference
#include <types.h>
#include <arch/barrier.h>
#include <arch/exception.h>
#include <arch/transition.h>
#include <console/console.h>
#include <console/uart.h>
#include <arch/lib_helpers.h>
Include dependency graph for exception.c:

Go to the source code of this file.

Functions

static void dump_stack (uintptr_t addr, size_t bytes)
 
static void print_regs (struct exc_state *exc_state)
 
int exception_handler_register (uint64_t vid, struct exception_handler *h)
 
int exception_handler_unregister (uint64_t vid, struct exception_handler *h)
 
static void print_exception_info (struct exc_state *state, uint64_t idx)
 
static void print_exception_and_die (struct exc_state *state, uint64_t idx)
 
static int handle_exception (struct exc_state *state, uint64_t idx)
 
void exc_dispatch (struct exc_state *state, uint64_t idx)
 
static int test_exception_handler (struct exc_state *state, uint64_t vector_id)
 
static uint64_t test_exception (void)
 
void exception_init (void)
 

Variables

uint8_t exception_stack [2 *KiB]
 
static const char * exception_names [NUM_EXC_VIDS]
 
static struct exception_handlerhandlers [NUM_EXC_VIDS]
 

Function Documentation

◆ dump_stack()

static void dump_stack ( uintptr_t  addr,
size_t  bytes 
)
static

Definition at line 32 of file exception.c.

References addr, ALIGN_DOWN, BIOS_DEBUG, and printk.

Referenced by print_exception_info().

Here is the caller graph for this function:

◆ exc_dispatch()

void exc_dispatch ( struct exc_state state,
uint64_t  idx 
)

◆ exception_handler_register()

int exception_handler_register ( uint64_t  vid,
struct exception_handler h 
)

Definition at line 68 of file exception.c.

References handlers, exception_handler::next, NUM_EXC_VIDS, store_release, and vid.

Referenced by probe_mb(), and test_exception().

Here is the caller graph for this function:

◆ exception_handler_unregister()

int exception_handler_unregister ( uint64_t  vid,
struct exception_handler h 
)

Definition at line 80 of file exception.c.

References handlers, exception_handler::next, NULL, NUM_EXC_VIDS, store_release, and vid.

Referenced by probe_mb(), and test_exception().

Here is the caller graph for this function:

◆ exception_init()

void exception_init ( void  )

Definition at line 189 of file exception.c.

References ARRAY_SIZE, BIOS_DEBUG, CONFIG, exception_init_asm(), exception_stack, printk, and test_exception().

Here is the call graph for this function:

◆ handle_exception()

static int handle_exception ( struct exc_state state,
uint64_t  idx 
)
static

Definition at line 123 of file exception.c.

References EXC_RET_ABORT, exception_handler::handler, handlers, exception_handler::next, and NULL.

Referenced by exc_dispatch().

Here is the caller graph for this function:

◆ print_exception_and_die()

static void print_exception_and_die ( struct exc_state state,
uint64_t  idx 
)
static

Definition at line 117 of file exception.c.

References die(), and print_exception_info().

Referenced by exc_dispatch().

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

◆ print_exception_info()

static void print_exception_info ( struct exc_state state,
uint64_t  idx 
)
static

Definition at line 102 of file exception.c.

References __uart_tx_byte(), BIOS_DEBUG, dump_stack(), exception_names, NUM_EXC_VIDS, print_regs(), and printk.

Referenced by exc_dispatch(), and print_exception_and_die().

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

◆ print_regs()

static void print_regs ( struct exc_state exc_state)
static

Definition at line 47 of file exception.c.

References BIOS_DEBUG, elx_state::elr, exc_state::elx, printk, exc_state::regs, regs::sp, and regs::x.

Referenced by print_exception_info().

Here is the caller graph for this function:

◆ test_exception()

static uint64_t test_exception ( void  )
static

Definition at line 169 of file exception.c.

References EXC_VID_CUR_SP_EL0_SYNC, EXC_VID_CUR_SP_ELX_SYNC, exception_handler_register(), exception_handler_unregister(), force_read, exception_handler::handler, sync_el0, and test_exception_handler().

Referenced by exception_init().

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

◆ test_exception_handler()

static int test_exception_handler ( struct exc_state state,
uint64_t  vector_id 
)
static

Definition at line 161 of file exception.c.

References EXC_RET_HANDLED.

Referenced by test_exception().

Here is the caller graph for this function:

Variable Documentation

◆ exception_names

const char* exception_names[NUM_EXC_VIDS]
static
Initial value:
= {
[EXC_VID_CUR_SP_EL0_SYNC] = "_sync_sp_el0",
[EXC_VID_CUR_SP_EL0_IRQ] = "_irq_sp_el0",
[EXC_VID_CUR_SP_EL0_FIRQ] = "_fiq_sp_el0",
[EXC_VID_CUR_SP_EL0_SERR] = "_serror_sp_el0",
[EXC_VID_CUR_SP_ELX_SYNC] = "_sync_sp_el3",
[EXC_VID_CUR_SP_ELX_IRQ] = "_irq_sp_el3",
[EXC_VID_CUR_SP_ELX_FIQ] = "_fiq_sp_el3",
[EXC_VID_CUR_SP_ELX_SERR] = "_serror_sp_el3",
[EXC_VID_LOW64_SYNC] = "_sync_elx_64",
[EXC_VID_LOW64_IRQ] = "_irq_elx_64",
[EXC_VID_LOW64_FIQ] = "_fiq_elx_64",
[EXC_VID_LOW64_SERR] = "_serror_elx_64",
[EXC_VID_LOW32_SYNC] = "_sync_elx_32",
[EXC_VID_LOW32_IRQ] = "_irq_elx_32",
[EXC_VID_LOW32_FIQ] = "_fiq_elx_32",
[EXC_VID_LOW32_SERR] = "_serror_elx_32"
}
#define EXC_VID_CUR_SP_EL0_SYNC
Definition: transition.h:28
#define EXC_VID_CUR_SP_ELX_SERR
Definition: transition.h:35
#define EXC_VID_LOW64_IRQ
Definition: transition.h:37
#define EXC_VID_CUR_SP_ELX_FIQ
Definition: transition.h:34
#define EXC_VID_CUR_SP_EL0_SERR
Definition: transition.h:31
#define EXC_VID_LOW32_IRQ
Definition: transition.h:41
#define EXC_VID_CUR_SP_ELX_IRQ
Definition: transition.h:33
#define EXC_VID_LOW64_FIQ
Definition: transition.h:38
#define EXC_VID_LOW64_SYNC
Definition: transition.h:36
#define EXC_VID_CUR_SP_EL0_IRQ
Definition: transition.h:29
#define EXC_VID_CUR_SP_ELX_SYNC
Definition: transition.h:32
#define EXC_VID_LOW32_SERR
Definition: transition.h:43
#define EXC_VID_LOW32_FIQ
Definition: transition.h:42
#define EXC_VID_CUR_SP_EL0_FIRQ
Definition: transition.h:30
#define EXC_VID_LOW64_SERR
Definition: transition.h:39
#define EXC_VID_LOW32_SYNC
Definition: transition.h:40

Definition at line 13 of file exception.c.

Referenced by print_exception_info().

◆ exception_stack

uint8_t exception_stack[2 *KiB]

Definition at line 11 of file exception.c.

◆ handlers

struct exception_handler* handlers[NUM_EXC_VIDS]
static