This source file includes following definitions.
- CreateTask_spytask
- boot
- CreateTask_my
- sub_FF0203C4_my
- sub_FF022914_my
- sub_FF02473C_my
- sub_FF027DC0_my
- task_Startup_my
- taskcreatePhySw_my
- init_file_modules_task
- kbd_p1_f_cont_my
- sub_FF02BDF4_my
- init_required_fw_features
1
2
3
4 #include "lolevel.h"
5 #include "platform.h"
6 #include "core.h"
7 #include "dryos31.h"
8
9 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
10
11 const char * const new_sa = &_end;
12
13
14
15
16 void CreateTask_spytask()
17 {
18 _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
19 }
20
21
22
23
24
25
26
27
28
29
30 void __attribute__((naked,noinline)) boot() {
31 asm volatile (
32 " LDR R1, =0xC0410000 \n"
33 " MOV R0, #0 \n"
34 " STR R0, [R1] \n"
35 " MOV R1, #0x78 \n"
36 " MCR p15, 0, R1, c1, c0 \n"
37 " MOV R1, #0 \n"
38 " MCR p15, 0, R1, c7, c10, 4 \n"
39 " MCR p15, 0, R1, c7, c5 \n"
40 " MCR p15, 0, R1, c7, c6 \n"
41 " MOV R0, #0x3D \n"
42 " MCR p15, 0, R0, c6, c0 \n"
43 " MOV R0, #0xC000002F \n"
44 " MCR p15, 0, R0, c6, c1 \n"
45 " MOV R0, #0x39 \n"
46 " MCR p15, 0, R0, c6, c2 \n"
47 " MOV R0, #0x40000039 \n"
48 " MCR p15, 0, R0, c6, c3 \n"
49 " MOV R0, #0x80000017 \n"
50 " MCR p15, 0, R0, c6, c4 \n"
51 " LDR R0, =0xFF00002F \n"
52 " MCR p15, 0, R0, c6, c5 \n"
53 " MOV R0, #0x34 \n"
54 " MCR p15, 0, R0, c2, c0 \n"
55 " MOV R0, #0x34 \n"
56 " MCR p15, 0, R0, c2, c0, 1 \n"
57 " MOV R0, #0x34 \n"
58 " MCR p15, 0, R0, c3, c0 \n"
59 " LDR R0, =0x3333330 \n"
60 " MCR p15, 0, R0, c5, c0, 2 \n"
61 " LDR R0, =0x3333330 \n"
62 " MCR p15, 0, R0, c5, c0, 3 \n"
63 " MRC p15, 0, R0, c1, c0 \n"
64 " ORR R0, R0, #0x1000 \n"
65 " ORR R0, R0, #4 \n"
66 " ORR R0, R0, #1 \n"
67 " MCR p15, 0, R0, c1, c0 \n"
68 " MOV R1, #0x80000006 \n"
69 " MCR p15, 0, R1, c9, c1 \n"
70 " MOV R1, #6 \n"
71 " MCR p15, 0, R1, c9, c1, 1 \n"
72 " MRC p15, 0, R1, c1, c0 \n"
73 " ORR R1, R1, #0x50000 \n"
74 " MCR p15, 0, R1, c1, c0 \n"
75 " LDR R2, =0xC0200000 \n"
76 " MOV R1, #1 \n"
77 " STR R1, [R2, #0x10C] \n"
78 " MVN R1, #0 \n"
79 " STR R1, [R2, #0xC] \n"
80 " STR R1, [R2, #0x1C] \n"
81 " STR R1, [R2, #0x2C] \n"
82 " STR R1, [R2, #0x3C] \n"
83 " STR R1, [R2, #0x4C] \n"
84 " STR R1, [R2, #0x5C] \n"
85 " STR R1, [R2, #0x6C] \n"
86 " STR R1, [R2, #0x7C] \n"
87 " STR R1, [R2, #0x8C] \n"
88 " STR R1, [R2, #0x9C] \n"
89 " STR R1, [R2, #0xAC] \n"
90 " STR R1, [R2, #0xBC] \n"
91 " STR R1, [R2, #0xCC] \n"
92 " STR R1, [R2, #0xDC] \n"
93 " STR R1, [R2, #0xEC] \n"
94 " STR R1, [R2, #0xFC] \n"
95 " LDR R1, =0xC0400008 \n"
96 " LDR R2, =0x430005 \n"
97 " STR R2, [R1] \n"
98 " MOV R1, #1 \n"
99 " LDR R2, =0xC0243100 \n"
100 " STR R2, [R1] \n"
101 " LDR R2, =0xC0242010 \n"
102 " LDR R1, [R2] \n"
103 " ORR R1, R1, #1 \n"
104 " STR R1, [R2] \n"
105 " LDR R0, =0xFF9131B4 \n"
106 " LDR R1, =0x6B1000 \n"
107 " LDR R3, =0x6E3F2A \n"
108
109 "loc_FF02013C:\n"
110 " CMP R1, R3 \n"
111 " LDRCC R2, [R0], #4 \n"
112 " STRCC R2, [R1], #4 \n"
113 " BCC loc_FF02013C \n"
114 " LDR R0, =0xFF8FB60C \n"
115 " LDR R1, =0x1900 \n"
116 " LDR R3, =0x194A8 \n"
117
118 "loc_FF020158:\n"
119 " CMP R1, R3 \n"
120 " LDRCC R2, [R0], #4 \n"
121 " STRCC R2, [R1], #4 \n"
122 " BCC loc_FF020158 \n"
123 " LDR R1, =0x32A990 \n"
124 " MOV R2, #0 \n"
125
126 "loc_FF020170:\n"
127 " CMP R3, R1 \n"
128 " STRCC R2, [R3], #4 \n"
129 " BCC loc_FF020170 \n"
130
131
132
133
134
135 " LDR R0, =patch_CreateTask\n"
136 " LDM R0, {R1,R2}\n"
137 " LDR R0, =hook_CreateTask\n"
138 " STM R0, {R1,R2}\n"
139
140 " B sub_FF0203C4_my \n"
141
142 "patch_CreateTask:\n"
143 " LDR PC, [PC,#-0x4]\n"
144 " .long CreateTask_my\n"
145 );
146 }
147
148
149
150 void __attribute__((naked,noinline)) CreateTask_my() {
151 asm volatile (
152 " STMFD SP!, {R0}\n"
153
154
155
156 " LDR R0, =task_CaptSeq\n"
157 " CMP R0, R3\n"
158 " LDREQ R3, =capt_seq_task\n"
159 " BEQ exitHook\n"
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 " LDR R0, =task_InitFileModules\n"
187 " CMP R0, R3\n"
188 " LDREQ R3, =init_file_modules_task\n"
189
190 "exitHook:\n"
191
192 " LDMFD SP!, {R0}\n"
193
194 " STMFD SP!, {R1-R5,LR} \n"
195 " MOV R4, R2 \n"
196 " LDR PC, =0x006B571C \n"
197 );
198 }
199
200
201
202 void __attribute__((naked,noinline)) sub_FF0203C4_my() {
203
204
205
206
207 *(int*)(0x2f0c+0x4) = (*(int*)0xC022F48C)&0x20000 ? 0x80000 : 0x40000;
208
209 asm volatile (
210 " LDR R0, =0xFF02043C \n"
211 " MOV R1, #0 \n"
212 " LDR R3, =0xFF020474 \n"
213
214 "loc_FF0203D0:\n"
215 " CMP R0, R3 \n"
216 " LDRCC R2, [R0], #4 \n"
217 " STRCC R2, [R1], #4 \n"
218 " BCC loc_FF0203D0 \n"
219 " LDR R0, =0xFF020474 \n"
220 " MOV R1, #0x1E0 \n"
221 " LDR R3, =0xFF02064C \n"
222
223 "loc_FF0203EC:\n"
224 " CMP R0, R3 \n"
225 " LDRCC R2, [R0], #4 \n"
226 " STRCC R2, [R1], #4 \n"
227 " BCC loc_FF0203EC \n"
228 " MOV R0, #0xD2 \n"
229 " MSR CPSR_cxsf, R0 \n"
230 " MOV SP, #0x1000 \n"
231 " MOV R0, #0xD3 \n"
232 " MSR CPSR_cxsf, R0 \n"
233 " MOV SP, #0x1000 \n"
234 " LDR R0, =0x3B8 \n"
235 " LDR R2, =0xEEEEEEEE \n"
236 " MOV R3, #0x1000 \n"
237
238 "loc_FF020420:\n"
239 " CMP R0, R3 \n"
240 " STRCC R2, [R0], #4 \n"
241 " BCC loc_FF020420 \n"
242 " B sub_FF022914_my \n"
243 );
244 }
245
246
247
248 void __attribute__((naked,noinline)) sub_FF022914_my() {
249 asm volatile (
250 " LDR R1, =0x1A64 \n"
251 " STR LR, [SP, #-4]! \n"
252 " SUB SP, SP, #0x7C \n"
253 " MOV R0, #0x80000 \n"
254 " STR R0, [R1] \n"
255 " LDR R0, =0x40DEBEE0 \n"
256 " LDR R1, =0x1A68 \n"
257 " STR R0, [R1] \n"
258 " LDR R1, =0x1A6C \n"
259 " ADD R0, R0, #0x2000 \n"
260 " STR R0, [R1] \n"
261 " MOV R1, #0x78 \n"
262 " ADD R0, SP, #4 \n"
263 " BL sub_006DC0D0 \n"
264 " MOV R0, #0xA0000 \n"
265 " STR R0, [SP, #8] \n"
266
267 #if defined(CHDK_NOT_IN_CANON_HEAP)
268 " LDR R0, =0x32A990 \n"
269 #else
270 " LDR R0, =new_sa\n"
271 " LDR R0, [R0]\n"
272 #endif
273
274 " LDR R2, =0x562A94 \n"
275 " STR R0, [SP, #0xC] \n"
276 " SUB R0, R2, R0 \n"
277 " STR R0, [SP, #0x10] \n"
278 " MOV R0, #0x22 \n"
279 " STR R0, [SP, #0x1C] \n"
280 " MOV R0, #0x98 \n"
281 " STR R0, [SP, #0x20] \n"
282 " LDR R0, =0x21A \n"
283 " LDR R1, =0x56E000 \n"
284 " STR R2, [SP, #0x14] \n"
285 " STR R0, [SP, #0x24] \n"
286 " MOV R0, #0xFA \n"
287 " STR R1, [SP, #4] \n"
288 " STR R1, [SP, #0x18] \n"
289 " STR R0, [SP, #0x28] \n"
290 " MOV R0, #0xD4 \n"
291 " STR R0, [SP, #0x2C] \n"
292 " MOV R0, #0x85 \n"
293 " STR R0, [SP, #0x30] \n"
294 " MOV R0, #0x40 \n"
295 " STR R0, [SP, #0x34] \n"
296 " MOV R0, #4 \n"
297 " STR R0, [SP, #0x38] \n"
298 " MOV R0, #0 \n"
299 " STR R0, [SP, #0x3C] \n"
300 " MOV R0, #0x10 \n"
301 " STR R0, [SP, #0x60] \n"
302 " MOV R0, #0x1000 \n"
303 " STR R0, [SP, #0x64] \n"
304 " MOV R0, #0x100 \n"
305 " STR R0, [SP, #0x68] \n"
306 " MOV R0, #0x2000 \n"
307 " STR R0, [SP, #0x6C] \n"
308 " LDR R1, =sub_FF02473C_my \n"
309 " MOV R2, #0 \n"
310 " ADD R0, SP, #4 \n"
311 " BL sub_006B1BC4 \n"
312 " ADD SP, SP, #0x7C \n"
313 " LDR PC, [SP], #4 \n"
314 );
315 }
316
317
318
319 void __attribute__((naked,noinline)) sub_FF02473C_my() {
320 asm volatile (
321 " STMFD SP!, {R4,LR} \n"
322 " LDR R4, =0xFF0247F8 /*'/_term'*/ \n"
323 " BL sub_FF020848 \n"
324 " LDR R1, =0x1A64 \n"
325 " LDR R0, =0x19F8 \n"
326 " LDR R1, [R1] \n"
327 " LDR R0, [R0] \n"
328 " ADD R1, R1, #0x10 \n"
329 " CMP R0, R1 \n"
330 " LDRCC R0, =0xFF024808 /*'USER_MEM size checking'*/ \n"
331 " BLCC _err_init_task \n"
332 " BL sub_FF023528 \n"
333 " CMP R0, #0 \n"
334 " LDRLT R0, =0xFF024820 /*'dmSetup'*/ \n"
335 " BLLT _err_init_task \n"
336 " BL sub_FF022528 \n"
337 " CMP R0, #0 \n"
338 " LDRLT R0, =0xFF024828 /*'termDriverInit'*/ \n"
339 " BLLT _err_init_task \n"
340 " MOV R0, R4 \n"
341 " BL sub_FF022608 \n"
342 " CMP R0, #0 \n"
343 " LDRLT R0, =0xFF024838 /*'termDeviceCreate'*/ \n"
344 " BLLT _err_init_task \n"
345 " MOV R0, R4 \n"
346 " BL sub_FF022140 \n"
347 " CMP R0, #0 \n"
348 " LDRLT R0, =0xFF02484C /*'stdioSetup'*/ \n"
349 " BLLT _err_init_task \n"
350 " BL sub_FF024DA8 \n"
351 " CMP R0, #0 \n"
352 " LDRLT R0, =0xFF024858 /*'stdlibSetup'*/ \n"
353 " BLLT _err_init_task \n"
354 " BL sub_FF020F4C \n"
355 " CMP R0, #0 \n"
356 " LDRLT R0, =0xFF024864 /*'extlib_setup'*/ \n"
357 " BLLT _err_init_task \n"
358 " LDMFD SP!, {R4,LR} \n"
359 " B sub_FF027DC0_my \n"
360 );
361 }
362
363
364
365 void __attribute__((naked,noinline)) sub_FF027DC0_my() {
366 asm volatile (
367 " STMFD SP!, {R3,LR} \n"
368 " BL sub_FF0340B0 \n"
369 " BL sub_FF02D7D4 /*_IsNormalCameraMode_FW*/ \n"
370
371
372
373
374
375 "loc_FF027DDC:\n"
376
377
378 "loc_FF027DE0:\n"
379 " BL sub_006B8C18 \n"
380 " LDR R1, =0x60E000 \n"
381 " MOV R0, #0 \n"
382 " BL sub_FF038368 \n"
383 " MOV R3, #0 \n"
384 " STR R3, [SP] \n"
385 " LDR R3, =task_Startup_my \n"
386 " MOV R2, #0 \n"
387 " MOV R1, #0x19 \n"
388 " LDR R0, =0xFF027E1C /*'Startup'*/ \n"
389 " BL _CreateTask \n"
390 " MOV R0, #0 \n"
391 " LDMFD SP!, {R3,PC} \n"
392 );
393 }
394
395
396
397 void __attribute__((naked,noinline)) task_Startup_my() {
398 asm volatile (
399 " STMFD SP!, {R4,LR} \n"
400 " BL sub_FF022CCC \n"
401 " BL sub_FF02C6B8 \n"
402 " BL sub_FF02B914 \n"
403
404 " BL sub_FF038114 \n"
405
406 " BL sub_FF038278 \n"
407 " BL sub_FF03843C \n"
408
409 " BL sub_FF038148 \n"
410 " BL sub_FF033FE8 \n"
411 " BL sub_FF038444 \n"
412 " BL CreateTask_spytask\n"
413 " BL taskcreatePhySw_my \n"
414 " BL init_required_fw_features\n"
415 " BL sub_FF031C68 \n"
416 " BL sub_FF0C7978 \n"
417 " BL sub_FF029190 \n"
418 " BL sub_FF02B44C \n"
419 " BL sub_FF037C98 \n"
420 " BL sub_FF02B8C4 \n"
421 " BL sub_FF02B3E0 \n"
422
423 " BL sub_FF029FCC \n"
424 " BL sub_FF02B39C \n"
425 " LDMFD SP!, {R4,LR} \n"
426 " B sub_FF022E1C \n"
427 );
428 }
429
430
431
432 void __attribute__((naked,noinline)) taskcreatePhySw_my() {
433 asm volatile (
434 " STMFD SP!, {R3-R5,LR} \n"
435 " BL sub_FF036F00 \n"
436 " BL sub_FF02D70C /*_IsFactoryMode_FW*/ \n"
437 " CMP R0, #0 \n"
438 " BLEQ sub_FF036E68 /*_OpLog.Start_FW*/ \n"
439 " LDR R4, =0x1C18 \n"
440 " LDR R0, [R4, #4] \n"
441 " CMP R0, #0 \n"
442 " BNE loc_FF02C0DC \n"
443 " MOV R3, #0 \n"
444 " STR R3, [SP] \n"
445 " LDR R3, =mykbd_task \n"
446 " MOV R2, #0x2000 \n"
447 " MOV R1, #0x17 \n"
448 " LDR R0, =0xFF02C38C /*'PhySw'*/ \n"
449 " BL sub_006B7C84 /*_CreateTaskStrictly*/ \n"
450 " STR R0, [R4, #4] \n"
451
452 "loc_FF02C0DC:\n"
453 " LDMFD SP!, {R3-R5,PC} \n"
454 );
455 }
456
457
458
459 void __attribute__((naked,noinline)) init_file_modules_task() {
460 asm volatile (
461 " STMFD SP!, {R4-R6,LR} \n"
462 " MOV R0, #6 \n"
463
464 " BL sub_FF0B0DA8 \n"
465 " LDR R5, =0x5006 \n"
466 " MOVS R4, R0 \n"
467 " MOVNE R1, #0 \n"
468 " MOVNE R0, R5 \n"
469 " BLNE _PostLogicalEventToUI \n"
470 " BL sub_FF0B0DD8 \n"
471 " BL core_spytask_can_start\n"
472 " CMP R4, #0 \n"
473 " LDMNEFD SP!, {R4-R6,PC} \n"
474 " MOV R0, R5 \n"
475 " LDMFD SP!, {R4-R6,LR} \n"
476 " MOV R1, #1 \n"
477 " B _PostLogicalEventToUI \n"
478 );
479 }
480
481
482
483 void __attribute__((naked,noinline)) kbd_p1_f_cont_my() {
484 asm volatile (
485 " LDR R2, =0x1A278 \n"
486 " MOV R0, #2 \n"
487 " ADD R3, R2, #0x24 \n"
488 " MOV R4, SP \n"
489
490 "loc_FF02C5F0:\n"
491 " ADD R1, R3, R0, LSL#2 \n"
492 " LDR R12, [R2, R0, LSL#2] \n"
493 " LDR R6, [R1, #0xC] \n"
494 " LDR R1, [R1, #0x18] \n"
495 " AND R12, R12, R6 \n"
496 " EOR R1, R1, R12 \n"
497 " STR R1, [R4, R0, LSL#2] \n"
498 " SUBS R0, R0, #1 \n"
499 " BPL loc_FF02C5F0 \n"
500 " bl xtra_kbd_cb \n"
501 " mov r3, r0 \n"
502 " LDR R2, =0x1A290 \n"
503 " MOV R0, SP \n"
504 " SUB R1, R2, #0xC \n"
505 " BL sub_FF02BDF4_my \n"
506 " LDR PC, =0xFF02C624 \n"
507 );
508 }
509
510
511
512 void __attribute__((naked,noinline)) sub_FF02BDF4_my() {
513 asm volatile (
514 " STMFD SP!, {R0-R12,LR} \n"
515 " MOV R5, R0 \n"
516
517 " mov r0, r3 \n"
518 " LDR PC, =0xFF02BE00 \n"
519 );
520 }
521
522
523
524
525
526 void init_required_fw_features(void) {
527 extern void _init_focus_eventflag();
528 extern void _init_nd_eventflag();
529 extern void _init_nd_semaphore();
530
531
532 _init_focus_eventflag();
533 _init_nd_eventflag();
534 _init_nd_semaphore();
535 }
536