Ignore:
File:
1 edited

Legend:

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

    r3fcea34 rebb3538  
    146146}
    147147
    148 uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
    149 {
    150         return stack_base + stack_size;
    151 }
    152 
    153148/** Change processor mode.
    154149 *
    155150 * @param kernel_uarg Userspace settings (entry point, stack, ...).
    156151 */
    157 void userspace(uintptr_t pc, uintptr_t sp)
     152void userspace(uspace_arg_t *kernel_uarg)
    158153{
    159154        /* Prepare return to EL0. */
     
    162157
    163158        /* Set program entry. */
    164         ELR_EL1_write(pc);
     159        ELR_EL1_write(kernel_uarg->uspace_entry);
    165160
    166161        /* Set user stack. */
    167         SP_EL0_write(sp);
     162        SP_EL0_write(kernel_uarg->uspace_stack +
     163            kernel_uarg->uspace_stack_size);
    168164
    169165        /* Clear Thread ID register. */
     
    174170             * Reset the kernel stack to its base value.
    175171             *
    176              * Clear all general-purpose registers.
     172             * Clear all general-purpose registers,
     173             * except x0 that holds an argument for
     174             * the user space.
    177175             */
    178176            "mov sp, %[kstack]\n"
    179             "mov x0, #0\n"
     177            "mov x0, %[uspace_uarg]\n"
    180178            "mov x1, #0\n"
    181179            "mov x2, #0\n"
     
    209207            "mov x30, #0\n"
    210208            "eret\n"
    211             :: [kstack] "r" (((uint64_t) (THREAD->kstack)) +
     209            :: [uspace_uarg] "r" (kernel_uarg->uspace_uarg),
     210              [kstack] "r" (((uint64_t) (THREAD->kstack)) +
    212211              MEM_STACK_SIZE - SP_DELTA)
    213212        );
Note: See TracChangeset for help on using the changeset viewer.