root/platform/ixus310_elph500hs/sub/101c/boot.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. taskHook
  2. CreateTask_spytask
  3. boot
  4. sub_FF000358_my
  5. sub_FF0011B0_my
  6. sub_FF005EE0_my
  7. taskcreate_Startup_my
  8. task_Startup_my
  9. taskcreatePhySw_my
  10. init_file_modules_task
  11. task_TouchPanel_my
  12. sub_FF059E30_my
  13. sub_FF059D24_my
  14. sub_FF05A414_my
  15. sub_FF059C58_my

   1 /*
   2  * boot.c - auto-generated by CHDK code_gen.
   3  */
   4 #include "lolevel.h"
   5 #include "platform.h"
   6 #include "core.h"
   7 #include "dryos31.h"
   8 
   9 #define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
  10 
  11 const char * const new_sa = &_end;
  12 
  13 // Forward declarations
  14 void task_TouchPanel_my(void);
  15 
  16 extern void task_CaptSeq();
  17 extern void task_DvlpSeqTask();
  18 extern void task_InitFileModules();
  19 extern void task_TouchPanel();
  20 extern void task_MovieRecord();
  21 extern void task_ExpDrv();
  22 extern void task_FileWrite();
  23 
  24 void taskHook(context_t **context)
  25 { 
  26         task_t *tcb=(task_t*)((char*)context-offsetof(task_t, context));
  27 
  28         // Replace firmware task addresses with ours
  29         if(tcb->entry == (void*)task_CaptSeq)                   tcb->entry = (void*)capt_seq_task; 
  30     if(tcb->entry == (void*)task_DvlpSeqTask)       tcb->entry = (void*)dvlp_seq_task;
  31         if(tcb->entry == (void*)task_InitFileModules)   tcb->entry = (void*)init_file_modules_task;
  32         if(tcb->entry == (void*)task_TouchPanel)                tcb->entry = (void*)task_TouchPanel_my;
  33         if(tcb->entry == (void*)task_MovieRecord)               tcb->entry = (void*)movie_record_task;
  34         if(tcb->entry == (void*)task_ExpDrv)                    tcb->entry = (void*)exp_drv_task;
  35     if(tcb->entry == (void*)task_FileWrite)         tcb->entry = (void*)filewritetask;
  36 }
  37 
  38 /*----------------------------------------------------------------------
  39         CreateTask --> core_spytask
  40 -----------------------------------------------------------------------*/
  41 void CreateTask_spytask()
  42 {
  43         _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
  44 }
  45 
  46 /*----------------------------------------------------------------------
  47         boot()
  48 
  49         Main entry point for the CHDK code
  50 -----------------------------------------------------------------------*/
  51 
  52 /*************************************************************/
  53 //** boot @ 0xFF00000C - 0xFF000160, length=86
  54 void __attribute__((naked,noinline)) boot() {
  55 asm volatile (
  56 "    LDR     R1, =0xC0410000 \n"
  57 "    MOV     R0, #0 \n"
  58 "    STR     R0, [R1] \n"
  59 "    MOV     R1, #0x78 \n"
  60 "    MCR     p15, 0, R1, c1, c0 \n"
  61 "    MOV     R1, #0 \n"
  62 "    MCR     p15, 0, R1, c7, c10, 4 \n"
  63 "    MCR     p15, 0, R1, c7, c5 \n"
  64 "    MCR     p15, 0, R1, c7, c6 \n"
  65 "    MOV     R0, #0x3D \n"
  66 "    MCR     p15, 0, R0, c6, c0 \n"
  67 "    MOV     R0, #0xC000002F \n"
  68 "    MCR     p15, 0, R0, c6, c1 \n"
  69 "    MOV     R0, #0x35 \n"
  70 "    MCR     p15, 0, R0, c6, c2 \n"
  71 "    MOV     R0, #0x40000035 \n"
  72 "    MCR     p15, 0, R0, c6, c3 \n"
  73 "    MOV     R0, #0x80000017 \n"
  74 "    MCR     p15, 0, R0, c6, c4 \n"
  75 "    LDR     R0, =0xFF00002F \n"
  76 "    MCR     p15, 0, R0, c6, c5 \n"
  77 "    MOV     R0, #0x34 \n"
  78 "    MCR     p15, 0, R0, c2, c0 \n"
  79 "    MOV     R0, #0x34 \n"
  80 "    MCR     p15, 0, R0, c2, c0, 1 \n"
  81 "    MOV     R0, #0x34 \n"
  82 "    MCR     p15, 0, R0, c3, c0 \n"
  83 "    LDR     R0, =0x3333330 \n"
  84 "    MCR     p15, 0, R0, c5, c0, 2 \n"
  85 "    LDR     R0, =0x3333330 \n"
  86 "    MCR     p15, 0, R0, c5, c0, 3 \n"
  87 "    MRC     p15, 0, R0, c1, c0 \n"
  88 "    ORR     R0, R0, #0x1000 \n"
  89 "    ORR     R0, R0, #4 \n"
  90 "    ORR     R0, R0, #1 \n"
  91 "    MCR     p15, 0, R0, c1, c0 \n"
  92 "    MOV     R1, #0x80000006 \n"
  93 "    MCR     p15, 0, R1, c9, c1 \n"
  94 "    MOV     R1, #6 \n"
  95 "    MCR     p15, 0, R1, c9, c1, 1 \n"
  96 "    MRC     p15, 0, R1, c1, c0 \n"
  97 "    ORR     R1, R1, #0x50000 \n"
  98 "    MCR     p15, 0, R1, c1, c0 \n"
  99 "    LDR     R2, =0xC0200000 \n"
 100 "    MOV     R1, #1 \n"
 101 "    STR     R1, [R2, #0x10C] \n"
 102 "    MOV     R1, #0xFF \n"
 103 "    STR     R1, [R2, #0xC] \n"
 104 "    STR     R1, [R2, #0x1C] \n"
 105 "    STR     R1, [R2, #0x2C] \n"
 106 "    STR     R1, [R2, #0x3C] \n"
 107 "    STR     R1, [R2, #0x4C] \n"
 108 "    STR     R1, [R2, #0x5C] \n"
 109 "    STR     R1, [R2, #0x6C] \n"
 110 "    STR     R1, [R2, #0x7C] \n"
 111 "    STR     R1, [R2, #0x8C] \n"
 112 "    STR     R1, [R2, #0x9C] \n"
 113 "    STR     R1, [R2, #0xAC] \n"
 114 "    STR     R1, [R2, #0xBC] \n"
 115 "    STR     R1, [R2, #0xCC] \n"
 116 "    STR     R1, [R2, #0xDC] \n"
 117 "    STR     R1, [R2, #0xEC] \n"
 118 "    STR     R1, [R2, #0xFC] \n"
 119 "    LDR     R1, =0xC0400008 \n"
 120 "    LDR     R2, =0x430005 \n"
 121 "    STR     R2, [R1] \n"
 122 "    MOV     R1, #1 \n"
 123 "    LDR     R2, =0xC0243100 \n"
 124 "    STR     R2, [R1] \n"
 125 "    LDR     R2, =0xC0242010 \n"
 126 "    LDR     R1, [R2] \n"
 127 "    ORR     R1, R1, #1 \n"
 128 "    STR     R1, [R2] \n"
 129 "    LDR     R0, =0xFF50C010 \n"
 130 "    LDR     R1, =0x1900 \n"
 131 "    LDR     R3, =0x11058 \n"
 132 
 133 "loc_FF00013C:\n"
 134 "    CMP     R1, R3 \n"
 135 "    LDRCC   R2, [R0], #4 \n"
 136 "    STRCC   R2, [R1], #4 \n"
 137 "    BCC     loc_FF00013C \n"
 138 "    LDR     R1, =0x18B834 \n"
 139 "    MOV     R2, #0 \n"
 140 
 141 "loc_FF000154:\n"
 142 "    CMP     R3, R1 \n"
 143 "    STRCC   R2, [R3], #4 \n"
 144 "    BCC     loc_FF000154 \n"
 145 "    B       sub_FF000358_my \n"  // --> Patched. Old value = 0xFF000358.
 146 );
 147 }
 148 
 149 /*************************************************************/
 150 //** sub_FF000358_my @ 0xFF000358 - 0xFF0003C0, length=27
 151 void __attribute__((naked,noinline)) sub_FF000358_my() {
 152 
 153         //http://chdk.setepontos.com/index.php/topic,4194.0.html
 154         *(int*)0x1938=(int)taskHook;
 155         *(int*)0x193C=(int)taskHook;
 156     
 157         // replacement of sub_FF024B5C for correct power-on.
 158         *(int*)(0x2638) = (*(int*)0xC0220130)&1 ? 0x200000 : 0x100000; 
 159 
 160 asm volatile (
 161 "    LDR     R0, =0xFF0003D0 \n"
 162 "    MOV     R1, #0 \n"
 163 "    LDR     R3, =0xFF000408 \n"
 164 
 165 "loc_FF000364:\n"
 166 "    CMP     R0, R3 \n"
 167 "    LDRCC   R2, [R0], #4 \n"
 168 "    STRCC   R2, [R1], #4 \n"
 169 "    BCC     loc_FF000364 \n"
 170 "    LDR     R0, =0xFF000408 \n"
 171 "    MOV     R1, #0x4B0 \n"
 172 "    LDR     R3, =0xFF00061C \n"
 173 
 174 "loc_FF000380:\n"
 175 "    CMP     R0, R3 \n"
 176 "    LDRCC   R2, [R0], #4 \n"
 177 "    STRCC   R2, [R1], #4 \n"
 178 "    BCC     loc_FF000380 \n"
 179 "    MOV     R0, #0xD2 \n"
 180 "    MSR     CPSR_cxsf, R0 \n"
 181 "    MOV     SP, #0x1000 \n"
 182 "    MOV     R0, #0xD3 \n"
 183 "    MSR     CPSR_cxsf, R0 \n"
 184 "    MOV     SP, #0x1000 \n"
 185 "    LDR     R0, =0x6C4 \n"
 186 "    LDR     R2, =0xEEEEEEEE \n"
 187 "    MOV     R3, #0x1000 \n"
 188 
 189 "loc_FF0003B4:\n"
 190 "    CMP     R0, R3 \n"
 191 "    STRCC   R2, [R0], #4 \n"
 192 "    BCC     loc_FF0003B4 \n"
 193 "    BL      sub_FF0011B0_my \n"  // --> Patched. Old value = 0xFF0011B0.
 194 );
 195 }
 196 
 197 /*************************************************************/
 198 //** sub_FF0011B0_my @ 0xFF0011B0 - 0xFF001248, length=39
 199 void __attribute__((naked,noinline)) sub_FF0011B0_my() {
 200 asm volatile (
 201 "    STR     LR, [SP, #-4]! \n"
 202 "    SUB     SP, SP, #0x74 \n"
 203 "    MOV     R1, #0x74 \n"
 204 "    MOV     R0, SP \n"
 205 "    BL      sub_FF3CA354 \n"
 206 "    MOV     R0, #0x53000 \n"
 207 "    STR     R0, [SP, #4] \n"
 208 
 209 #if defined(CHDK_NOT_IN_CANON_HEAP) // use original heap offset if CHDK is loaded in high memory
 210 "    LDR     R0, =0x18B834 \n"
 211 #else
 212 "    LDR     R0, =new_sa\n"   // otherwise use patched value
 213 "    LDR     R0, [R0]\n"      // 
 214 #endif
 215 
 216 "    LDR     R2, =0x371F80 \n"
 217 "    STR     R0, [SP, #8] \n"
 218 "    SUB     R0, R2, R0 \n"
 219 "    STR     R0, [SP, #0xC] \n"
 220 "    MOV     R0, #0x22 \n"
 221 "    STR     R0, [SP, #0x18] \n"
 222 "    MOV     R0, #0x68 \n"
 223 "    STR     R0, [SP, #0x1C] \n"
 224 "    LDR     R1, =0x379C00 \n"
 225 "    LDR     R0, =0x19B \n"
 226 "    STR     R1, [SP] \n"
 227 "    STR     R0, [SP, #0x20] \n"
 228 "    MOV     R0, #0x96 \n"
 229 "    STR     R2, [SP, #0x10] \n"
 230 "    STR     R1, [SP, #0x14] \n"
 231 "    STR     R0, [SP, #0x24] \n"
 232 "    STR     R0, [SP, #0x28] \n"
 233 "    MOV     R0, #0x64 \n"
 234 "    STR     R0, [SP, #0x2C] \n"
 235 "    MOV     R0, #0 \n"
 236 "    STR     R0, [SP, #0x30] \n"
 237 "    STR     R0, [SP, #0x34] \n"
 238 "    MOV     R0, #0x10 \n"
 239 "    STR     R0, [SP, #0x5C] \n"
 240 "    MOV     R0, #0x800 \n"
 241 "    STR     R0, [SP, #0x60] \n"
 242 "    MOV     R0, #0xA0 \n"
 243 "    STR     R0, [SP, #0x64] \n"
 244 "    MOV     R0, #0x280 \n"
 245 "    STR     R0, [SP, #0x68] \n"
 246 "    LDR     R1, =sub_FF005EE0_my \n"  // --> Patched. Old value = 0xFF005EE0.
 247 "    LDR     PC, =0xFF00124C \n"  // Continue in firmware
 248 );
 249 }
 250 
 251 /*************************************************************/
 252 //** sub_FF005EE0_my @ 0xFF005EE0 - 0xFF005F54, length=30
 253 void __attribute__((naked,noinline)) sub_FF005EE0_my() {
 254 asm volatile (
 255 "    STMFD   SP!, {R4,LR} \n"
 256 "    BL      sub_FF000B28 \n"
 257 "    BL      sub_FF00A374 \n"
 258 "    CMP     R0, #0 \n"
 259 "    LDRLT   R0, =0xFF005FF4 /*'dmSetup'*/ \n"
 260 "    BLLT    _err_init_task \n"
 261 "    BL      sub_FF005B18 \n"
 262 "    CMP     R0, #0 \n"
 263 "    LDRLT   R0, =0xFF005FFC /*'termDriverInit'*/ \n"
 264 "    BLLT    _err_init_task \n"
 265 "    LDR     R0, =0xFF00600C /*'/_term'*/ \n"
 266 "    BL      sub_FF005C00 \n"
 267 "    CMP     R0, #0 \n"
 268 "    LDRLT   R0, =0xFF006014 /*'termDeviceCreate'*/ \n"
 269 "    BLLT    _err_init_task \n"
 270 "    LDR     R0, =0xFF00600C /*'/_term'*/ \n"
 271 "    BL      sub_FF003CA8 \n"
 272 "    CMP     R0, #0 \n"
 273 "    LDRLT   R0, =0xFF006028 /*'stdioSetup'*/ \n"
 274 "    BLLT    _err_init_task \n"
 275 "    BL      sub_FF009D00 \n"
 276 "    CMP     R0, #0 \n"
 277 "    LDRLT   R0, =0xFF006034 /*'stdlibSetup'*/ \n"
 278 "    BLLT    _err_init_task \n"
 279 "    BL      sub_FF001690 \n"
 280 "    CMP     R0, #0 \n"
 281 "    LDRLT   R0, =0xFF006040 /*'armlib_setup'*/ \n"
 282 "    BLLT    _err_init_task \n"
 283 "    LDMFD   SP!, {R4,LR} \n"
 284 "    B       taskcreate_Startup_my \n"  // --> Patched. Old value = 0xFF00FC80.
 285 );
 286 }
 287 
 288 /*************************************************************/
 289 //** taskcreate_Startup_my @ 0xFF00FC80 - 0xFF00FD2C, length=44
 290 void __attribute__((naked,noinline)) taskcreate_Startup_my() {
 291 asm volatile (
 292 "    STMFD   SP!, {R3-R9,LR} \n"
 293 "    MOV     R6, #0 \n"
 294 //"  BL      _sub_FF055974 \n"  // --> Nullsub call removed.
 295 "    BL      sub_FF02D1D0 \n"
 296 "    LDR     R9, =0xC0220000 \n"
 297 "    MOVS    R7, R0 \n"
 298 "    MOV     R8, #1 \n"
 299 "    BNE     loc_FF00FCE8 \n"
 300 "    BL      sub_FF026598 /*_IsNormalCameraMode_FW*/ \n"
 301 "    CMP     R0, #0 \n"
 302 "    BEQ     loc_FF00FCE8 \n"
 303 "    LDR     R0, [R9, #0x138] \n"
 304 "    BIC     R5, R8, R0 \n"
 305 "    LDR     R0, [R9, #0x130] \n"
 306 "    BIC     R4, R8, R0 \n"
 307 "    BL      sub_FF023D90 \n"
 308 "    CMP     R0, #1 \n"
 309 "    MOVEQ   R6, #1 \n"
 310 "    ORR     R0, R4, R5 \n"
 311 "    ORRS    R0, R0, R6 \n"
 312 "    BNE     loc_FF00FCF8 \n"
 313 "    BL      sub_FF0241A0 \n"
 314 "    MOV     R0, #0x44 \n"
 315 "    STR     R0, [R9, #0x1C] \n"
 316 "    BL      sub_FF024390 \n"
 317 
 318 "loc_FF00FCE4:\n"
 319 "    B       loc_FF00FCE4 \n"
 320 
 321 "loc_FF00FCE8:\n"
 322 "    LDR     R0, [R9, #0x130] \n"
 323 "    BIC     R4, R8, R0 \n"
 324 "    LDR     R0, [R9, #0x138] \n"
 325 "    BIC     R5, R8, R0 \n"
 326 
 327 "loc_FF00FCF8:\n"
 328 "    MOV     R3, R6 \n"
 329 "    MOV     R2, R7 \n"
 330 "    MOV     R1, R5 \n"
 331 "    MOV     R0, R4 \n"
 332 //"  BL      _sub_FF05597C \n"  // See begin of sub_FF000364_my()
 333 //"  BL      _sub_FF055978 \n"  // --> Nullsub call removed.
 334 "    BL      sub_FF02B3A0 \n"
 335 "    LDR     R1, =0x3CE000 \n"
 336 "    MOV     R0, #0 \n"
 337 "    BL      sub_FF02B810 \n"
 338 "    BL      sub_FF02B5B8 \n"
 339 "    MOV     R3, #0 \n"
 340 "    STR     R3, [SP] \n"
 341 "    LDR     R3, =task_Startup_my \n"  // --> Patched. Old value = 0xFF00FBF4.
 342 "    LDR     PC, =0xFF00FD30 \n"  // Continue in firmware
 343 );
 344 }
 345 
 346 /*************************************************************/
 347 //** task_Startup_my @ 0xFF00FBF4 - 0xFF00FC4C, length=23
 348 void __attribute__((naked,noinline)) task_Startup_my() {
 349 asm volatile (
 350 "    STMFD   SP!, {R4,LR} \n"
 351 "    BL      sub_FF006588 \n"
 352 "    BL      sub_FF025E08 \n"
 353 "    BL      sub_FF023DA0 \n"
 354 //"  BL      _sub_FF0560F8 \n"  // --> Nullsub call removed.
 355 "    BL      sub_FF02D404 \n"
 356 "    BL      sub_FF024FA4 \n"
 357 "    BL      sub_FF023824 \n"
 358 //"  BL      _sub_FF02D2AC \n"  // start diskboot.bin
 359 "    BL      sub_FF08D69C \n"
 360 "    LDR     R1, =0x30101 \n"
 361 "    MOV     R0, #2 \n"
 362 "    BL      sub_FF02A8CC \n"
 363 "    LDR     R1, =0xC0220000 \n"
 364 "    MOV     R0, #8 \n"
 365 "    STR     R0, [R1, #0x34] \n"
 366 "    MOV     R0, #2 \n"
 367 "    BL      sub_FF02A5FC \n"
 368 "    BL      sub_FF022234 \n"
 369 "    BL      sub_FF02D434 \n"
 370 "    BL      sub_FF02AB44 \n"
 371 "    BL      sub_FF02D5BC \n"
 372 
 373 "    BL      CreateTask_spytask\n"  // added
 374 
 375 "    BL      taskcreatePhySw_my \n"  // --> Patched. Old value = 0xFF0249FC.
 376 "    LDR     PC, =0xFF00FC50 \n"  // Continue in firmware
 377 );
 378 }
 379 
 380 /*************************************************************/
 381 //** taskcreatePhySw_my @ 0xFF0249FC - 0xFF024A1C, length=9
 382 void __attribute__((naked,noinline)) taskcreatePhySw_my() {
 383 asm volatile (
 384 "    STMFD   SP!, {R3-R5,LR} \n"
 385 "    LDR     R4, =0x1C3C \n"
 386 "    LDR     R0, [R4, #4] \n"
 387 "    CMP     R0, #0 \n"
 388 "    BNE     sub_FF024A30 \n"
 389 "    MOV     R3, #0 \n"
 390 "    STR     R3, [SP] \n"
 391 "    LDR     R3, =mykbd_task \n"  // --> Patched. Old value = 0xFF0249C8.
 392 "    MOV     R2, #0x2000 \n"  // --> Patched. Old value = 0x800. stack size for new task_PhySw
 393 "    LDR     PC, =0xFF024A20 \n"  // Continue in firmware
 394 );
 395 }
 396 
 397 /*************************************************************/
 398 //** init_file_modules_task @ 0xFF090AB0 - 0xFF090ACC, length=8
 399 void __attribute__((naked,noinline)) init_file_modules_task() {
 400 asm volatile (
 401 "    STMFD   SP!, {R4-R6,LR} \n"
 402 "    BL      sub_FF088584 \n"
 403 "    LDR     R5, =0x5006 \n"
 404 "    MOVS    R4, R0 \n"
 405 "    MOVNE   R1, #0 \n"
 406 "    MOVNE   R0, R5 \n"
 407 "    BLNE    _PostLogicalEventToUI \n"
 408 "    BL      sub_FF0885B0 \n"
 409 "    BL      core_spytask_can_start\n"  // CHDK: Set "it's-safe-to-start" flag for spytask
 410 "    LDR     PC, =0xFF090AD0 \n"  // Continue in firmware
 411 );
 412 }
 413 
 414 /*************************************************************/
 415 //** task_TouchPanel_my @ 0xFF059E84 - 0xFF059FF4, length=93
 416 void __attribute__((naked,noinline)) task_TouchPanel_my() {
 417 asm volatile (
 418 "    STMFD   SP!, {R3-R7,LR} \n"
 419 "    MOV     R0, #0 \n"
 420 "    LDR     R1, =0xC0221000 \n"
 421 "    MOV     R4, R0 \n"
 422 "    STR     R0, [SP] \n"
 423 "    MOV     R0, #0x23 \n"
 424 "    STR     R0, [R1, #0x314] \n"
 425 "    MOV     R0, #0x1C \n"
 426 "    SUB     R1, R1, #0x1E000 \n"
 427 "    STR     R0, [R1, #0x40] \n"
 428 "    MOV     R3, #0 \n"
 429 "    LDR     R2, =0xFF059BD0 \n"
 430 "    MOV     R1, #0x55 \n"
 431 "    MOV     R0, R3 \n"
 432 "    BL      sub_FF00E948 /*_RegisterInterruptHandler*/ \n"
 433 "    BL      sub_FF05A2C8 \n"
 434 "    LDR     R5, =0x28BC \n"
 435 "    MOV     R1, #0x10 \n"
 436 "    LDR     R0, [R5, #0x24] \n"
 437 "    BL      sub_FF07FAFC /*_ClearEventFlag*/ \n"
 438 "    MOV     R6, #7 \n"
 439 
 440 "loc_FF059ED8:\n"
 441 "    LDR     R0, [R5, #0x24] \n"
 442 "    MOV     R2, #0 \n"
 443 "    MOV     R1, #0x17 \n"
 444 "    BL      sub_FF07F924 /*_WaitForAnyEventFlag*/ \n"
 445 "    CMP     R0, #0 \n"
 446 "    LDRNE   R1, =0x322 \n"
 447 "    LDRNE   R0, =0xFF059C34 /*'TouchPanelDriver_TSC2008.c'*/ \n"
 448 "    BLNE    _DebugAssert \n"
 449 "    LDR     R0, [R5, #0x24] \n"
 450 "    MOV     R1, SP \n"
 451 "    BL      sub_FF07FB34 /*_GetEventFlagValue*/ \n"
 452 "    CMP     R0, #0 \n"
 453 "    LDRNE   R1, =0x323 \n"
 454 "    LDRNE   R0, =0xFF059C34 /*'TouchPanelDriver_TSC2008.c'*/ \n"
 455 "    BLNE    _DebugAssert \n"
 456 "    LDR     R0, [SP] \n"
 457 "    TST     R0, #1 \n"
 458 "    BEQ     loc_FF059F50 \n"
 459 "    LDR     R0, [R5, #4] \n"
 460 "    BL      _CancelHPTimer \n"
 461 "    STR     R6, [R5, #4] \n"
 462 "    LDR     R0, [R5, #0x24] \n"
 463 "    MOV     R1, #5 \n"
 464 "    BL      sub_FF07FAFC /*_ClearEventFlag*/ \n"
 465 "    BL      sub_FF059BE0 \n"
 466 "    MOV     R4, #0 \n"
 467 "    BL      sub_FF05A2C8 \n"
 468 "    LDR     R0, [R5, #0x24] \n"
 469 "    MOV     R1, #0x80000000 \n"
 470 "    BL      sub_FF07FAC8 /*_SetEventFlag*/ \n"
 471 
 472 "loc_FF059F50:\n"
 473 "    LDR     R0, [SP] \n"
 474 "    TST     R0, #2 \n"
 475 "    BEQ     loc_FF059F80 \n"
 476 "    LDR     R0, [R5, #0x24] \n"
 477 "    MOV     R1, #2 \n"
 478 "    BL      sub_FF07FAFC /*_ClearEventFlag*/ \n"
 479 "    CMP     R4, #0 \n"
 480 "    BNE     loc_FF059ED8 \n"
 481 "    LDR     R0, =0xBB8 \n"
 482 "    BL      sub_FF059A1C \n"
 483 "    MOV     R4, #1 \n"
 484 "    BL      sub_FF05A3DC \n"
 485 
 486 "loc_FF059F80:\n"
 487 "    LDR     R0, [SP] \n"
 488 "    TST     R0, #0x10 \n"
 489 "    BEQ     loc_FF059FC0 \n"
 490 "    LDR     R0, [R5, #4] \n"
 491 "    BL      _CancelHPTimer \n"
 492 "    STR     R6, [R5, #4] \n"
 493 "    BL      sub_FF05A2C8 \n"
 494 "    LDR     R0, [R5, #0x24] \n"
 495 "    MOV     R1, #0x14 \n"
 496 "    BL      sub_FF07FAFC /*_ClearEventFlag*/ \n"
 497 "    CMP     R4, #0 \n"
 498 "    BEQ     loc_FF059ED8 \n"
 499 "    BL      sub_FF059E30_my \n"  // --> Patched. Old value = 0xFF059E30.
 500 "    LDR     R0, [R5, #8] \n"
 501 "    CMP     R0, #0 \n"
 502 "    BLNE    sub_FF059ADC \n"
 503 
 504 "loc_FF059FC0:\n"
 505 "    LDR     R0, [SP] \n"
 506 "    TST     R0, #4 \n"
 507 "    BEQ     loc_FF059ED8 \n"
 508 "    STR     R6, [R5, #4] \n"
 509 "    LDR     R0, [R5, #0x24] \n"
 510 "    MOV     R1, #4 \n"
 511 "    BL      sub_FF07FAFC /*_ClearEventFlag*/ \n"
 512 "    CMP     R4, #0 \n"
 513 "    BEQ     loc_FF059ED8 \n"
 514 "    BL      sub_FF059E30_my \n"  // --> Patched. Old value = 0xFF059E30.
 515 "    LDR     R0, [R5, #8] \n"
 516 "    CMP     R0, #0 \n"
 517 "    BLNE    sub_FF059ADC \n"
 518 "    B       loc_FF059ED8 \n"
 519 );
 520 }
 521 
 522 /*************************************************************/
 523 //** sub_FF059E30_my @ 0xFF059E30 - 0xFF059E80, length=21
 524 void __attribute__((naked,noinline)) sub_FF059E30_my() {
 525 asm volatile (
 526 "    LDR     R1, =0x28BC \n"
 527 "    LDR     R0, [R1, #8] \n"
 528 "    CMP     R0, #0 \n"
 529 "    BEQ     loc_FF059E5C \n"
 530 "    CMP     R0, #1 \n"
 531 "    BEQ     sub_FF059D24_my \n"  // --> Patched. Old value = 0xFF059D24.
 532 "    CMP     R0, #2 \n"
 533 "    BEQ     sub_FF05A414_my \n"  // --> Patched. Old value = 0xFF05A414.
 534 "    LDRNE   R1, =0x311 \n"
 535 "    LDRNE   R0, =0xFF059C34 /*'TouchPanelDriver_TSC2008.c'*/ \n"
 536 "    BNE     _DebugAssert \n"
 537 
 538 "loc_FF059E5C:\n"
 539 "    LDR     R0, =0xC0220000 \n"
 540 "    LDR     R0, [R0, #0x8C] \n"
 541 "    TST     R0, #1 \n"
 542 "    BNE     sub_FF05A3DC \n"
 543 "    MOV     R0, #0 \n"
 544 "    STR     R0, [R1, #0x14] \n"
 545 "    STR     R0, [R1, #0x10] \n"
 546 "    MOV     R0, #1 \n"
 547 "    STR     R0, [R1, #8] \n"
 548 "    BX      LR \n"
 549 );
 550 }
 551 
 552 /*************************************************************/
 553 //** sub_FF059D24_my @ 0xFF059D24 - 0xFF059E2C, length=67
 554 void __attribute__((naked,noinline)) sub_FF059D24_my() {
 555 asm volatile (
 556 "    STMFD   SP!, {R3-R5,LR} \n"
 557 "    LDR     R4, =0x28BC \n"
 558 "    LDR     R5, =0xC0220000 \n"
 559 "    LDR     R0, [R4, #0xC] \n"
 560 "    CMP     R0, #1 \n"
 561 "    BNE     loc_FF059DC0 \n"
 562 "    LDR     R0, [R4, #0x14] \n"
 563 "    ADD     R1, R0, #1 \n"
 564 "    MOV     R0, R4 \n"
 565 "    STR     R1, [R4, #0x14] \n"
 566 "    LDR     R0, [R0, #0x10] \n"
 567 "    CMP     R1, #0xA \n"
 568 "    BNE     loc_FF059D84 \n"
 569 "    CMP     R0, #2 \n"
 570 "    BCC     loc_FF059E28 \n"
 571 "    LDR     R0, [R5, #0x8C] \n"
 572 "    TST     R0, #1 \n"
 573 "    BNE     loc_FF059D7C \n"
 574 "    ADD     R1, R4, #0x34 \n"
 575 "    MOV     R0, #0 \n"
 576 "    BL      sub_FF059A7C \n"
 577 "    B       loc_FF059DEC \n"
 578 
 579 "loc_FF059D7C:\n"
 580 "    BL      sub_FF05A3F0 \n"
 581 "    LDMFD   SP!, {R3-R5,PC} \n"
 582 
 583 "loc_FF059D84:\n"
 584 "    LDR     R1, [R5, #0x8C] \n"
 585 "    TST     R1, #1 \n"
 586 "    BEQ     loc_FF059D9C \n"
 587 "    CMP     R0, #2 \n"
 588 "    LDMCSFD SP!, {R3-R5,PC} \n"
 589 "    B       loc_FF059E28 \n"
 590 
 591 "loc_FF059D9C:\n"
 592 "    ADD     R0, R0, #1 \n"
 593 "    CMP     R0, #2 \n"
 594 "    STR     R0, [R4, #0x10] \n"
 595 "    LDMNEFD SP!, {R3-R5,PC} \n"
 596 "    MOV     R0, #0 \n"
 597 "    LDR     R1, =0x28F0 \n"
 598 "    BL      sub_FF059A7C \n"
 599 "    BL      sub_FF059C58_my \n"  // --> Patched. Old value = 0xFF059C58.
 600 "    LDMFD   SP!, {R3-R5,PC} \n"
 601 
 602 "loc_FF059DC0:\n"
 603 "    LDR     R0, [R5, #0x8C] \n"
 604 "    TST     R0, #1 \n"
 605 "    BNE     loc_FF059E28 \n"
 606 "    LDR     R1, =0x28F0 \n"
 607 "    MOV     R0, #0 \n"
 608 "    BL      sub_FF059A7C \n"
 609 "    LDR     R0, =0x2710 \n"
 610 "    BL      sub_FF059A1C \n"
 611 "    LDR     R0, [R5, #0x8C] \n"
 612 "    TST     R0, #1 \n"
 613 "    BNE     loc_FF059DF4 \n"
 614 
 615 "loc_FF059DEC:\n"
 616 "    BL      sub_FF059C58_my \n"  // --> Patched. Old value = 0xFF059C58.
 617 "    B       loc_FF059D7C \n"
 618 
 619 "loc_FF059DF4:\n"
 620 "    LDR     R0, =0x28F0 \n"
 621 "    MOV     R3, #0 \n"
 622 "    STR     R3, [SP] \n"
 623 "    LDRH    R1, [R0, #2] \n"
 624 "    LDRH    R0, [R0] \n"
 625 "    LDR     R12, [R4, #0x1C] \n"
 626 "    BIC     R2, R1, #0x8000 \n"
 627 "    LDR     R1, =0x3FF \n"
 628 "    BIC     R0, R0, #0x8000 \n"
 629 "    EOR     R2, R1, R2, LSR#5 \n"
 630 "    EOR     R1, R1, R0, LSR#5 \n"
 631 "    MOV     R0, R3 \n"
 632 "    BLX     R12 \n"
 633 
 634 "loc_FF059E28:\n"
 635 "    BL      sub_FF059BE0 \n"
 636 "    LDMFD   SP!, {R3-R5,PC} \n"
 637 );
 638 }
 639 
 640 /*************************************************************/
 641 //** sub_FF05A414_my @ 0xFF05A414 - 0xFF05A4E4, length=53
 642 void __attribute__((naked,noinline)) sub_FF05A414_my() {
 643 asm volatile (
 644 "    STMFD   SP!, {R3-R9,LR} \n"
 645 "    LDR     R7, =0xC0220000 \n"
 646 "    LDR     R0, [R7, #0x8C] \n"
 647 "    LDR     R4, =0x28BC \n"
 648 "    TST     R0, #1 \n"
 649 "    LDR     R0, [R4, #0x18] \n"
 650 "    LDR     R5, =0x2710 \n"
 651 "    SUB     R0, R0, #1 \n"
 652 "    BEQ     loc_FF05A44C \n"
 653 "    CMP     R0, #0 \n"
 654 "    STR     R0, [R4, #0x18] \n"
 655 "    LDMEQFD SP!, {R3-R9,LR} \n"
 656 "    BEQ     sub_FF059BE0 \n"
 657 "    B       loc_FF05A470 \n"
 658 
 659 "loc_FF05A44C:\n"
 660 "    LDR     R6, =0x28F0 \n"
 661 "    LDR     R8, =0x7FFF \n"
 662 "    MOV     R1, #3 \n"
 663 "    CMP     R0, #2 \n"
 664 "    STR     R1, [R4, #0x18] \n"
 665 "    BCS     loc_FF05A47C \n"
 666 "    LDRH    R0, [R6] \n"
 667 "    CMP     R0, R8 \n"
 668 "    BNE     loc_FF05A4DC \n"
 669 
 670 "loc_FF05A470:\n"
 671 "    MOV     R0, R5 \n"
 672 "    LDMFD   SP!, {R3-R9,LR} \n"
 673 "    B       sub_FF059A1C \n"
 674 
 675 "loc_FF05A47C:\n"
 676 "    LDR     R1, =0x28F0 \n"
 677 "    MOV     R0, #0 \n"
 678 "    BL      sub_FF059A7C \n"
 679 "    MOV     R0, R5 \n"
 680 "    BL      sub_FF059A1C \n"
 681 "    LDR     R0, [R7, #0x8C] \n"
 682 "    TST     R0, #1 \n"
 683 "    BEQ     loc_FF05A4DC \n"
 684 "    MOV     R3, #0 \n"
 685 "    STR     R3, [SP] \n"
 686 "    LDRH    R0, [R6, #2] \n"
 687 "    LDR     R12, [R4, #0x1C] \n"
 688 "    BIC     R1, R0, #0x8000 \n"
 689 "    LDR     R0, =0x3FF \n"
 690 "    EOR     R2, R0, R1, LSR#5 \n"
 691 "    LDRH    R1, [R6] \n"
 692 "    BIC     R1, R1, #0x8000 \n"
 693 "    EOR     R1, R0, R1, LSR#5 \n"
 694 "    MOV     R0, R3 \n"
 695 "    BLX     R12 \n"
 696 "    LDR     R0, [R4, #0x18] \n"
 697 "    SUB     R0, R0, #1 \n"
 698 "    STR     R0, [R4, #0x18] \n"
 699 "    LDMFD   SP!, {R3-R9,PC} \n"
 700 
 701 "loc_FF05A4DC:\n"
 702 "    BL      sub_FF059C58_my \n"  // --> Patched. Old value = 0xFF059C58.
 703 "    STRH    R8, [R6] \n"
 704 "    LDMFD   SP!, {R3-R9,PC} \n"
 705 );
 706 }
 707 
 708 /*************************************************************/
 709 //** sub_FF059C58_my @ 0xFF059C58 - 0xFF059C58, length=1
 710 void __attribute__((naked,noinline)) sub_FF059C58_my() {
 711 asm volatile (
 712 "    STMFD   SP!, {R4,R5,LR} \n"
 713 "    BL      chdk_process_touch \n"
 714 "    LDMFD   SP!, {R4,R5,LR} \n"
 715 "    CMP     R0, #0 \n"
 716 "    BXNE    LR \n"
 717 "    LDR     PC, =0xFF059C58 \n"  // Continue in firmware
 718 );
 719 }

/* [<][>][^][v][top][bottom][index][help] */