Changeset 407 for trunk/tools


Ignore:
Timestamp:
Nov 7, 2017, 3:08:12 PM (4 years ago)
Author:
alain
Message:

First implementation of fork/exec.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/bootloader_tsar/boot.c

    r401 r407  
    807807            }
    808808
    809             boot_printf("\n[BOOT] core[%x,%d] loaded boot_info at cycle %d\n",
     809            boot_printf("\n[BOOT] core[%x,%d] loaded arch_info at cycle %d\n",
    810810                        cxy , lid , boot_get_proctime() );
    811811
     
    901901
    902902// display address extensions
    903 uint32_t cp2_data_ext;
    904 uint32_t cp2_ins_ext;
    905 asm volatile( "mfc2   %0,  $24" : "=&r" (cp2_data_ext) );
    906 asm volatile( "mfc2   %0,  $25" : "=&r" (cp2_ins_ext) );
    907 boot_printf("\n[BOOT] core[%x,%d] CP2_DATA_EXT = %x / CP2_INS_EXT = %x\n",
    908             cxy , lid , cp2_data_ext , cp2_ins_ext );
     903// uint32_t cp2_data_ext;
     904// uint32_t cp2_ins_ext;
     905// asm volatile( "mfc2   %0,  $24" : "=&r" (cp2_data_ext) );
     906// asm volatile( "mfc2   %0,  $25" : "=&r" (cp2_ins_ext) );
     907// boot_printf("\n[BOOT] core[%x,%d] CP2_DATA_EXT = %x / CP2_INS_EXT = %x\n",
     908// cxy , lid , cp2_data_ext , cp2_ins_ext );
    909909
    910910            // Wait until all local cores in cluster ready
     
    930930
    931931// display address extensions
    932 uint32_t cp2_data_ext;
    933 uint32_t cp2_ins_ext;
    934 asm volatile( "mfc2   %0,  $24" : "=&r" (cp2_data_ext) );
    935 asm volatile( "mfc2   %0,  $25" : "=&r" (cp2_ins_ext) );
    936 boot_printf("\n[BOOT] core[%x,%d] CP2_DATA_EXT = %x / CP2_INS_EXT = %x\n",
    937             cxy , lid , cp2_data_ext , cp2_ins_ext );
     932// uint32_t cp2_data_ext;
     933// uint32_t cp2_ins_ext;
     934// asm volatile( "mfc2   %0,  $24" : "=&r" (cp2_data_ext) );
     935// asm volatile( "mfc2   %0,  $25" : "=&r" (cp2_ins_ext) );
     936// boot_printf("\n[BOOT] core[%x,%d] CP2_DATA_EXT = %x / CP2_INS_EXT = %x\n",
     937// cxy , lid , cp2_data_ext , cp2_ins_ext );
    938938
    939939        // Wait until all local cores in cluster ready
     
    941941    }
    942942
    943     // Ech core compute stack pointer to the kernel idle-thread descriptor.
     943    // Each core initialise the following registers before jumping to kernel:
     944    // - sp_29    : stack pointer on idle thread,
     945    // - c0_sr    : reset BEV bit
     946    // - a0_04    : pointer on boot_info structure
     947    // - c0_ebase : kentry_base(and jump to kernel_entry.
     948
    944949    // The array of idle-thread descriptors is allocated in the kdata segment,
    945950    // just after the boot_info structure
    946 
    947951    uint32_t sp;
    948952    uint32_t base;
     
    951955    uint32_t psize  = CONFIG_PPM_PAGE_SIZE;
    952956
    953 
    954957    // compute base address of idle thread descriptors array
    955958    if( offset & pmask ) base = seg_kdata_base + (offset & ~pmask) + psize;
     
    959962    sp = base + ((lid + 1) * CONFIG_THREAD_DESC_SIZE) - 16;
    960963
    961     // Each cores initialise stack pointer,
    962     // reset the BEV bit in status register,
    963     // register "boot_info" argument in a0,
    964     // and jump to kernel_entry.
    965964    asm volatile( "mfc0  $27,  $12           \n"
    966965                  "lui   $26,  0xFFBF        \n"
     
    970969                  "move  $4,   %0            \n"
    971970                  "move  $29,  %1            \n"
    972                   "jr    %2                  \n"
    973                   :: "r"(boot_info) , "r"(sp) , "r"(kernel_entry) );
     971                  "mtc0  %2,   $15,  1       \n"
     972                  "jr    %3                  \n"
     973                  :: "r"(boot_info) ,
     974                     "r"(sp) ,
     975                     "r"(boot_info->kentry_base),
     976                     "r"(kernel_entry) );
    974977
    975978} // boot_loader()
Note: See TracChangeset for help on using the changeset viewer.