This source file includes following definitions.
- h_kbd_p2_f
- _platformsub_kbd_fetch_data_my
- 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 long wrs_kernel_bss_start;
9 extern long wrs_kernel_bss_end;
10 extern void createHook (void *pNewTcb);
11 extern void deleteHook (void *pTcb);
12
13 void boot();
14
15
16 void __attribute__((naked,noinline)) h_usrInit();
17 void __attribute__((naked,noinline)) h_usrKernelInit();
18 void __attribute__((naked,noinline)) h_usrRoot();
19
20 extern void mykbd_task_proceed_2();
21
22
23 void __attribute__((naked,noinline)) h_kbd_p2_f()
24 {
25 asm volatile (
26 "LDR R4, =0xFBA0\n"
27 "LDR R2, [R4,#0x38]\n"
28 "TST R2, #0x8000\n"
29 "BEQ loc_FF828D10\n"
30 "MOV R2, #0x8000\n"
31 "MOV R0, #0x2F\n"
32 "MOV R1, #2\n"
33 "BL sub_FF8292C0\n"
34 "LDR R3, [R4,#0x38]\n"
35 "BIC R3, R3, #0x8000\n"
36 "STR R3, [R4,#0x38]\n"
37 "MOV R2, R3\n"
38 "loc_FF828D10:\n"
39 "TST R2, #2\n"
40 "BEQ loc_FF828D38\n"
41 "MOV R1, #2\n"
42 "MOV R2, R1\n"
43 "MOV R0, #0x21\n"
44 "BL sub_FF8292C0\n"
45 "LDR R3, [R4,#0x38]\n"
46 "BIC R3, R3, #2\n"
47 "STR R3, [R4,#0x38]\n"
48 "MOV R2, R3\n"
49 "loc_FF828D38:\n"
50 "TST R2, #4\n"
51 "BEQ loc_FF828D60\n"
52 "MOV R2, #4\n"
53 "MOV R0, #0x22\n"
54 "MOV R1, #2\n"
55 "BL sub_FF8292C0\n"
56 "LDR R3, [R4,#0x38]\n"
57 "BIC R3, R3, #4\n"
58 "STR R3, [R4,#0x38]\n"
59 "MOV R2, R3\n"
60 "loc_FF828D60:\n"
61 "ADD R1, R4, #0x30\n"
62 "LDMIA R1, {R1,R3}\n"
63 "ADD R3, R1, R3\n"
64 "CMN R3, R2\n"
65 "BEQ loc_FF828D78\n"
66 "BL sub_FF829320\n"
67 "loc_FF828D78:\n"
68 "LDR R3, =0x1FBC\n"
69 "LDR R1, [R3]\n"
70 "CMP R1, #1\n"
71 "BNE loc_FF828D94\n"
72 "MOV R0, #0\n"
73 "MOV R2, R1\n"
74 "BL sub_FF8292C0\n"
75 "loc_FF828D94:\n"
76 "BL sub_FF8299FC\n"
77 "B mykbd_task_proceed_2\n"
78 );
79 }
80
81 void __attribute__((naked,noinline)) _platformsub_kbd_fetch_data_my(){
82 asm volatile (
83 "STMFD SP!, {R4-R11,LR}\n"
84 "MOV LR, #0x220000\n"
85 "ORR R3, LR, #0x204\n"
86 "LDR R1, =0xFC74\n"
87 "ORR R3, R3, #0xC0000000\n"
88
89
90
91 "MOV R2, R0\n"
92 "LDR R0, [R3]\n"
93 "STMFD SP!, {R1-R11}\n"
94 "BL usb_power_status_override\n"
95 "LDMFD SP!, {R1-R11}\n"
96 "MOV R9, R0\n"
97 "MOV R0, R2\n"
98 "MOV LR, #0x220000\n"
99
100
101
102 "LDR R6, [R1]\n"
103 "LDR R4, =0xFC08\n"
104 "LDR R1, [R0,#0x1C]\n"
105 "MOV R10, R6,LSL#2\n"
106 "AND R1, R9, R1\n"
107 "ADD R12, R4, #0x20\n"
108 "SUB R8, R6, #1\n"
109 "SUB R7, R6, #2\n"
110 "STR R1, [R12,R10]\n"
111 "AND R8, R8, #7\n"
112 "AND R7, R7, #7\n"
113 "MOV R8, R8,LSL#2\n"
114 "MOV R7, R7,LSL#2\n"
115 "LDR R2, =0xFC68\n"
116 "LDR R5, [R12,R7]\n"
117 "LDR R12, [R12,R8]\n"
118 "LDR R3, [R2,#4]\n"
119 "EOR R11, R1, R12\n"
120 "EOR R12, R1, R5\n"
121 "ORR R12, R11, R12\n"
122 "EOR R2, R3, R1\n"
123 "STR R1, [R0,#0x10]\n"
124 "BIC R2, R2, R12\n"
125 "LDR R1, =0xFC68\n"
126 "EOR R3, R3, R2\n"
127 "STR R3, [R1,#4]\n"
128 "STR R2, [R0,#0x34]\n"
129 "STR R9, [R0,#0x58]\n"
130 "ORR R3, LR, #0x208\n"
131 "ORR R3, R3, #0xC0000000\n"
132 "LDR R1, [R3]\n"
133
134 "MOV R2, R0\n"
135 "MOV R0, R1\n"
136 "STMFD SP!, {R1-R11}\n"
137 "BL my_kbd_read_keys\n"
138 "LDMFD SP!, {R1-R11}\n"
139 "MOV R1,R0\n"
140 "MOV R0,R2\n"
141 "MOV LR, #0x220000\n"
142
143 "MOV R2, #0xFF00\n"
144 "ADD R2, R2, #0xFF\n"
145 "ADD R4, R4, #0x40\n"
146 "AND R2, R1, R2\n"
147 "STR R2, [R4,R10]\n"
148 "ADD LR, LR, #0x3000\n"
149 "STR R1, [R0,#0x5C]\n"
150 "ADD R1, LR, #0xC000001C\n"
151 "LDR R3, [R1]\n"
152 "AND R3, R3, #1\n"
153 "ORR R2, R2, R3,LSL#16\n"
154 "STR R2, [R4,R10]\n"
155 "ADD LR, LR, #0xC0000024\n"
156 "LDR R3, [LR]\n"
157 "LDR R1, [R0,#0x20]\n"
158
159
160 "AND R3, R3, #0\n"
161
162 "ORR R2, R2, R3,LSL#17\n"
163 "AND R2, R2, R1\n"
164 "STR R2, [R4,R10]\n"
165 "LDR R3, [R4,R8]\n"
166 "LDR LR, [R4,R7]\n"
167 "LDR R4, =0xFC68\n"
168 "LDR R1, [R4,#8]\n"
169 "EOR R11, R2, R3\n"
170 "EOR R12, R2, LR\n"
171 "EOR R3, R1, R2\n"
172 "ORR R12, R11, R12\n"
173 "BIC R3, R3, R12\n"
174 "EOR R1, R1, R3\n"
175 "ADD R6, R6, #1\n"
176 "STR R2, [R0,#0x14]\n"
177 "STR R1, [R4,#8]\n"
178 "LDR R1, =0xFC74\n"
179 "AND R6, R6, #7\n"
180 "STR R6, [R1]\n"
181 "STR R3, [R0,#0x38]\n"
182 "LDMFD SP!, {R4-R11,PC}\n"
183 );
184 }
185
186 void boot()
187 {
188
189 long *canon_data_src = (void*)0xFFAD09D0;
190
191 long *canon_data_dst = (void*)0x1900;
192
193 long canon_data_len = 0xD3E0;
194
195 long *canon_bss_start = (void*)0xECE0;
196
197 long canon_bss_len = 0x7C410 - 0xECE0;
198
199 long i;
200
201 asm volatile (
202 "MRC p15, 0, R0,c1,c0\n"
203 "ORR R0, R0, #0x1000\n"
204 "ORR R0, R0, #4\n"
205 "ORR R0, R0, #1\n"
206 "MCR p15, 0, R0,c1,c0\n"
207 :::"r0");
208
209
210 for(i=0;i<canon_data_len/4;i++)
211 canon_data_dst[i]=canon_data_src[i];
212
213 for(i=0;i<canon_bss_len/4;i++)
214 canon_bss_start[i]=0;
215
216 asm volatile (
217 "MRC p15, 0, R0,c1,c0\n"
218 "ORR R0, R0, #0x1000\n"
219 "BIC R0, R0, #4\n"
220 "ORR R0, R0, #1\n"
221 "MCR p15, 0, R0,c1,c0\n"
222 :::"r0");
223
224 h_usrInit();
225 }
226
227
228 void h_usrInit()
229 {
230 asm volatile (
231 "STR LR, [SP,#-4]!\n"
232 "BL sub_FF811A40\n"
233 "MOV R0, #2\n"
234 "MOV R1, R0\n"
235 "BL sub_FFAB7114\n"
236 "BL sub_FFAA37EC\n"
237 "BL sub_FF811298\n"
238 "BL sub_FF811800\n"
239 "LDR LR, [SP],#4\n"
240 "B h_usrKernelInit\n"
241 );
242 }
243
244 void h_usrKernelInit()
245 {
246 asm volatile (
247 "STMFD SP!, {R4,LR}\n"
248 "SUB SP, SP, #8\n"
249 "BL sub_FFAB7614\n"
250 "BL sub_FFAC9E20\n"
251 "LDR R3, =0xE114\n"
252 "LDR R2, =0x78600\n"
253 "LDR R1, [R3]\n"
254 "LDR R0, =0x7BDD0\n"
255 "MOV R3, #0x100\n"
256 "BL sub_FFAC5750\n"
257 "LDR R3, =0xE0D4\n"
258 "LDR R0, =0xE4F4\n"
259 "LDR R1, [R3]\n"
260 "BL sub_FFAC5750\n"
261 "LDR R3, =0xE190\n"
262 "LDR R0, =0x7BDA4\n"
263 "LDR R1, [R3]\n"
264 "BL sub_FFAC5750\n"
265 "BL sub_FFACE9A0\n"
266 "BL sub_FF811384\n"
267 "MOV R4, #0\n"
268 "MOV R3, R0\n"
269 "MOV R12, #0x800\n"
270 "LDR R0, =h_usrRoot\n"
271 "MOV R1, #0x4000\n"
272 );
273
274 asm volatile (
275 "LDR R2, =new_sa\n"
276 "LDR R2, [R2]\n"
277 );
278 asm volatile (
279 "STR R12, [SP]\n"
280 "STR R4, [SP,#4]\n"
281 "BL sub_FFAC7060\n"
282 "ADD SP, SP, #8\n"
283 "LDMFD SP!, {R4,PC}\n"
284 );
285 }
286
287
288 void h_usrRoot()
289 {
290 asm volatile (
291 "STMFD SP!, {R4,R5,LR}\n"
292 "MOV R5, R0\n"
293 "MOV R4, R1\n"
294 "BL sub_FF811AA8\n"
295 "MOV R1, R4\n"
296 "MOV R0, R5\n"
297 "BL sub_FFABD790\n"
298 "MOV R1, R4\n"
299 "MOV R0, R5\n"
300 "BL sub_FFABE208\n"
301
302 "BL sub_FF8117DC\n"
303 "MOV R0, #0x32\n"
304 "BL sub_FFAC01AC\n"
305 "BL sub_FF811AEC\n"
306 "BL sub_FF811ACC\n"
307 "BL sub_FF811B18\n"
308 "BL sub_FFABFA6C\n"
309 "BL sub_FF811A9C\n"
310 );
311
312 _taskCreateHookAdd(createHook);
313 _taskDeleteHookAdd(deleteHook);
314
315 drv_self_hide();
316
317 asm volatile (
318 "LDMFD SP!, {R4,R5,LR}\n"
319 "B sub_FF811444\n"
320 );
321 }