AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
cpu.h File Reference
#include <core/system.h>

Go to the source code of this file.

Data Structures

struct  aarch64_regs
 What an exception saves on the kernel stack (cpu/vectors.S): the context it interrupted. More...
struct  arch_cpu
 A CPU's aarch64 state (struct cpu's arch). More...

Macros

#define PSTATE_EL0t   0x0
#define PSTATE_EL1h   0x5
#define PSTATE_MODE   0xF
#define PSTATE_DAIF   (0xF << 6)
#define REGS_USER(r)
#define read_sysreg(r)
#define write_sysreg(r, v)
#define isb()
#define dsb()

Functions

static struct cpu * curcpu (void)
 Returns the running CPU's struct cpu, which TPIDR_EL1, the register meant for it, holds.

Macro Definition Documentation

◆ dsb

#define dsb ( )
Value:
asm volatile("dsb sy" ::: "memory")

Definition at line 46 of file cpu.h.

◆ isb

#define isb ( )
Value:
asm volatile("isb" ::: "memory")

Definition at line 45 of file cpu.h.

Referenced by aarch64_init(), fpen(), pmap_switch(), and timer_setup().

◆ PSTATE_DAIF

#define PSTATE_DAIF   (0xF << 6)

Definition at line 26 of file cpu.h.

◆ PSTATE_EL0t

#define PSTATE_EL0t   0x0

Definition at line 23 of file cpu.h.

◆ PSTATE_EL1h

#define PSTATE_EL1h   0x5

Definition at line 24 of file cpu.h.

◆ PSTATE_MODE

#define PSTATE_MODE   0xF

Definition at line 25 of file cpu.h.

◆ read_sysreg

#define read_sysreg ( r)
Value:
({ \
uint64_t __v; \
asm volatile("mrs %0, " #r : "=r"(__v)); \
__v; \
})
unsigned long long int uint64_t
Definition stddef.h:23

Definition at line 33 of file cpu.h.

Referenced by aarch64_init(), abort(), arch_cycles(), arch_rtime_ns(), curcpu(), dump(), and timer_setup().

◆ REGS_USER

#define REGS_USER ( r)
Value:
(((r)->pstate & PSTATE_MODE) == PSTATE_EL0t)
#define PSTATE_MODE
Definition cpu.h:25
#define PSTATE_EL0t
Definition cpu.h:23

Definition at line 29 of file cpu.h.

Referenced by aarch64_irq(), aarch64_return_to_user(), abort(), sched_tick(), and sync_dispatch().

◆ write_sysreg

#define write_sysreg ( r,
v )
Value:
do { \
uint64_t __v = (uint64_t) (v); \
asm volatile("msr " #r ", %0" :: "r"(__v)); \
} while (0)

Definition at line 39 of file cpu.h.

Referenced by aarch64_init(), fpen(), pmap_switch(), timer_irq(), and timer_setup().

Function Documentation

◆ curcpu()

struct cpu * curcpu ( void )
inlinestatic

Returns the running CPU's struct cpu, which TPIDR_EL1, the register meant for it, holds.

Definition at line 62 of file cpu.h.

References read_sysreg.