This source file includes following definitions.
- _Open
- sub_FF872470_my
- blink
- taskHook
- CreateTask_spytask
- boot
- sub_FF810354_my
- sub_FF811198_my
- sub_FF815EE0_my
- taskcreate_Startup_my
- task_Startup_my
- JogDial_task_my
- init_file_modules_task
- sub_FF8966B4_my
- sub_FF87538C_my
- sub_FF874FB4_my
- sub_FF874CD4_my
1 #include "lolevel.h"
2 #include "platform.h"
3 #include "core.h"
4 #include "dryos31.h"
5
6
7 extern void task_FileWrite();
8
9
10
11
12
13 int fsionotify_compfail = 0;
14 int fsionotify_success = 0;
15
16 int __attribute__((naked,noinline)) _Open(const char *name, int flags, int mode) {
17 (void)name; (void)flags, (void)mode;
18
19 asm volatile (
20 "STMFD SP!, {R4-R8,LR} \n"
21 "MOV R6, R0 \n"
22 "LDRB R0, [R0] \n"
23 "MOV R7, R2 \n"
24 "MOV R4, R1 \n"
25 "BL sub_FF874530 \n"
26 "MOV R8, R0 \n"
27 "MOV R0, #1 \n"
28 "BIC R5, R0, R4,LSR#12 \n"
29 "BIC R4, R4, #0x9000 \n"
30 "MOV R0, R8 \n"
31 "MOV R1, #1 \n"
32 "BL sub_FF8758C0 \n"
33 "MOV R2, R7 \n"
34 "MOV R1, R4 \n"
35 "MOV R0, R6 \n"
36 "BL _open \n"
37 "CMP R5, #0 \n"
38 "MOV R7, R0 \n"
39 "MOVNE R0, R7 \n"
40 "MOVNE R2, R4 \n"
41 "MOVNE R1, R6 \n"
42 "BLNE sub_FF872470_my \n"
43 "MOV R0, R8 \n"
44 "BL sub_FF875938 \n"
45 "MOV R0, R7 \n"
46 "LDMFD SP!, {R4-R8,PC} \n"
47 );
48
49 return 0;
50 }
51
52 void __attribute__((naked,noinline)) sub_FF872470_my() {
53
54 asm volatile (
55 "STMFD SP!, {R4-R8,LR} \n"
56 "MOV R5, R0 \n"
57 "LDR R0, =0x31B8 \n"
58 "MOV R7, R1 \n"
59 "LDR R0, [R0,#4] \n"
60 "MOV R6, R2 \n"
61 "CMP R0, #0 \n"
62 "LDMEQFD SP!, {R4-R8,PC} \n"
63 "CMP R5, #0 \n"
64 "LDMLTFD SP!, {R4-R8,PC} \n"
65 "MOV R4, #0 \n"
66 "LDR R2, =0x38EA8 \n"
67 "MOV R0, #0 \n"
68 "loc_FF8724D0: \n"
69 "ADD R1, R0, R0,LSL#1 \n"
70 "LDR R1, [R2,R1,LSL#5] \n"
71 "CMN R1, #1 \n"
72 "ADDEQ R0, R0, R0,LSL#1 \n"
73 "ADDEQ R4, R2, R0,LSL#5 \n"
74 "BEQ loc_FF8724F8\n"
75 "CMP R1, R5 \n"
76
77 "BEQ loc_2 \n"
78
79 "ADDNE R0, R0, #1 \n"
80 "CMPNE R0, #0xA \n"
81 "BLT loc_FF8724D0 \n"
82
83 "loc_FF8724F8: \n"
84 "CMP R4, #0 \n"
85 "LDREQ R1, =0x1C9 \n"
86 "LDREQ R0, =0xFF8723E4 \n"
87 "BLEQ sub_FF81EB78 \n"
88
89 "LDR R1, =fsionotify_success \n"
90 "LDR R0, [R1] \n"
91 "ADD R0, R0, #1 \n"
92 "STR R0, [R1] \n"
93
94 "MOV R0, #0 \n"
95 "STR R0, [R4,#0x58] \n"
96 "STR R5, [R4] \n"
97 "MOV R0, R4 \n"
98 "MOV R1, R7 \n"
99 "STR R6, [R4,#0x24] \n"
100 "BL sub_FF872264 \n"
101 "ADD R1, R4, #0x28 \n"
102 "MOV R0, R7 \n"
103 "LDMFD SP!, {R4-R8,LR} \n"
104 "B sub_FF8381C4 \n"
105
106 "loc_2: \n"
107 "LDR R1, =fsionotify_compfail \n"
108 "LDR R0, [R1] \n"
109 "ADD R0, R0, #1 \n"
110 "STR R0, [R1] \n"
111 "LDMFD SP!, {R4-R8,PC} \n"
112 );
113 }
114
115 #define LED_PR 0xC0220138
116 void __attribute__((naked,noinline)) blink()
117 {
118 volatile long *p=(void*)LED_PR;
119 int i;
120 int cnt =10;
121 for(;cnt>0;cnt--){
122 p[0]=0x46;
123
124 for(i=0;i<0x200000;i++){
125 asm ("nop\n");
126 asm ("nop\n");
127 }
128 p[0]=0x44;
129 for(i=0;i<0x200000;i++){
130 asm ("nop\n");
131 asm ("nop\n");
132 }
133 }
134 shutdown();
135 }
136
137
138 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
139
140 void JogDial_task_my(void);
141
142 const char * const new_sa = &_end;
143
144 void taskHook(context_t **context) {
145
146 task_t *tcb=(task_t*)((char*)context-offsetof(task_t, context));
147
148 if(!_strcmp(tcb->name, "PhySw")) tcb->entry = (void*)mykbd_task;
149 if(!_strcmp(tcb->name, "CaptSeqTask")) tcb->entry = (void*)capt_seq_task;
150 if(!_strcmp(tcb->name, "InitFileModules")) tcb->entry = (void*)init_file_modules_task;
151
152 if(!_strcmp(tcb->name, "ExpDrvTask")) tcb->entry = (void*)exp_drv_task;
153 if(!_strcmp(tcb->name, "RotarySw")) tcb->entry = (void*)JogDial_task_my;
154 if(tcb->entry == (void*)task_FileWrite) tcb->entry = (void*)filewritetask;
155
156 }
157
158 void CreateTask_spytask() {
159 _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
160 };
161
162
163 void __attribute__((naked,noinline)) boot() {
164
165 asm volatile (
166
167 "LDR R1, =0xC0410000\n"
168 "MOV R0, #0\n"
169 "STR R0, [R1]\n"
170 "MOV R1, #0x78\n"
171 "MCR p15, 0, R1,c1,c0\n"
172 "MOV R1, #0\n"
173 "MCR p15, 0, R1,c7,c10, 4\n"
174 "MCR p15, 0, R1,c7,c5\n"
175 "MCR p15, 0, R1,c7,c6\n"
176 "MOV R0, #0x3D\n"
177 "MCR p15, 0, R0,c6,c0\n"
178 "MOV R0, #0xC000002F\n"
179 "MCR p15, 0, R0,c6,c1\n"
180 "MOV R0, #0x35\n"
181 "MCR p15, 0, R0,c6,c2\n"
182 "MOV R0, #0x40000035\n"
183 "MCR p15, 0, R0,c6,c3\n"
184 "MOV R0, #0x80000017\n"
185 "MCR p15, 0, R0,c6,c4\n"
186 "LDR R0, =0xFF80002D\n"
187 "MCR p15, 0, R0,c6,c5\n"
188 "MOV R0, #0x34\n"
189 "MCR p15, 0, R0,c2,c0\n"
190 "MOV R0, #0x34\n"
191 "MCR p15, 0, R0,c2,c0, 1\n"
192 "MOV R0, #0x34\n"
193 "MCR p15, 0, R0,c3,c0\n"
194 "LDR R0, =0x3333330\n"
195 "MCR p15, 0, R0,c5,c0, 2\n"
196 "LDR R0, =0x3333330\n"
197 "MCR p15, 0, R0,c5,c0, 3\n"
198 "MRC p15, 0, R0,c1,c0\n"
199 "ORR R0, R0, #0x1000\n"
200 "ORR R0, R0, #4\n"
201 "ORR R0, R0, #1\n"
202 "MCR p15, 0, R0,c1,c0\n"
203 "MOV R1, #0x80000006\n"
204 "MCR p15, 0, R1,c9,c1\n"
205 "MOV R1, #6\n"
206 "MCR p15, 0, R1,c9,c1, 1\n"
207 "MRC p15, 0, R1,c1,c0\n"
208 "ORR R1, R1, #0x50000\n"
209 "MCR p15, 0, R1,c1,c0\n"
210 "LDR R2, =0xC0200000\n"
211 "MOV R1, #1\n"
212 "STR R1, [R2,#0x10C]\n"
213 "MOV R1, #0xFF\n"
214 "STR R1, [R2,#0xC]\n"
215 "STR R1, [R2,#0x1C]\n"
216 "STR R1, [R2,#0x2C]\n"
217 "STR R1, [R2,#0x3C]\n"
218 "STR R1, [R2,#0x4C]\n"
219 "STR R1, [R2,#0x5C]\n"
220 "STR R1, [R2,#0x6C]\n"
221 "STR R1, [R2,#0x7C]\n"
222 "STR R1, [R2,#0x8C]\n"
223 "STR R1, [R2,#0x9C]\n"
224 "STR R1, [R2,#0xAC]\n"
225 "STR R1, [R2,#0xBC]\n"
226 "STR R1, [R2,#0xCC]\n"
227 "STR R1, [R2,#0xDC]\n"
228 "STR R1, [R2,#0xEC]\n"
229 "STR R1, [R2,#0xFC]\n"
230 "LDR R1, =0xC0400008\n"
231 "LDR R2, =0x430005\n"
232 "STR R2, [R1]\n"
233 "MOV R1, #1\n"
234 "LDR R2, =0xC0243100\n"
235 "STR R2, [R1]\n"
236 "LDR R2, =0xC0242010\n"
237 "LDR R1, [R2]\n"
238 "ORR R1, R1, #1\n"
239 "STR R1, [R2]\n"
240 "LDR R0, =0xFFC56DE0\n"
241 "LDR R1, =0x1900\n"
242 "LDR R3, =0x10728\n"
243 "loc_FF81013C:\n"
244
245 "CMP R1, R3\n"
246 "LDRCC R2, [R0],#4\n"
247 "STRCC R2, [R1],#4\n"
248 "BCC loc_FF81013C\n"
249 "LDR R1, =0x172BF8\n"
250 "MOV R2, #0\n"
251 "loc_FF810154:\n"
252 "CMP R3, R1\n"
253 "STRCC R2, [R3],#4\n"
254 "BCC loc_FF810154\n"
255 "B sub_FF810354_my\n"
256
257 );
258 }
259
260
261 void __attribute__((naked,noinline)) sub_FF810354_my() {
262
263 *(int*)0x1938=(int)taskHook;
264 *(int*)0x193C=(int)taskHook;
265
266
267 if ((*(int*) 0xC022010C) & 1)
268 *(int*)(0x254C) = 0x400000;
269 else
270 *(int*)(0x254C) = 0x200000;
271
272 asm volatile (
273 "LDR R0, =0xFF8103CC\n"
274 "MOV R1, #0\n"
275 "LDR R3, =0xFF810404\n"
276 "loc_FF810360:\n"
277 "CMP R0, R3\n"
278 "LDRCC R2, [R0],#4\n"
279 "STRCC R2, [R1],#4\n"
280 "BCC loc_FF810360\n"
281 "LDR R0, =0xFF810404\n"
282 "MOV R1, #0x4B0\n"
283 "LDR R3, =0xFF810618\n"
284 "loc_FF81037C:\n"
285 "CMP R0, R3\n"
286 "LDRCC R2, [R0],#4\n"
287 "STRCC R2, [R1],#4\n"
288 "BCC loc_FF81037C\n"
289 "MOV R0, #0xD2\n"
290 "MSR CPSR_cxsf, R0\n"
291 "MOV SP, #0x1000\n"
292 "MOV R0, #0xD3\n"
293 "MSR CPSR_cxsf, R0\n"
294 "MOV SP, #0x1000\n"
295 "LDR R0, =0x6C4\n"
296 "LDR R2, =0xEEEEEEEE\n"
297 "MOV R3, #0x1000\n"
298 "loc_FF8103B0:\n"
299 "CMP R0, R3\n"
300 "STRCC R2, [R0],#4\n"
301 "BCC loc_FF8103B0\n"
302 "BL sub_FF811198_my\n"
303
304
305
306
307 "loc_FF8103C0:\n"
308 "ANDEQ R0, R0, R4,ASR#13\n"
309 "loc_FF8103C4:\n"
310 "ANDEQ R0, R0, R0,ROR R6\n"
311 "loc_FF8103C8:\n"
312 "ANDEQ R0, R0, R4,ROR R6\n"
313 "loc_FF8103CC:\n"
314 "NOP\n"
315 "LDR PC, =0xFF810618\n"
316 );
317 }
318
319 void __attribute__((naked,noinline)) sub_FF811198_my() {
320 asm volatile (
321 "STR LR, [SP,#-4]!\n"
322 "SUB SP, SP, #0x74\n"
323 "MOV R0, SP\n"
324 "MOV R1, #0x74\n"
325 "BL sub_FFB87648\n"
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355 "MOV R0, #0x53000\n"
356 "STR R0, [SP,#4]\n"
357 #if defined(CHDK_NOT_IN_CANON_HEAP)
358 " LDR R0, =0x172BF8 \n"
359 #else
360 " LDR R0, =new_sa\n"
361 " LDR R0, [R0]\n"
362 #endif
363 "LDR R1, =0x379C00\n"
364 "STR R0, [SP,#8]\n"
365
366 "RSB R0, R0, #0x1F80\n"
367 "ADD R0, R0, #0x370000\n"
368 "STR R0, [SP,#0x0c]\n"
369 "LDR R0, =0x371F80\n"
370
371 "STR R1, [SP,#0] \n"
372 "STRD R0, [SP,#0x10] \n"
373 "MOV R0, #0x22 \n"
374 "STR R0, [SP,#0x18] \n"
375 "MOV R0, #0x68 \n"
376 "STR R0, [SP,#0x1c] \n"
377 "LDR R0, =0x19B \n"
378
379
380
381
382 "LDR R1, =sub_FF815EE0_my\n"
383
384
385
386
387
388
389
390
391 "STR R0, [SP,#0x20]\n"
392 "MOV R0, #0x96\n"
393 "STR R0, [SP,#0x24]\n"
394 "MOV R0, #0x78\n"
395 "STR R0, [SP,#0x28]\n"
396 "MOV R0, #0x64\n"
397 "STR R0, [SP,#0x2C]\n"
398 "MOV R0, #0\n"
399 "STR R0, [SP,#0x30]\n"
400 "STR R0, [SP,#0x34]\n"
401 "MOV R0, #0x10\n"
402 "STR R0, [SP,#0x5C]\n"
403 "MOV R0, #0x800\n"
404 "STR R0, [SP,#0x60]\n"
405 "MOV R0, #0xA0\n"
406 "STR R0, [SP,#0x64]\n"
407 "MOV R0, #0x280\n"
408 "STR R0, [SP,#0x68]\n"
409 "MOV R0, SP\n"
410 "MOV R2, #0\n"
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432 "BL sub_FF8134B8\n"
433 "ADD SP, SP, #0x74\n"
434 "LDR PC, [SP],#4\n"
435 );
436 }
437
438
439
440 void __attribute__((naked,noinline)) sub_FF815EE0_my() {
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511 asm volatile (
512 "STMFD SP!, {R4,LR}\n"
513 "BL sub_FF810B20\n"
514 "BL sub_FF81A33C\n"
515 "CMP R0, #0\n"
516 "LDRLT R0, =0xFF815FF4\n"
517 "BLLT sub_FF815FD4\n"
518 "BL sub_FF815B1C\n"
519 "CMP R0, #0\n"
520 "LDRLT R0, =0xFF815FFC\n"
521 "BLLT sub_FF815FD4\n"
522 "LDR R0, =0xFF81600C\n"
523 "BL sub_FF815C04\n"
524 "CMP R0, #0\n"
525 "LDRLT R0, =0xFF816014\n"
526 "BLLT sub_FF815FD4\n"
527 "LDR R0, =0xFF81600C\n"
528 "BL sub_FF813CA4\n"
529 "CMP R0, #0\n"
530 "LDRLT R0, =0xFF816028\n"
531 "BLLT sub_FF815FD4\n"
532 "BL sub_FF819CC4\n"
533 "CMP R0, #0\n"
534 "LDRLT R0, =0xFF816034\n"
535 "BLLT sub_FF815FD4\n"
536 "BL sub_FF81167C\n"
537 "CMP R0, #0\n"
538 "LDRLT R0, =0xFF816040\n"
539 "BLLT sub_FF815FD4\n"
540 "LDMFD SP!, {R4,LR}\n"
541 "B taskcreate_Startup_my\n"
542
543
544 " MOV R0, #0 \n"
545 " LDMFD SP!, {R3-R5,PC} \n"
546
547 );
548 };
549
550
551
552
553 void __attribute__((naked,noinline)) taskcreate_Startup_my() {
554 asm volatile (
555
556 "STMFD SP!, {R3-R5,LR}\n"
557 "BL sub_FF8348CC\n"
558 "BL sub_FF83D1D4\n"
559 "CMP R0, #0\n"
560
561 "BNE loc_FF81FBFC\n"
562
563
564 "BL sub_FF8370E8\n"
565 "CMP R0, #0\n"
566 "BEQ loc_FF81FBFC\n"
567
568
569 "LDR R4, =0xC0220000\n"
570
571
572
573 "LDR R0, [R4,#0x120]\n"
574 "TST R0, #1\n"
575 "MOVEQ R0, #0x12C\n"
576
577
578
579
580 "BLEQ sub_FF83B574\n"
581
582
583
584 "BL sub_FF8348C8\n"
585 "CMP R0, #0\n"
586 "BNE loc_FF81FBFC\n"
587 "BL sub_FF833F34\n"
588 "MOV R0, #0x44\n"
589 "STR R0, [R4,#0x1C]\n"
590 "BL sub_FF834120\n"
591 "loc_FF81FBF8:\n"
592 "B loc_FF81FBF8\n"
593
594
595 "loc_FF81FBFC:\n"
596
597
598 "BL sub_FF8348D0\n"
599 "BL sub_FF83B3EC\n"
600
601 "LDR R1, =0x3CE000\n"
602 "MOV R0, #0\n"
603
604 "BL sub_FF83B834\n"
605 "BL sub_FF83B5E0\n"
606 "MOV R3, #0\n"
607
608 "STR R3, [SP]\n"
609 "LDR R3, =task_Startup_my\n"
610
611
612 "MOV R2, #0\n"
613 "MOV R1, #0x19\n"
614 "LDR R0, =0xFF81FC60\n"
615
616
617 "BL sub_FF81E8A0\n"
618 "MOV R0, #0\n"
619 "LDMFD SP!, {R3-R5,PC}\n"
620
621
622
623
624 );
625 }
626
627
628
629
630 void __attribute__((naked,noinline)) task_Startup_my() {
631 asm volatile (
632
633 "STMFD SP!, {R4,LR}\n"
634 "BL sub_FF816594\n"
635 "BL sub_FF835A30\n"
636 "BL sub_FF833B3C\n"
637 "BL sub_FF83D218\n"
638 "BL sub_FF83D404\n"
639
640 "BL sub_FF83D5AC\n"
641 "BL sub_FF81648C\n"
642 "BL sub_FF836754\n"
643 "LDR R1, =0x7C007C00\n"
644 "LDR R0, =0xC0F1800C\n"
645 "BL sub_FF835A3C\n"
646 "LDR R0, =0xC0F18010\n"
647 "MOV R1, #0\n"
648 "BL sub_FF835A3C\n"
649 "LDR R0, =0xC0F18018\n"
650 "MOV R1, #0\n"
651 "BL sub_FF835A3C\n"
652 "LDR R0, =0xC0F1801C\n"
653 "MOV R1, #0x1000\n"
654 "BL sub_FF835A3C\n"
655 "LDR R0, =0xC0F18020\n"
656 "MOV R1, #8\n"
657 "BL sub_FF835A3C\n"
658 "LDR R0, =0xC022D06C\n"
659 "MOV R1, #0xE000000\n"
660 "BL sub_FF835A3C\n"
661 "BL sub_FF8164CC\n"
662 "BL sub_FF8324F4\n"
663 "BL sub_FF83D434\n"
664 "BL sub_FF83AB90\n"
665 "BL sub_FF83D5B0\n"
666
667 "BL CreateTask_spytask\n"
668
669 "BL sub_FF834788\n"
670 );
671
672
673
674
675
676
677
678
679
680
681 asm volatile (
682 "BL sub_FF838CF0\n"
683 "BL sub_FF83D5C8\n"
684 "BL sub_FF8318F8\n"
685 "BL sub_FF8334A0\n"
686 "BL sub_FF83CF9C\n"
687 "BL sub_FF833AF0\n"
688 "BL sub_FF83343C\n"
689 "BL sub_FF832528\n"
690 "BL sub_FF83E1D0\n"
691 "BL sub_FF8333F8\n"
692 "LDMFD SP!, {R4,LR}\n"
693
694 "B sub_FF8166B4\n"
695 );
696 }
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743 void __attribute__((naked,noinline)) JogDial_task_my() {
744
745 asm volatile (
746 " STMFD SP!, {R4-R11,LR} \n"
747 " SUB SP, SP, #0x1C \n"
748 " BL sub_FF863A68 \n"
749 " LDR R1, =0x2560 \n"
750 " LDR R6, =0xFFB8D6EC \n"
751 " MOV R0, #0 \n"
752 " ADD R3, SP, #0x10 \n"
753 " ADD R12, SP, #0x14 \n"
754 " ADD R10, SP, #0x08 \n"
755 " MOV R2, #0 \n"
756 " ADD R9, SP, #0xC \n"
757
758 "loc_FF863668: \n"
759 " ADD R12, SP, #0x14 \n"
760 " ADD LR, R12, R0,LSL#1 \n"
761 " MOV R2, #0 \n"
762 " ADD R3, SP, #0x10 \n"
763 " STRH R2, [LR] \n"
764 " ADD LR, R3, R0,LSL#1 \n"
765 " STRH R2, [LR] \n"
766 " STR R2, [R9,R0,LSL#2] \n"
767 " STR R2, [R10,R0,LSL#2] \n"
768 " ADD R0, R0, #1 \n"
769 " CMP R0, #2 \n"
770 " BLT loc_FF863668 \n"
771
772 "loc_FF863698: \n"
773 " LDR R0, =0x2560 \n"
774 " MOV R2, #0 \n"
775 " LDR R0, [R0,#0xC] \n"
776 " MOV R1, SP \n"
777 " BL sub_FF83AE20 \n"
778 " CMP R0, #0 \n"
779 " LDRNE R1, =0x262 \n"
780
781
782 " LDRNE R0, =0xFF863924 \n"
783
784 " BLNE sub_FF81EB78 \n"
785
786
787 "labelA:\n"
788 "LDR R0, =jogdial_stopped\n"
789 "LDR R0, [R0]\n"
790 "CMP R0, #1\n"
791 "BNE labelB\n"
792 "MOV R0, #40\n"
793 "BL _SleepTask\n"
794 "B labelA\n"
795 "labelB:\n"
796
797
798 " LDR R0, [SP] \n"
799 " AND R4, R0, #0xFF \n"
800 " AND R0, R0, #0xFF00 \n"
801 " CMP R0, #0x100 \n"
802 " BEQ loc_FF863708 \n"
803 " CMP R0, #0x200 \n"
804 " BEQ loc_FF863740 \n"
805 " CMP R0, #0x300 \n"
806 " BEQ loc_FF863938 \n"
807 " CMP R0, #0x400 \n"
808 " BNE loc_FF863698 \n"
809 " CMP R4, #0 \n"
810 " LDRNE R1, =0x2ED \n"
811
812
813 " LDRNE R0, =0xFF8638F8 \n"
814
815 " BLNE sub_FF81EB78 \n"
816 " RSB R0, R4, R4,LSL#3 \n"
817 " LDR R0, [R6,R0,LSL#2] \n"
818
819 "loc_FF863700: \n"
820 " BL sub_FF863A6C \n"
821 " B loc_FF863698 \n"
822
823 "loc_FF863708: \n"
824 " LDR R7, =0x2570 \n"
825 " LDR R0, [R7,R4,LSL#2] \n"
826 " BL sub_FF83BDB8 \n"
827
828
829 " LDR R2, =0xFF8635B4 \n"
830
831 " ADD R1, R2, #0 \n"
832 " ORR R3, R4, #0x200 \n"
833 " MOV R0, #0x28 \n"
834 " BL sub_FF83BCD4 \n"
835 " TST R0, #1 \n"
836 " CMPNE R0, #0x15 \n"
837 " STR R0, [R10,R4,LSL#2] \n"
838 " BEQ loc_FF863698 \n"
839 " MOV R1, #0x274 \n"
840 " B loc_FF8638E4 \n"
841
842 "loc_FF863740: \n"
843 " RSB R5, R4, R4,LSL#3 \n"
844 " LDR R0, [R6,R5,LSL#2] \n"
845 " LDR R1, =0xC0240104 \n"
846 " LDR R0, [R1,R0,LSL#8] \n"
847 " MOV R2, R0,ASR#16 \n"
848 " ADD R0, SP, #0x14 \n"
849 " ADD R0, R0, R4,LSL#1 \n"
850 " STR R0, [SP,#0x18] \n"
851 " STRH R2, [R0] \n"
852 " ADD R0, SP, #0x10 \n"
853 " ADD R11, R0, R4,LSL#1 \n"
854 " LDRSH R3, [R11] \n"
855 " SUB R0, R2, R3 \n"
856 " CMP R0, #0 \n"
857 " BNE loc_FF8637C0 \n"
858 " LDR R0, [R9,R4,LSL#2] \n"
859 " CMP R0, #0 \n"
860 " BEQ loc_FF8638A0 \n"
861 " LDR R7, =0x2570 \n"
862 " LDR R0, [R7,R4,LSL#2] \n"
863 " BL sub_FF83BDB8 \n"
864
865
866 " LDR R2, =0xFF8635C0 \n"
867
868 " ADD R1, R2, #0 \n"
869 " ORR R3, R4, #0x300 \n"
870 " MOV R0, #0x1F4 \n"
871 " BL sub_FF83BCD4 \n"
872 " TST R0, #1 \n"
873 " CMPNE R0, #0x15 \n"
874 " STR R0, [R7,R4,LSL#2] \n"
875 " BEQ loc_FF8638A0 \n"
876 " LDR R1, =0x28D \n"
877 " B loc_FF863898 \n"
878
879 "loc_FF8637C0: \n"
880 " MOV R1, R0 \n"
881 " RSBLT R0, R0, #0 \n"
882 " MOVLE R7, #0 \n"
883 " MOVGT R7, #1 \n"
884 " CMP R0, #0xFF \n"
885 " BLS loc_FF863800 \n"
886 " CMP R1, #0 \n"
887 " RSBLE R0, R3, #0xFF \n"
888 " ADDLE R0, R0, #0x7F00 \n"
889 " ADDLE R0, R0, R2 \n"
890 " RSBGT R0, R2, #0xFF \n"
891 " ADDGT R0, R0, #0x7F00 \n"
892 " ADDGT R0, R0, R3 \n"
893 " ADD R0, R0, #0x8000 \n"
894 " ADD R0, R0, #1 \n"
895 " EOR R7, R7, #1 \n"
896
897 "loc_FF863800: \n"
898 " STR R0, [SP,#0x04] \n"
899 " LDR R0, [R9,R4,LSL#2] \n"
900 " CMP R0, #0 \n"
901 " ADDEQ R0, R6, R5,LSL#2 \n"
902 " LDREQ R0, [R0,#8] \n"
903 " BEQ loc_FF863838 \n"
904 " ADD R8, R6, R5,LSL#2 \n"
905 " ADD R1, R8, R7,LSL#2 \n"
906 " LDR R1, [R1,#0x10] \n"
907 " CMP R1, R0 \n"
908 " BEQ loc_FF86383C \n"
909 " LDR R0, [R8,#0xC] \n"
910 " BL sub_FF89C310 \n"
911 " LDR R0, [R8,#8] \n"
912
913 "loc_FF863838: \n"
914 " BL sub_FF89C310 \n"
915
916 "loc_FF86383C: \n"
917 " ADD R0, R6, R5,LSL#2 \n"
918 " ADD R7, R0, R7,LSL#2 \n"
919 " LDR R0, [R7,#0x10] \n"
920 " LDR R1, [SP,#0x04] \n"
921 " BL sub_FF89C238 \n"
922 " LDR R0, [R7,#0x10] \n"
923 " LDR R7, =0x2570 \n"
924 " STR R0, [R9,R4,LSL#2] \n"
925 " LDR R0, [SP,#0x18] \n"
926 " LDRH R0, [R0] \n"
927 " STRH R0, [R11] \n"
928 " LDR R0, [R7,R4,LSL#2] \n"
929 " BL sub_FF83BDB8 \n"
930
931
932 " LDR R2, =0xFF8635C0 \n"
933
934 " ADD R1, R2, #0 \n"
935 " ORR R3, R4, #0x300 \n"
936 " MOV R0, #0x1F4 \n"
937 " BL sub_FF83BCD4 \n"
938 " TST R0, #1 \n"
939 " CMPNE R0, #0x15 \n"
940 " STR R0, [R7,R4,LSL#2] \n"
941 " BEQ loc_FF8638A0 \n"
942 " LDR R1, =0x2CF \n"
943
944 "loc_FF863898: \n"
945
946 " LDR R0, =0xFF8638F8 \n"
947
948 " BL sub_FF81EB78 \n"
949
950 "loc_FF8638A0: \n"
951 " ADD R0, R6, R5,LSL#2 \n"
952 " LDR R0, [R0,#0x18] \n"
953 " CMP R0, #1 \n"
954 " BNE loc_FF863930 \n"
955 " LDR R0, =0x2560 \n"
956 " LDR R0, [R0,#0x14] \n"
957 " CMP R0, #0 \n"
958 " BEQ loc_FF863930 \n"
959
960
961 " LDR R2, =0xFF8635B4 \n"
962
963 " ADD R1, R2, #0 \n"
964 " ORR R3, R4, #0x400 \n"
965 " BL sub_FF83BCD4 \n"
966 " TST R0, #1 \n"
967 " CMPNE R0, #0x15 \n"
968 " STR R0, [R10,R4,LSL#2] \n"
969 " BEQ loc_FF863698 \n"
970 " LDR R1, =0x2D6 \n"
971
972 "loc_FF8638E4: \n"
973
974 " LDR R0, =0xFF863924 \n"
975
976 " BL sub_FF81EB78 \n"
977 " B loc_FF863698 \n"
978
979 "NOP \n"
980
981
982 "loc_FF863930: \n"
983 " LDR R0, [R6,R5,LSL#2] \n"
984 " B loc_FF863700 \n"
985
986 "loc_FF863938: \n"
987 " LDR R0, [R9,R4,LSL#2] \n"
988 " CMP R0, #0 \n"
989 " MOVEQ R1, #0x2E0 \n"
990
991
992 " LDREQ R0, =0xFF863924 \n"
993
994 " BLEQ sub_FF81EB78 \n"
995 " RSB R0, R4, R4,LSL#3 \n"
996 " ADD R0, R6, R0,LSL#2 \n"
997 " LDR R0, [R0,#0xC] \n"
998 " BL sub_FF89C310 \n"
999 " MOV R2, #0 \n"
1000 " STR R2, [R9,R4,LSL#2] \n"
1001 " B loc_FF863698 \n"
1002 );
1003 };
1004
1005
1006
1007 void __attribute__((naked,noinline)) init_file_modules_task() {
1008
1009 asm volatile(
1010 "STMFD SP!, {R4-R6,LR}\n"
1011 "BL sub_FF8966B4\n"
1012 "LDR R5, =0x5006\n"
1013 "MOVS R4, R0\n"
1014 "MOVNE R1, #0\n"
1015 "MOVNE R0, R5\n"
1016 "BLNE sub_FF89A490\n"
1017
1018 "BL sub_FF8966B4_my\n"
1019
1020 "BL core_spytask_can_start\n"
1021 "CMP R4, #0\n"
1022 "MOVEQ R0, R5\n"
1023 "LDMEQFD SP!, {R4-R6,LR}\n"
1024 "MOVEQ R1, #0\n"
1025 "BEQ sub_FF89A490\n"
1026 "LDMFD SP!, {R4-R6,PC}\n"
1027 );
1028 };
1029
1030 void __attribute__((naked,noinline)) sub_FF8966B4_my() {
1031
1032 asm volatile(
1033 "STMFD SP!, {R4,LR}\n"
1034 "MOV R0, #3\n"
1035
1036 "BL sub_FF87538C_my\n"
1037
1038
1039 "B sub_FF8966EC\n"
1040 );
1041 };
1042
1043 void __attribute__((naked,noinline)) sub_FF87538C_my() {
1044
1045 asm volatile(
1046 "STMFD SP!, {R4-R8,LR}\n"
1047 "MOV R8, R0\n"
1048 "BL sub_FF875338\n"
1049 "LDR R1, =0x3A068\n"
1050 "MOV R6, R0\n"
1051 "ADD R4, R1, R0,LSL#7\n"
1052 "LDR R0, [R4,#0x6C]\n"
1053 "CMP R0, #4\n"
1054 "LDREQ R1, =0x83F\n"
1055 "LDREQ R0, =0xFF874E78\n"
1056 "BLEQ sub_FF81EB78\n"
1057 "MOV R1, R8\n"
1058 "MOV R0, R6\n"
1059 "BL sub_FF874BEC\n"
1060 "LDR R0, [R4,#0x38]\n"
1061 "BL sub_FF875A5C\n"
1062 "CMP R0, #0\n"
1063 "STREQ R0, [R4,#0x6C]\n"
1064 "MOV R0, R6\n"
1065 "BL sub_FF874C7C\n"
1066 "MOV R0, R6\n"
1067
1068 "BL sub_FF874FB4_my\n"
1069
1070
1071 "B sub_FF875410 \n"
1072 );
1073
1074 };
1075 void __attribute__((naked,noinline)) sub_FF874FB4_my() {
1076
1077 asm volatile(
1078 "STMFD SP!, {R4-R6,LR}\n"
1079 "MOV R5, R0\n"
1080 "LDR R0, =0x3A068\n"
1081 "ADD R4, R0, R5,LSL#7\n"
1082 "LDR R0, [R4,#0x6C]\n"
1083 "TST R0, #2\n"
1084 "MOVNE R0, #1\n"
1085 "LDMNEFD SP!, {R4-R6,PC}\n"
1086 "LDR R0, [R4,#0x38]\n"
1087 "MOV R1, R5\n"
1088
1089 "BL sub_FF874CD4_my\n"
1090
1091
1092 "B sub_FF87500C\n"
1093
1094 );
1095
1096 };
1097
1098 void __attribute__((naked,noinline)) sub_FF874CD4_my() {
1099 asm volatile(
1100 " STMFD SP!, {R4-R10,LR}\n"
1101 " MOV R9, R0\n"
1102 " LDR R0, =0x3A068\n"
1103 " MOV R8, #0\n"
1104 " ADD R5, R0, R1,LSL#7\n"
1105 " LDR R0, [R5,#0x3C]\n"
1106 " MOV R7, #0\n"
1107 " CMP R0, #7\n"
1108 " MOV R6, #0\n"
1109 " ADDLS PC, PC, R0,LSL#2\n"
1110 " B loc_FF874E2C\n"
1111 "loc_FF874D00:\n"
1112 " B loc_FF874D38\n"
1113 "loc_FF874D04:\n"
1114 " B loc_FF874D20\n"
1115 "loc_FF874D08:\n"
1116 " B loc_FF874D20\n"
1117 "loc_FF874D0C:\n"
1118 " B loc_FF874D20\n"
1119 "loc_FF874D10:\n"
1120 " B loc_FF874D20\n"
1121 "loc_FF874D14:\n"
1122 " B loc_FF874E24\n"
1123 "loc_FF874D18:\n"
1124 " B loc_FF874D20\n"
1125 "loc_FF874D1C:\n"
1126 " B loc_FF874D20\n"
1127 "loc_FF874D20:\n"
1128 " MOV R2, #0\n"
1129 " MOV R1, #0x200\n"
1130 " MOV R0, #2\n"
1131 " BL sub_FF890764\n"
1132 " MOVS R4, R0\n"
1133 " BNE loc_FF874D40\n"
1134 "loc_FF874D38:\n"
1135 " MOV R0, #0\n"
1136 " LDMFD SP!, {R4-R10,PC}\n"
1137 "loc_FF874D40:\n"
1138 " LDR R12, [R5,#0x50]\n"
1139 " MOV R3, R4\n"
1140 " MOV R2, #1\n"
1141 " MOV R1, #0\n"
1142 " MOV R0, R9\n"
1143 " BLX R12\n"
1144 " CMP R0, #1\n"
1145 " BNE loc_FF874D6C\n"
1146 " MOV R0, #2\n"
1147 " BL sub_FF8908B4\n"
1148 " B loc_FF874D38\n"
1149 "loc_FF874D6C:\n"
1150 " LDR R1, [R5,#0x64]\n"
1151 " MOV R0, R9\n"
1152 " BLX R1\n"
1153
1154
1155 "MOV R1, R4\n"
1156 "BL mbr_read_dryos\n"
1157
1158
1159
1160
1161
1162
1163 "MOV R12, R4\n"
1164 "MOV LR, R4\n"
1165 "MOV R1, #1\n"
1166 "B dg_sd_fat32_enter\n"
1167 "dg_sd_fat32:\n"
1168 "CMP R1, #4\n"
1169 "BEQ dg_sd_fat32_end\n"
1170 "ADD R12, R12, #0x10\n"
1171 "ADD R1, R1, #1\n"
1172 "dg_sd_fat32_enter:\n"
1173 "LDRB R2, [R12, #0x1BE]\n"
1174 "LDRB R3, [R12, #0x1C2]\n"
1175 "CMP R3, #0xB\n"
1176 "CMPNE R3, #0xC\n"
1177 "BNE dg_sd_fat32\n"
1178 "CMP R2, #0x00\n"
1179 "CMPNE R2, #0x80\n"
1180 "BNE dg_sd_fat32\n"
1181
1182 "MOV R4, R12\n"
1183
1184 "dg_sd_fat32_end:\n"
1185
1186
1187
1188
1189
1190
1191 " LDRB R1, [R4,#0x1C9]\n"
1192 " LDRB R3, [R4,#0x1C8]\n"
1193 " LDRB R12, [R4,#0x1CC]\n"
1194 " MOV R1, R1,LSL#24\n"
1195 " ORR R1, R1, R3,LSL#16\n"
1196 " LDRB R3, [R4,#0x1C7]\n"
1197 " LDRB R2, [R4,#0x1BE]\n"
1198
1199 " ORR R1, R1, R3,LSL#8\n"
1200 " LDRB R3, [R4,#0x1C6]\n"
1201 " CMP R2, #0\n"
1202 " CMPNE R2, #0x80\n"
1203 " ORR R1, R1, R3\n"
1204 " LDRB R3, [R4,#0x1CD]\n"
1205 " MOV R3, R3,LSL#24\n"
1206 " ORR R3, R3, R12,LSL#16\n"
1207 " LDRB R12, [R4,#0x1CB]\n"
1208 " ORR R3, R3, R12,LSL#8\n"
1209 " LDRB R12, [R4,#0x1CA]\n"
1210 " ORR R3, R3, R12\n"
1211
1212
1213 "LDRB R12, [LR,#0x1FE]\n"
1214 "LDRB LR, [LR,#0x1FF]\n"
1215
1216
1217 " BNE loc_FF874DF8\n"
1218 " CMP R0, R1\n"
1219 " BCC loc_FF874DF8\n"
1220 " ADD R2, R1, R3\n"
1221 " CMP R2, R0\n"
1222 " CMPLS R12, #0x55\n"
1223 " CMPEQ LR, #0xAA\n"
1224 " MOVEQ R7, R1\n"
1225 " MOVEQ R6, R3\n"
1226 " MOVEQ R4, #1\n"
1227 " BEQ loc_FF874DFC\n"
1228 "loc_FF874DF8:\n"
1229 " MOV R4, R8\n"
1230 "loc_FF874DFC:\n"
1231 " MOV R0, #2\n"
1232 " BL sub_FF8908B4\n"
1233 " CMP R4, #0\n"
1234 " BNE loc_FF874E38\n"
1235 " LDR R1, [R5,#0x64]\n"
1236 " MOV R7, #0\n"
1237 " MOV R0, R9\n"
1238 " BLX R1\n"
1239 " MOV R6, R0\n"
1240 " B loc_FF874E38\n"
1241 "loc_FF874E24:\n"
1242 " MOV R6, #0x40\n"
1243 " B loc_FF874E38\n"
1244 "loc_FF874E2C:\n"
1245 " LDR R1, =0x597\n"
1246 " LDR R0, =0xFF874E78\n"
1247 " BL sub_FF81EB78\n"
1248
1249 "loc_FF874E38:\n"
1250 " STR R7, [R5,#0x44]!\n"
1251 " STMIB R5, {R6,R8}\n"
1252 " MOV R0, #1\n"
1253 " LDMFD SP!, {R4-R10,PC}\n"
1254
1255 );
1256
1257 };