Rev 2304 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2304 | Rev 2318 | ||
---|---|---|---|
Line 111... | Line 111... | ||
111 | } |
111 | } |
112 | 112 | ||
113 | /** Perform arm32 specific tasks needed before the new task is run. */ |
113 | /** Perform arm32 specific tasks needed before the new task is run. */ |
114 | void before_task_runs_arch(void) |
114 | void before_task_runs_arch(void) |
115 | { |
115 | { |
- | 116 | tlb_invalidate_all(); |
|
116 | /* TODO */ |
117 | /* TODO */ |
117 | } |
118 | } |
118 | 119 | ||
119 | /** Perform arm32 specific tasks needed before the new thread is scheduled. */ |
120 | /** Perform arm32 specific tasks needed before the new thread is scheduled. */ |
120 | void before_thread_runs_arch(void) |
121 | void before_thread_runs_arch(void) |
Line 146... | Line 147... | ||
146 | uint32_t lr; |
147 | uint32_t lr; |
147 | uint32_t pc; |
148 | uint32_t pc; |
148 | } ustate_t; |
149 | } ustate_t; |
149 | 150 | ||
150 | 151 | ||
151 | void prefetch_exception_generator(void) { |
- | |
152 | asm __volatile__ ( |
- | |
153 | "ldr pc, =0x7000000" |
- | |
154 | ); |
- | |
155 | - | ||
156 | } |
- | |
157 | - | ||
158 | /** Changes processor mode and jumps to the address specified in the first parameter. |
152 | /** Changes processor mode and jumps to the address specified in the first parameter. |
159 | * |
153 | * |
160 | * \param kernel_uarg userspace settings (entry point, stack, ...) |
154 | * \param kernel_uarg userspace settings (entry point, stack, ...) |
161 | */ |
155 | */ |
162 | void userspace(uspace_arg_t *kernel_uarg) |
156 | void userspace(uspace_arg_t *kernel_uarg) |
Line 176... | Line 170... | ||
176 | ustate.r9 = ustate.r10 = ustate.r11 = ustate.r12 = 1; |
170 | ustate.r9 = ustate.r10 = ustate.r11 = ustate.r12 = 1; |
177 | 171 | ||
178 | ustate.lr = 3; |
172 | ustate.lr = 3; |
179 | 173 | ||
180 | //set user stack |
174 | //set user stack |
181 | ustate.sp = ((uint32_t)kernel_uarg->uspace_stack) + PAGE_SIZE; |
175 | ustate.sp = ((uint32_t)kernel_uarg->uspace_stack) + |
- | 176 | PAGE_SIZE - sizeof(void*); |
|
- | 177 | //on the bottom of stack there is pointer to TLS |
|
182 | 178 | ||
183 | //set where uspace execution starts |
179 | //set where uspace execution starts |
184 | ustate.pc = (uintptr_t) kernel_uarg->uspace_entry; |
180 | ustate.pc = (uintptr_t) kernel_uarg->uspace_entry; |
185 | 181 | ||
186 | //status register in user mode |
182 | //status register in user mode |
187 | ipl_t cpsr = current_status_reg_read(); |
183 | ipl_t cpsr = current_status_reg_read(); |