root/platform/g7/sub/100j/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     long *canon_data_src = (void*)0xFFBB1B50;
  26     long *canon_data_dst = (void*)0x1900;
  27     long canon_data_len = 0xD610;
  28     long *canon_bss_start = (void*)0xEF10; // just after data
  29     long canon_bss_len = 0xA7910 - 0xEF10;
  30     long i;
  31 
  32     asm volatile (
  33         "MRC     p15, 0, R0,c1,c0\n"
  34         "ORR     R0, R0, #0x1000\n"
  35         "ORR     R0, R0, #4\n"
  36         "ORR     R0, R0, #1\n"
  37         "MCR     p15, 0, R0,c1,c0\n"
  38     :::"r0");
  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()
  59 {
  60     asm volatile (
  61         "STR     LR, [SP,#-4]!\n"
  62         "BL      sub_FF811968\n"
  63         "MOV     R0, #2\n"
  64         "MOV     R1, R0\n"
  65         "BL      sub_FFB98688\n"
  66         "BL      sub_FFB8AD34\n"
  67         "BL      sub_FF8111C4\n"
  68         "BL      sub_FF811728\n"
  69         "LDR     LR, [SP],#4\n"
  70         "B       h_usrKernelInit\n"
  71     );
  72 }
  73 
  74 void  h_usrKernelInit()
  75 {
  76     asm volatile (
  77         "STMFD   SP!, {R4,LR}\n"
  78         "SUB     SP, SP, #8\n"
  79         "BL      sub_FFB98B88\n"
  80         "BL      sub_FFBAB970\n"
  81         "LDR     R3, =0xDF30\n"
  82         "LDR     R2, =0xA3DA0\n"
  83         "LDR     R1, [R3]\n"
  84         "LDR     R0, =0xA72D0\n"
  85         "MOV     R3, #0x100\n"
  86         "BL      sub_FFBA4A80\n"
  87         "LDR     R3, =0xDEF0\n"
  88         "LDR     R0, =0xE738\n"
  89         "LDR     R1, [R3]\n"
  90         "BL      sub_FFBA4A80\n"
  91         "LDR     R3, =0xDFAC\n"
  92         "LDR     R0, =0xA72A4\n"
  93         "LDR     R1, [R3]\n"
  94         "BL      sub_FFBA4A80\n"
  95         "BL      sub_FFBAFD2C\n"
  96         "BL      sub_FF8112AC\n"
  97         "MOV     R4, #0\n"
  98         "MOV     R3, R0\n"
  99         "MOV     R12, #0x800\n"
 100         "LDR     R0, =h_usrRoot\n"
 101         "MOV     R1, #0x4000\n"
 102     );    
 103 //      "LDR     R2, =0xE7910\n"        // 0xA7910 + 0x40000
 104     asm volatile (
 105         "LDR     R2, =new_sa\n"
 106         "LDR     R2, [R2]\n"
 107     );
 108     asm volatile (
 109         "STR     R12, [SP]\n"
 110         "STR     R4, [SP,#4]\n"
 111         "BL      sub_FFBA8BB0\n"
 112         "ADD     SP, SP, #8\n"
 113         "LDMFD   SP!, {R4,PC}\n"
 114     );
 115 }
 116 
 117 
 118 void  h_usrRoot()
 119 {
 120     asm volatile (
 121         "STMFD   SP!, {R4,R5,LR}\n"
 122         "MOV     R5, R0\n"
 123         "MOV     R4, R1\n"
 124         "BL      sub_FF8119D0\n"
 125         "MOV     R1, R4\n"
 126         "MOV     R0, R5\n"
 127         "BL      sub_FFB9D81C\n"
 128         "MOV     R1, R4\n"
 129         "MOV     R0, R5\n"
 130         "BL      sub_FFB9E294\n"
 131         "BL      sub_FF8117E8\n"
 132         "BL      sub_FF811704\n"
 133         "BL      sub_FF811A0C\n"
 134         "BL      sub_FF8119F0\n"
 135         "BL      sub_FF811A38\n"
 136         "BL      sub_FF8119C4\n"
 137     );
 138 
 139     _taskCreateHookAdd(createHook);
 140     _taskDeleteHookAdd(deleteHook);
 141 
 142     drv_self_hide();
 143 
 144     asm volatile (
 145         "LDMFD   SP!, {R4,R5,LR}\n"
 146         "B       sub_FF81136C\n"
 147     );
 148 }
 149 

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