root/platform/ixus150_elph140/sub/100c/boot.c

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

DEFINITIONS

This source file includes following definitions.
  1. CreateTask_spytask
  2. boot
  3. CreateTask_my
  4. sub_FF8203C4_my
  5. sub_FF8228DC_my
  6. sub_FF8248DC_my
  7. sub_FF827C18_my
  8. task_Startup_my
  9. taskcreatePhySw_my
  10. init_file_modules_task
  11. init_required_fw_features

   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 /*----------------------------------------------------------------------
  14         CreateTask_spytask
  15 -----------------------------------------------------------------------*/
  16 void CreateTask_spytask()
  17 {
  18     _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
  19 }
  20 
  21 /*----------------------------------------------------------------------
  22         boot()
  23 
  24         Main entry point for the CHDK code
  25 -----------------------------------------------------------------------*/
  26 
  27 /*************************************************************/
  28 //** boot @ 0xFF82000C - 0xFF82017C, length=93
  29 void __attribute__((naked,noinline)) boot() {
  30 asm volatile (
  31 "    LDR     R1, =0xC0410000 \n"
  32 "    MOV     R0, #0 \n"
  33 "    STR     R0, [R1] \n"
  34 "    MOV     R1, #0x78 \n"
  35 "    MCR     p15, 0, R1, c1, c0 \n"
  36 "    MOV     R1, #0 \n"
  37 "    MCR     p15, 0, R1, c7, c10, 4 \n"
  38 "    MCR     p15, 0, R1, c7, c5 \n"
  39 "    MCR     p15, 0, R1, c7, c6 \n"
  40 "    MOV     R0, #0x3D \n"
  41 "    MCR     p15, 0, R0, c6, c0 \n"
  42 "    MOV     R0, #0xC000002F \n"
  43 "    MCR     p15, 0, R0, c6, c1 \n"
  44 "    MOV     R0, #0x35 \n"
  45 "    MCR     p15, 0, R0, c6, c2 \n"
  46 "    MOV     R0, #0x40000035 \n"
  47 "    MCR     p15, 0, R0, c6, c3 \n"
  48 "    MOV     R0, #0x80000017 \n"
  49 "    MCR     p15, 0, R0, c6, c4 \n"
  50 "    LDR     R0, =0xFF80002D \n"
  51 "    MCR     p15, 0, R0, c6, c5 \n"
  52 "    MOV     R0, #0x34 \n"
  53 "    MCR     p15, 0, R0, c2, c0 \n"
  54 "    MOV     R0, #0x34 \n"
  55 "    MCR     p15, 0, R0, c2, c0, 1 \n"
  56 "    MOV     R0, #0x34 \n"
  57 "    MCR     p15, 0, R0, c3, c0 \n"
  58 "    LDR     R0, =0x3333330 \n"
  59 "    MCR     p15, 0, R0, c5, c0, 2 \n"
  60 "    LDR     R0, =0x3333330 \n"
  61 "    MCR     p15, 0, R0, c5, c0, 3 \n"
  62 "    MRC     p15, 0, R0, c1, c0 \n"
  63 "    ORR     R0, R0, #0x1000 \n"
  64 "    ORR     R0, R0, #4 \n"
  65 "    ORR     R0, R0, #1 \n"
  66 "    MCR     p15, 0, R0, c1, c0 \n"
  67 "    MOV     R1, #0x80000006 \n"
  68 "    MCR     p15, 0, R1, c9, c1 \n"
  69 "    MOV     R1, #6 \n"
  70 "    MCR     p15, 0, R1, c9, c1, 1 \n"
  71 "    MRC     p15, 0, R1, c1, c0 \n"
  72 "    ORR     R1, R1, #0x50000 \n"
  73 "    MCR     p15, 0, R1, c1, c0 \n"
  74 "    LDR     R2, =0xC0200000 \n"
  75 "    MOV     R1, #1 \n"
  76 "    STR     R1, [R2, #0x10C] \n"
  77 "    MVN     R1, #0 \n"
  78 "    STR     R1, [R2, #0xC] \n"
  79 "    STR     R1, [R2, #0x1C] \n"
  80 "    STR     R1, [R2, #0x2C] \n"
  81 "    STR     R1, [R2, #0x3C] \n"
  82 "    STR     R1, [R2, #0x4C] \n"
  83 "    STR     R1, [R2, #0x5C] \n"
  84 "    STR     R1, [R2, #0x6C] \n"
  85 "    STR     R1, [R2, #0x7C] \n"
  86 "    STR     R1, [R2, #0x8C] \n"
  87 "    STR     R1, [R2, #0x9C] \n"
  88 "    STR     R1, [R2, #0xAC] \n"
  89 "    STR     R1, [R2, #0xBC] \n"
  90 "    STR     R1, [R2, #0xCC] \n"
  91 "    STR     R1, [R2, #0xDC] \n"
  92 "    STR     R1, [R2, #0xEC] \n"
  93 "    STR     R1, [R2, #0xFC] \n"
  94 "    LDR     R1, =0xC0400008 \n"
  95 "    LDR     R2, =0x430005 \n"
  96 "    STR     R2, [R1] \n"
  97 "    MOV     R1, #1 \n"
  98 "    LDR     R2, =0xC0243100 \n"
  99 "    STR     R2, [R1] \n"
 100 "    LDR     R2, =0xC0242010 \n"
 101 "    LDR     R1, [R2] \n"
 102 "    ORR     R1, R1, #1 \n"
 103 "    STR     R1, [R2] \n"
 104 "    LDR     R0, =0xFFCD7394 \n"
 105 "    LDR     R1, =0x6B1000 \n"
 106 "    LDR     R3, =0x6C1402 \n"
 107 
 108 "loc_FF82013C:\n"
 109 "    CMP     R1, R3 \n"
 110 "    LDRCC   R2, [R0], #4 \n"
 111 "    STRCC   R2, [R1], #4 \n"
 112 "    BCC     loc_FF82013C \n"
 113 "    LDR     R0, =0xFFCC9530 \n"
 114 "    LDR     R1, =0x1900 \n"
 115 "    LDR     R3, =0xF764 \n"
 116 
 117 "loc_FF820158:\n"
 118 "    CMP     R1, R3 \n"
 119 "    LDRCC   R2, [R0], #4 \n"
 120 "    STRCC   R2, [R1], #4 \n"
 121 "    BCC     loc_FF820158 \n"
 122 "    LDR     R1, =0x182980 \n"
 123 "    MOV     R2, #0 \n"
 124 
 125 "loc_FF820170:\n"
 126 "    CMP     R3, R1 \n"
 127 "    STRCC   R2, [R3], #4 \n"
 128 "    BCC     loc_FF820170 \n"
 129 /* Install task hooks via 0x193x is not possible with this new dryos version
 130    So the below code patches the CreateTask function in RAM to install our
 131    hook -- ERR99
 132 */
 133 // Install CreateTask patch
 134 "    LDR     R0, =patch_CreateTask\n"   // Patch data
 135 "    LDM     R0, {R1,R2}\n"             // Get two patch instructions
 136 "    LDR     R0, =hook_CreateTask\n"    // Address to patch
 137 "    STM     R0, {R1,R2}\n"             // Store patch instructions
 138 
 139 "    B       sub_FF8203C4_my \n"  // --> Patched. Old value = 0xFF8203C4.
 140 
 141 "patch_CreateTask:\n"
 142 "    LDR     PC, [PC,#-0x4]\n"          // Do jump to absolute address CreateTask_my
 143 "    .long   CreateTask_my\n"
 144 );
 145 }
 146 
 147 /*************************************************************/
 148 //** CreateTask_my @ 0x006B562C - 0x006B5630, length=2
 149 void __attribute__((naked,noinline)) CreateTask_my() {
 150 asm volatile (
 151 "    STMFD   SP!, {R0}\n"
 152 //R3 = Pointer to task function to create
 153 
 154 /*** INSTALL capt_seq_task() hook ***/
 155 "    LDR     R0, =task_CaptSeq\n"       // DryOS original code function ptr.
 156 "    CMP     R0, R3\n"                  // is the given taskptr equal to our searched function?
 157 "    LDREQ   R3, =capt_seq_task\n"      // if so replace with our task function base ptr.
 158 "    BEQ     exitHook\n"                // below compares not necessary if this check has found something.
 159 
 160 /*** INSTALL exp_drv_task() hook ***/
 161 "    LDR     R0, =task_ExpDrv\n"
 162 "    CMP     R0, R3\n"
 163 "    LDREQ   R3, =exp_drv_task\n"
 164 "    BEQ     exitHook\n"
 165 
 166 /*** INSTALL filewrite() hook ***/
 167 "    LDR     R0, =task_FileWrite\n"
 168 "    CMP     R0, R3\n"
 169 "    LDREQ   R3, =filewritetask\n"
 170 "    BEQ     exitHook\n"
 171 
 172 /*** INSTALL movie_record_task() hook ***/
 173 "    LDR     R0, =task_MovieRecord\n"
 174 "    CMP     R0, R3\n"
 175 "    LDREQ   R3, =movie_record_task\n"
 176 "    BEQ     exitHook\n"
 177 
 178 /*** INSTALL liveimage_task() hook ***/
 179 "    LDR     R0, =task_LiveImageTask\n"
 180 "    CMP     R0, R3\n"
 181 "    LDREQ   R3, =liveimage_task\n"
 182 "    BEQ     exitHook\n"
 183 
 184 /*** INSTALL init_file_modules_task() hook ***/
 185 "    LDR     R0, =task_InitFileModules\n"
 186 "    CMP     R0, R3\n"
 187 "    LDREQ   R3, =init_file_modules_task\n"
 188 
 189 "exitHook:\n" 
 190 // restore overwritten registers
 191 "    LDMFD   SP!, {R0}\n"
 192 // Execute overwritten instructions from original code, then jump to firmware
 193 "    STMFD   SP!, {R1-R9,LR} \n"
 194 "    MOV     R4, R0 \n"
 195 "    LDR     PC, =0x006B5634 \n"  // Continue in firmware
 196 );
 197 }
 198 
 199 /*************************************************************/
 200 //** sub_FF8203C4_my @ 0xFF8203C4 - 0xFF82042C, length=27
 201 void __attribute__((naked,noinline)) sub_FF8203C4_my() {
 202 
 203    // Replacement of sub_ for correct power-on.
 204    // (short press = playback mode, long press = record mode)
 205    // ON/OFF switch state read at 0xFF82BA98
 206    // value and pointer from sub_FF867FD8
 207    *(int*)(0x29bc + 4) = (*(int*)0xC022F48C)&0x100000 ? 0x200000 : 0x100000;
 208 
 209 asm volatile (
 210 "    LDR     R0, =0xFF82043C \n"
 211 "    MOV     R1, #0 \n"
 212 "    LDR     R3, =0xFF820474 \n"
 213 
 214 "loc_FF8203D0:\n"
 215 "    CMP     R0, R3 \n"
 216 "    LDRCC   R2, [R0], #4 \n"
 217 "    STRCC   R2, [R1], #4 \n"
 218 "    BCC     loc_FF8203D0 \n"
 219 "    LDR     R0, =0xFF820474 \n"
 220 "    MOV     R1, #0x1C0 \n"
 221 "    LDR     R3, =0xFF82065C \n"
 222 
 223 "loc_FF8203EC:\n"
 224 "    CMP     R0, R3 \n"
 225 "    LDRCC   R2, [R0], #4 \n"
 226 "    STRCC   R2, [R1], #4 \n"
 227 "    BCC     loc_FF8203EC \n"
 228 "    MOV     R0, #0xD2 \n"
 229 "    MSR     CPSR_cxsf, R0 \n"
 230 "    MOV     SP, #0x1000 \n"
 231 "    MOV     R0, #0xD3 \n"
 232 "    MSR     CPSR_cxsf, R0 \n"
 233 "    MOV     SP, #0x1000 \n"
 234 "    LDR     R0, =0x3A8 \n"
 235 "    LDR     R2, =0xEEEEEEEE \n"
 236 "    MOV     R3, #0x1000 \n"
 237 
 238 "loc_FF820420:\n"
 239 "    CMP     R0, R3 \n"
 240 "    STRCC   R2, [R0], #4 \n"
 241 "    BCC     loc_FF820420 \n"
 242 "    B       sub_FF8228DC_my \n"  // --> Patched. Old value = 0xFF8228DC.
 243 );
 244 }
 245 
 246 /*************************************************************/
 247 //** sub_FF8228DC_my @ 0xFF8228DC - 0xFF822A50, length=94
 248 void __attribute__((naked,noinline)) sub_FF8228DC_my() {
 249 asm volatile (
 250 "    LDR     R0, =0x1A58 \n"
 251 "    STR     LR, [SP, #-4]! \n"
 252 "    SUB     SP, SP, #0x7C \n"
 253 "    MOV     R1, #0x80000 \n"
 254 "    STR     R1, [R0] \n"
 255 "    LDR     R0, =0x40BCE980 \n"
 256 "    LDR     R1, =0x1A5C \n"
 257 "    STR     R0, [R1] \n"
 258 "    LDR     R1, =0x1A60 \n"
 259 "    ADD     R0, R0, #0x2000 \n"
 260 "    STR     R0, [R1] \n"
 261 "    MOV     R1, #0x78 \n"
 262 "    ADD     R0, SP, #4 \n"
 263 "    BL      sub_006BD068 \n"
 264 "    MOV     R0, #0x84000 \n"
 265 "    STR     R0, [SP, #8] \n"
 266 
 267 #if defined(CHDK_NOT_IN_CANON_HEAP) // use original heap offset if CHDK is loaded in high memory
 268 "    LDR     R0, =0x182980 \n"
 269 #else
 270 "    LDR     R0, =new_sa\n"   // otherwise use patched value
 271 "    LDR     R0, [R0]\n"      //
 272 #endif
 273 
 274 "    LDR     R2, =0x5817B0 \n"
 275 "    STR     R0, [SP, #0xC] \n"
 276 "    SUB     R0, R2, R0 \n"
 277 "    STR     R0, [SP, #0x10] \n"
 278 "    MOV     R0, #0x22 \n"
 279 "    STR     R0, [SP, #0x1C] \n"
 280 "    MOV     R0, #0x7C \n"
 281 "    STR     R0, [SP, #0x20] \n"
 282 "    LDR     R1, =0x58A000 \n"
 283 "    LDR     R0, =0x1D3 \n"
 284 "    STR     R1, [SP, #4] \n"
 285 "    STR     R0, [SP, #0x24] \n"
 286 "    MOV     R0, #0x96 \n"
 287 "    STR     R2, [SP, #0x14] \n"
 288 "    STR     R1, [SP, #0x18] \n"
 289 "    STR     R0, [SP, #0x28] \n"
 290 "    STR     R0, [SP, #0x2C] \n"
 291 "    MOV     R0, #0x64 \n"
 292 "    STR     R0, [SP, #0x30] \n"
 293 "    MOV     R0, #0 \n"
 294 "    STR     R0, [SP, #0x34] \n"
 295 "    STR     R0, [SP, #0x38] \n"
 296 "    STR     R0, [SP, #0x3C] \n"
 297 "    MOV     R0, #0x10 \n"
 298 "    STR     R0, [SP, #0x60] \n"
 299 "    MOV     R0, #0x1000 \n"
 300 "    STR     R0, [SP, #0x64] \n"
 301 "    MOV     R0, #0x100 \n"
 302 "    STR     R0, [SP, #0x68] \n"
 303 "    MOV     R0, #0x2000 \n"
 304 "    STR     R0, [SP, #0x6C] \n"
 305 "    LDR     R1, =sub_FF8248DC_my \n"  // --> Patched. Old value = 0xFF8248DC.
 306 "    MOV     R2, #0 \n"
 307 "    ADD     R0, SP, #4 \n"
 308 "    BL      sub_006B1B9C \n"
 309 "    ADD     SP, SP, #0x7C \n"
 310 "    LDR     PC, [SP], #4 \n"
 311 );
 312 }
 313 
 314 /*************************************************************/
 315 //** sub_FF8248DC_my @ 0xFF8248DC - 0xFF824974, length=39
 316 void __attribute__((naked,noinline)) sub_FF8248DC_my() {
 317 asm volatile (
 318 "    STMFD   SP!, {R4,LR} \n"
 319 "    LDR     R4, =0xFF824998 /*'/_term'*/ \n"
 320 "    BL      sub_FF820858 \n"
 321 "    LDR     R1, =0x1A58 \n"
 322 "    LDR     R0, =0x19F0 \n"
 323 "    LDR     R1, [R1] \n"
 324 "    LDR     R0, [R0] \n"
 325 "    ADD     R1, R1, #0x10 \n"
 326 "    CMP     R0, R1 \n"
 327 "    LDRCC   R0, =0xFF8249A8 /*'USER_MEM size checking'*/ \n"
 328 "    BLCC    _err_init_task \n"
 329 "    BL      sub_FF8236A4 \n"
 330 "    CMP     R0, #0 \n"
 331 "    LDRLT   R0, =0xFF8249C0 /*'dmSetup'*/ \n"
 332 "    BLLT    _err_init_task \n"
 333 "    BL      sub_FF8224E8 \n"
 334 "    CMP     R0, #0 \n"
 335 "    LDRLT   R0, =0xFF8249C8 /*'termDriverInit'*/ \n"
 336 "    BLLT    _err_init_task \n"
 337 "    MOV     R0, R4 \n"
 338 "    BL      sub_FF8225D0 \n"
 339 "    CMP     R0, #0 \n"
 340 "    LDRLT   R0, =0xFF8249D8 /*'termDeviceCreate'*/ \n"
 341 "    BLLT    _err_init_task \n"
 342 "    MOV     R0, R4 \n"
 343 "    BL      sub_FF822100 \n"
 344 "    CMP     R0, #0 \n"
 345 "    LDRLT   R0, =0xFF8249EC /*'stdioSetup'*/ \n"
 346 "    BLLT    _err_init_task \n"
 347 "    BL      sub_FF824F44 \n"
 348 "    CMP     R0, #0 \n"
 349 "    LDRLT   R0, =0xFF8249F8 /*'stdlibSetup'*/ \n"
 350 "    BLLT    _err_init_task \n"
 351 "    BL      sub_FF8210A8 \n"
 352 "    CMP     R0, #0 \n"
 353 "    LDRLT   R0, =0xFF824A04 /*'extlib_setup'*/ \n"
 354 "    BLLT    _err_init_task \n"
 355 "    LDMFD   SP!, {R4,LR} \n"
 356 "    B       sub_FF827C18_my \n"  // --> Patched. Old value = 0xFF827C18.
 357 );
 358 }
 359 
 360 /*************************************************************/
 361 //** sub_FF827C18_my @ 0xFF827C18 - 0xFF827C88, length=29
 362 void __attribute__((naked,noinline)) sub_FF827C18_my() {
 363 asm volatile (
 364 "    STMFD   SP!, {R3,LR} \n"
 365 //"  BL      _sub_FF8962FC \n"  // --> Nullsub call removed.
 366 "    BL      sub_FF8366F8 \n"
 367 "    CMP     R0, #0 \n"
 368 "    BNE     loc_FF827C3C \n"
 369 "    BL      sub_FF82C900 /*_IsNormalCameraMode_FW*/ \n"
 370 "    CMP     R0, #0 \n"
 371 "    MOVNE   R0, #1 \n"
 372 "    BNE     loc_FF827C40 \n"
 373 
 374 "loc_FF827C3C:\n"
 375 "    MOV     R0, #0 \n"
 376 
 377 "loc_FF827C40:\n"
 378 //"  BL      _sub_FF82BA84 \n"  // startup checks, disable
 379 //"  CMP     R0, #0 \n"
 380 //"  BNE     loc_FF827C54 \n"
 381 //"  BL      _sub_FF82B26C \n"
 382 
 383 "loc_FF827C50:\n"
 384 //"  B       loc_FF827C50 \n"
 385 
 386 "loc_FF827C54:\n"
 387 "    BL      sub_006B8A8C \n"
 388 "    LDR     R1, =0x60E000 \n"
 389 "    MOV     R0, #0 \n"
 390 "    BL      sub_FF836BF0 \n"
 391 "    BL      sub_006B8DD4 \n"
 392 "    MOV     R3, #0 \n"
 393 "    STR     R3, [SP] \n"
 394 "    LDR     R3, =task_Startup_my \n"  // --> Patched. Old value = 0xFF827BB0.
 395 "    MOV     R2, #0 \n"
 396 "    MOV     R1, #0x19 \n"
 397 "    LDR     R0, =0xFF827C94 /*'Startup'*/ \n"
 398 "    BL      _CreateTask \n"
 399 "    MOV     R0, #0 \n"
 400 "    LDMFD   SP!, {R3,PC} \n"
 401 );
 402 }
 403 
 404 /*************************************************************/
 405 //** task_Startup_my @ 0xFF827BB0 - 0xFF827C14, length=26
 406 void __attribute__((naked,noinline)) task_Startup_my() {
 407 asm volatile (
 408 "    STMFD   SP!, {R4,LR} \n"
 409 "    BL      sub_FF822E10 \n"
 410 "    BL      sub_FF82BED8 \n"
 411 "    BL      sub_FF82B218 \n"
 412 //"  BL      _sub_FF868594 \n"  // --> Nullsub call removed.
 413 "    BL      sub_FF836934 \n"
 414 //"  BL      _sub_FF8367F4 \n"  // load DISKBOOT.BIN
 415 "    BL      sub_FF836A8C \n"
 416 "    BL      sub_FF836CC4 \n"
 417 //"  BL      _sub_FF836A80 \n"  // --> Nullsub call removed.
 418 "    BL      sub_FF836970 \n"
 419 "    BL      sub_FF8329C4 \n"
 420 "    BL      sub_FF836CCC \n"
 421 "    BL      CreateTask_spytask\n" // added
 422 "    BL      taskcreatePhySw_my \n"  // --> Patched. Old value = 0xFF82B930.
 423 "    BL      init_required_fw_features\n" // added
 424 "    BL      sub_FF830AE8 \n"
 425 "    BL      sub_FF8ACAC8 \n"
 426 "    BL      sub_FF829008 \n"
 427 "    BL      sub_FF82AD74 \n"
 428 "    BL      sub_FF836508 \n"
 429 "    BL      sub_FF82B1CC \n"
 430 "    BL      sub_FF82AD08 \n"
 431 //"  BL      _sub_FF836A84 \n"  // --> Nullsub call removed.
 432 "    BL      sub_FF829C98 \n"
 433 "    BL      sub_FF82ACC4 \n"
 434 "    LDMFD   SP!, {R4,LR} \n"
 435 "    B       sub_FF822F38 \n"
 436 );
 437 }
 438 
 439 /*************************************************************/
 440 //** taskcreatePhySw_my @ 0xFF82B930 - 0xFF82B974, length=18
 441 void __attribute__((naked,noinline)) taskcreatePhySw_my() {
 442 asm volatile (
 443 "    STMFD   SP!, {R3-R5,LR} \n"
 444 "    BL      sub_FF83575C \n"
 445 "    BL      sub_FF82C838 /*_IsFactoryMode_FW*/ \n"
 446 "    CMP     R0, #0 \n"
 447 "    BLEQ    sub_FF8356C4 /*_OpLog.Start_FW*/ \n"
 448 "    LDR     R4, =0x1C94 \n"
 449 "    LDR     R0, [R4, #4] \n"
 450 "    CMP     R0, #0 \n"
 451 "    BNE     loc_FF82B974 \n"
 452 "    MOV     R3, #0 \n"
 453 "    STR     R3, [SP] \n"
 454 "    LDR     R3, =mykbd_task \n"  // --> Patched. Old value = 0xFF82B8FC.
 455 "    MOV     R2, #0x2000 \n"  // --> Patched. Old value = 0x800. stack size for new task_PhySw so we don't have to do stack switch
 456 "    MOV     R1, #0x17 \n"
 457 "    LDR     R0, =0xFF82BBE0 /*'PhySw'*/ \n"
 458 "    BL      sub_006B7B9C /*_CreateTaskStrictly*/ \n"
 459 "    STR     R0, [R4, #4] \n"
 460 
 461 "loc_FF82B974:\n"
 462 "    LDMFD   SP!, {R3-R5,PC} \n"
 463 );
 464 }
 465 
 466 /*************************************************************/
 467 //** init_file_modules_task @ 0xFF857C38 - 0xFF857C6C, length=14
 468 void __attribute__((naked,noinline)) init_file_modules_task() {
 469 asm volatile (
 470 "    STMFD   SP!, {R4-R6,LR} \n"
 471 "    BL      sub_FF89CF24 \n"
 472 "    LDR     R5, =0x5006 \n"
 473 "    MOVS    R4, R0 \n"
 474 "    MOVNE   R1, #0 \n"
 475 "    MOVNE   R0, R5 \n"
 476 "    BLNE    _PostLogicalEventToUI \n"
 477 "    BL      sub_FF89CF58 \n"
 478 "    BL      core_spytask_can_start\n"  // CHDK: Set "it's-safe-to-start" flag for spytask
 479 "    CMP     R4, #0 \n"
 480 "    LDMNEFD SP!, {R4-R6,PC} \n"
 481 "    MOV     R0, R5 \n"
 482 "    LDMFD   SP!, {R4-R6,LR} \n"
 483 "    MOV     R1, #0 \n"
 484 "    B       _PostLogicalEventToUI \n"
 485 );
 486 }
 487 
 488 /*
 489     *** TEMPORARY workaround ***
 490     Init stuff to avoid asserts on cameras running DryOS r54+
 491     Execute this only once
 492  */
 493 void init_required_fw_features(void) {
 494     extern void _init_focus_eventflag();
 495     extern void _init_nd_eventflag();
 496     extern void _init_nd_semaphore();
 497     //extern void _init_zoom_semaphore(); // for MoveZoomLensWithPoint
 498 
 499     _init_focus_eventflag();
 500     _init_nd_eventflag();
 501     _init_nd_semaphore();

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