Changeset ebb1489 in mainline for kernel/arch/arm64/src/arm64.c
- Timestamp:
- 2024-10-13T08:23:40Z (8 weeks ago)
- Children:
- 0472cf17
- Parents:
- 2a0c827c (diff), b3b79981 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- boba-buba <120932204+boba-buba@…> (2024-10-13 08:23:40)
- git-committer:
- GitHub <noreply@…> (2024-10-13 08:23:40)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm64/src/arm64.c
r2a0c827c rebb1489 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 148 153 /** Change processor mode. 149 154 * 150 155 * @param kernel_uarg Userspace settings (entry point, stack, ...). 151 156 */ 152 void userspace(u space_arg_t *kernel_uarg)157 void userspace(uintptr_t pc, uintptr_t sp) 153 158 { 154 159 /* Prepare return to EL0. */ … … 157 162 158 163 /* Set program entry. */ 159 ELR_EL1_write( kernel_uarg->uspace_entry);164 ELR_EL1_write(pc); 160 165 161 166 /* Set user stack. */ 162 SP_EL0_write(kernel_uarg->uspace_stack + 163 kernel_uarg->uspace_stack_size); 167 SP_EL0_write(sp); 164 168 165 169 /* Clear Thread ID register. */ … … 170 174 * Reset the kernel stack to its base value. 171 175 * 172 * Clear all general-purpose registers, 173 * except x0 that holds an argument for 174 * the user space. 176 * Clear all general-purpose registers. 175 177 */ 176 178 "mov sp, %[kstack]\n" 177 "mov x0, %[uspace_uarg]\n"179 "mov x0, #0\n" 178 180 "mov x1, #0\n" 179 181 "mov x2, #0\n" … … 207 209 "mov x30, #0\n" 208 210 "eret\n" 209 :: [uspace_uarg] "r" (kernel_uarg->uspace_uarg), 210 [kstack] "r" (((uint64_t) (THREAD->kstack)) + 211 :: [kstack] "r" (((uint64_t) (THREAD->kstack)) + 211 212 MEM_STACK_SIZE - SP_DELTA) 212 213 );
Note:
See TracChangeset
for help on using the changeset viewer.