comparison g23m/objdiff/l1_ext/l1_afunc.notes @ 45:576e684603e0

l1_afunc.c differences analysed
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Fri, 04 Mar 2016 04:41:52 +0000
parents
children
comparison
equal deleted inserted replaced
44:851c826f9545 45:576e684603e0
1 The result of l1_afunc.c recompilation is identical to the original up until
2 the l1a_clip_txpwr() function, which is the last function in the module.
3
4 Original 20070608 version of l1_afunc.obj, disassembly of l1a_clip_txpwr():
5
6 $l1a_clip_txpwr: ; Global
7 ; u_char l1a_clip_txpwr();
8 ; Begin function
9 ; REGPARM r0: u_char supplied_txpwr;
10 ; REGPARM r1: u_short radio_freq;
11 ; REG r1: unsigned "C$21";
12 ; REG r1: unsigned "C$22";
13 ; REG r1: unsigned "C$23";
14 ; REG r2: struct ? *"K$6";
15 ; REG r1: u_char "U$41";
16 ; REG r1: u_char "U$82";
17 ; REG r1: u_char "U$95";
18 ; REG r1: u_char "U$108";
19 ; REG r0: u_char power;
20 ; REG r1: u_short radio_freq;
21 ; REG r0: u_char supplied_txpwr;
22 ; REG r3: int "S$20";
23 ; REG r5: int "S$19";
24 ; REG r2: unsigned "S$18";
25 ; REG r1: unsigned "S$17";
26 ; REG r3: int "S$16";
27 ; REG r5: int "S$15";
28 ; REG r2: unsigned "S$14";
29 ; REG r1: unsigned "S$13";
30 ; REG r1: int "S$12";
31 ; REG r5: int "S$11";
32 ; REG r2: unsigned "S$10";
33 ; REG r1: unsigned "S$9";
34 ; REG r3: int "S$8";
35 ; REG r5: int "S$7";
36 ; REG r2: unsigned "S$6";
37 ; REG r1: unsigned "S$5";
38 ; REG r3: int "S$4";
39 ; REG r5: int "S$3";
40 ; REG r2: unsigned "S$2";
41 ; REG r1: unsigned "S$1";
42 ; REG r3: unsigned "U$26";
43 ; REG r3: unsigned "U$26";
44 ; REG r3: unsigned "U$26";
45 ; REG r1: u_char "U$22";
46 ; REG r3: u_char "U$22";
47 ; REG r4: unsigned "U$30";
48 ; REG r4: unsigned "U$30";
49 ; REG r4: unsigned "U$30";
50 ; REG r4: unsigned "U$30";
51 ; REG r4: unsigned "U$30";
52 ; REG r3: unsigned "U$51";
53 ; REG r3: unsigned "U$51";
54 ; REG r1: u_char "U$75";
55 ; REG r1: u_char "U$75";
56
57 $CODE16: ; label
58 490: b530 push {r4, r5, lr}
59 ; switch statement
60 492: 4a87 ldr r2, =_l1_config ; via 0x6b0
61 494: 7813 ldrb r3, [r2, #0]
62 496: 1e5b sub r3, r3, #1
63 498: 2b01 cmp r3, #1
64 49a: d800 bhi 0x49e
65 49c: e0fa b 0x694 ; GSM or GSM_E
66 49e: 3b02 sub r3, #2
67 4a0: 2b00 cmp r3, #0
68 4a2: d100 bne 0x4a6
69 4a4: e0cf b 0x646 ; PCS1900
70 4a6: 3b01 sub r3, #1
71 4a8: 2b00 cmp r3, #0
72 4aa: d100 bne 0x4ae
73 4ac: e0a4 b 0x5f8 ; DCS1800
74 4ae: 3b01 sub r3, #1
75 4b0: 2b01 cmp r3, #1
76 4b2: d968 bls 0x586 ; DUAL or DUAL_EXT
77 4b4: 3b02 sub r3, #2
78 4b6: 2b00 cmp r3, #0
79 4b8: d03d beq 0x536 ; GSM850
80 4ba: 3b01 sub r3, #1
81 4bc: 2b00 cmp r3, #0
82 4be: d000 beq 0x4c2 ; DUAL_US
83 4c0: e0f5 b 0x6ae ; default - return
84 ; case DUAL_US:
85 4c2: 68d3 ldr r3, [r2, #12] ; 0xc
86 4c4: 4299 cmp r1, r3
87 4c6: d20e bcs 0x4e6
88 ; low band (850)
89 4c8: 4b7c ldr r3, =_MIN_TXPWR_GSM850 ; via 0x6bc
90 4ca: 497d ldr r1, =_l1a_l1s_com+0x335 ; via 0x6c0
91 4cc: 7809 ldrb r1, [r1, #0]
92 4ce: 5c59 ldrb r1, [r3, r1]
93 4d0: 4288 cmp r0, r1
94 4d2: db06 blt 0x4e2
95 ; line
96 4d4: 69d1 ldr r1, [r2, #28] ; 0x1c
97 4d6: 4288 cmp r0, r1
98 4d8: d800 bhi 0x4dc
99 4da: e0e8 b 0x6ae
100 ; line
101 4dc: 0608 lsl r0, r1, #24
102 4de: 0e00 lsr r0, r0, #24
103 4e0: e0e5 b 0x6ae
104 ; line
105 4e2: 1c08 mov r0, r1 (add r0, r1, #0)
106 4e4: e0e3 b 0x6ae
107 ; high band (1900)
108 4e6: 6a54 ldr r4, [r2, #36] ; 0x24
109 4e8: 42a0 cmp r0, r4
110 4ea: d901 bls 0x4f0
111 4ec: 1c05 mov r5, r0 (add r5, r0, #0)
112 4ee: e001 b 0x4f4
113 4f0: 2120 mov r1, #32 ; 0x20
114 4f2: 180d add r5, r1, r0
115 4f4: 4b73 ldr r3, =_MIN_TXPWR_PCS ; via 0x6c4
116 4f6: 4974 ldr r1, =_l1a_l1s_com+0x336 ; via 0x6c8
117 4f8: 7809 ldrb r1, [r1, #0]
118 4fa: 5c59 ldrb r1, [r3, r1]
119 4fc: 42a1 cmp r1, r4
120 4fe: d901 bls 0x504
121 500: 1c0b mov r3, r1 (add r3, r1, #0)
122 502: e001 b 0x508
123 504: 2320 mov r3, #32 ; 0x20
124 506: 185b add r3, r3, r1
125 508: 429d cmp r5, r3
126 50a: db12 blt 0x532
127 ; line
128 50c: 42a0 cmp r0, r4
129 50e: d901 bls 0x514
130 510: 1c01 mov r1, r0 (add r1, r0, #0)
131 512: e001 b 0x518
132 514: 2120 mov r1, #32 ; 0x20
133 516: 1809 add r1, r1, r0
134 518: 6a13 ldr r3, [r2, #32] ; 0x20
135 51a: 42a3 cmp r3, r4
136 51c: d802 bhi 0x524
137 51e: 2220 mov r2, #32 ; 0x20
138 520: 18d2 add r2, r2, r3
139 522: e000 b 0x526
140 524: 1c1a mov r2, r3 (add r2, r3, #0)
141 526: 4291 cmp r1, r2
142 528: d800 bhi 0x52c
143 52a: e0c0 b 0x6ae
144 ; line
145 52c: 0618 lsl r0, r3, #24
146 52e: 0e00 lsr r0, r0, #24
147 530: e0bd b 0x6ae
148 ; line
149 532: 1c08 mov r0, r1 (add r0, r1, #0)
150 534: e0bb b 0x6ae
151 ; case GSM850:
152 536: 6a54 ldr r4, [r2, #36] ; 0x24
153 538: 42a0 cmp r0, r4
154 53a: d901 bls 0x540
155 53c: 1c05 mov r5, r0 (add r5, r0, #0)
156 53e: e001 b 0x544
157 540: 2120 mov r1, #32 ; 0x20
158 542: 180d add r5, r1, r0
159 544: 495d ldr r1, =_MIN_TXPWR_GSM850 ; via 0x6bc
160 546: 4b5e ldr r3, =_l1a_l1s_com+0x335 ; via 0x6c0
161 548: 781b ldrb r3, [r3, #0]
162 54a: 5ccb ldrb r3, [r1, r3]
163 54c: 42a3 cmp r3, r4
164 54e: d901 bls 0x554
165 550: 1c19 mov r1, r3 (add r1, r3, #0)
166 552: e001 b 0x558
167 554: 2120 mov r1, #32 ; 0x20
168 556: 18c9 add r1, r1, r3
169 558: 428d cmp r5, r1
170 55a: db12 blt 0x582
171 ; line
172 55c: 42a0 cmp r0, r4
173 55e: d901 bls 0x564
174 560: 1c01 mov r1, r0 (add r1, r0, #0)
175 562: e001 b 0x568
176 564: 2120 mov r1, #32 ; 0x20
177 566: 1809 add r1, r1, r0
178 568: 69d3 ldr r3, [r2, #28] ; 0x1c
179 56a: 42a3 cmp r3, r4
180 56c: d802 bhi 0x574
181 56e: 2220 mov r2, #32 ; 0x20
182 570: 18d2 add r2, r2, r3
183 572: e000 b 0x576
184 574: 1c1a mov r2, r3 (add r2, r3, #0)
185 576: 4291 cmp r1, r2
186 578: d800 bhi 0x57c
187 57a: e098 b 0x6ae
188 ; line
189 57c: 0618 lsl r0, r3, #24
190 57e: 0e00 lsr r0, r0, #24
191 580: e095 b 0x6ae
192 ; line
193 582: 1c18 mov r0, r3 (add r0, r3, #0)
194 584: e093 b 0x6ae
195 ; case DUAL:
196 ; case DUAL_EXT:
197 586: 68d3 ldr r3, [r2, #12] ; 0xc
198 588: 4299 cmp r1, r3
199 58a: d20e bcs 0x5aa
200 ; low band (900)
201 58c: 4b4f ldr r3, =_MIN_TXPWR_GSM ; via 0x6cc
202 58e: 494c ldr r1, =_l1a_l1s_com+0x335 ; via 0x6c0
203 590: 7809 ldrb r1, [r1, #0]
204 592: 5c59 ldrb r1, [r3, r1]
205 594: 4288 cmp r0, r1
206 596: db06 blt 0x5a6
207 ; line
208 598: 69d1 ldr r1, [r2, #28] ; 0x1c
209 59a: 4288 cmp r0, r1
210 59c: d800 bhi 0x5a0
211 59e: e086 b 0x6ae
212 ; line
213 5a0: 0608 lsl r0, r1, #24
214 5a2: 0e00 lsr r0, r0, #24
215 5a4: e083 b 0x6ae
216 ; line
217 5a6: 1c08 mov r0, r1 (add r0, r1, #0)
218 5a8: e081 b 0x6ae
219 ; high band (1800)
220 5aa: 6a54 ldr r4, [r2, #36] ; 0x24
221 5ac: 42a0 cmp r0, r4
222 5ae: d901 bls 0x5b4
223 5b0: 1c05 mov r5, r0 (add r5, r0, #0)
224 5b2: e001 b 0x5b8
225 5b4: 2120 mov r1, #32 ; 0x20
226 5b6: 180d add r5, r1, r0
227 5b8: 4b45 ldr r3, =_MIN_TXPWR_DCS ; via 0x6d0
228 5ba: 4943 ldr r1, =_l1a_l1s_com+0x336 ; via 0x6c8
229 5bc: 7809 ldrb r1, [r1, #0]
230 5be: 5c59 ldrb r1, [r3, r1]
231 5c0: 42a1 cmp r1, r4
232 5c2: d901 bls 0x5c8
233 5c4: 1c0b mov r3, r1 (add r3, r1, #0)
234 5c6: e001 b 0x5cc
235 5c8: 2320 mov r3, #32 ; 0x20
236 5ca: 185b add r3, r3, r1
237 5cc: 429d cmp r5, r3
238 5ce: db11 blt 0x5f4
239 ; line
240 5d0: 42a0 cmp r0, r4
241 5d2: d901 bls 0x5d8
242 5d4: 1c01 mov r1, r0 (add r1, r0, #0)
243 5d6: e001 b 0x5dc
244 5d8: 2120 mov r1, #32 ; 0x20
245 5da: 1809 add r1, r1, r0
246 5dc: 6a13 ldr r3, [r2, #32] ; 0x20
247 5de: 42a3 cmp r3, r4
248 5e0: d802 bhi 0x5e8
249 5e2: 2220 mov r2, #32 ; 0x20
250 5e4: 18d2 add r2, r2, r3
251 5e6: e000 b 0x5ea
252 5e8: 1c1a mov r2, r3 (add r2, r3, #0)
253 5ea: 4291 cmp r1, r2
254 5ec: d95f bls 0x6ae
255 ; line
256 5ee: 0618 lsl r0, r3, #24
257 5f0: 0e00 lsr r0, r0, #24
258 5f2: e05c b 0x6ae
259 ; line
260 5f4: 1c08 mov r0, r1 (add r0, r1, #0)
261 5f6: e05a b 0x6ae
262 ; case DCS1800:
263 5f8: 6a54 ldr r4, [r2, #36] ; 0x24
264 5fa: 42a0 cmp r0, r4
265 5fc: d901 bls 0x602
266 5fe: 1c05 mov r5, r0 (add r5, r0, #0)
267 600: e001 b 0x606
268 602: 2120 mov r1, #32 ; 0x20
269 604: 180d add r5, r1, r0
270 606: 4932 ldr r1, =_MIN_TXPWR_DCS ; via 0x6d0
271 608: 4b2d ldr r3, =_l1a_l1s_com+0x335 ; via 0x6c0
272 60a: 781b ldrb r3, [r3, #0]
273 60c: 5cc9 ldrb r1, [r1, r3]
274 60e: 42a1 cmp r1, r4
275 610: d901 bls 0x616
276 612: 1c0b mov r3, r1 (add r3, r1, #0)
277 614: e001 b 0x61a
278 616: 2320 mov r3, #32 ; 0x20
279 618: 185b add r3, r3, r1
280 61a: 429d cmp r5, r3
281 61c: db11 blt 0x642
282 ; line
283 61e: 42a0 cmp r0, r4
284 620: d901 bls 0x626
285 622: 1c01 mov r1, r0 (add r1, r0, #0)
286 624: e001 b 0x62a
287 626: 2120 mov r1, #32 ; 0x20
288 628: 1809 add r1, r1, r0
289 62a: 69d3 ldr r3, [r2, #28] ; 0x1c
290 62c: 42a3 cmp r3, r4
291 62e: d802 bhi 0x636
292 630: 2220 mov r2, #32 ; 0x20
293 632: 18d2 add r2, r2, r3
294 634: e000 b 0x638
295 636: 1c1a mov r2, r3 (add r2, r3, #0)
296 638: 4291 cmp r1, r2
297 63a: d938 bls 0x6ae
298 ; line
299 63c: 0618 lsl r0, r3, #24
300 63e: 0e00 lsr r0, r0, #24
301 640: e035 b 0x6ae
302 ; line
303 642: 1c08 mov r0, r1 (add r0, r1, #0)
304 644: e033 b 0x6ae
305 ; case PCS1900:
306 646: 6a54 ldr r4, [r2, #36] ; 0x24
307 648: 42a0 cmp r0, r4
308 64a: d901 bls 0x650
309 64c: 1c05 mov r5, r0 (add r5, r0, #0)
310 64e: e001 b 0x654
311 650: 2120 mov r1, #32 ; 0x20
312 652: 180d add r5, r1, r0
313 654: 4b1b ldr r3, =_MIN_TXPWR_PCS ; via 0x6c4
314 656: 491a ldr r1, =_l1a_l1s_com+0x335 ; via 0x6c0
315 658: 7809 ldrb r1, [r1, #0]
316 65a: 5c59 ldrb r1, [r3, r1]
317 65c: 42a1 cmp r1, r4
318 65e: d901 bls 0x664
319 660: 1c0b mov r3, r1 (add r3, r1, #0)
320 662: e001 b 0x668
321 664: 2320 mov r3, #32 ; 0x20
322 666: 185b add r3, r3, r1
323 668: 429d cmp r5, r3
324 66a: db11 blt 0x690
325 ; line
326 66c: 42a0 cmp r0, r4
327 66e: d901 bls 0x674
328 670: 1c01 mov r1, r0 (add r1, r0, #0)
329 672: e001 b 0x678
330 674: 2120 mov r1, #32 ; 0x20
331 676: 1809 add r1, r1, r0
332 678: 69d3 ldr r3, [r2, #28] ; 0x1c
333 67a: 42a3 cmp r3, r4
334 67c: d802 bhi 0x684
335 67e: 2220 mov r2, #32 ; 0x20
336 680: 18d2 add r2, r2, r3
337 682: e000 b 0x686
338 684: 1c1a mov r2, r3 (add r2, r3, #0)
339 686: 4291 cmp r1, r2
340 688: d911 bls 0x6ae
341 ; line
342 68a: 0618 lsl r0, r3, #24
343 68c: 0e00 lsr r0, r0, #24
344 68e: e00e b 0x6ae
345 ; line
346 690: 1c08 mov r0, r1 (add r0, r1, #0)
347 692: e00c b 0x6ae
348 ; case GSM:
349 ; case GSM_E:
350 694: 4b0d ldr r3, =_MIN_TXPWR_GSM ; via 0x6cc
351 696: 490a ldr r1, =_l1a_l1s_com+0x335 ; via 0x6c0
352 698: 7809 ldrb r1, [r1, #0]
353 69a: 5c59 ldrb r1, [r3, r1]
354 69c: 4288 cmp r0, r1
355 69e: db05 blt 0x6ac
356 ; line
357 6a0: 69d1 ldr r1, [r2, #28] ; 0x1c
358 6a2: 4288 cmp r0, r1
359 6a4: d903 bls 0x6ae
360 ; line
361 6a6: 0608 lsl r0, r1, #24
362 6a8: 0e00 lsr r0, r0, #24
363 6aa: e000 b 0x6ae
364 ; line
365 6ac: 1c08 mov r0, r1 (add r0, r1, #0)
366 ; line
367 6ae: bd30 pop {r4, r5, pc}
368 ; End function
369
370 Conclusion: the logic contained in the above disassembly is exactly the same
371 as in the available C code, but there must have been some change to the code
372 expression that results in different output from the compiler.