Ignore:
File:
1 edited

Legend:

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

    rdb17889 r3fcea34  
    4040#include <arch/exception.h>
    4141#include <arch/machine_func.h>
     42#include <console/console.h>
    4243#include <interrupt.h>
    4344#include <proc/scheduler.h>
     
    145146}
    146147
     148uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
     149{
     150        return stack_base + stack_size;
     151}
     152
    147153/** Change processor mode.
    148154 *
    149155 * @param kernel_uarg Userspace settings (entry point, stack, ...).
    150156 */
    151 void userspace(uspace_arg_t *kernel_uarg)
     157void userspace(uintptr_t pc, uintptr_t sp)
    152158{
    153159        /* Prepare return to EL0. */
     
    156162
    157163        /* Set program entry. */
    158         ELR_EL1_write(kernel_uarg->uspace_entry);
     164        ELR_EL1_write(pc);
    159165
    160166        /* Set user stack. */
    161         SP_EL0_write(kernel_uarg->uspace_stack +
    162             kernel_uarg->uspace_stack_size);
     167        SP_EL0_write(sp);
    163168
    164169        /* Clear Thread ID register. */
     
    169174             * Reset the kernel stack to its base value.
    170175             *
    171              * Clear all general-purpose registers,
    172              * except x0 that holds an argument for
    173              * the user space.
     176             * Clear all general-purpose registers.
    174177             */
    175178            "mov sp, %[kstack]\n"
    176             "mov x0, %[uspace_uarg]\n"
     179            "mov x0, #0\n"
    177180            "mov x1, #0\n"
    178181            "mov x2, #0\n"
     
    206209            "mov x30, #0\n"
    207210            "eret\n"
    208             :: [uspace_uarg] "r" (kernel_uarg->uspace_uarg),
    209               [kstack] "r" (((uint64_t) (THREAD->kstack)) +
     211            :: [kstack] "r" (((uint64_t) (THREAD->kstack)) +
    210212              MEM_STACK_SIZE - SP_DELTA)
    211213        );
     
    256258}
    257259
     260void early_putuchar(char32_t c)
     261{
     262#ifdef CONFIG_DEBUG_EARLY_PRINT
     263        if (c == '\n')
     264                machine_early_uart_output('\r');
     265
     266        machine_early_uart_output(c);
     267#endif
     268}
     269
    258270/** @}
    259271 */
Note: See TracChangeset for help on using the changeset viewer.