-
Notifications
You must be signed in to change notification settings - Fork 1
/
asm.s
161 lines (133 loc) · 2.51 KB
/
asm.s
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
.global __boot
.section .text
.thumb_func
# .cfi_startproc
__boot:
# Address of stack memory
ldr r0, =0x81008000
mov r13, r0
# Hand execution over to `main`.
bl main
svc 0xFF
# Note: `main` must not return. `bl` is used only because it has a wider range than `b`.
# .cfi_endproc
# To actually test changes made here, do the following:
# 1. Run ./assemble.sh
# 2. Run cargo build
# 3. In neutron-host run ./hard_rebuild.sh (Hard rebuild seems to occationally be needed to properly re-link stuff)
# 4. In neutron-host run cargo test
# 5. Your changes are now in action and, if test passed, you haven't broken anything!
# Please try to keep entries in same order here as in lib.rs!
# Costack operators
.global __push_costack
.section .text
.thumb_func
__push_costack:
svc 0x10
mov pc, lr
.global __pop_costack
.section .text
.thumb_func
__pop_costack:
svc 0x11
mov pc, lr
.global __clear_costack
.section .text
.thumb_func
__clear_costack:
svc 0x14
mov pc, lr
.global __move_input_to_output_costack
.section .text
.thumb_func
__move_input_to_output_costack:
svc 0x16
mov pc, lr
# Comap operators
.global __push_comap
.section .text
.thumb_func
__push_comap:
svc 0x30
mov pc, lr
.global __push_raw_comap
.section .text
.thumb_func
__push_raw_comap:
svc 0x31
mov pc, lr
.global __peek_comap
.section .text
.thumb_func
__peek_comap:
svc 0x32
mov pc, lr
.global __peek_raw_comap
.section .text
.thumb_func
__peek_raw_comap:
svc 0x33
mov pc, lr
.global __peek_result_comap
.section .text
.thumb_func
__peek_result_comap:
svc 0x34
mov pc, lr
.global __peek_raw_result_comap
.section .text
.thumb_func
__peek_raw_result_comap:
svc 0x35
mov pc, lr
# Context info operators
.global __gas_remaining
.section .text
.thumb_func
__gas_remaining:
svc 0x90
mov pc, lr
.global __self_address
.section .text
.thumb_func
__self_address:
svc 0x91
mov pc, lr
.global __origin
.section .text
.thumb_func
__origin:
svc 0x92
mov pc, lr
.global __sender
.section .text
.thumb_func
__sender:
svc 0x94
mov pc, lr
.global __execution_type
.section .text
.thumb_func
__execution_type:
svc 0x96
mov pc, lr
# Misc operators
.global __exit
.section .text
.thumb_func
__exit:
svc 0xFF
# incase of some return from the SVC call, execute it again in an infintie loop
b __exit
.global __system_call
.section .text
.thumb_func
__system_call:
svc 0x20
mov pc, lr
.global __breakpoint
.section .text
.thumb_func
__breakpoint:
bkpt
mov pc, lr