This source file includes following definitions.
- boot
- h_usrInit
- h_usrKernelInit
- h_usrRoot
1 #include "lolevel.h"
2 #include "platform.h"
3 #include "core.h"
4
5 const char * const new_sa = &_end;
6
7
8 extern void createHook (void *pNewTcb);
9 extern void deleteHook (void *pTcb);
10
11
12 void boot();
13
14
15 void __attribute__((naked,noinline)) h_usrInit();
16 void __attribute__((naked,noinline)) h_usrKernelInit();
17 void __attribute__((naked,noinline)) h_usrRoot();
18
19
20
21 void boot()
22 {
23 long *canon_data_src = (void*)0xFFED3720;
24 long *canon_data_dst = (void*)0x1900;
25 long canon_data_len = 0xe910;
26 long *canon_bss_start = (void*)0x10210;
27 long canon_bss_len = 0xA0B70 - 0x10210;
28 long i;
29
30 asm volatile (
31 "MRC p15, 0, R0,c1,c0\n"
32 "ORR R0, R0, #0x1000\n"
33 "ORR R0, R0, #4\n"
34 "ORR R0, R0, #1\n"
35 "MCR p15, 0, R0,c1,c0\n"
36 :::"r0");
37
38 for(i=0;i<canon_data_len/4;i++)
39 canon_data_dst[i]=canon_data_src[i];
40
41 for(i=0;i<canon_bss_len/4;i++)
42 canon_bss_start[i]=0;
43
44 asm volatile (
45 "MRC p15, 0, R0,c1,c0\n"
46 "ORR R0, R0, #0x1000\n"
47 "BIC R0, R0, #4\n"
48 "ORR R0, R0, #1\n"
49 "MCR p15, 0, R0,c1,c0\n"
50 :::"r0");
51
52 h_usrInit();
53 }
54
55
56 void h_usrInit()
57 {
58 asm volatile (
59 "STR LR, [SP,#-4]!\n"
60 "BL sub_FFC019BC\n"
61 "MOV R0, #2\n"
62 "MOV R1, R0\n"
63 "BL sub_FFEB737C\n"
64 "BL sub_FFEA3A54\n"
65 "BL sub_FFC01218\n"
66 "BL sub_FFC0177C\n"
67 "LDR LR, [SP],#4\n"
68 "B h_usrKernelInit\n"
69 );
70 }
71
72 void h_usrKernelInit()
73 {
74 asm volatile (
75 "STMFD SP!, {R4,LR}\n"
76 "SUB SP, SP, #8\n"
77 "BL sub_FFEB787C\n"
78 "BL sub_FFECCB68\n"
79 "LDR R3, =0xF1A4\n"
80 "LDR R2, =0x9D200\n"
81 "LDR R1, [R3]\n"
82 "LDR R0, =0xA0530\n"
83 "MOV R3, #0x100\n"
84 "BL sub_FFEC59B8\n"
85 "LDR R3, =0xF164\n"
86 "LDR R0, =0xFA2C\n"
87 "LDR R1, [R3]\n"
88 "BL sub_FFEC59B8\n"
89 "LDR R3, =0xF220\n"
90 "LDR R0, =0xA0504\n"
91 "LDR R1, [R3]\n"
92 "BL sub_FFEC59B8\n"
93 "BL sub_FFED16E8\n"
94 "BL sub_FFC01304\n"
95 "MOV R4, #0\n"
96 "MOV R3, R0\n"
97 "MOV R12, #0x800\n"
98 "LDR R0, =h_usrRoot\n"
99 "MOV R1, #0x4000\n"
100 #if defined(CHDK_NOT_IN_CANON_HEAP)
101 "LDR R2, =0xA0B70\n"
102 #else
103 "LDR R2, =new_sa\n"
104 "LDR R2, [R2]\n"
105 #endif
106 "STR R12, [SP]\n"
107 "STR R4, [SP,#4]\n"
108 "BL sub_FFEC9DA8\n"
109 "ADD SP, SP, #8\n"
110 "LDMFD SP!, {R4,PC}\n"
111 );
112 }
113
114 void h_usrRoot()
115 {
116 asm volatile (
117 "STMFD SP!, {R4,R5,LR}\n"
118 "MOV R5, R0\n"
119 "MOV R4, R1\n"
120 "BL sub_FFC01A24\n"
121 "MOV R1, R4\n"
122 "MOV R0, R5\n"
123 "BL sub_FFEBD9F8\n"
124 "MOV R1, R4\n"
125 "MOV R0, R5\n"
126 "BL sub_FFEBE470\n"
127 "BL sub_FFC0183C\n"
128 "BL sub_FFC01758\n"
129 "MOV R0, #0x32\n"
130 "BL sub_FFEC0414\n"
131 "BL sub_FFC01A68\n"
132 "BL sub_FFC01A48\n"
133 "BL sub_FFC01A94\n"
134 "BL sub_FFEBFCD4\n"
135 "BL sub_FFC01A18\n"
136 );
137
138 _taskCreateHookAdd(createHook);
139 _taskDeleteHookAdd(deleteHook);
140
141 drv_self_hide();
142
143 asm volatile (
144 "LDMFD SP!, {R4,R5,LR}\n"
145 "B sub_FFC013C0\n"
146 );
147 }
148