Changes in kernel/arch/arm64/src/arm64.c [3fcea34:ebb3538] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm64/src/arm64.c
r3fcea34 rebb3538 146 146 } 147 147 148 uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)149 {150 return stack_base + stack_size;151 }152 153 148 /** Change processor mode. 154 149 * 155 150 * @param kernel_uarg Userspace settings (entry point, stack, ...). 156 151 */ 157 void userspace(u intptr_t pc, uintptr_t sp)152 void userspace(uspace_arg_t *kernel_uarg) 158 153 { 159 154 /* Prepare return to EL0. */ … … 162 157 163 158 /* Set program entry. */ 164 ELR_EL1_write( pc);159 ELR_EL1_write(kernel_uarg->uspace_entry); 165 160 166 161 /* Set user stack. */ 167 SP_EL0_write(sp); 162 SP_EL0_write(kernel_uarg->uspace_stack + 163 kernel_uarg->uspace_stack_size); 168 164 169 165 /* Clear Thread ID register. */ … … 174 170 * Reset the kernel stack to its base value. 175 171 * 176 * Clear all general-purpose registers. 172 * Clear all general-purpose registers, 173 * except x0 that holds an argument for 174 * the user space. 177 175 */ 178 176 "mov sp, %[kstack]\n" 179 "mov x0, #0\n"177 "mov x0, %[uspace_uarg]\n" 180 178 "mov x1, #0\n" 181 179 "mov x2, #0\n" … … 209 207 "mov x30, #0\n" 210 208 "eret\n" 211 :: [kstack] "r" (((uint64_t) (THREAD->kstack)) + 209 :: [uspace_uarg] "r" (kernel_uarg->uspace_uarg), 210 [kstack] "r" (((uint64_t) (THREAD->kstack)) + 212 211 MEM_STACK_SIZE - SP_DELTA) 213 212 );
Note:
See TracChangeset
for help on using the changeset viewer.