Changeset 1f12fab in mainline for kernel/arch/sparc32/src/userspace.c


Ignore:
Timestamp:
2013-10-07T20:00:34Z (11 years ago)
Author:
Jakub Klama <jakub.klama@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a73ebf0
Parents:
80d9d83
Message:

First attempt to implement preemptive trap handlers
and switch to userspace. Preemptive traps are needed
for at least page faults, as page fault handling code
can trigger window underflow/overflow exceptions.

This commit also introduces userspace window buffer
for saving userspace register windows (just as in
sparc64).

These changes are unfinished and far from working
correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc32/src/userspace.c

    r80d9d83 r1f12fab  
    3636#include <typedefs.h>
    3737#include <arch.h>
     38#include <arch/asm.h>
    3839#include <abi/proc/uarg.h>
    3940#include <mm/as.h>
     
    4142void userspace(uspace_arg_t *kernel_uarg)
    4243{
     44        printf("userspace(): entry=%p, stack=%p, stacksize=%d\n", kernel_uarg->uspace_entry, kernel_uarg->uspace_stack, kernel_uarg->uspace_stack_size);
    4345        /* On real hardware this switches the CPU to user
    4446           space mode and jumps to kernel_uarg->uspace_entry. */
    45        
     47
     48        uint32_t psr = psr_read();
     49
     50        psr &= ~(1 << 7);
     51        psr &= ~(1 << 6);
     52
     53        asm volatile (
     54                "mov %[stack], %%sp\n"
     55                "mov %[psr], %%psr\n"
     56                "nop\n"
     57                "jmp %[entry]\n"
     58                "nop\n" :: [entry] "r" (kernel_uarg->uspace_entry),
     59                           [psr] "r" (psr),
     60                           [stack] "r" (kernel_uarg->uspace_stack + kernel_uarg->uspace_stack_size));
     61
    4662        while (true);
    4763}
Note: See TracChangeset for help on using the changeset viewer.