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

Last change on this file since 684 was 653, checked in by alain, 5 years ago

Remove the hard_config.h file include.

File size: 4.1 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 the TSAR architecture,  */
26/* that is a generic multi-clusters / multi-processors architecture.                          */
27/*                                                                                            */
28/* This assembly code is executed by all cores, but not at the same time, because all cores   */
29/* are not simultaneously activated. It makes the assuption that the CPO register containing  */
30/* the core gid (global hardware identifier) has a fixed format:                              */
31/*    gid == (((x << Y_WIDTH) + y) << P_WIDTH) + lid                                          */
32/*                                                                                            */
33/* It does 3 things:                                                                          */
34/* - It initializes the stack pointer depending on the lid extracted from the gid,            */
35/*   using the BOOT_STACK_BASE and BOOT_STACK_SIZE parameters that are defined in             */
36/*   the boot_config.h file,                                                                  */
37/* - It changes the value of the DATA address extension register using the cxy extracted      */
38/*   from the gid, with X_WIDTH, Y_WIDTH, P_WIDTH defined in the boot¨config.h file.          */
39/* - It jumps to the boot_loader() function defined in the 'boot.c' file, passing the two     */
40/*   arguments (cxy and lid).                                                                 */
41/**********************************************************************************************/
42
43#include "mips32_registers.h"
44#include "boot_config.h"
45
46    .section    .text, "ax", @progbits
47
48    .globl      boot_entry
49    .ent        boot_entry
50
51    .align      2
52    .set        noreorder
53
54boot_entry:
55
56    /* Get (cxy, lid) values from gid contained in CP0 register  */
57
58    mfc0    k0,     CP0_PROCID         
59    andi    k0,     k0,     0xFFF                       /* k0 <= gid                        */
60    andi    t1,     k0,     ((1 << P_WIDTH) - 1)        /* t1 <= lid                        */
61    srl     t2,     k0,     P_WIDTH                     /* t2 <= cxy                        */
62   
63    /* Initialize stack pointer from lid value  */
64   
65    la      t0,     BOOT_STACK_BASE                     /* t0 <= BOOT_STACK_BASE            */
66    li      k1,     BOOT_STACK_SIZE                     /* k1 <= BOOT_STACK_SIZE            */
67    multu   k1,     t1
68    mflo    k0                                          /* k0 <= BOOT_STACK_SIZE * lid      */
69    subu    sp,     t0,     k0                          /* P[cxy,lid] sp initialized        */
70
71    /* Switch to local DSPACE by changing the value of the address extension register       */
72
73    mtc2    t2,     CP2_DATA_PADDR_EXT
74
75    /* Jump to boot_loader() function after passing (cxy,lid) arguments in the registers    */
76
77    or      a0,     zero,   t1                          /* a0 <= lid                        */     
78    or      a1,     zero,   t2                          /* a1 <= cxy                        */
79    la      ra,     boot_loader
80    jr      ra
81    nop
82
83    .end boot_entry
84
85    .set reorder
Note: See TracBrowser for help on using the repository browser.