[eb79d60] | 1 | /*
|
---|
| 2 | * Copyright (c) 2005 Jakub Jermar
|
---|
| 3 | * Copyright (c) 2009 Pavel Rimsky
|
---|
| 4 | * All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
---|
| 7 | * modification, are permitted provided that the following conditions
|
---|
| 8 | * are met:
|
---|
| 9 | *
|
---|
| 10 | * - Redistributions of source code must retain the above copyright
|
---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 14 | * documentation and/or other materials provided with the distribution.
|
---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
---|
| 16 | * derived from this software without specific prior written permission.
|
---|
| 17 | *
|
---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /** @addtogroup sparc64interrupt
|
---|
| 31 | * @{
|
---|
| 32 | */
|
---|
| 33 | #ifndef KERN_sparc64_sun4v_REGWIN_H_
|
---|
| 34 | #define KERN_sparc64_sun4v_REGWIN_H_
|
---|
| 35 |
|
---|
| 36 | #ifdef __ASM__
|
---|
| 37 |
|
---|
| 38 | /*
|
---|
| 39 | * Saves the contents of the current window to the userspace window buffer.
|
---|
| 40 | * Does not modify any register window registers, but updates pointer to the
|
---|
| 41 | * top of the userspace window buffer.
|
---|
| 42 | *
|
---|
| 43 | * Parameters:
|
---|
| 44 | * \tmpreg1 global register to be used for scratching purposes
|
---|
| 45 | * \tmpreg2 global register to be used for scratching purposes
|
---|
| 46 | */
|
---|
| 47 | .macro SAVE_TO_USPACE_WBUF tmpreg1, tmpreg2
|
---|
| 48 | set SCRATCHPAD_WBUF, \tmpreg2
|
---|
| 49 | ldxa [\tmpreg2] ASI_SCRATCHPAD, \tmpreg1
|
---|
| 50 | stx %l0, [\tmpreg1 + L0_OFFSET]
|
---|
| 51 | stx %l1, [\tmpreg1 + L1_OFFSET]
|
---|
| 52 | stx %l2, [\tmpreg1 + L2_OFFSET]
|
---|
| 53 | stx %l3, [\tmpreg1 + L3_OFFSET]
|
---|
| 54 | stx %l4, [\tmpreg1 + L4_OFFSET]
|
---|
| 55 | stx %l5, [\tmpreg1 + L5_OFFSET]
|
---|
| 56 | stx %l6, [\tmpreg1 + L6_OFFSET]
|
---|
| 57 | stx %l7, [\tmpreg1 + L7_OFFSET]
|
---|
| 58 | stx %i0, [\tmpreg1 + I0_OFFSET]
|
---|
| 59 | stx %i1, [\tmpreg1 + I1_OFFSET]
|
---|
| 60 | stx %i2, [\tmpreg1 + I2_OFFSET]
|
---|
| 61 | stx %i3, [\tmpreg1 + I3_OFFSET]
|
---|
| 62 | stx %i4, [\tmpreg1 + I4_OFFSET]
|
---|
| 63 | stx %i5, [\tmpreg1 + I5_OFFSET]
|
---|
| 64 | stx %i6, [\tmpreg1 + I6_OFFSET]
|
---|
| 65 | stx %i7, [\tmpreg1 + I7_OFFSET]
|
---|
| 66 | add \tmpreg1, STACK_WINDOW_SAVE_AREA_SIZE, \tmpreg1
|
---|
| 67 | stxa \tmpreg1, [\tmpreg2] ASI_SCRATCHPAD
|
---|
| 68 | .endm
|
---|
| 69 |
|
---|
| 70 | /*
|
---|
| 71 | * Macro used to spill userspace window to userspace window buffer.
|
---|
| 72 | * It is triggered from normal kernel code doing SAVE when
|
---|
| 73 | * OTHERWIN>0 at (TL=0).
|
---|
| 74 | */
|
---|
| 75 | .macro SPILL_TO_USPACE_WINDOW_BUFFER
|
---|
| 76 | SAVE_TO_USPACE_WBUF %g7, %g4
|
---|
| 77 | saved
|
---|
| 78 | retry
|
---|
| 79 | .endm
|
---|
| 80 |
|
---|
| 81 | #endif
|
---|
| 82 |
|
---|
| 83 | #endif
|
---|
| 84 |
|
---|
| 85 | /** @}
|
---|
| 86 | */
|
---|