source: trunk/boot/tsar_mips32/boot_entry.S @ 644

Last change on this file since 644 was 623, checked in by alain, 6 years ago

Introduce three new types of vsegs (KCODE,KDATA,KDEV)
to map the kernel vsegs in the process VSL and GPT.
This now used by both the TSAR and the I86 architectures.

File size: 4.6 KB
Line 
1/*
2 * boot_entry.S - TSAR bootloader entry point.
3 *
4 * Authors :   Alain Greiner / Vu Son  (2016)
5 *
6 * Copyright (c) UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
14 * ALMOS-MKH is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24/**********************************************************************************************
25 * This file contains the entry point of the ALMOS-MK boot-loader for TSAR architecture,      *
26 * that is a generic multi-clusters / multi-processors architecture.                          *
27 *                                                                                            *
28 * - The number of clusters is defined by the (X_SIZE, Y_SIZE) parameters in the              *
29 *   hard_config.h file (up to 256 clusters).                                                 *
30 * - The number of processors per cluster is defined by the NB_PROCS_MAX parameter in the     *
31 *   hard_config.h file (up to 4 processors per cluster).                                     *
32 *                                                                                            *
33 * This assembly code is executed by all cores, but at the same time, because all cores       *
34 * are not simultaneously activated. It makes the assuption that the CPO register containing  *
35 * the core gid (global hardware identifier) has a fixed format:                              *
36 *    gid == (((x << Y_WIDTH) + y) << P_WIDTH) + lid                                          *
37 *                                                                                            *
38 * It does 3 things:                                                                          *
39 * - It initializes the stack pointer depending on the lid extracted from the gid,            *
40 *   using the BOOT_STACK_BASE and BOOT_STACK_SIZE parameters defined in the                  *
41 *   'boot_config.h' file,                                                                    *
42 * - It changes the value of the DATA address extension register using the cxy extracted      *
43 *   from the gid,                                                                            *
44 * - It jumps to the boot_loader() function defined in the 'boot.c' file, passing the two     *
45 *   arguments (cxy and lid).                                                                 *
46 *********************************************************************************************/
47
48#include "mips32_registers.h"
49#include "hard_config.h"
50#include "boot_config.h"
51
52    .section    .text, "ax", @progbits
53
54    .globl      boot_entry
55    .ent        boot_entry
56
57    .align      2
58    .set        noreorder
59
60boot_entry:
61
62    /* Get (cxy, lid) values from gid contained in CP0 register  */
63
64    mfc0    k0,     CP0_PROCID         
65    andi    k0,     k0,     0xFFF                       /* k0 <= gid                        */
66    andi    t1,     k0,     ((1 << P_WIDTH) - 1)        /* t1 <= lid                        */
67    srl     t2,     k0,     P_WIDTH                     /* t2 <= cxy                        */
68   
69    /* Initialize stack pointer from lid value  */
70   
71    la      t0,     BOOT_STACK_BASE                     /* t0 <= BOOT_STACK_BASE            */
72    li      k1,     BOOT_STACK_SIZE                     /* k1 <= BOOT_STACK_SIZE            */
73    multu   k1,     t1
74    mflo    k0                                          /* k0 <= BOOT_STACK_SIZE * lid      */
75    subu    sp,     t0,     k0                          /* P[cxy,lid] sp initialized        */
76
77    /* Switch to local DSPACE by changing the value of the address extension register       */
78
79    mtc2    t2,     CP2_DATA_PADDR_EXT
80
81    /* Jump to boot_loader() function after passing (cxy,lid) arguments in the registers    */
82
83    or      a0,     zero,   t1                          /* a0 <= lid                        */     
84    or      a1,     zero,   t2                          /* a1 <= cxy                        */
85    la      ra,     boot_loader
86    jr      ra
87    nop
88
89    .end boot_entry
90
91    .set reorder
Note: See TracBrowser for help on using the repository browser.