root/platform/s2is/sub/100f/boot.c

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

DEFINITIONS

This source file includes following definitions.
  1. h_kbd_p2_f
  2. boot
  3. h_usrInit
  4. h_usrKernelInit
  5. 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 void boot();
  14 
  15 /* "relocated" functions */
  16 void __attribute__((naked,noinline)) h_usrInit();
  17 void __attribute__((naked,noinline)) h_usrKernelInit();
  18 void __attribute__((naked,noinline)) h_usrRoot();
  19 
  20 extern void mykbd_task_proceed_2();
  21 
  22 
  23 void __attribute__((naked,noinline)) h_kbd_p2_f()
  24 {
  25     asm volatile (
  26                  "LDR     R4, =0x10390\n"
  27                  "LDR     R1, [R4,#0x30]\n"
  28                  "TST     R1, #0x8000\n"
  29                  "BEQ     loc_FF829394\n"
  30                  "MOV     R1, #0\n"
  31                  "MOV     R0, #0xF\n"
  32                  "MOV     R2, #0x8000\n"
  33                  "BL      sub_FF829978\n"
  34                  "LDR     R3, [R4,#0x30]\n"
  35                  "BIC     R3, R3, #0x8000\n"
  36                  "STR     R3, [R4,#0x30]\n"
  37                  "MOV     R1, R3\n"
  38   "loc_FF829394:\n"
  39                  "TST     R1, #1\n"
  40                  "BEQ     loc_FF8293BC\n"
  41                  "MOV     R0, #0\n"
  42                  "MOV     R1, R0\n"
  43                  "MOV     R2, R5\n"
  44                  "BL      sub_FF829978\n"
  45                  "LDR     R3, [R4,#0x30]\n"
  46                  "BIC     R3, R3, #1\n"
  47                  "STR     R3, [R4,#0x30]\n"
  48                  "MOV     R1, R3\n"
  49   "loc_FF8293BC:\n"
  50                  "TST     R1, #2\n"
  51                  "BEQ     loc_FF8293E4\n"
  52                  "MOV     R1, #0\n"
  53                  "MOV     R0, R5\n"
  54                  "MOV     R2, #2\n"
  55                  "BL      sub_FF829978\n"
  56                  "LDR     R3, [R4,#0x30]\n"
  57                  "BIC     R3, R3, #2\n"
  58                  "STR     R3, [R4,#0x30]\n"
  59                  "MOV     R1, R3\n"
  60   "loc_FF8293E4:\n"
  61                  "LDR     R3, [R4,#0x34]\n"
  62                  "LDR     R2, [R4,#0x38]\n"
  63                  "ADD     R3, R1, R3\n"
  64                  "CMN     R3, R2\n"
  65                  "BEQ     loc_FF8293FC\n"
  66                  "BL      sub_FF8299D8\n"
  67   "loc_FF8293FC:\n"
  68                  "LDR     R3, =0x1FC0\n"
  69                  "LDR     R1, [R3]\n"
  70                  "CMP     R1, #1\n"
  71                  "BNE     loc_FF829418\n"
  72                  "MOV     R0, #0x28\n"
  73                  "MOV     R2, #0x100\n"
  74                  "BL      sub_FF829978\n"
  75   "loc_FF829418:\n"
  76                  "LDR     R3, =0x1038C\n"
  77                  "LDR     R0, [R3]\n"
  78                  "CMP     R0, #1\n"
  79                  "BNE     loc_FF829440\n"
  80                  "MOV     R3, #0x30\n"
  81                  "STRH    R3, [SP,#2]\n"
  82                  "MOV     R1, R6\n"
  83                  "LDR     R3, =0x103F0\n"
  84                  "MOV     LR, PC\n"
  85                  "LDR     PC, [R3]\n"
  86   "loc_FF829440:\n"
  87                  "BL      sub_FF82A37C\n"
  88                  "B       mykbd_task_proceed_2\n"
  89     );
  90 }
  91 
  92 
  93 void boot()
  94 {
  95     long *canon_data_src = (void*)0xFFB09320;
  96     long *canon_data_dst = (void*)0x1900;
  97     long canon_data_len = 0xDBB0;
  98     long *canon_bss_start = (void*)0xF4B0; // just after data
  99     long canon_bss_len = 0x6EF50 - 0xF4B0;
 100     long i;
 101 
 102     asm volatile (
 103         "MRC     p15, 0, R0,c1,c0\n"
 104         "ORR     R0, R0, #0x1000\n"
 105         "ORR     R0, R0, #4\n"
 106         "ORR     R0, R0, #1\n"
 107         "MCR     p15, 0, R0,c1,c0\n"
 108     :::"r0");
 109 
 110 
 111     for(i=0;i<canon_data_len/4;i++)
 112         canon_data_dst[i]=canon_data_src[i];
 113 
 114     for(i=0;i<canon_bss_len/4;i++)
 115         canon_bss_start[i]=0;
 116 
 117     asm volatile (
 118         "MRC     p15, 0, R0,c1,c0\n"
 119         "ORR     R0, R0, #0x1000\n"
 120         "BIC     R0, R0, #4\n"
 121         "ORR     R0, R0, #1\n"
 122         "MCR     p15, 0, R0,c1,c0\n"
 123     :::"r0");
 124 
 125     h_usrInit();
 126 }
 127 
 128 
 129 void h_usrInit()
 130 {
 131     asm volatile (
 132         "STR    LR, [SP,#-4]!\n"
 133         "BL     sub_FF811A40\n"
 134         "MOV    R0, #2\n"
 135         "MOV    R1, R0\n"
 136         "BL     sub_FFAEFA60\n"
 137         "BL     sub_FFADC138\n"
 138         "BL     sub_FF811298\n"
 139         "BL     sub_FF811800\n"
 140         "LDR    LR, [SP],#4\n"
 141         "B      h_usrKernelInit\n"
 142     );
 143 }
 144 
 145 void  h_usrKernelInit()
 146 {
 147     asm volatile (
 148         "STMFD  SP!, {R4,LR}\n"
 149         "SUB    SP, SP, #8\n"
 150         "BL     sub_FFAEFF60\n"
 151         "BL     sub_FFB0276C\n"
 152         "LDR    R3, =0xE8EC\n"
 153         "LDR    R2, =0x6A2C0\n"
 154         "LDR    R1, [R3]\n"
 155         "LDR    R0, =0x6E910\n"
 156         "MOV    R3, #0x100\n"
 157         "BL     sub_FFAFE09C\n"
 158         "LDR    R3, =0xE8AC\n"
 159         "LDR    R0, =0xECCC\n"
 160         "LDR    R1, [R3]\n"
 161         "BL     sub_FFAFE09C\n"
 162         "LDR    R3, =0xE968\n"
 163         "LDR    R0, =0x6E8E4\n"
 164         "LDR    R1, [R3]\n"
 165         "BL     sub_FFAFE09C\n"
 166         "BL     sub_FFB072EC\n"
 167         "BL     sub_FF811384\n"
 168         "MOV    R4, #0\n"
 169         "MOV    R3, R0\n"
 170         "MOV    R12, #0x800\n"
 171         "LDR    R0, =h_usrRoot\n"
 172         "MOV    R1, #0x4000\n"
 173     );    
 174 //      "LDR    R2, =0x9EF50\n" // 0x6EF50 + 0x30000
 175     asm volatile (
 176         "LDR     R2, =new_sa\n"
 177         "LDR     R2, [R2]\n"
 178     );
 179     asm volatile (
 180         "STR    R12, [SP]\n"
 181         "STR    R4, [SP,#4]\n"
 182         "BL     sub_FFAFF9AC\n"
 183         "ADD    SP, SP, #8\n"
 184         "LDMFD  SP!, {R4,PC}\n"
 185     );
 186 }
 187 
 188 
 189 
 190 void  h_usrRoot()
 191 {
 192     asm volatile (
 193         "STMFD  SP!, {R4,R5,LR}\n"
 194         "MOV    R5, R0\n"
 195         "MOV    R4, R1\n"
 196         "BL     sub_FF811AA8\n"
 197         "MOV    R1, R4\n"
 198         "MOV    R0, R5\n"
 199         "BL     sub_FFAF60DC\n"
 200         "MOV    R1, R4\n"
 201         "MOV    R0, R5\n"
 202         "BL     sub_FFAF6B54\n"
 203         "BL     sub_FF8118C0\n"
 204         "BL     sub_FF8117DC\n"
 205         "MOV    R0, #0x32\n"
 206         "BL     sub_FFAF8AF8\n"
 207         "BL     sub_FF811AEC\n"
 208         "BL     sub_FF811ACC\n"
 209         "BL     sub_FF811B18\n"
 210         "BL     sub_FFAF83B8\n"
 211         "BL     sub_FF811A9C\n"
 212     );
 213 
 214     _taskCreateHookAdd(createHook);
 215     _taskDeleteHookAdd(deleteHook);
 216 
 217     drv_self_hide();
 218 
 219     asm volatile (
 220         "LDMFD  SP!, {R4,R5,LR}\n"
 221         "B      sub_FF811444\n"
 222     );
 223 }
 224 

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