Changeset 96e0748d in mainline for kernel/arch/mips32/src/mips32.c


Ignore:
Timestamp:
2009-02-17T22:47:27Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f89979b
Parents:
e662a5f
Message:

make arch_pre_main optional, don't force any specific prototype
simplify boot process
mips32: detect number of configured CPUs in msim

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/mips32.c

    re662a5f r96e0748d  
    3434
    3535#include <arch.h>
    36 #include <arch/boot.h>
    3736#include <arch/cp0.h>
    3837#include <arch/exception.h>
     
    5958#include <arch/asm/regname.h>
    6059
    61 /* Size of the code jumping to the exception handler code 
    62  * - J+NOP 
    63  */
    64 #define EXCEPTION_JUMP_SIZE    8
    65 
    66 #define TLB_EXC ((char *) 0x80000000)
    67 #define NORM_EXC ((char *) 0x80000180)
    68 #define CACHE_EXC ((char *) 0x80000100)
     60/* Size of the code jumping to the exception handler code
     61 * - J+NOP
     62 */
     63#define EXCEPTION_JUMP_SIZE  8
     64
     65#define TLB_EXC    ((char *) 0x80000000)
     66#define NORM_EXC   ((char *) 0x80000180)
     67#define CACHE_EXC  ((char *) 0x80000100)
    6968
    7069
    7170/* Why the linker moves the variable 64K away in assembler
    72  * when not in .text section ????????
    73  */
     71 * when not in .text section?
     72 */
     73
     74/* Stack pointer saved when entering user mode */
    7475uintptr_t supervisor_sp __attribute__ ((section (".text")));
    75 /* Stack pointer saved when entering user mode */
    76 /* TODO: How do we do it on SMP system???? */
    77 bootinfo_t bootinfo __attribute__ ((section (".text")));
    78 
    79 void arch_pre_main(void)
     76
     77count_t cpu_count = 0;
     78
     79void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
    8080{
    8181        /* Setup usermode */
    82         init.cnt = bootinfo.cnt;
    83        
    84         uint32_t i;
    85        
    86         for (i = 0; i < bootinfo.cnt; i++) {
    87                 init.tasks[i].addr = bootinfo.tasks[i].addr;
    88                 init.tasks[i].size = bootinfo.tasks[i].size;
     82        init.cnt = bootinfo->cnt;
     83       
     84        count_t i;
     85        for (i = 0; i < min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) {
     86                init.tasks[i].addr = bootinfo->tasks[i].addr;
     87                init.tasks[i].size = bootinfo->tasks[i].size;
     88        }
     89       
     90        for (i = 0; i < CPUMAP_MAX_RECORDS; i++) {
     91                if ((bootinfo->cpumap & (1 << i)) != 0)
     92                        cpu_count++;
    8993        }
    9094}
Note: See TracChangeset for help on using the changeset viewer.