root/platform/ixusizoom_sd30/sub/100g/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 extern void ShowCode(int code);
   5 extern void ShowCodeR(int code);
   6 /* These functions need to be taken from the original firmware and addresses need to be modifyed */
   7 
   8 /* Ours stuff */
   9 extern long wrs_kernel_bss_start;
  10 extern long wrs_kernel_bss_end;
  11 extern void createHook (void *pNewTcb);
  12 extern void deleteHook (void *pTcb);
  13 const char * const new_sa = &_end;
  14 
  15 void boot();
  16 
  17 /* "relocated" functions */
  18 void __attribute__((naked,noinline)) h_usrInit();
  19 void __attribute__((naked,noinline)) h_usrKernelInit();
  20 void __attribute__((naked,noinline)) h_usrRoot();
  21 
  22 void boot()             //done
  23 {
  24     long *canon_data_src = (void*)0xFFAE7EE0; // This is the address of the "Startofdata"-4 string on the firmware
  25     long *canon_data_dst = (void*)MEMBASEADDR; // This is where the boot data is copiedduring firmware update
  26     long canon_data_len = 0xE7D0; // This is the length of data from "Startofdata" to the end of the firmware dump
  27     long *canon_bss_start = (void*) (canon_data_len + MEMBASEADDR); //  = 0xEB60 + 0x1900,  just after data
  28     long canon_bss_len = MEMISOSTART - (long) canon_bss_start; // The original address of h_usrKernelInit - bss start
  29     long i;
  30 
  31     asm volatile (
  32         "MRC     p15, 0, R0,c1,c0\n"
  33         "ORR     R0, R0, #0x1000\n"
  34         "ORR     R0, R0, #4\n"
  35         "ORR     R0, R0, #1\n"
  36         "MCR     p15, 0, R0,c1,c0\n"
  37     :::"r0");
  38 
  39 
  40     for(i=0;i<canon_data_len/4;i++)
  41         canon_data_dst[i]=canon_data_src[i];
  42 
  43     for(i=0;i<canon_bss_len/4;i++)
  44         canon_bss_start[i]=0;
  45 
  46     asm volatile (
  47         "MRC     p15, 0, R0,c1,c0\n"
  48         "ORR     R0, R0, #0x1000\n"
  49         "BIC     R0, R0, #4\n"
  50         "ORR     R0, R0, #1\n"
  51         "MCR     p15, 0, R0,c1,c0\n"
  52     :::"r0");
  53     
  54     h_usrInit();
  55 }
  56 
  57 
  58 void h_usrInit() //done 
  59 {
  60         asm volatile (
  61         "STR     LR, [SP,#-4]!\n"
  62         "BL      sub_FF811A40\n"
  63         "MOV     R0, #2\n"
  64         "MOV     R1, R0\n"
  65         "BL      sub_FFACBB40\n"
  66         "BL      sub_FFAB8218\n"
  67         "BL      sub_FF811298\n"
  68         "BL      sub_FF811800\n"
  69         "LDR     LR, [SP],#4\n"
  70         "B       h_usrKernelInit\n"
  71         );
  72 }
  73 
  74 
  75 void  h_usrKernelInit() //done   @ 0xFF81181C in dump
  76 {
  77         asm volatile (
  78         "STMFD   SP!, {R4,LR}\n"
  79         "SUB     SP, SP, #8\n"
  80         "BL      sub_FFACC040\n"
  81         "BL      sub_FFAE132C\n"
  82         "LDR     R3, =0xF05C\n"
  83         "LDR     R2, =0xA4740\n"
  84         "LDR     R1, [R3]\n"
  85         "LDR     R0, =0xA7FB0\n"
  86         "MOV     R3, #0x100\n"
  87         "BL      sub_FFADA17C\n"
  88         "LDR     R3, =0xF01C\n"
  89         "LDR     R0, =0xF8E4\n"
  90         "LDR     R1, [R3]\n"
  91         "BL      sub_FFADA17C\n"
  92         "LDR     R3, =0xF0D8\n"
  93         "LDR     R0, =0xA7F84\n"
  94         "LDR     R1, [R3]\n"
  95         "BL      sub_FFADA17C\n"
  96         "BL      sub_FFAE5EAC\n"
  97         "BL      sub_FF811384\n"
  98         "MOV     R4, #0\n"
  99         "MOV     R3, R0\n"
 100         "MOV     R12, #0x800\n"
 101         "LDR     R0, =h_usrRoot\n"
 102         "MOV     R1, #0x4000\n"
 103 
 104         "LDR     R2, =new_sa\n"
 105         "LDR     R2, [R2]\n"
 106 
 107         "STR     R12, [SP]\n"
 108         "STR     R4, [SP,#4]\n"
 109         "BL      sub_FFADE56C\n"
 110         "ADD     SP, SP, #8\n"
 111         "LDMFD   SP!, {R4,PC}\n"
 112         );
 113 }
 114 
 115 
 116 void  h_usrRoot() // 0xFF811B44 in dump  //done
 117 {
 118         asm volatile (
 119         "STMFD   SP!, {R4,R5,LR}\n"
 120         "MOV     R5, R0\n"
 121         "MOV     R4, R1\n"
 122         "BL      sub_FF811AA8\n"
 123         "MOV     R1, R4\n"
 124         "MOV     R0, R5\n"
 125         "BL      sub_FFAD21BC\n" // memInit
 126         "MOV     R1, R4\n"
 127         "MOV     R0, R5\n"
 128         "BL      sub_FFAD2C34\n" // mmPartLibInit <----- OK up to here!!
 129         //NULLSTUB
 130         "BL      sub_FF8117DC\n"
 131         "MOV     R0, #0x32\n"
 132         "BL      sub_FFAD4BD8\n" // selectInit
 133         "BL      sub_FF811AEC\n"
 134         "BL      sub_FF811ACC\n"
 135         "BL      sub_FF811B18\n"
 136         "BL      sub_FFAD4498\n" //selTaskDeleteHookAdd
 137         "BL      sub_FF811A9C\n"
 138         );
 139 
 140         _taskCreateHookAdd(createHook);
 141         _taskDeleteHookAdd(deleteHook);
 142 
 143         drv_self_hide();
 144 
 145         asm volatile (
 146         "LDMFD   SP!, {R4,R5,LR}\n"
 147         "B       sub_FF811444\n"
 148         );
 149 
 150 }

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