Changeset 32e8cd1 in mainline for kernel/arch/sparc32/src/userspace.c


Ignore:
Timestamp:
2013-12-28T17:16:44Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c1023bcb
Parents:
f6f22cdb
Message:

code revision
coding style fixes
removal of debugging printouts and other temporary stuff

File:
1 edited

Legend:

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

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32le
     29/** @addtogroup sparc32
    3030 * @{
    3131 */
     
    4242void userspace(uspace_arg_t *kernel_uarg)
    4343{
    44 //      printf("userspace(): entry=%p, stack=%p, stacksize=%d\n", kernel_uarg->uspace_entry, kernel_uarg->uspace_stack, kernel_uarg->uspace_stack_size);
    45         /* On real hardware this switches the CPU to user
    46            space mode and jumps to kernel_uarg->uspace_entry. */
    47 
    48         uint32_t l0, l1, l2;
    4944        uint32_t psr = psr_read();
    50         uint8_t wim;
    51 
    5245        psr &= ~(1 << 7);
    5346        psr &= ~(1 << 6);
    54 
     47       
    5548        /* Read invalid window variables */
     49        uint32_t l0;
     50        uint32_t l1;
     51        uint32_t l2;
    5652        read_from_invalid(&l0, &l1, &l2);
    57 
     53       
    5854        /* Make current window invalid */
    59         wim = (psr & 0x7) + 1;
     55        uint8_t wim = (psr & 0x7) + 1;
    6056        wim = (1 << wim) | (1 >> (8 - wim));
    61 
     57       
    6258        asm volatile (
    6359                "flush\n"
     
    7167                "ld %[arg], %%o1\n"
    7268                "jmp %[entry]\n"
    73                 "mov %[psr], %%psr\n" :: [entry] "r" (kernel_uarg->uspace_entry),
    74                            [arg] "m" (kernel_uarg->uspace_uarg),
    75                            [psr] "r" (psr),
    76                            [wim] "r" ((uint32_t)wim),   
    77                            [v0] "m" (l0),
    78                            [v1] "m" (l1),
    79                            [v2] "m" (l2),
    80                            [stack] "r" (kernel_uarg->uspace_stack + kernel_uarg->uspace_stack_size - 64) : "%g3", "%g4");
    81 
    82         while (true);
     69                "mov %[psr], %%psr\n"
     70                :: [entry] "r" (kernel_uarg->uspace_entry),
     71                   [arg] "m" (kernel_uarg->uspace_uarg),
     72                   [psr] "r" (psr),
     73                   [wim] "r" ((uint32_t)wim),
     74                   [v0] "m" (l0),
     75                   [v1] "m" (l1),
     76                   [v2] "m" (l2),
     77                   [stack] "r" (kernel_uarg->uspace_stack +
     78                   kernel_uarg->uspace_stack_size - 64)
     79                : "%g3", "%g4"
     80        );
     81       
     82        while (1);
    8383}
    8484
Note: See TracChangeset for help on using the changeset viewer.