root/platform/s80/sub/101b/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
  5. set_jogdial_is_stopped
  6. sub_FF965FAC_my
  7. task_JogDial_my

   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 void boot()
  21 {
  22 
  23     long *canon_data_src = (void*)0xFFB1A490;   //
  24     long *canon_data_dst = (void*)0x1900; //
  25     long canon_data_len = 0xefe0;       //
  26     long *canon_bss_start = (void*)0x108E0; // just after data
  27     long canon_bss_len = 0xA27F0 - 0x108E0; //
  28     long i;
  29 
  30     asm volatile (
  31         "MRC     p15, 0, R0,c1,c0\n"
  32         "ORR     R0, R0, #0x1000\n"
  33         "ORR     R0, R0, #4\n"
  34         "ORR     R0, R0, #1\n"
  35         "MCR     p15, 0, R0,c1,c0\n"
  36     :::"r0");
  37 
  38     for(i=0;i<canon_data_len/4;i++)
  39         canon_data_dst[i]=canon_data_src[i];
  40 
  41     for(i=0;i<canon_bss_len/4;i++)
  42         canon_bss_start[i]=0;
  43 
  44     asm volatile (
  45         "MRC     p15, 0, R0,c1,c0\n"
  46         "ORR     R0, R0, #0x1000\n"
  47         "BIC     R0, R0, #4\n"
  48         "ORR     R0, R0, #1\n"
  49         "MCR     p15, 0, R0,c1,c0\n"
  50         "LDR    LR, [SP],#4\n"
  51     :::"r0");
  52 
  53     h_usrInit();
  54 }
  55 
  56 
  57 void h_usrInit()                        // loc_FF811990
  58 {
  59     asm volatile (
  60         "STR     LR, [SP,#-4]!\n"
  61         "BL      sub_FF81196C\n"
  62         "MOV     R0, #2\n"
  63         "MOV     R1, R0\n"
  64         "BL      sub_FFAFE0E8\n"        // unknown_libname_889
  65         "BL      sub_FFAEA7C0\n"        // excVecInit
  66         "BL      sub_FF8111C4\n"
  67         "BL      sub_FF81172C\n"
  68         "LDR     LR, [SP],#4\n"
  69         "B       h_usrKernelInit\n"
  70     );
  71 }
  72 
  73 void  h_usrKernelInit()                 //loc_FF811748 
  74 {
  75     asm volatile (
  76         "STMFD   SP!, {R4,LR}\n"
  77         "SUB     SP, SP, #8\n"
  78         "BL      sub_FFAFE5E8\n"        // classLibInit
  79         "BL      sub_FFB138D4\n"        // taskLibInit
  80         "LDR     R3, =0xF874\n"
  81         "LDR     R2, =0x9EEA0\n"
  82         "LDR     R1, [R3]\n"
  83         "LDR     R0, =0xA21B0\n"
  84         "MOV     R3, #0x100\n"
  85         "BL      sub_FFB0C724\n"        // qInit
  86         "LDR     R3, =0xF834\n"
  87         "LDR     R0, =0x100FC\n"
  88         "LDR     R1, [R3]\n"
  89         "BL      sub_FFB0C724\n"        // qInit
  90         "LDR     R3, =0xF8F0\n"
  91         "LDR     R0, =0xA2184\n"
  92         "LDR     R1, [R3]\n"
  93         "BL      sub_FFB0C724\n"
  94         "BL      sub_FFB18454\n"        // workQInit
  95         "BL      sub_FF8112B0\n"
  96         "MOV     R4, #0\n"
  97         "MOV     R3, R0\n"
  98         "MOV     R12, #0x800\n"
  99         "LDR     R0, =h_usrRoot\n"      // h_usrRoot -> sub_FF811A70
 100         "MOV     R1, #0x4000\n"
 101         //"LDR     R2, =0xE27F0\n"      // 0xA27F0 + 0x40000
 102     );    
 103     asm volatile (
 104         "LDR     R2, =new_sa\n"
 105         "LDR     R2, [R2]\n"
 106     );
 107     asm volatile (
 108         "STR     R12, [SP]\n"
 109         "STR     R4, [SP,#4]\n"
 110         "BL      sub_FFB10B14\n"        // kernelInit
 111         "ADD     SP, SP, #8\n"
 112         "LDMFD   SP!, {R4,PC}\n"
 113     );
 114 }
 115 
 116 void  h_usrRoot()                       // sub_FF811A70
 117 {
 118     asm volatile (
 119         "STMFD   SP!, {R4,R5,LR}\n"
 120         "MOV     R5, R0\n"
 121         "MOV     R4, R1\n"
 122         "BL      sub_FF8119D4\n"
 123         "MOV     R1, R4\n"
 124         "MOV     R0, R5\n"
 125         "BL      sub_FFB04764\n"        // memInit
 126         "MOV     R1, R4\n"
 127         "MOV     R0, R5\n"
 128         "BL      sub_FFB051DC\n"        // memPartLibInit
 129         //"BL      sub_FF8117EC\n"      // nullstub_1, null stub, useless
 130         "BL      sub_FF811708\n"
 131         "MOV     R0, #0x32\n"
 132         "BL      sub_FFB07180\n"        // selectInit
 133         "BL      sub_FF811A18\n"
 134         "BL      sub_FF8119F8\n"
 135         "BL      sub_FF811A44\n"
 136         "BL      sub_FFB06A40\n"        // selTaskDeleteHookAdd
 137         "BL      sub_FF8119C8\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_FF811370\n"
 148     );
 149 }
 150 
 151 int jogdial_is_stopped = 0;
 152 
 153 void set_jogdial_is_stopped () {
 154     extern int jogdial_stopped; // from kbd.c
 155     if (jogdial_stopped == 0)
 156         jogdial_is_stopped = 0;
 157     else
 158         jogdial_is_stopped = 1;
 159 }
 160 
 161 void __attribute__((naked,noinline)) sub_FF965FAC_my() { //
 162     asm volatile (
 163         "MOV R1, #0\n"
 164     "sub_FF965FBC_my:\n"
 165         "LDR R2, =jogdial_is_stopped\n"
 166         "LDR R2, [R2]\n"
 167         "CMP R2, #0\n"
 168         "BEQ sub_FF965FBC\n"                // emit control events only when not in ALT mode
 169         "BX  LR\n"
 170     );
 171 }
 172 
 173 void __attribute__((naked,noinline)) task_JogDial_my() { // sub_FF8287AC_my
 174 asm volatile (
 175       "    STMFD   SP!, {R4-R11,LR} \n" 
 176       "    MOV     R7, #0x240000 \n" 
 177       "    MOV     R9, #0x80000000 \n" 
 178       "    ADD     R7, R7, #0x400 \n" 
 179       "    LDR     R10, =0x11A70 \n" 
 180       "    LDR     R8, =0x11A72 \n" 
 181       "    LDR     R11, =0x11A74 \n" 
 182       "    MOV     R9, R9, ASR #0xF \n" 
 183       "    ADD     R7, R7, #0xC0000004 \n" 
 184 "loc_FF8287D0:\n"
 185       "    LDR     R3, =0x11A64 \n" 
 186       "    MOV     R1, #0 \n" 
 187       "    LDR     R0, [R3] \n" 
 188       "    BL      sub_FF820F78 \n"         // TakeSemaphore
 189       "    MOV     R0, #0x28 \n" 
 190       "    BL      _SleepTask \n" 
 191       "BL set_jogdial_is_stopped\n"         // +
 192       "    LDR     R12, [R7] \n" 
 193       "    MOV     R3, #0x204 \n" 
 194       "    ADD     R3, R3, #0xC0000000 \n" 
 195       "    ADD     R3, R3, #0x240000 \n" 
 196       "    AND     R12, R12, R9 \n" 
 197       "    MOV     R12, R12, LSR #0x10 \n" 
 198       "    LDR     R2, [R3] \n" 
 199       "    MOV     R1, R12, LSL #0x10 \n" 
 200       "    LDRSH   R3, [R8] \n" 
 201       "    AND     R2, R2, R9 \n" 
 202       "    MOV     R1, R1, ASR #0x10 \n" 
 203       "    MOV     R2, R2, LSR #0x10 \n" 
 204       "    CMP     R1, R3 \n" 
 205       "    STRH    R2, [R11] \n" 
 206       "    STRH    R12, [R10] \n" 
 207       "    BEQ     loc_FF828990 \n" 
 208       "    BLE     loc_FF828854 \n" 
 209       "    LDRSH   R2, [R10] \n" 
 210       "    LDRSH   R3, [R8] \n" 
 211       "    RSB     R1, R3, R2 \n" 
 212       "    CMP     R1, #0xFF \n" 
 213       "    RSBGT   R3, R2, R3 \n" 
 214       "    ADDGT   R5, R3, #0x10000 \n" 
 215       "    BGT     loc_FF828878 \n" 
 216       "    MOV     R5, R1 \n" 
 217       "    MOV     R4, #1 \n" 
 218       "    B       loc_FF82887C \n" 
 219 "loc_FF828854:\n"
 220       "    LDRSH   R2, [R8] \n" 
 221       "    LDRSH   R3, [R10] \n" 
 222       "    RSB     R1, R3, R2 \n" 
 223       "    CMP     R1, #0xFF \n" 
 224       "    RSBGT   R3, R2, R3 \n" 
 225       "    ADDGT   R5, R3, #0x10000 \n" 
 226       "    MOVGT   R4, #1 \n" 
 227       "    BGT     loc_FF82887C \n" 
 228       "    MOV     R5, R1 \n" 
 229 "loc_FF828878:\n"
 230       "    MOV     R4, #0 \n" 
 231 "loc_FF82887C:\n"
 232       "    CMP     R5, #1 \n" 
 233       "    MOV     R12, #1 \n" 
 234       "    BNE     loc_FF8288E8 \n" 
 235       "    LDR     R3, =0x11A76 \n" 
 236       "    LDR     LR, =0x11A70 \n" 
 237       "    LDR     R6, =0x11A74 \n" 
 238       "    LDRSH   R0, [R3] \n" 
 239       "    LDRSH   R2, [LR] \n" 
 240       "    LDRSH   R1, [R8] \n" 
 241       "    LDRSH   R3, [R6] \n" 
 242       "    RSB     R2, R1, R2 \n" 
 243       "    RSB     R3, R0, R3 \n" 
 244       "    CMP     R2, R3 \n" 
 245       "    BNE     loc_FF8288E8 \n" 
 246       "    MOV     R3, #0x204 \n" 
 247       "    ADD     R3, R3, #0xC0000000 \n" 
 248       "    MOV     R5, #0 \n" 
 249       "    MOV     R1, R12 \n" 
 250       "    MOV     R2, #2 \n" 
 251       "    ADD     R3, R3, #0x240000 \n" 
 252       "    STR     R2, [R7] \n" 
 253       "    STRH    R5, [LR] \n" 
 254       "    STR     R1, [R7] \n" 
 255       "    STRH    R5, [R6] \n" 
 256       "    STR     R2, [R3] \n" 
 257       "    STR     R1, [R3] \n" 
 258       "    MOV     R12, R5 \n" 
 259 "loc_FF8288E8:\n"
 260       "    CMP     R12, #0 \n" 
 261       "    BEQ     loc_FF82897C \n" 
 262       "    LDR     R3, =0x11A84 \n" 
 263       "    LDR     R1, [R3] \n" 
 264       "    CMP     R1, #0 \n" 
 265       "    BEQ     loc_FF82892C \n" 
 266       "    LDR     R2, =0x1FDC \n" 
 267       "    MOV     R6, R4, LSL #2 \n" 
 268       "    LDR     R3, [R6, R2] \n" 
 269       "    CMP     R3, R1 \n" 
 270       "    BEQ     loc_FF82893C \n" 
 271       "    MOV     R4, #0xB00 \n" 
 272       "    ADD     R0, R4, #1 \n" 
 273       "    BL      sub_FF965FAC_my \n"      // -> spec case of sub_FF965FB8 in FW 100G (with R1=0)
 274       "    ADD     R0, R4, #0x80000001 \n" 
 275       "    BL      sub_FF965FAC_my \n"      // ->
 276       "    B       loc_FF82893C \n" 
 277 "loc_FF82892C:\n"
 278       "    MOV     R0, #0xB00 \n" 
 279       "    ADD     R0, R0, #0x80000001 \n" 
 280       "    BL      sub_FF965FAC_my \n"      // ->
 281       "    MOV     R6, R4, LSL #2 \n" 
 282 "loc_FF82893C:\n"
 283       "    LDR     R4, =0x1FDC \n" 
 284       "    LDR     R2, =0x11A84 \n" 
 285       "    LDR     R3, [R6, R4] \n" 
 286       "    MOV     R1, R5 \n" 
 287       "    STR     R3, [R2] \n" 
 288       "    MOV     R0, R3 \n" 
 289       "    BL      sub_FF965FBC_my \n"      // ->
 290       "    LDR     R3, =0x1FD0 \n" 
 291       "    LDR     R2, [R3] \n" 
 292       "    CMP     R2, #0 \n" 
 293       "    BEQ     loc_FF82897C \n" 
 294       "    LDR     R1, [R6, R4] \n" 
 295       "    MOV     R2, R5 \n" 
 296       "    LDR     R0, =0xFF82878C \n" 
 297       "    LDRSH   R3, [R10] \n" 
 298       "    BL      sub_FFB00844 \n"         // printf
 299 "loc_FF82897C:\n"
 300       "    LDR     R3, =0x11A76 \n" 
 301       "    LDRH    R2, [R11] \n" 
 302       "    STRH    R2, [R3] \n" 
 303       "    LDRH    R3, [R10] \n" 
 304       "    STRH    R3, [R8] \n" 
 305 "loc_FF828990:\n"
 306       "    MOV     R2, #0x240000 \n" 
 307       "    MOV     R3, #0xC0000000 \n" 
 308       "    ADD     R2, R2, #0x400 \n" 
 309       "    ADD     R3, R3, #0x240000 \n" 
 310       "    MOV     R0, #0 \n" 
 311       "    ADD     R2, R2, #0xC0000008 \n" 
 312       "    MOV     R1, #1 \n" 
 313       "    STR     R0, [R3, #0x400] \n" 
 314       "    STR     R1, [R2] \n" 
 315       "    LDR     R3, =0x11A78 \n" 
 316       "    LDR     R0, [R3] \n" 
 317       "    CMP     R0, #0 \n" 
 318       "    BEQ     loc_FF8287D0 \n" 
 319       "    BL      _SleepTask \n" 
 320       "    B       loc_FF8287D0 \n" 
 321     );
 322 }

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