root/loader/ixus145_elph135/main.c

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

DEFINITIONS

This source file includes following definitions.
  1. my_restart

   1 #include "../generic/check_compat.c"
   2 
   3 extern long *blob_chdk_core;
   4 extern long blob_chdk_core_size;
   5 
   6 void __attribute__((noreturn)) my_restart() 
   7 {
   8     // DEBUG: blink led
   9     /*
  10     int counter;
  11 
  12     while(1) {
  13     counter = DELAY; *DEBUG_LED = 0x46;  while (counter--) { asm("nop\n nop\n"); };
  14     counter = DELAY; *DEBUG_LED = 0x44;  while (counter--) { asm("nop\n nop\n"); };
  15     }
  16     */
  17 
  18     long *dst = (long*)MEMISOSTART;
  19     const long *src = blob_chdk_core;
  20     long length = (blob_chdk_core_size + 3) >> 2;
  21 
  22   core_copy(src, dst, length);
  23 
  24     // ROM:FF826C68 resetcode here:
  25     // search for "0x12345678"
  26     // [sx170]  
  27   asm volatile (
  28                 //"    BL          sub_FF863224 \n" 
  29                 //"    BL          sub_003F79A4 \n" 
  30                 //"    BL          sub_003F6884 \n" 
  31                 //"    BL          sub_FF88DC4C \n" 
  32                 //"    CMP         R4, #7 \n" 
  33                 //"    LDMEQFD SP!, {R4,PC} \n" 
  34 "    MOV     R0, #0x78 \n"
  35 "    MCR     p15, 0, R0, c1, c0 \n"
  36 "    MOV     R0, #0 \n"
  37 "    MCR     p15, 0, R0, c7, c10, 4 \n"
  38 "    MCR     p15, 0, R0, c7, c5 \n"
  39 "    MCR     p15, 0, R0, c7, c6 \n"
  40 "    MOV     R0, #0x80000006 \n"
  41 "    MCR     p15, 0, R0, c9, c1 \n"
  42 "    MCR     p15, 0, R0, c9, c1, 1 \n"
  43 "    MRC     p15, 0, R0, c1, c0 \n"
  44 "    ORR     R0, R0, #0x50000 \n"
  45 "    MCR     p15, 0, R0, c1, c0 \n"
  46 "    LDR     R0, =0x12345678 \n"
  47 "    MOV     R1, #0x80000000 \n"
  48 "    STR     R0, [R1, #0xFFC] \n"
  49                 //"    LDR         R0, =0xFF820000 \n" 
  50                 "MOV     R0, %0\n"              // new jump-vector                              
  51                 "    LDMFD   SP!, {R4,LR} \n" 
  52 "    BX      R0 \n"
  53                 : : "r"(MEMISOSTART) : "memory","r0","r1","r2","r3","r4"
  54         );
  55   while(1);

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