Changeset 46c20c8 in mainline for kernel/arch/sparc64/src/sun4v/asm.S


Ignore:
Timestamp:
2010-11-26T20:08:10Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
45df59a
Parents:
fb150d78 (diff), ffdd2b9 (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.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/sun4v/asm.S

    rfb150d78 r46c20c8  
    11#
    2 # Copyright (c) 2007 Michal Kebrt
     2# Copyright (c) 2008 Pavel Rimsky
    33# All rights reserved.
    44#
     
    2727#
    2828
     29#include <arch/mm/mmu.h>
     30#include <arch/regdef.h>
     31#include <arch/stack.h>
    2932
    3033.text
    3134
    32 .global memcpy
     35/** Switch to userspace.
     36 *
     37 * %o0  Userspace entry address.
     38 * %o1  Userspace stack pointer address.
     39 * %o2  Userspace address of uarg structure.
     40 */
     41.global switch_to_userspace
     42switch_to_userspace:
     43        wrpr PSTATE_PRIV_BIT, %pstate
     44        save %o1, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
     45        flushw
     46        wrpr %g0, 0, %cleanwin          ! avoid information leak
    3347
    34 memcpy:
    35         add     r3, r1, #3
    36         bic     r3, r3, #3
    37         cmp     r1, r3
    38         stmdb   sp!, {r4, r5, lr}
    39         mov     r5, r0
    40         beq     4f
    41 1:
    42         cmp     r2, #0
    43         movne   ip, #0
    44         beq     3f
    45 2:
    46         ldrb    r3, [ip, r1]
    47         strb    r3, [ip, r0]
    48         add     ip, ip, #1
    49         cmp     ip, r2
    50         bne     2b
    51 3:
    52         mov     r0, r5
    53         ldmia   sp!, {r4, r5, pc}
    54 4:
    55         add     r3, r0, #3
    56         bic     r3, r3, #3
    57         cmp     r0, r3
    58         bne     1b
    59         movs    r4, r2, lsr #2
    60         moveq   lr, r4
    61         beq     6f
    62         mov     lr, #0
    63         mov     ip, lr
    64 5:
    65         ldr     r3, [ip, r1]
    66         add     lr, lr, #1
    67         cmp     lr, r4
    68         str     r3, [ip, r0]
    69         add     ip, ip, #4
    70         bne     5b
    71 6:
    72         ands    r4, r2, #3
    73         beq     3b
    74         mov     r3, lr, lsl #2
    75         add     r0, r3, r0
    76         add     ip, r3, r1
    77         mov     r2, #0
    78 7:
    79         ldrb    r3, [r2, ip]
    80         strb    r3, [r2, r0]
    81         add     r2, r2, #1
    82         cmp     r2, r4
    83         bne     7b
    84         b       3b
     48        mov %i2, %o0                    ! uarg
     49        xor %o1, %o1, %o1               ! %o1 is defined to hold pcb_ptr
     50                                        ! set it to 0
     51        clr %i2
     52        clr %i3
     53        clr %i4
     54        clr %i5
     55        clr %i6
     56        wrpr %g0, 1, %tl                ! enforce mapping via nucleus
    8557
     58        rdpr %cwp, %g1
     59        wrpr %g1, TSTATE_IE_BIT, %tstate
     60        wrpr %i0, 0, %tnpc
     61       
     62        /*
     63         * Set primary context according to secondary context.
     64         * Secondary context has been already installed by
     65         * higher-level functions.
     66         */
     67        wr %g0, ASI_SECONDARY_CONTEXT_REG, %asi
     68        ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1
     69        wr %g0, ASI_PRIMARY_CONTEXT_REG, %asi
     70        stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi
     71        flush %i7
    8672
     73        /*
     74         * Spills and fills will be handled by the userspace handlers.
     75         */
     76        wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate
     77        done                            ! jump to userspace
Note: See TracChangeset for help on using the changeset viewer.