MOS Source Code
Loading...
Searching...
No Matches
cpu.h File Reference
#include <mos/mos_global.h>
#include <mos/types.h>
+ Include dependency graph for cpu.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  platform_regs_t
 

Macros

#define read_csr(reg)
 
#define write_csr(reg, val)
 
#define make_satp(mode, asid, ppn)
 
#define SATP_MODE_SV39   8
 
#define SATP_MODE_SV48   9
 
#define SATP_MODE_SV57   10
 
#define SSTATUS_SIE   BIT(1)
 
#define SSTATUS_SPIE   BIT(5)
 
#define SSTATUS_SPP   BIT(8)
 
#define SSTATUS_SUM   BIT(18)
 
#define SSTATUS_FS_OFF   0
 
#define SSTATUS_FS_INITIAL   BIT(13)
 
#define SSTATUS_FS_CLEAN   BIT(14)
 
#define SSTATUS_FS_DIRTY   (BIT(13) | BIT(14))
 
#define SIE_SEIE   BIT(9)
 
#define SIE_STIE   BIT(5)
 
#define SIE_SSIE   BIT(1)
 

Functions

 MOS_STATIC_ASSERT (sizeof(platform_regs_t)==264, "please also change cpu/interrupt.S")
 
void riscv64_trap_exit (platform_regs_t *regs)
 

Variables

const char __riscv64_trap_entry []
 
const char __riscv64_usermode_trap_entry []
 

Macro Definition Documentation

◆ read_csr

#define read_csr ( reg)
Value:
statement_expr(reg_t, { asm volatile("csrr %0, " #reg : "=r"(retval)); })
#define statement_expr(type,...)
Definition mos_global.h:92
uintn reg_t
Definition types.h:51

Definition at line 23 of file cpu.h.

Referenced by do_save_fp_context(), platform_interrupt_disable(), platform_interrupt_enable(), platform_return_to_userspace(), platform_startup_early(), and riscv64_trap_handler().

◆ write_csr

#define write_csr ( reg,
val )

◆ make_satp

#define make_satp ( mode,
asid,
ppn )
Value:
((u64) (mode) << 60 | ((u64) (asid) << 44) | (ppn))
unsigned long long u64
Definition types.h:23

Definition at line 26 of file cpu.h.

Referenced by platform_switch_mm().

◆ SATP_MODE_SV39

#define SATP_MODE_SV39   8

Definition at line 28 of file cpu.h.

◆ SATP_MODE_SV48

#define SATP_MODE_SV48   9

Definition at line 29 of file cpu.h.

Referenced by platform_switch_mm().

◆ SATP_MODE_SV57

#define SATP_MODE_SV57   10

Definition at line 30 of file cpu.h.

◆ SSTATUS_SIE

#define SSTATUS_SIE   BIT(1)

Definition at line 32 of file cpu.h.

Referenced by platform_interrupt_disable(), and platform_interrupt_enable().

◆ SSTATUS_SPIE

#define SSTATUS_SPIE   BIT(5)

Definition at line 33 of file cpu.h.

Referenced by platform_return_to_userspace().

◆ SSTATUS_SPP

#define SSTATUS_SPP   BIT(8)

Definition at line 34 of file cpu.h.

Referenced by riscv64_trap_handler().

◆ SSTATUS_SUM

#define SSTATUS_SUM   BIT(18)

Definition at line 35 of file cpu.h.

Referenced by platform_return_to_userspace(), and platform_startup_early().

◆ SSTATUS_FS_OFF

#define SSTATUS_FS_OFF   0

Definition at line 37 of file cpu.h.

◆ SSTATUS_FS_INITIAL

#define SSTATUS_FS_INITIAL   BIT(13)

Definition at line 38 of file cpu.h.

Referenced by platform_startup_early().

◆ SSTATUS_FS_CLEAN

#define SSTATUS_FS_CLEAN   BIT(14)

Definition at line 39 of file cpu.h.

◆ SSTATUS_FS_DIRTY

#define SSTATUS_FS_DIRTY   (BIT(13) | BIT(14))

Definition at line 40 of file cpu.h.

◆ SIE_SEIE

#define SIE_SEIE   BIT(9)

Definition at line 42 of file cpu.h.

Referenced by platform_startup_early().

◆ SIE_STIE

#define SIE_STIE   BIT(5)

Definition at line 43 of file cpu.h.

Referenced by platform_startup_early().

◆ SIE_SSIE

#define SIE_SSIE   BIT(1)

Definition at line 44 of file cpu.h.

Referenced by platform_startup_early().

Function Documentation

◆ MOS_STATIC_ASSERT()

MOS_STATIC_ASSERT ( sizeof(platform_regs_t) = =264,
"please also change cpu/interrupt.S"  )

◆ riscv64_trap_exit()

void riscv64_trap_exit ( platform_regs_t * regs)
extern

Variable Documentation

◆ __riscv64_trap_entry

const char __riscv64_trap_entry[]
extern

◆ __riscv64_usermode_trap_entry

const char __riscv64_usermode_trap_entry[]
extern