-
Notifications
You must be signed in to change notification settings - Fork 18
/
xbe.S
executable file
·227 lines (209 loc) · 10.3 KB
/
xbe.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#define BASE_ADDRESS 0x10000
#define FILE_SIZE (0x4000+0x40000)
header_start:
.ascii "XBEH"
// digital signature
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.long BASE_ADDRESS // base address
.long headers_end - header_start // size of headers
.long FILE_SIZE+1024 // size of image
.long header_end - header_start // size of image header
.long 0 // time date stamp *unimportant*
.long certificate // certificate address
.long 1 // number of section headers
.long section_headers // section headers address
.long 0 // initialization flags
.long 0x11100 ^ 0xA8FC57AB // entry point address XOR key **GAS ISSUE: "entry" won't work**
.long 0x18000 // thread local storage address
.long 0 // size of stack commit (PE copy) *unimportant*
.long 0 // size of heap reserve (PE copy) *unimportant*
.long 0 // size of heap commit (PE copy) *unimportant*
.long 0 // original base address (PE copy) *unimportant*
.long 0 // original size of image (PE copy)*unimportant*
.long 0 // original checksum (PE copy) *unimportant*
.long 0 // original time stamp (PE copy) *unimportant*
.long normalname // debug path name address *unimportant*
.long normalname // debug file name address *unimportant*
.long unicodename // debug unicode file name address *unimportant*
.long 0x11000 ^ 0x5B6D40B6 // kernel image thunk address XOR key **GAS ISSUE: see above**
.long 0 // non-kernel import directory address
.long 0 // number of library versions *unimportant*
.long 0 // library versions address *unimportant*
.long 0 // kernel library version address *unimportant*
.long 0 // XAPI library address *unimportant*
.long logo // logo bitmap address *unimportant*
.long logo_end-logo // logo bitmap size *unimportant*
header_end:
certificate:
.long certificate_end - certificate // size of certificate
.long 0 // time date stamp *unimportant*
.long 0 // title id *unimportant?*
// title name (unicode string, 40 chars) *unimportant, but beautiful*
unicodename:
.word 'L','i','n','u','x',0,0,0,0,0,0
normalname:
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0
// alternate title ids
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.long 0xC0000005
.long 0x80000007 // game regions: all; don't delete eepromkey
.long -1 // game ratings
.long 0 // disk number
.long 0 // version
// LAN key
.long 0,0,0,0
// signature key
.long 0,0,0,0
// 16 title alternate signature keys
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
certificate_end:
section_headers:
// .long 0x16 // flags: RO_HEAD_PAGE, EXECUTABLE, PRELOAD
.long 0x07 // flags: WRITABLE, EXECUTABLE, PRELOAD
.long section_1_start // virtual address
.long FILE_SIZE // virtual size
.long 0x1000 // file pointer to raw data
.long FILE_SIZE // size of raw data
.long section_name // address of section name
.long 0 // unknown
.long rc1 // head shared page reference count address *not NULL important*
.long rc2 // tail shared page reference count address *not NULL important*
// unknown
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0
section_headers_end:
rc1:
.word 0
rc2:
.word 0
section_name:
.byte '.','t','e','x','t',0
.align 4
logo:
// "Linux"
.byte 0x52, 0x00, 0x13, 0x73, 0xB3, 0xF3, 0xF5, 0xE3
.byte 0xD3, 0xE3, 0x63, 0x03, 0x03, 0x03, 0x03, 0x07
.byte 0x03, 0x03, 0x13, 0x43, 0x33, 0x13, 0x03, 0x96
.byte 0x00, 0x9A, 0x00, 0x03, 0x03, 0x13, 0x33, 0xB3
.byte 0xF3, 0xF3, 0xF3, 0x93, 0x43, 0x23, 0x13, 0x03
.byte 0x03, 0x09, 0x03, 0x03, 0x73, 0x93, 0x83, 0x33
.byte 0x13, 0x03, 0x92, 0x00, 0x9A, 0x00, 0x03, 0x03
.byte 0x03, 0x23, 0x63, 0xF5, 0xE3, 0x73, 0x43, 0x23
.byte 0x13, 0x03, 0x03, 0x09, 0x03, 0x03, 0x73, 0x93
.byte 0x83, 0x33, 0x13, 0x03, 0x03, 0x09, 0x03, 0x05
.byte 0x09, 0x0B, 0x05, 0x03, 0x03, 0x05, 0x05, 0x07
.byte 0x03, 0x0B, 0x05, 0x9A, 0x00, 0x03, 0x03, 0x03
.byte 0x13, 0x63, 0xF5, 0xE3, 0x73, 0x43, 0x23, 0x03
.byte 0x03, 0x0B, 0x03, 0x13, 0x33, 0x53, 0x53, 0x33
.byte 0x13, 0x03, 0x03, 0x05, 0x03, 0x03, 0x05, 0x03
.byte 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03
.byte 0x03, 0x03, 0x03, 0x03, 0x03, 0x05, 0x03, 0x03
.byte 0x03, 0x03, 0x05, 0x03, 0x03, 0x05, 0x03, 0x03
.byte 0x03, 0x9A, 0x00, 0x03, 0x03, 0x03, 0x13, 0x53
.byte 0xF5, 0xD3, 0x73, 0x33, 0x13, 0x03, 0x05, 0x03
.byte 0x05, 0x03, 0x03, 0x23, 0x33, 0x33, 0x33, 0x23
.byte 0x23, 0x23, 0x23, 0x35, 0x23, 0x33, 0x33, 0x33
.byte 0x23, 0x05, 0x03, 0x13, 0x35, 0x33, 0x23, 0x13
.byte 0x25, 0x23, 0x33, 0x23, 0x13, 0x13, 0x33, 0x33
.byte 0x35, 0x33, 0x23, 0x23, 0x33, 0x33, 0x13, 0x03
.byte 0x03, 0x9A, 0x00, 0x03, 0x03, 0x03, 0x03, 0x53
.byte 0xF5, 0xD3, 0x73, 0x33, 0x13, 0x03, 0x03, 0x03
.byte 0x05, 0x03, 0x03, 0x53, 0x83, 0x73, 0x43, 0x23
.byte 0x13, 0x63, 0x93, 0xD3, 0xF3, 0xE3, 0xB3, 0xB3
.byte 0xA3, 0xE3, 0xA3, 0x43, 0x13, 0x23, 0x93, 0xF3
.byte 0xE3, 0xF3, 0x83, 0x43, 0x83, 0x93, 0xD3, 0xF3
.byte 0x93, 0x13, 0x33, 0xB3, 0xF7, 0xB3, 0x43, 0xA3
.byte 0xF3, 0xE3, 0x53, 0x13, 0x03, 0x9A, 0x00, 0x03
.byte 0x03, 0x03, 0x03, 0x53, 0xF5, 0xD3, 0x63, 0x33
.byte 0x13, 0x03, 0x05, 0x03, 0x03, 0x03, 0x63, 0x83
.byte 0x53, 0x93, 0x83, 0x33, 0x23, 0x13, 0x23, 0xD3
.byte 0xF3, 0xF3, 0xD3, 0x53, 0x33, 0xC3, 0xF3, 0xD3
.byte 0x43, 0x33, 0x53, 0x93, 0xF3, 0xF3, 0xA3, 0x43
.byte 0x23, 0x73, 0xF5, 0xC3, 0x33, 0x23, 0x23, 0xA3
.byte 0xF5, 0x83, 0x43, 0x73, 0xD3, 0x63, 0x23, 0x13
.byte 0x03, 0x9A, 0x00, 0x03, 0x03, 0x03, 0x03, 0x53
.byte 0xF5, 0xD3, 0x63, 0x33, 0x13, 0x03, 0x03, 0x03
.byte 0x05, 0x13, 0x83, 0x43, 0x63, 0x93, 0x83, 0x53
.byte 0x33, 0x13, 0x33, 0xC3, 0xF3, 0xF3, 0x83, 0x53
.byte 0x33, 0xA3, 0xF3, 0xF3, 0x73, 0x33, 0x23, 0x43
.byte 0xE3, 0xF3, 0xB3, 0x53, 0x33, 0x83, 0xF5, 0xC3
.byte 0x53, 0x33, 0x23, 0x43, 0xD3, 0xF3, 0xE3, 0x83
.byte 0xD3, 0x83, 0x33, 0x23, 0x13, 0x03, 0x9A, 0x00
.byte 0x03, 0x03, 0x03, 0x03, 0x53, 0xF5, 0xD3, 0x63
.byte 0x33, 0x13, 0x03, 0x05, 0x03, 0x73, 0x33, 0x43
.byte 0x33, 0x73, 0x93, 0x83, 0x53, 0x33, 0x13, 0x23
.byte 0xB3, 0xF3, 0xF3, 0x83, 0x53, 0x33, 0x93, 0xF3
.byte 0xF3, 0x83, 0x33, 0x23, 0x43, 0xF3, 0xF3, 0xB3
.byte 0x53, 0x33, 0x93, 0xF5, 0xC3, 0x53, 0x33, 0x13
.byte 0x23, 0x73, 0xF5, 0xE3, 0xC3, 0x53, 0x33, 0x23
.byte 0x03, 0x03, 0x9A, 0x00, 0x03, 0x03, 0x03, 0x13
.byte 0x53, 0xF5, 0xD3, 0x63, 0x33, 0x13, 0x03, 0x03
.byte 0x03, 0x03, 0xA3, 0x53, 0x23, 0x53, 0x93, 0x93
.byte 0x83, 0x53, 0x33, 0x13, 0x23, 0xC3, 0xF3, 0xE3
.byte 0x83, 0x43, 0x23, 0x93, 0xF3, 0xF3, 0x83, 0x43
.byte 0x23, 0x43, 0xF5, 0xA3, 0x53, 0x33, 0x73, 0xF5
.byte 0xC3, 0x53, 0x33, 0x13, 0x13, 0x23, 0xB3, 0xF3
.byte 0xF3, 0xA3, 0x53, 0x33, 0x13, 0x03, 0x03, 0x9A
.byte 0x00, 0x03, 0x03, 0x03, 0x03, 0x53, 0xF5, 0xD3
.byte 0x73, 0x33, 0x13, 0x03, 0x03, 0x03, 0x03, 0xB3
.byte 0x63, 0x33, 0x63, 0x93, 0x93, 0x73, 0x53, 0x33
.byte 0x13, 0x23, 0xC3, 0xF3, 0xE3, 0x73, 0x43, 0x23
.byte 0x93, 0xF3, 0xF3, 0x83, 0x43, 0x23, 0x43, 0xF5
.byte 0xA3, 0x53, 0x33, 0x73, 0xF3, 0xF3, 0xC3, 0x53
.byte 0x33, 0x13, 0x13, 0x13, 0x73, 0xF3, 0xF3, 0xE3
.byte 0x73, 0x33, 0x13, 0x03, 0x03, 0x9A, 0x00, 0x03
.byte 0x03, 0x03, 0x03, 0x53, 0xF5, 0xD3, 0x63, 0x33
.byte 0x13, 0x03, 0x03, 0x03, 0x33, 0xE3, 0x63, 0x43
.byte 0x83, 0x93, 0x83, 0x73, 0x73, 0x53, 0x13, 0x23
.byte 0xC3, 0xF3, 0xD3, 0x73, 0x33, 0x13, 0x93, 0xF3
.byte 0xF3, 0x73, 0x43, 0x23, 0x43, 0xF5, 0xA3, 0x53
.byte 0x23, 0x73, 0xF5, 0xC3, 0x53, 0x33, 0x13, 0x03
.byte 0x03, 0x83, 0xC3, 0xF3, 0xF3, 0xC3, 0x43, 0x23
.byte 0x03, 0x03, 0x9A, 0x00, 0x05, 0x03, 0x03, 0x53
.byte 0xF5, 0xE3, 0x73, 0x33, 0x13, 0x03, 0x05, 0x83
.byte 0xF3, 0x73, 0x53, 0x93, 0x93, 0x83, 0x73, 0x83
.byte 0x43, 0x23, 0x33, 0xC3, 0xF3, 0xD3, 0x73, 0x43
.byte 0x23, 0x93, 0xF3, 0xF3, 0x73, 0x43, 0x23, 0x43
.byte 0xF5, 0xA3, 0x53, 0x33, 0x83, 0xF5, 0xC3, 0x53
.byte 0x33, 0x13, 0x03, 0x63, 0xE3, 0x73, 0xB3, 0xF5
.byte 0x83, 0x33, 0x13, 0x03, 0x9A, 0x00, 0x05, 0x03
.byte 0x03, 0x63, 0xF5, 0xF3, 0x73, 0x33, 0x13, 0x03
.byte 0x23, 0x73, 0xF3, 0xF3, 0x73, 0x63, 0x93, 0x93
.byte 0x83, 0x83, 0x73, 0x33, 0x23, 0x23, 0xD3, 0xF3
.byte 0xD3, 0x63, 0x33, 0x13, 0x93, 0xF3, 0xF3, 0x63
.byte 0x33, 0x23, 0x43, 0xF3, 0xF3, 0xB3, 0x53, 0x43
.byte 0xA3, 0xF5, 0xC3, 0x53, 0x33, 0x03, 0x23, 0xB3
.byte 0x83, 0x43, 0x63, 0xD3, 0xF3, 0xE3, 0x53, 0x23
.byte 0x13, 0x9E, 0x00, 0x13, 0x63, 0x83, 0xC3, 0xF3
.byte 0xF5, 0xA3, 0x83, 0x73, 0x73, 0xC3, 0xF7, 0x83
.byte 0x53, 0x83, 0x93, 0x93, 0x83, 0x53, 0x33, 0x53
.byte 0x83, 0xF5, 0xE3, 0xA3, 0x53, 0x63, 0xD3, 0xF3
.byte 0xF3, 0xA3, 0x63, 0x23, 0x23, 0x93, 0xF3, 0xF3
.byte 0xB3, 0x93, 0xB3, 0xF3, 0xF3, 0xE3, 0x83, 0x53
.byte 0x73, 0xA3, 0xF3, 0xC3, 0x63, 0x73, 0xB3, 0xF5
.byte 0xC3, 0x63, 0x23, 0x9E, 0x00, 0x13, 0x63, 0x75
.byte 0x83, 0x93, 0x83, 0x83, 0x73, 0x63, 0x73, 0x73
.byte 0x83, 0x83, 0x93, 0x63, 0x43, 0x43, 0x63, 0x63
.byte 0x53, 0x33, 0x23, 0x43, 0x63, 0x73, 0x83, 0x93
.byte 0x83, 0x53, 0x63, 0x83, 0x83, 0x93, 0x93, 0x53
.byte 0x23, 0x13, 0x33, 0x73, 0xA3, 0xA3, 0x73, 0x43
.byte 0x83, 0xA3, 0x93, 0x73, 0x43, 0x73, 0x73, 0x73
.byte 0x93, 0x53, 0x53, 0x73, 0x83, 0x93, 0x93, 0x63
.byte 0x23, 0x9A, 0x00, 0x03, 0x03, 0x03, 0x13, 0x23
.byte 0x33, 0x43, 0x43, 0x33, 0x23, 0x13, 0x13, 0x23
.byte 0x23, 0x35, 0x33, 0x23, 0x23, 0x23, 0x33, 0x33
.byte 0x23, 0x13, 0x13, 0x13, 0x23, 0x33, 0x33, 0x33
.byte 0x23, 0x13, 0x23, 0x33, 0x33, 0x33, 0x23, 0x13
.byte 0x13, 0x13, 0x23, 0x33, 0x33, 0x33, 0x35, 0x45
.byte 0x33, 0x23, 0x13, 0x13, 0x23, 0x23, 0x23, 0x23
.byte 0x23, 0x33, 0x33, 0x33, 0x23, 0x13, 0x4E, 0x00
logo_end:
.align 4
headers_end: