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

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