source: mainline/kernel/arch/sparc64/src/sun4v/asm.S@ cb7be8f

Last change on this file since cb7be8f was cb7be8f, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Update headers in .S files that incorrectly use #-style comments

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2008 Pavel Rimsky
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <abi/asmtool.h>
8#include <arch/mm/mmu.h>
9#include <arch/regdef.h>
10#include <arch/stack.h>
11
12.text
13
14/** Switch to userspace.
15 *
16 * %o0 Userspace entry address.
17 * %o1 Userspace stack pointer address.
18 * %o2 Userspace address of uarg structure.
19 */
20FUNCTION_BEGIN(switch_to_userspace)
21 save %o1, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
22 flushw
23 wrpr %g0, 0, %cleanwin ! avoid information leak
24
25 mov %i2, %o0 ! uarg
26 xor %o1, %o1, %o1 ! %o1 is defined to hold pcb_ptr
27 ! set it to 0
28 clr %i2
29 clr %i3
30 clr %i4
31 clr %i5
32 clr %i6
33 wrpr %g0, 1, %tl ! enforce mapping via nucleus
34
35 rdpr %cwp, %g1
36 wrpr %g1, TSTATE_IE_BIT, %tstate
37 wrpr %i0, 0, %tnpc
38
39 /*
40 * Set primary context according to secondary context.
41 * Secondary context has been already installed by
42 * higher-level functions.
43 */
44 wr %g0, ASI_SECONDARY_CONTEXT_REG, %asi
45 ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1
46 wr %g0, ASI_PRIMARY_CONTEXT_REG, %asi
47 stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi
48 flush %i7
49
50 /*
51 * Spills and fills will be handled by the userspace handlers.
52 */
53 wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate
54 done ! jump to userspace
55FUNCTION_END(switch_to_userspace)
Note: See TracBrowser for help on using the repository browser.