This source file includes following definitions.
- spytask
- CreateTask_spytask
- init_required_fw_features
- boot
- CreateTask_my
- sub_fc05eec0_my
- sub_fc05f050_my
- sub_fc05f0e4_my
- sub_fc05f456_my
- sub_fc07319c_my
- task_Startup_my
- sub_fc07308e_my
- init_file_modules_task
- kbd_p2_f_my
- sub_fc0706e8_my
1 #include "lolevel.h"
2 #include "platform.h"
3 #include "core.h"
4
5
6 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
7
8 const char * const new_sa = &_end;
9
10
11 extern volatile int jogdial_stopped;
12 void JogDial_task_my(void);
13
14 extern void task_CaptSeq();
15 extern void task_InitFileModules();
16 extern void task_RotaryEncoder();
17 extern void task_MovieRecord();
18 extern void task_LiveImageTask();
19 extern void task_ExpDrv();
20
21
22
23
24 void spytask(long ua, long ub, long uc, long ud, long ue, long uf)
25 {
26 (void)ua; (void)ub; (void)uc; (void)ud; (void)ue; (void)uf;
27 core_spytask();
28 }
29
30
31
32
33 void CreateTask_spytask()
34 {
35
36
37 _CreateTask("SpyTask", 0x19, 0x2000, spytask, 0);
38 }
39
40
41
42
43
44
45
46 void init_required_fw_features(void) {
47 extern void _init_focus_eventflag();
48 extern void _init_nd_eventflag();
49
50
51
52 _init_focus_eventflag();
53 _init_nd_eventflag();
54
55 extern int av_override_semaphore;
56 extern int _CreateBinarySemaphoreStrictly(int x, int y);
57 av_override_semaphore = _CreateBinarySemaphoreStrictly(0,0);
58
59 }
60
61
62
63
64
65
66
67
68
69
70
71
72 void __attribute__((naked,noinline)) boot() {
73
74 asm volatile (
75 " ldr.w sp, =0x80010000\n"
76 " bl sub_fc020064\n"
77 " ldr r2, =0xc0242010\n"
78 " ldr r1, [r2]\n"
79 " orr r1, r1, #1\n"
80 " str r1, [r2]\n"
81 " ldr r0, =0xfcd16b8c\n"
82 " ldr r1, =0x010e1000\n"
83 " ldr r3, =0x0110daa4\n"
84 "loc_fc020024:\n"
85 " cmp r1, r3\n"
86 " itt lo\n"
87 " ldrlo r2, [r0], #4\n"
88 " strlo r2, [r1], #4\n"
89 " blo loc_fc020024\n"
90
91
92 "adr r0, patch_CreateTask\n"
93 "ldr r1, =hook_CreateTask\n"
94 "add r2, r0, #8\n"
95 "task_hook_loop:\n"
96 "ldrh r3, [r0],#2\n"
97 "strh r3, [r1],#2\n"
98 "cmp r0,r2\n"
99 "blo task_hook_loop\n"
100 " ldr r0, =0x010e1000\n"
101 " ldr r1, =0x0002caa4\n"
102 " bl sub_fc1361ce\n"
103 " ldr r0, =0xfccec580\n"
104 " ldr r1, =0x00008000\n"
105 " ldr r3, =0x0003260c\n"
106 "loc_fc020040:\n"
107 " cmp r1, r3\n"
108 " itt lo\n"
109 " ldrlo r2, [r0], #4\n"
110 " strlo r2, [r1], #4\n"
111 " blo loc_fc020040\n"
112 " ldr r3, =0x0003260c\n"
113 " ldr r1, =0x003a8bb0\n"
114 " mov.w r2, #0\n"
115 "loc_fc020056:\n"
116 " cmp r3, r1\n"
117 " it lo\n"
118 " strlo r2, [r3], #4\n"
119 " blo loc_fc020056\n"
120
121 " b.w sub_fc05eec0_my\n"
122
123 "patch_CreateTask:\n"
124 "ldr.w pc, [pc,#0]\n"
125 ".long CreateTask_my + 1\n"
126
127
128 );
129 }
130
131
132 void __attribute__((naked,noinline)) CreateTask_my() {
133
134 asm volatile (
135 " push {r0}\n"
136
137 " ldr r0, =task_CaptSeq\n"
138 " cmp r0, r3\n"
139 " itt eq\n"
140 " ldreq r3, =capt_seq_task\n"
141 " orreq r3, #1\n"
142 " beq exitHook\n"
143
144 " LDR R0, =task_ExpDrv\n"
145 " CMP R0, R3\n"
146 " itt eq\n"
147 " LDREQ R3, =exp_drv_task\n"
148 " orreq r3, #1\n"
149 " BEQ exitHook\n"
150
151
152
153
154
155
156
157
158
159 " ldr r0, =task_FileWrite\n"
160 " cmp r0, r3\n"
161 " itt eq\n"
162 " ldreq r3, =filewritetask\n"
163 " orreq r3, #1\n"
164 " beq exitHook\n"
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180 " ldr r0, =task_InitFileModules\n"
181 " cmp r0, r3\n"
182 " itt eq\n"
183 " ldreq r3, =init_file_modules_task\n"
184 " orreq r3, #1\n"
185
186 "exitHook:\n"
187
188
189 " pop {r0}\n"
190
191
192
193
194
195
196
197
198 " stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, lr}\n"
199
200 " mov r4, r0\n"
201 " ldr r0, =0x8160\n"
202
203
204 " ldr.w pc, =(hook_CreateTask + 8 + 1) \n"
205 ".ltorg\n"
206 );
207
208 }
209
210
211 void __attribute__((naked,noinline)) sub_fc05eec0_my() {
212
213
214
215
216
217
218
219
220
221
222
223
224 asm volatile (
225 "push {r4, lr}\n"
226
227 #if defined(CHDK_NOT_IN_CANON_HEAP)
228 "ldr r4, =0x003a8bb0\n"
229 #else
230 "ldr r4, =new_sa\n"
231 "ldr r4, [r4]\n"
232 #endif
233 " sub sp, #0x78\n"
234 " ldr r0, =0x006ce000\n"
235 " ldr r1, =0x0008fd8c\n"
236 " subs r0, r0, r4\n"
237 " cmp r0, r1\n"
238 " bhs loc_fc05eed2\n"
239 "loc_fc05eed0:\n"
240 " b loc_fc05eed0\n"
241 "loc_fc05eed2:\n"
242 " ldr r1, =0x00008074\n"
243 " mov.w r0, #0x80000\n"
244 " str r0, [r1]\n"
245 " ldr r1, =0x00008078\n"
246 " ldr r0, =0x42a41000\n"
247 " str r0, [r1]\n"
248 " ldr r1, =0x0000807c\n"
249 " ldr r0, =0x42a43000\n"
250 " str r0, [r1]\n"
251 " movs r1, #0x78\n"
252 " mov r0, sp\n"
253 " blx sub_fc2cf438\n"
254 " ldr r0, =0x0062e000\n"
255 " mov.w r1, #0xa0000\n"
256 " stm.w sp, {r0, r1, r4}\n"
257 " ldr r1, =0x00622274\n"
258 " subs r2, r1, r4\n"
259 " strd r2, r1, [sp, #0xc]\n"
260 " str r0, [sp, #0x14]\n"
261 " movs r0, #0x22\n"
262 " str r0, [sp, #0x18]\n"
263 " movs r0, #0x98\n"
264 " str r0, [sp, #0x1c]\n"
265 " movw r0, #0x24c\n"
266 " str r0, [sp, #0x20]\n"
267 " movs r0, #0xfa\n"
268 " str r0, [sp, #0x24]\n"
269 " movs r0, #0xe8\n"
270 " str r0, [sp, #0x28]\n"
271 " movs r0, #0x85\n"
272 " str r0, [sp, #0x2c]\n"
273 " movs r0, #0x40\n"
274 " str r0, [sp, #0x30]\n"
275 " movs r0, #4\n"
276 " str r0, [sp, #0x34]\n"
277 " movs r0, #0\n"
278 " str r0, [sp, #0x38]\n"
279 " movs r0, #0x10\n"
280 " str r0, [sp, #0x5c]\n"
281 " movs r2, #0\n"
282 " lsls r0, r0, #8\n"
283 " str r0, [sp, #0x60]\n"
284
285 "ldr r1, =sub_fc05f050_my\n"
286 " asrs r0, r0, #4\n"
287 " str r0, [sp, #0x64]\n"
288 " lsls r0, r0, #5\n"
289 " str r0, [sp, #0x68]\n"
290 " mov r0, sp\n"
291 " blx sub_fc2ce9a4\n"
292 " add sp, #0x78\n"
293 " pop {r4, pc}\n"
294 ".ltorg\n"
295
296 );
297
298
299 }
300
301
302
303 void __attribute__((naked,noinline)) sub_fc05f050_my() {
304
305
306 asm volatile (
307 " push {r4, lr}\n"
308 " ldr r4, =0xfc05f0fc\n"
309 " bl sub_fc0602ec\n"
310 " ldr r0, =0x000080ec\n"
311 " ldr r1, [r0]\n"
312 " ldr r0, =0x00008074\n"
313 " ldr r0, [r0]\n"
314 " adds r0, #0x10\n"
315 " cmp r1, r0\n"
316 " bhs loc_fc05f06c\n"
317 " ldr r0, =0xfc05f10c\n"
318 " bl sub_fc05f0e4\n"
319 "loc_fc05f06c:\n"
320 " bl sub_fc1362a8\n"
321 " ldr r3, =0x80000800\n"
322
323
324 "mov.w r1, #0x80000000\n"
325 "mov.w r2, #0xeeeeeeee\n"
326 "loc_fc05f07a:\n"
327 " stm r1!, {r2}\n"
328 " cmp r1, r3\n"
329 " blo loc_fc05f07a\n"
330 " bl sub_fc1362ba\n"
331 " bl sub_fc136890\n"
332 " cmp r0, #0\n"
333 " bge loc_fc05f092\n"
334 " ldr r0, =0xfc05f128\n"
335 " bl sub_fc05f0e4\n"
336 "loc_fc05f092:\n"
337 " bl sub_fc05f8c4\n"
338 " cmp r0, #0\n"
339 " bge loc_fc05f0a0\n"
340 " ldr r0, =0xfc05f130\n"
341 " bl sub_fc05f0e4\n"
342 "loc_fc05f0a0:\n"
343 " mov r0, r4\n"
344 " bl sub_fc05f952\n"
345
346 " cmp r0, #0\n"
347 " bge loc_fc05f0b0\n"
348 " ldr r0, =0xfc05f140\n"
349 " bl sub_fc05f0e4\n"
350 "loc_fc05f0b0:\n"
351 " mov r0, r4\n"
352 " bl sub_fc05f288\n"
353
354 " cmp r0, #0\n"
355 " bge loc_fc05f0c0\n"
356 " ldr r0, =0xfc05f154\n"
357 " bl sub_fc05f0e4\n"
358 "loc_fc05f0c0:\n"
359 " bl sub_fc05f3cc\n"
360 " cmp r0, #0\n"
361 " bge loc_fc05f0ce\n"
362 " ldr r0, =0xfc05f160\n"
363 " bl sub_fc05f0e4\n"
364 "loc_fc05f0ce:\n"
365 " bl sub_fc0623e8\n"
366 " cmp r0, #0\n"
367 " bge loc_fc05f0dc\n"
368 " ldr r0, =0xfc05f16c\n"
369 " bl sub_fc05f0e4\n"
370 "loc_fc05f0dc:\n"
371 " pop.w {r4, lr}\n"
372
373 "b.w sub_fc05f456_my\n"
374 ".ltorg\n"
375
376 );
377
378 }
379
380 void __attribute__((naked,noinline)) sub_fc05f0e4_my() {
381
382
383 }
384 void __attribute__((naked,noinline)) sub_fc05f456_my() {
385
386
387
388 asm volatile (
389 " push {r3, lr}\n"
390 " bl sub_fc05f570\n"
391 " bl sub_fc0b9738\n"
392 " cbnz r0, loc_fc05f46c\n"
393 " bl sub_fc07f062\n"
394 " cbz r0, loc_fc05f46c\n"
395 " movs r0, #1\n"
396 " b loc_fc05f46e\n"
397 "loc_fc05f46c:\n"
398 "movs r0, #0\n"
399 "loc_fc05f46e:\n"
400 " bl sub_fc07319c\n"
401 " cbnz r0, loc_fc05f47a\n"
402 " bl sub_fc05f55e\n"
403 "loc_fc05f478:\n"
404 " b loc_fc05f478\n"
405 "loc_fc05f47a:\n"
406 " blx sub_fc2ce9fc\n"
407 " ldr r1, =0x006ce000\n"
408 " movs r0, #0\n"
409 " bl sub_fc3364fc\n"
410 " blx sub_fc2cefd0\n"
411 " movs r3, #0\n"
412 " str r3, [sp]\n"
413
414 "ldr r3, =task_Startup_my\n"
415 " movs r2, #0\n"
416 " movs r1, #0x19\n"
417 " ldr r0, =0xfc05f4a8\n"
418
419
420
421
422
423
424
425
426 "bl _CreateTask\n"
427 " movs r0, #0\n"
428 " pop {r3, pc}\n"
429 ".ltorg\n"
430 );
431 }
432
433
434 #if 0
435 void __attribute__((naked,noinline)) sub_fc07319c_my() {
436 asm volatile (
437 "stmdb sp!, {r2, r3, r4, r5, r6, r7, r8, lr}\n"
438 "mov.w r8, #0\n"
439 "mov r7, r0\n"
440 "mov r6, r8\n"
441 "bl sub_fc0705ee\n"
442 "movs r0, #16\n"
443 "bl sub_fc06fbde\n"
444 "movs r4, #1\n"
445 "bic.w r5, r4, r0\n"
446 "movs r0, #15\n"
447 "bl sub_fc06fbde\n"
448 "bics r4, r0\n"
449 "cbz r7, loc_fc0731f6\n"
450 "orrs.w r0, r5, r4\n"
451
452 "loc_fc0731f6:\n"
453 "bl sub_fc0b9738\n"
454 "movs r3, #0\n"
455 "mov r2, r0\n"
456 "strd r8, r6, [sp]\n"
457 "mov r1, r4\n"
458 "mov r0, r5\n"
459
460
461 "movs r0, #1\n"
462 "loc_fc073210:\n"
463 "ldmia.w sp!, {r2, r3, r4, r5, r6, r7, r8, pc}\n"
464 ".ltorg\n"
465 );
466 }
467 #endif
468
469
470
471
472 void __attribute__((naked,noinline)) task_Startup_my() {
473
474 asm volatile (
475 " push {r4, lr}\n"
476 " bl sub_fc137ad4\n"
477 " bl sub_fc05f53c\n"
478
479 " bl sub_fc0daedc\n"
480 "bl sub_010e6355\n"
481
482 " bl sub_fc08da46\n"
483 " bl sub_fc0db028\n"
484 " bl sub_fc05f804\n"
485 " bl sub_fc05f650\n"
486 " bl sub_fc0daf1a\n"
487 " bl sub_fc0b947c\n"
488 " bl sub_fc0db02e\n"
489 " bl sub_fc07308e_my\n"
490 " bl CreateTask_spytask\n"
491 " bl init_required_fw_features\n"
492 " bl sub_fc275708\n"
493 " bl sub_fc0db044\n"
494 " bl sub_fc0b9230\n"
495 " bl sub_fc13788e\n"
496 " bl sub_fc0b95e4\n"
497 " bl sub_fc0b942e\n"
498 " bl sub_fc13784a\n"
499 " bl sub_fc05f808\n"
500 " bl sub_fc32f656\n"
501 " bl sub_fc13781e\n"
502 " pop.w {r4, lr}\n"
503 " b.w sub_fc137aaa\n"
504 ".ltorg\n"
505 );
506 }
507
508 void __attribute__((naked,noinline)) sub_fc07308e_my() {
509
510 asm volatile (
511 " push {r3, r4, r5, lr}\n"
512 " bl sub_fc07202c\n"
513 " bl sub_fc07efe0\n"
514 " cbnz r0, loc_fc07309e\n"
515 " bl sub_fc071fd0\n"
516 "loc_fc07309e:\n"
517 " ldr r4, =0x000082c8\n"
518 " ldr r0, [r4, #4]\n"
519 " cmp r0, #0\n"
520 " bne loc_fc0730ba\n"
521 " movs r3, #0\n"
522 " str r3, [sp]\n"
523
524 "ldr r3, =mykbd_task\n"
525 " movs r1, #0x17\n"
526 " ldr r0, =0xfc0730e8\n"
527 " movw r2, #0x2000\n"
528 " blx sub_fc2cf340\n"
529
530
531
532
533
534
535
536 " str r0, [r4, #4]\n"
537 "loc_fc0730ba:\n"
538 " pop {r3, r4, r5, pc}\n"
539 ".ltorg\n"
540 );
541 }
542
543 void __attribute__((naked,noinline)) init_file_modules_task() {
544
545
546 asm volatile (
547 " push {r4, r5, r6, lr}\n"
548 " bl sub_fc0e5238\n"
549 " movs r4, r0\n"
550 " movw r5, #0x5006\n"
551 " beq loc_fc0bda26\n"
552 " movs r1, #0\n"
553 " mov r0, r5\n"
554 " bl _PostLogicalEventToUI\n"
555 "loc_fc0bda26:\n"
556 " bl sub_fc0e5262\n"
557 " BL core_spytask_can_start\n"
558 " cmp r4, #0\n"
559 " bne loc_fc0bda3a\n"
560 " mov r0, r5\n"
561 " pop.w {r4, r5, r6, lr}\n"
562 " movs r1, #0\n"
563 " b.w _PostLogicalEventToUI\n"
564 "loc_fc0bda3a:\n"
565 " pop {r4, r5, r6, pc}\n"
566 " .ltorg\n"
567 );
568
569 }
570
571
572 void __attribute__((naked,noinline)) kbd_p2_f_my() {
573
574
575
576 asm volatile(
577 " stmdb sp!, {r4, r5, r6, r7, r8, lr}\n"
578
579 " ldr r6, =0x00033f88\n"
580 " sub sp, #0x18\n"
581 " add r7, sp, #8\n"
582 " subs r6, #0xc\n"
583 " b loc_fc072e76\n"
584
585 "loc_fc072e42:\n"
586 " ldr r1, =0x00033f88\n"
587 " add r3, sp, #8\n"
588 " ldrb.w r0, [sp, #4]\n"
589 " add r2, sp, #0x14\n"
590 " subs r1, #0x18\n"
591 " bl sub_fc070b4e\n"
592 " cbnz r0, loc_fc072e5c\n"
593 " ldr r1, [sp, #0x14]\n"
594 " movs r0, #0\n"
595 " bl sub_fc072da6\n"
596
597 "loc_fc072e5c:\n"
598 " movs r0, #2\n"
599 "loc_fc072e5e:\n"
600 " ldr.w r1, [r7, r0, lsl #2]\n"
601 " cbz r1, loc_fc072e6e\n"
602 " ldr.w r2, [r6, r0, lsl #2]\n"
603 " bics r2, r1\n"
604 " str.w r2, [r6, r0, lsl #2]\n"
605 "loc_fc072e6e:\n"
606 " subs r0, r0, #1\n"
607 " sxtb r0, r0\n"
608 " cmp r0, #0\n"
609 " bge loc_fc072e5e\n"
610
611 "loc_fc072e76:\n"
612 " ldr r0, =0x00033f88\n"
613 " add r1, sp, #4\n"
614 " subs r0, #0xc\n"
615 " bl sub_fc07084c\n"
616 " cmp r0, #0\n"
617 " bne loc_fc072e42\n"
618 " ldr.w r8, =0x00033f88\n"
619 " movs r4, #0\n"
620 "loc_fc072e8a:\n"
621 " movs r5, #0\n"
622 " ldr.w r0, [r6, r4, lsl #2]\n"
623 " ldr.w r1, [r8, r4, lsl #2]\n"
624 " ands r0, r1\n"
625 " str.w r0, [r6, r4, lsl #2]\n"
626 " b loc_fc072ee2\n"
627 "loc_fc072e9c:\n"
628 " lsrs r0, r5\n"
629 " lsls r0, r0, #0x1f\n"
630 " beq loc_fc072eda\n"
631 " ldr r1, =0x00033f88\n"
632 " add.w r0, r5, r4, lsl #5\n"
633 " add r3, sp, #8\n"
634 " subs r1, #0x18\n"
635 " add r2, sp, #0x14\n"
636 " uxtb r0, r0\n"
637 " bl sub_fc070b4e\n"
638 " cbnz r0, loc_fc072ebe\n"
639 " ldr r1, [sp, #0x14]\n"
640 " movs r0, #1\n"
641 " bl sub_fc072da6\n"
642 "loc_fc072ebe:\n"
643 " mov r0, r4\n"
644 " b loc_fc072ed6\n"
645
646 "loc_fc072ec2:\n"
647 " ldr.w r1, [r7, r0, lsl #2]\n"
648 " cbz r1, loc_fc072ed2\n"
649 " ldr.w r2, [r6, r0, lsl #2]\n"
650 " bics r2, r1\n"
651 " str.w r2, [r6, r0, lsl #2]\n"
652 "loc_fc072ed2:\n"
653 " adds r0, r0, #1\n"
654 " sxtb r0, r0\n"
655 "loc_fc072ed6:\n"
656 " cmp r0, #3\n"
657 " blt loc_fc072ec2\n"
658 "loc_fc072eda:\n"
659 " ldr.w r0, [r6, r4, lsl #2]\n"
660 " adds r5, r5, #1\n"
661 " uxtb r5, r5\n"
662 "loc_fc072ee2:\n"
663 " cmp r0, #0\n"
664 " bne loc_fc072e9c\n"
665 " adds r4, r4, #1\n"
666 " sxtb r4, r4\n"
667 " cmp r4, #3\n"
668 " blt loc_fc072e8a\n"
669
670 " bl sub_fc0706e8_my\n"
671 " add sp, #0x18\n"
672 " pop.w {r4, r5, r6, r7, r8, pc}\n"
673 ".ltorg\n"
674 );
675
676 }
677
678 void __attribute__((naked,noinline)) sub_fc0706e8_my() {
679 asm volatile(
680 " push {r4, lr}\n"
681 " ldr r4, =0x0000970c\n"
682 " ldr r0, [r4, #0xc]\n"
683 " bl sub_fc072250\n"
684 " bl sub_fc0f9118\n"
685 " ldr r0, [r4, #0x10]\n"
686 " bl sub_fc07216c\n"
687
688
689 " bl handle_jogdial\n"
690 " cmp r0, #0\n"
691 " beq no_scroll\n"
692 " bl sub_fc072490\n"
693 "no_scroll:\n"
694 " pop {r4, pc}\n"
695 );
696 }
697