source: trunk/platform/ixus900_sd900/sub/100c/mount.c @ 959

Revision 959, 7.8 KB checked in by reyalp, 3 years ago (diff)

ixus900_sd900 port by pixeldoc http://chdk.kernreaktor.org/mantis/view.php?id=347

  • Property svn:eol-style set to native
Line 
1// Multiple Partition support, used if CAM_MULTIPART enabled
2
3// ROM:FF9D32AC
4void __attribute__((naked,noinline)) init_file_modules_task() {
5    asm volatile(
6            "STMFD   SP!, {R4,LR}\n"
7
8            "BL      _Unmount_FileSystem\n"   // +
9
10            "BL      sub_FFB3B500\n"
11            "SUBS    R4, R0, #0\n"
12            "MOV     R0, #0x5000\n"
13            "MOV     R1, #0\n"
14            "ADD     R0, R0, #6\n"
15            "BEQ     loc_FF9D32CC\n"
16            "BL      sub_FF9A42AC\n"   // PostLogicalEventToUI
17        "loc_FF9D32CC:\n"
18
19            //"BL      sub_FFB3B52C\n"   // orginal
20            "BL      sub_FFB3B52C_my\n"   // + --->
21
22            "MOV     R0, #0x5000\n"
23            "CMP     R4, #0\n"
24            "MOV     R1, R4\n"
25            "ADD     R0, R0, #6\n"
26            "LDMNEFD SP!, {R4,PC}\n"
27            "LDMFD   SP!, {R4,LR}\n"
28    );
29
30    //debug_led(1);   // DEBUG help (check if code gets executed)
31
32    asm volatile(
33            "B       sub_FF9A42AC\n"   // PostLogicalEventToUI
34    );
35}
36
37// ROM:FFB3B52C
38void __attribute__((naked,noinline)) sub_FFB3B52C_my() {
39    asm volatile(
40            "STR     LR, [SP,#-4]!\n"
41
42            //"BL      Mount_FileSystem\n"   // orginal
43            "BL      Mount_FileSystem_my\n"   // +
44
45            "LDR     R3, =0xBDDC\n"
46            "LDR     R2, [R3]\n"
47            "CMP     R2, #0\n"
48            "BNE     loc_FFB3B568\n"
49            "BL      sub_FF9F5044\n"
50            "AND     R0, R0, #0xFF\n"
51            "BL      sub_FF835A3C\n"
52            "BL      sub_FF9F5044\n"
53            "AND     R0, R0, #0xFF\n"
54            "BL      sub_FF86F738\n"
55            "BL      sub_FF9F5054\n"
56            "AND     R0, R0, #0xFF\n"
57            "BL      sub_FF835B18\n"
58        "loc_FFB3B568:\n"
59            "LDR     R2, =0xBDD8\n"
60            "MOV     R3, #1\n"
61            "STR     R3, [R2]\n"
62            "LDR     PC, [SP],#4\n"
63    );
64}
65
66// ROM:FF87A8AC
67void __attribute__((naked,noinline)) Mount_FileSystem_my() {
68    asm volatile(
69            "STMFD   SP!, {R4-R6,LR}\n"
70            "MOV     R5, #0\n"
71            "LDR     R6, =0x2DA00\n"
72            "MOV     R0, R5\n"
73            "BL      sub_FF87A294\n"
74            "LDR     R0, [R6,#0x38]\n"
75            "BL      sub_FF879954\n"
76            "SUBS    R1, R0, #0\n"
77            "MOV     R0, R5\n"
78            "BNE     loc_FF87A8EC\n"
79            "LDR     R3, =0x27EC\n"
80            "LDR     R2, =0x27E4\n"
81            "STR     R1, [R3]\n"
82            "LDR     R3, =0x27E8\n"
83            "STR     R1, [R2]\n"
84            "STR     R1, [R3]\n"
85        "loc_FF87A8EC:\n"
86            "BL      sub_FF87A2E4\n"
87            "MOV     R0, R5\n"
88
89            //"BL      sub_FF87A60C\n"   // orginal
90            "BL      sub_FF87A60C_my\n"   // + --->
91
92            "MOV     R4, R0\n"
93            "MOV     R0, R5\n"
94            "BL      sub_FF87A694\n"   // Mounter.c:808
95            "AND     R4, R4, R0\n"
96            "MOV     R2, R4\n"
97            "MOV     R0, R6\n"
98            "LDR     R1, [R6,#0x3C]\n"
99            "BL      sub_FF87A85C\n"
100            "STR     R0, [R6,#0x40]\n"
101            "LDMFD   SP!, {R4-R6,PC}\n"
102    );
103}
104
105// ROM:FF87A60C
106void __attribute__((naked,noinline)) sub_FF87A60C_my() {
107    asm volatile(
108            "STMFD   SP!, {R4-R7,LR}\n"
109            "LDR     R7, =0x27E8\n"
110            "LDR     R3, [R7]\n"
111            "MOV     R4, R0\n"
112            "CMP     R3, #0\n"
113            "ADD     R3, R4, R4,LSL#1\n"
114            "RSB     R3, R4, R3,LSL#3\n"
115            "LDR     R6, =0x2DA38\n"
116            "MOV     R5, R3,LSL#2\n"
117            "MOV     R1, R4\n"
118
119            //"BNE     loc_FF87A680\n"   // gcc: loc_FF87A680 not found
120            "BNE     sub_FF87A680\n"   // +
121
122            "LDR     R0, [R6,R5]\n"
123
124            //"BL      sub_FF87A3A0\n"   // orginal, Mounter.c:692
125            "BL      sub_FF87A3A0_my\n"   // + --->
126
127            "SUBS    R3, R0, #0\n"
128            "MOV     R1, R4\n"
129            "BEQ     loc_FF87A658\n"
130            "LDR     R0, [R6,R5]\n"
131            "BL      sub_FF87A4EC\n"   // Mounter.c:728
132            "MOV     R3, R0\n"
133        "loc_FF87A658:\n"
134            "CMP     R3, #0\n"
135            "MOV     R0, R4\n"
136            "BEQ     loc_FF87A66C\n"
137            "BL      sub_FF879A2C\n"
138            "MOV     R3, R0\n"
139        "loc_FF87A66C:\n"
140            "CMP     R3, #0\n"
141            "MOV     R0, R3\n"
142            "MOVNE   R3, #1\n"
143            "STRNE   R3, [R7]\n"
144            "LDMFD   SP!, {R4-R7,PC}\n"
145        "loc_FF87A680:\n"
146            "MOV     R0, #1\n"
147            "LDMFD   SP!, {R4-R7,PC}\n"
148    );
149}
150
151// ROM:FF87A3A0
152void __attribute__((naked,noinline)) sub_FF87A3A0_my() {
153    asm volatile(
154            "STMFD   SP!, {R4-R8,LR}\n"
155            "MOV     R5, R1\n"
156            "MOV     R8, R5,LSL#1\n"
157            "ADD     R3, R8, R5\n"
158            "LDR     R2, =0x2DA3C\n"
159            "SUB     SP, SP, #8\n"
160            "RSB     R3, R5, R3,LSL#3\n"
161            "LDR     R1, [R2,R3,LSL#2]\n"
162            "MOV     R6, #0\n"
163            "STR     R6, [SP]\n"
164            "MOV     R7, R0\n"
165            "STR     R6, [SP,#4]\n"
166            "CMP     R1, #5\n"
167            "LDRLS   PC, [PC,R1,LSL#2]\n"
168            "B       loc_FF87A49C\n"
169            ".long loc_FF87A440\n"
170            ".long loc_FF87A3F4\n"
171            ".long loc_FF87A3F4\n"
172            ".long loc_FF87A3F4\n"
173            ".long loc_FF87A3F4\n"
174            ".long loc_FF87A48C\n"
175        "loc_FF87A3F4:\n"
176            "MOV     R0, #3\n"
177            "MOV     R1, #0x200\n"
178            "MOV     R2, #0\n"
179            "BL      sub_FF812834\n"
180            "SUBS    R6, R0, #0\n"
181
182            //"BEQ     loc_FF87A4D0\n"   // gcc: loc_FF87A4D0 not found
183            "BEQ     sub_FF87A4D0\n"   // +
184
185            "ADD     R12, R8, R5\n"
186            "RSB     R12, R5, R12,LSL#3\n"
187            "LDR     R4, =0x2DA4C\n"
188            "MOV     R0, R7\n"
189            "MOV     R1, #0\n"
190            "MOV     R2, #1\n"
191            "MOV     R3, R6\n"
192            "MOV     LR, PC\n"
193            "LDR     PC, [R4,R12,LSL#2]\n"
194            "CMP     R0, #1\n"
195            "BNE     loc_FF87A448\n"
196            "MOV     R0, #3\n"
197            "BL      sub_FF812904\n"
198        "loc_FF87A440:\n"
199            "MOV     R0, #0\n"
200
201            //"B       loc_FF87A4D0\n"   // original
202            "B       sub_FF87A4D0\n"   // +
203
204        "loc_FF87A448:\n"
205            "MOV     R0, R7\n"
206            "BL      sub_FF88AD88\n"
207            "MOV     R1, R0\n"
208            "ADD     R2, SP, #4\n"
209            "MOV     R3, SP\n"
210            "MOV     R0, R6\n"
211
212            //"BL      sub_FF879B30\n"   // original
213            "STMFD   SP!, {R4-R11,LR}\n"   // + save registers to stack
214            "BL      mbr_read\n"    // + --->
215            "LDMFD   SP!, {R4-R11,LR}\n"   // + restore registers from stack
216
217            "MOV     R4, R0\n"
218            "MOV     R0, #3\n"
219            "BL      sub_FF812904\n"
220            "CMP     R4, #0\n"
221            "BNE     loc_FF87A4A8\n"
222            "MOV     R0, R7\n"
223            "STR     R4, [SP,#4]\n"
224            "BL      sub_FF88AD88\n"
225            "STR     R0, [SP]\n"
226            "B       loc_FF87A4A8\n"
227        "loc_FF87A48C:\n"
228            "MOV     R3, #0\n"
229            "MOV     R2, #0x40\n"
230            "STMEA   SP, {R2,R3}\n"
231            "B       loc_FF87A4A8\n"
232        "loc_FF87A49C:\n"
233            "LDR     R0, =0xFF879010\n"   // aMounter_c (default)
234            "MOV     R1, #0x2B4\n"
235            "BL      sub_FF813D70\n"   // DebugAssert
236        "loc_FF87A4A8:\n"
237            "LDR     R2, =0x2DA00\n"
238            "ADD     R3, R8, R5\n"
239            "LDMFD   SP, {R0,R12}\n"
240            "RSB     R3, R5, R3,LSL#3\n"
241            "MOV     R3, R3,LSL#2\n"
242            "ADD     R1, R2, #0x48\n"
243            "ADD     R2, R2, #0x44\n"
244            "STR     R0, [R1,R3]\n"
245            "STR     R12, [R2,R3]\n"
246            "MOV     R0, #1\n"
247        "loc_FF879358:\n"
248            "ADD     SP, SP, #8\n"
249            "LDMFD   SP!, {R4-R8,PC}\n"
250    );
251}
Note: See TracBrowser for help on using the repository browser.