s10_brand_asm.s revision 11685:95082903303d
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#if defined(lint)
27
28#include <sys/systm.h>
29
30#else	/* lint */
31
32#include <s10_offsets.h>
33#include "../common/brand_asm.h"
34
35#endif	/* lint */
36
37#ifdef	lint
38
39void
40s10_brand_sysenter_callback(void)
41{
42}
43
44void
45s10_brand_syscall_callback(void)
46{
47}
48
49#if defined(__amd64)
50void
51s10_brand_syscall32_callback(void)
52{
53}
54#endif	/* amd64 */
55
56void
57s10_brand_int91_callback(void)
58{
59}
60
61#else	/* lint */
62
63#if defined(__amd64)
64
65/*
66 * syscall handler for 32-bit user processes:
67 *	%rcx - the address of the instruction after the syscall
68 * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
69 */
70ENTRY(s10_brand_syscall32_callback)
71	SYSCALL_EMUL(s10_emulation_table, SPD_HANDLER, %rcx)
72	jmp	nopop_sys_syscall32_swapgs_sysretl
739:
74	retq
75SET_SIZE(s10_brand_syscall32_callback)
76
77/*
78 * syscall handler for 64-bit user processes:
79 *	%rcx - the address of the instruction after the syscall
80 * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
81 */
82ENTRY(s10_brand_syscall_callback)
83	SYSCALL_EMUL(s10_emulation_table, SPD_HANDLER, %rcx)
84	jmp	nopop_sys_syscall_swapgs_sysretq
859:
86	retq
87SET_SIZE(s10_brand_syscall_callback)
88
89/*
90 * %rdx - user space return address
91 * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
92 */
93ENTRY(s10_brand_sysenter_callback)
94	SYSCALL_EMUL(s10_emulation_table, SPD_HANDLER, %rdx)
95	jmp	sys_sysenter_swapgs_sysexit
969:
97	ret
98SET_SIZE(s10_brand_sysenter_callback)
99
100/*
101 * See "64-BIT INTERPOSITION STACK" and "64-BIT INT STACK" in brand_asm.h.
102 */
103ENTRY(s10_brand_int91_callback)
104	INT_EMUL(s10_emulation_table, SPD_HANDLER)
105	jmp	sys_sysint_swapgs_iret
1069:
107	retq
108SET_SIZE(s10_brand_int91_callback)
109
110#else	/* !__amd64 */
111
112/*
113 * See "32-BIT INTERPOSITION STACK" and "32-BIT INT STACK" in brand_asm.h.
114 */
115ENTRY(s10_brand_syscall_callback)
116	INT_EMUL(s10_emulation_table, SPD_HANDLER)
117	jmp	nopop_sys_rtt_syscall
1189:
119	ret
120SET_SIZE(s10_brand_syscall_callback)
121
122/*
123 * %edx - user space return address
124 * See "32-BIT INTERPOSITION STACK" in brand_asm.h.
125 */
126ENTRY(s10_brand_sysenter_callback)
127	SYSCALL_EMUL(s10_emulation_table, SPD_HANDLER, %edx)
128	sysexit
1299:
130	ret
131SET_SIZE(s10_brand_sysenter_callback)
132
133#endif	/* !__amd64 */
134#endif	/* lint */
135