mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 09:15:36 +00:00
Move away drivers from generic base-repository
Driver definitions which are used by kernel/core in base-hw, and also by other drivers (e.g. from the os repository) have to reside in the generic base-repository, for instance some uart drivers. All drivers which are interesting for one of the sites only (sp804 for timer driver, or cortex_a9 cpu driver for base-hw) should reside in the respective repos. Factorize cpu context out of Cortex A9 specific definitions. Moreover, there is already a Cpu_state object containing all common ARM registers. We use this as a base for the cpu context switching done by the base-hw kernel. The Cpu_state class get extended by a cpu-exception field, that stores the kind of exception raised when the corresponding context got interrupted. This information is used not only by the base-hw kernel, but also by the TrustZone VMM that is build currently.
This commit is contained in:
@ -21,11 +21,54 @@ namespace Genode {
|
||||
|
||||
struct Cpu_state
|
||||
{
|
||||
addr_t ip;
|
||||
addr_t sp;
|
||||
addr_t r[13];
|
||||
addr_t lr;
|
||||
addr_t cpsr;
|
||||
/**
|
||||
* Native exception types
|
||||
*/
|
||||
enum Cpu_exception {
|
||||
RESET = 1,
|
||||
UNDEFINED_INSTRUCTION = 2,
|
||||
SUPERVISOR_CALL = 3,
|
||||
PREFETCH_ABORT = 4,
|
||||
DATA_ABORT = 5,
|
||||
INTERRUPT_REQUEST = 6,
|
||||
FAST_INTERRUPT_REQUEST = 7,
|
||||
MAX_CPU_EXCEPTION = FAST_INTERRUPT_REQUEST,
|
||||
};
|
||||
|
||||
enum { MAX_GPR = 13 };
|
||||
|
||||
addr_t r[MAX_GPR]; /* r0-r12 - general purpose */
|
||||
addr_t sp; /* r13 - stack pointer */
|
||||
addr_t lr; /* r14 - link register */
|
||||
addr_t ip; /* r15 - instruction pointer */
|
||||
addr_t cpsr; /* current program status register */
|
||||
Cpu_exception cpu_exception; /* last exception */
|
||||
};
|
||||
|
||||
|
||||
struct Cpu_state_modes : Cpu_state
|
||||
{
|
||||
/**
|
||||
* Common banked registers for exception modes
|
||||
*/
|
||||
struct Mode_state {
|
||||
|
||||
enum Mode {
|
||||
UND, /* Undefined */
|
||||
SVC, /* Supervisor */
|
||||
ABORT, /* Abort */
|
||||
IRQ, /* Interrupt */
|
||||
FIQ, /* Fast Interrupt */
|
||||
MAX
|
||||
};
|
||||
|
||||
uint32_t sp; /* banked stack pointer */
|
||||
uint32_t lr; /* banked link register */
|
||||
uint32_t spsr; /* saved program status register */
|
||||
};
|
||||
|
||||
Mode_state mode[Mode_state::MAX]; /* exception mode registers */
|
||||
uint32_t fiq_r[5]; /* fast-interrupt mode r8-r12 */
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user