KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Interrupts

IRQs and ISRs for the SH4's CPU More...

Files

file  irq.h
 Interrupt and exception handling.
 

Data Structures

struct  irq_context_t
 Architecture-specific structure for holding the processor state. More...
 

Register Accessors

Convenience macros for accessing context registers

#define CONTEXT_PC(c)
 Fetch the program counter from an irq_context_t.
 
#define CONTEXT_FP(c)
 Fetch the frame pointer from an irq_context_t.
 
#define CONTEXT_SP(c)
 Fetch the stack pointer from an irq_context_t.
 
#define CONTEXT_RET(c)
 Fetch the return value from an irq_context_t.
 

Detailed Description

IRQs and ISRs for the SH4's CPU

This is an API for managing interrupts, their masks, and their handler routines along with thread context information.

Warning
This is a low-level, internal kernel API. Many of these interrupts are utilized by various KOS drivers and have higher-level APIs for hooking into them. Care must be taken to not interfere with the IRQ handling which is being done by in-use KOS drivers.
Note
The naming convention used by this API differs from that of the actual SH4 manual for historical reasons (it wasn't platform-specific). The SH4 manual refers to the most general type of CPU events which result in a SW callback as "exceptions," with "interrupts" and "general exceptions" being subtypes of exceptions. This API uses the term "interrupt" and "exception" interchangeably, except where it is explicitly noted that "SH4 interrupts" or "SH4 general exceptions" are being referred to, more specifically.

Macro Definition Documentation

◆ CONTEXT_FP

#define CONTEXT_FP ( c)
Value:
((c).r[14])

Fetch the frame pointer from an irq_context_t.

Parameters
cThe context to read from.
Returns
The frame pointer value.

◆ CONTEXT_PC

#define CONTEXT_PC ( c)
Value:
((c).pc)

Fetch the program counter from an irq_context_t.

Parameters
cThe context to read from.
Returns
The program counter value.

Referenced by catchnull(), and on_break().

◆ CONTEXT_RET

#define CONTEXT_RET ( c)
Value:
((c).r[0])

Fetch the return value from an irq_context_t.

Parameters
cThe context to read from.
Returns
The return value.

◆ CONTEXT_SP

#define CONTEXT_SP ( c)
Value:
((c).r[15])

Fetch the stack pointer from an irq_context_t.

Parameters
cThe context to read from.
Returns
The stack pointer value.