-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.go
67 lines (60 loc) · 1.71 KB
/
register.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package flamego
import (
"fmt"
)
type Register uint8
// RO: Read-Only
// PR: Privileged - Read-Only except by Interrupt Service Routine
// GP: General Purpose
const (
R0 Register = iota // RO, Always 0
R1 // RO, Always 1
R2 // RO, Core Identifier (0-7)
R3 // RO, Context Identifier (0-7)
R4 // PR, Interrupt Vector Table
R5 // PR, Process Identifier
R6 // PR, Program Counter (offset from Program Start)
R7 // PR, Program Start
R8 // PR, Program Limit
R9 // PR, Stack Pointer
R10 // PR, Stack Start
R11 // PR, Stack Limit
R12 // PR, Data Start
R13 // PR, Data Limit
R14 // PR, Reserved
R15 // PR, Reserved
R16 // GP
R17 // GP
R18 // GP
R19 // GP
R20 // GP
R21 // GP
R22 // GP
R23 // GP
R24 // GP
R25 // GP
R26 // GP
R27 // GP
R28 // GP
R29 // GP
R30 // GP
R31 // GP
)
const (
RegisterCount = 32
RCoreIdentifier = R2
RContextIdentifier = R3
RInterruptVectorTable = R4
RProcessIdentifier = R5
RProgramCounter = R6
RProgramStart = R7
RProgramLimit = R8
RStackPointer = R9
RStackStart = R10
RStackLimit = R11
RDataStart = R12
RDataLimit = R13
)
func (r Register) String() string {
return fmt.Sprintf("r%d", r)
}