root/platform/ixus60_sd600/sub/100d/boot.c

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

DEFINITIONS

This source file includes following definitions.
  1. boot
  2. h_usrInit
  3. h_usrKernelInit
  4. h_usrRoot

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "core.h"
   4 
   5 const char * const new_sa = &_end;
   6 
   7 /* Ours stuff */
   8 extern long wrs_kernel_bss_start;
   9 extern long wrs_kernel_bss_end;
  10 extern void createHook (void *pNewTcb);
  11 extern void deleteHook (void *pTcb);
  12 
  13 
  14 void boot();
  15 
  16 /* "relocated" functions */
  17 void __attribute__((naked,noinline)) h_usrInit();
  18 void __attribute__((naked,noinline)) h_usrKernelInit();
  19 void __attribute__((naked,noinline)) h_usrRoot();
  20 
  21 
  22 
  23 void boot()
  24 {
  25     // offset of "start of data" string in primary.bin - 4
  26     // All the asm code below is from: 0xFF8100F8
  27 
  28     long *canon_data_src = (void*)0xFFB204A0;
  29     long *canon_data_dst = (void*)0x1900;
  30     // up to the end of flash
  31     long canon_data_len = 0xBC80;
  32     // just after ROM data
  33     long *canon_bss_start = (void*)(0x1900+0xBC80);
  34     // BSS end offset (from FF810134 disasm) minus BSS start
  35     long canon_bss_len = 0x9C4B0 - (long)canon_bss_start;
  36     long i;
  37 
  38     asm volatile (
  39         "MRC     p15, 0, R0,c1,c0\n"
  40         "ORR     R0, R0, #0x1000\n"
  41         "ORR     R0, R0, #4\n"
  42         "ORR     R0, R0, #1\n"
  43         "MCR     p15, 0, R0,c1,c0\n"
  44     :::"r0");
  45 /*
  46         int * data = (int*)0x170000;
  47         for (i = 0; i < 30*1024*1024/4; i++) {
  48           data[i] = 0xCAFEDEAD;
  49         }
  50 */
  51 
  52     for(i=0;i<canon_data_len/4;i++)
  53         canon_data_dst[i]=canon_data_src[i];
  54 
  55     for(i=0;i<canon_bss_len/4;i++)
  56         canon_bss_start[i]=0;
  57 
  58 
  59     asm volatile (
  60         "MRC     p15, 0, R0,c1,c0\n"
  61         "ORR     R0, R0, #0x1000\n"
  62         "BIC     R0, R0, #4\n"
  63         "ORR     R0, R0, #1\n"
  64         "MCR     p15, 0, R0,c1,c0\n"
  65     :::"r0");
  66     h_usrInit();
  67 }
  68 
  69 
  70 void h_usrInit()        // 0xFF811990
  71 {
  72     asm volatile (
  73         "STR     LR, [SP,#-4]!\n"
  74         "BL      sub_FF81196C\n"
  75         "MOV     R0, #2\n"
  76         "MOV     R1, R0\n"
  77         "BL      sub_FFB05DF4\n"    // unknown_libname_805
  78         "BL      sub_FFAF90DC\n"    // excVecInit
  79         "BL      sub_FF8111C4\n"
  80         "BL      sub_FF81172C\n"
  81         "LDR     LR, [SP],#4\n"
  82         "B       h_usrKernelInit\n"
  83     );
  84 }
  85 
  86 void  h_usrKernelInit()     // 0xFF811748
  87 {
  88     asm volatile (
  89         "STMFD   SP!, {R4,LR}\n"
  90         "SUB     SP, SP, #8\n"
  91         "BL      sub_FFB062F4\n"
  92         "BL      sub_FFB19AFC\n"
  93         "LDR     R3, =0xC590\n"
  94         "LDR     R2, =0x99140\n"
  95         "LDR     R1, [R3]\n"
  96         "LDR     R0, =0x9BE70\n"
  97         "MOV     R3, #0x100\n"
  98         "BL      sub_FFB12C0C\n"
  99         "LDR     R3, =0xC550\n"
 100         "LDR     R0, =0xCD98\n"
 101         "LDR     R1, [R3]\n"
 102         "BL      sub_FFB12C0C\n"
 103         "LDR     R3, =0xC60C\n"
 104         "LDR     R0, =0x9BE44\n"
 105         "LDR     R1, [R3]\n"
 106         "BL      sub_FFB12C0C\n"
 107         "BL      sub_FFB1E67C\n"
 108         "BL      sub_FF8112B0\n"
 109         "MOV     R4, #0\n"
 110         "MOV     R3, R0\n"
 111         "MOV     R12, #0x800\n"
 112         "LDR     R0, =h_usrRoot\n"  // !!!
 113         "MOV     R1, #0x4000\n"
 114     );    
 115 
 116     asm volatile (
 117         "LDR     R2, =new_sa\n"
 118         "LDR     R2, [R2]\n"
 119     );
 120     asm volatile (
 121         "STR     R12, [SP]\n"                    
 122         "STR     R4, [SP,#4]\n"
 123         "BL      sub_FFB16D3C\n"
 124         "ADD     SP, SP, #8\n"
 125         "LDMFD   SP!, {R4,PC}\n"
 126     );
 127 }
 128 
 129 
 130 void  h_usrRoot()
 131 {
 132     asm volatile
 133     (
 134         "STMFD   SP!, {R4,R5,LR}\n"
 135         "MOV     R5, R0\n"
 136         "MOV     R4, R1\n"
 137         "BL      sub_FF8119D4\n"
 138         "MOV     R1, R4\n"
 139         "MOV     R0, R5\n"
 140         "BL      sub_FFB0AF88\n"    // memInit
 141         "MOV     R1, R4\n"
 142         "MOV     R0, R5\n"
 143         "BL      sub_FFB0BA00\n"    // memPartLibInit
 144         //"BL      sub_FF8117EC\n"    // nullsub
 145     "BL      sub_FF811708\n"
 146         "MOV     R0, #0x32\n"
 147         "BL      sub_FFB0D9A4\n"  // selectInit
 148     );
 149 
 150     asm volatile
 151     (   
 152         "BL      sub_FF811A14\n"
 153         "BL      sub_FF8119F8\n"
 154         "BL      sub_FF811A40\n"
 155         "BL      sub_FFB0D264\n" // selTaskDeleteHookAdd
 156         "BL      sub_FF8119C8\n"
 157     );
 158 
 159     _taskCreateHookAdd(createHook);
 160     _taskDeleteHookAdd(deleteHook);
 161 
 162     drv_self_hide();
 163 
 164     asm volatile (
 165         "LDMFD   SP!, {R4,R5,LR}\n"
 166         "B       sub_FF811370\n"
 167     );
 168 }
 169 

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