550W Document
550W, a high-end OS
csr.h
浏览该文件的文档.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2015 Regents of the University of California
4  */
5 #pragma once
6 
7 /* Status register flags */
8 #define SR_SIE 0x00000002 /* Supervisor Interrupt Enable */
9 #define SR_SPIE 0x00000020 /* Previous Supervisor IE */
10 #define SR_SPP 0x00000100 /* Previously Supervisor */
11 #define SR_SUM 0x00040000 /* Supervisor User Memory Access */
12 
13 #define SR_FS 0x00006000 /* Floating-point Status */
14 #define SR_FS_OFF 0x00000000
15 #define SR_FS_INITIAL 0x00002000
16 #define SR_FS_CLEAN 0x00004000
17 #define SR_FS_DIRTY 0x00006000
18 
19 #define SR_XS 0x00018000 /* Extension Status */
20 #define SR_XS_OFF 0x00000000
21 #define SR_XS_INITIAL 0x00008000
22 #define SR_XS_CLEAN 0x00010000
23 #define SR_XS_DIRTY 0x00018000
24 
25 #define SR_SD 0x8000000000000000 /* FS/XS dirty */
26 
27 /* SATP flags */
28 #define SATP_PPN 0x00000FFFFFFFFFFF
29 #define SATP_MODE_39 0x8000000000000000
30 #define SATP_MODE SATP_MODE_39
31 
32 /* SCAUSE */
33 #define SCAUSE_IRQ_FLAG ((uint64_t)1 << 63)
34 
35 #define IRQ_U_SOFT 0
36 #define IRQ_S_SOFT 1
37 #define IRQ_M_SOFT 3
38 #define IRQ_U_TIMER 4
39 #define IRQ_S_TIMER 5
40 #define IRQ_M_TIMER 7
41 #define IRQ_U_EXT 8
42 #define IRQ_S_EXT 9
43 #define IRQ_M_EXT 11
44 
45 #define EXC_INST_MISALIGNED 0
46 #define EXC_INST_ACCESS 1
47 #define EXC_BREAKPOINT 3
48 #define EXC_LOAD_ACCESS 5
49 #define EXC_STORE_ACCESS 7
50 #define EXC_SYSCALL 8
51 #define EXC_INST_PAGE_FAULT 12
52 #define EXC_LOAD_PAGE_FAULT 13
53 #define EXC_STORE_PAGE_FAULT 15
54 
55 /* SIE (Interrupt Enable) and SIP (Interrupt Pending) flags */
56 #define SIE_SSIE (0x1 << IRQ_S_SOFT)
57 #define SIE_STIE (0x1 << IRQ_S_TIMER)
58 #define SIE_SEIE (0x1 << IRQ_S_EXT)
59 
60 #define SSTATUS_UIE (1 << 0)
61 #define SSTATUS_SIE (1 << 1)
62 #define SSTATUS_UPIE (1 << 4)
63 #define SSTATUS_SPIE (1 << 5)
64 #define SSTATUS_SPP (1 << 8)
65 #define SSTATUS_FS (3 << 13)
66 #define SSTATUS_XS (3 << 15)
67 #define SSTATUS_SUM (1 << 18)
68 #define SSTATUS_MXR (1 << 19)
69 #define SSTATUS_UXL (3 << 34)
70 #define SSTATUS_SD (1 << 63)
71 
72 #define CSR_CYCLE 0xc00
73 #define CSR_TIME 0xc01
74 #define CSR_INSTRET 0xc02
75 #define CSR_SSTATUS 0x100
76 #define CSR_SIE 0x104
77 #define CSR_STVEC 0x105
78 #define CSR_SCOUNTEREN 0x106
79 #define CSR_SSCRATCH 0x140
80 #define CSR_SEPC 0x141
81 #define CSR_SCAUSE 0x142
82 #define CSR_STVAL 0x143
83 #define CSR_SIP 0x144
84 #define CSR_SATP 0x180
85 #define CSR_CYCLEH 0xc80
86 #define CSR_TIMEH 0xc81
87 #define CSR_INSTRETH 0xc82
88 
89 #define CSR_MHARTID 0xf14
90 
91 #define BOOT_STACK_MASTER 0x80600000
92 #define BOOT_STACK_SLAVE 0x805ff000