forked from tinygo-org/tinygo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
semihosting.go
63 lines (58 loc) · 1.88 KB
/
semihosting.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
package arm
// Semihosting commands.
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/Bgbjhiea.html
const (
// Regular semihosting calls
SemihostingClock = 0x10
SemihostingClose = 0x02
SemihostingElapsed = 0x30
SemihostingErrno = 0x13
SemihostingFileLen = 0x0C
SemihostingGetCmdline = 0x15
SemihostingHeapInfo = 0x16
SemihostingIsError = 0x08
SemihostingIsTTY = 0x09
SemihostingOpen = 0x01
SemihostingRead = 0x06
SemihostingReadByte = 0x07
SemihostingRemove = 0x0E
SemihostingRename = 0x0F
SemihostingSeek = 0x0A
SemihostingSystem = 0x12
SemihostingTickFreq = 0x31
SemihostingTime = 0x11
SemihostingTmpName = 0x0D
SemihostingWrite = 0x05
SemihostingWrite0 = 0x04
SemihostingWriteByte = 0x03
// Angel semihosting calls
SemihostingEnterSVC = 0x17
SemihostingReportException = 0x18
)
// Special codes for the Angel Semihosting interface.
const (
// Hardware vector reason codes
SemihostingBranchThroughZero = 20000
SemihostingUndefinedInstr = 20001
SemihostingSoftwareInterrupt = 20002
SemihostingPrefetchAbort = 20003
SemihostingDataAbort = 20004
SemihostingAddressException = 20005
SemihostingIRQ = 20006
SemihostingFIQ = 20007
// Software reason codes
SemihostingBreakPoint = 20020
SemihostingWatchPoint = 20021
SemihostingStepComplete = 20022
SemihostingRunTimeErrorUnknown = 20023
SemihostingInternalError = 20024
SemihostingUserInterruption = 20025
SemihostingApplicationExit = 20026
SemihostingStackOverflow = 20027
SemihostingDivisionByZero = 20028
SemihostingOSSpecific = 20029
)
// Call a semihosting function.
// TODO: implement it here using inline assembly.
//go:linkname SemihostingCall SemihostingCall
func SemihostingCall(num int, arg uintptr) int