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 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
14 void boot();
15
16
17 void __attribute__((naked,noinline)) h_usrInit();
18 void __attribute__((naked,noinline)) h_usrKernelInit();
19 void __attribute__((naked,noinline)) h_usrRoot();
20
21
22
23 void boot()
24 {
25
26
27
28 long *canon_data_src = (void*)0xFFB204A0;
29 long *canon_data_dst = (void*)0x1900;
30
31 long canon_data_len = 0xBC80;
32
33 long *canon_bss_start = (void*)(0x1900+0xBC80);
34
35 long canon_bss_len = 0x9C4B0 - (long)canon_bss_start;
36 long i;
37
38 asm volatile (
39 "MRC p15, 0, R0,c1,c0\n"
40 "ORR R0, R0, #0x1000\n"
41 "ORR R0, R0, #4\n"
42 "ORR R0, R0, #1\n"
43 "MCR p15, 0, R0,c1,c0\n"
44 :::"r0");
45
46
47
48
49
50
51
52 for(i=0;i<canon_data_len/4;i++)
53 canon_data_dst[i]=canon_data_src[i];
54
55 for(i=0;i<canon_bss_len/4;i++)
56 canon_bss_start[i]=0;
57
58
59 asm volatile (
60 "MRC p15, 0, R0,c1,c0\n"
61 "ORR R0, R0, #0x1000\n"
62 "BIC R0, R0, #4\n"
63 "ORR R0, R0, #1\n"
64 "MCR p15, 0, R0,c1,c0\n"
65 :::"r0");
66 h_usrInit();
67 }
68
69
70 void h_usrInit()
71 {
72 asm volatile (
73 "STR LR, [SP,#-4]!\n"
74 "BL sub_FF81196C\n"
75 "MOV R0, #2\n"
76 "MOV R1, R0\n"
77 "BL sub_FFB05DF4\n"
78 "BL sub_FFAF90DC\n"
79 "BL sub_FF8111C4\n"
80 "BL sub_FF81172C\n"
81 "LDR LR, [SP],#4\n"
82 "B h_usrKernelInit\n"
83 );
84 }
85
86 void h_usrKernelInit()
87 {
88 asm volatile (
89 "STMFD SP!, {R4,LR}\n"
90 "SUB SP, SP, #8\n"
91 "BL sub_FFB062F4\n"
92 "BL sub_FFB19AFC\n"
93 "LDR R3, =0xC590\n"
94 "LDR R2, =0x99140\n"
95 "LDR R1, [R3]\n"
96 "LDR R0, =0x9BE70\n"
97 "MOV R3, #0x100\n"
98 "BL sub_FFB12C0C\n"
99 "LDR R3, =0xC550\n"
100 "LDR R0, =0xCD98\n"
101 "LDR R1, [R3]\n"
102 "BL sub_FFB12C0C\n"
103 "LDR R3, =0xC60C\n"
104 "LDR R0, =0x9BE44\n"
105 "LDR R1, [R3]\n"
106 "BL sub_FFB12C0C\n"
107 "BL sub_FFB1E67C\n"
108 "BL sub_FF8112B0\n"
109 "MOV R4, #0\n"
110 "MOV R3, R0\n"
111 "MOV R12, #0x800\n"
112 "LDR R0, =h_usrRoot\n"
113 "MOV R1, #0x4000\n"
114 );
115
116 asm volatile (
117 "LDR R2, =new_sa\n"
118 "LDR R2, [R2]\n"
119 );
120 asm volatile (
121 "STR R12, [SP]\n"
122 "STR R4, [SP,#4]\n"
123 "BL sub_FFB16D3C\n"
124 "ADD SP, SP, #8\n"
125 "LDMFD SP!, {R4,PC}\n"
126 );
127 }
128
129
130 void h_usrRoot()
131 {
132 asm volatile
133 (
134 "STMFD SP!, {R4,R5,LR}\n"
135 "MOV R5, R0\n"
136 "MOV R4, R1\n"
137 "BL sub_FF8119D4\n"
138 "MOV R1, R4\n"
139 "MOV R0, R5\n"
140 "BL sub_FFB0AF88\n"
141 "MOV R1, R4\n"
142 "MOV R0, R5\n"
143 "BL sub_FFB0BA00\n"
144
145 "BL sub_FF811708\n"
146 "MOV R0, #0x32\n"
147 "BL sub_FFB0D9A4\n"
148 );
149
150 asm volatile
151 (
152 "BL sub_FF811A14\n"
153 "BL sub_FF8119F8\n"
154 "BL sub_FF811A40\n"
155 "BL sub_FFB0D264\n"
156 "BL sub_FF8119C8\n"
157 );
158
159 _taskCreateHookAdd(createHook);
160 _taskDeleteHookAdd(deleteHook);
161
162 drv_self_hide();
163
164 asm volatile (
165 "LDMFD SP!, {R4,R5,LR}\n"
166 "B sub_FF811370\n"
167 );
168 }
169