Rev 3913 | Rev 4023 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3913 | Rev 3922 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <arch.h> |
35 | #include <arch.h> |
36 | #include <arch/boot.h> |
- | |
37 | #include <arch/cp0.h> |
36 | #include <arch/cp0.h> |
38 | #include <arch/exception.h> |
37 | #include <arch/exception.h> |
39 | #include <mm/as.h> |
38 | #include <mm/as.h> |
40 | 39 | ||
41 | #include <userspace.h> |
40 | #include <userspace.h> |
Line 56... | Line 55... | ||
56 | #include <macros.h> |
55 | #include <macros.h> |
57 | #include <ddi/device.h> |
56 | #include <ddi/device.h> |
58 | 57 | ||
59 | #include <arch/asm/regname.h> |
58 | #include <arch/asm/regname.h> |
60 | 59 | ||
61 | /* Size of the code jumping to the exception handler code |
60 | /* Size of the code jumping to the exception handler code |
62 | * - J+NOP |
61 | * - J+NOP |
63 | */ |
62 | */ |
64 | #define EXCEPTION_JUMP_SIZE 8 |
63 | #define EXCEPTION_JUMP_SIZE 8 |
65 | 64 | ||
66 | #define TLB_EXC ((char *) 0x80000000) |
65 | #define TLB_EXC ((char *) 0x80000000) |
67 | #define NORM_EXC ((char *) 0x80000180) |
66 | #define NORM_EXC ((char *) 0x80000180) |
68 | #define CACHE_EXC ((char *) 0x80000100) |
67 | #define CACHE_EXC ((char *) 0x80000100) |
69 | 68 | ||
70 | 69 | ||
71 | /* Why the linker moves the variable 64K away in assembler |
70 | /* Why the linker moves the variable 64K away in assembler |
72 | * when not in .text section ???????? |
71 | * when not in .text section? |
73 | */ |
72 | */ |
74 | uintptr_t supervisor_sp __attribute__ ((section (".text"))); |
- | |
- | 73 | ||
75 | /* Stack pointer saved when entering user mode */ |
74 | /* Stack pointer saved when entering user mode */ |
76 | /* TODO: How do we do it on SMP system???? */ |
- | |
77 | bootinfo_t bootinfo __attribute__ ((section (".text"))); |
75 | uintptr_t supervisor_sp __attribute__ ((section (".text"))); |
78 | 76 | ||
79 | void arch_pre_main(void) |
77 | count_t cpu_count = 0; |
- | 78 | ||
- | 79 | void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo) |
|
80 | { |
80 | { |
81 | /* Setup usermode */ |
81 | /* Setup usermode */ |
82 | init.cnt = bootinfo.cnt; |
82 | init.cnt = bootinfo->cnt; |
83 | 83 | ||
84 | uint32_t i; |
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 | } |
|
85 | 89 | ||
86 | for (i = 0; i < bootinfo.cnt; i++) { |
90 | for (i = 0; i < CPUMAP_MAX_RECORDS; i++) { |
87 | init.tasks[i].addr = bootinfo.tasks[i].addr; |
91 | if ((bootinfo->cpumap & (1 << i)) != 0) |
88 | init.tasks[i].size = bootinfo.tasks[i].size; |
92 | cpu_count++; |
89 | } |
93 | } |
90 | } |
94 | } |
91 | 95 | ||
92 | void arch_pre_mm_init(void) |
96 | void arch_pre_mm_init(void) |
93 | { |
97 | { |