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.
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.
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]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
33 * weak aliases for public interfaces
35 ANSI_PRAGMA_WEAK2
(door_bind
,__door_bind
,function
)
36 ANSI_PRAGMA_WEAK2
(door_getparam
,__door_getparam
,function
)
37 ANSI_PRAGMA_WEAK2
(door_info
,__door_info
,function
)
38 ANSI_PRAGMA_WEAK2
(door_revoke
,__door_revoke
,function
)
39 ANSI_PRAGMA_WEAK2
(door_setparam
,__door_setparam
,function
)
42 * Offsets within struct door_results
44 #define DOOR_COOKIE (SA(MINFRAME) + STACK_BIAS + 0*CLONGSIZE)
45 #define DOOR_DATA_PTR (SA(MINFRAME) + STACK_BIAS + 1*CLONGSIZE)
46 #define DOOR_DATA_SIZE (SA(MINFRAME) + STACK_BIAS + 2*CLONGSIZE)
47 #define DOOR_DESC_PTR (SA(MINFRAME) + STACK_BIAS + 3*CLONGSIZE)
48 #define DOOR_DESC_SIZE (SA(MINFRAME) + STACK_BIAS + 4*CLONGSIZE)
49 #define DOOR_PC (SA(MINFRAME) + STACK_BIAS + 5*CLONGSIZE)
50 #define DOOR_SERVERS (SA(MINFRAME) + STACK_BIAS + 6*CLONGSIZE)
51 #define DOOR_INFO_PTR (SA(MINFRAME) + STACK_BIAS + 7*CLONGSIZE)
54 * All of the syscalls except door_return() follow the same pattern. The
55 * subcode goes in %o5, after all of the other arguments.
57 #define DOOR_SYSCALL(name, code) \
59 mov code
, %o5;
/* subcode */ \
60 SYSTRAP_RVAL1
(door
); \
65 DOOR_SYSCALL
(__door_bind
, DOOR_BIND
)
66 DOOR_SYSCALL
(__door_call
, DOOR_CALL
)
67 DOOR_SYSCALL
(__door_create
, DOOR_CREATE
)
68 DOOR_SYSCALL
(__door_getparam
, DOOR_GETPARAM
)
69 DOOR_SYSCALL
(__door_info
, DOOR_INFO
)
70 DOOR_SYSCALL
(__door_revoke
, DOOR_REVOKE
)
71 DOOR_SYSCALL
(__door_setparam
, DOOR_SETPARAM
)
72 DOOR_SYSCALL
(__door_ucred
, DOOR_UCRED
)
73 DOOR_SYSCALL
(__door_unbind
, DOOR_UNBIND
)
74 DOOR_SYSCALL
(__door_unref
, DOOR_UNREFSYS
)
80 * size_t data_size, (in bytes)
81 * door_return_desc_t *door_ptr, (holds returned desc info)
87 mov DOOR_RETURN
, %o5
/* subcode */
89 bcs
,pn
%icc
, 2f
/* errno is set */
90 ld [%sp
+ DOOR_SERVERS
], %g1
/* (delay) load nservers */
92 * On return, we're serving a door_call. Our stack looks like this:
94 * descriptors (if any)
100 tst
%g1
/* test nservers */
101 bg
1f
/* everything looks o.k. */
102 ldn
[%sp
+ DOOR_COOKIE
], %o0
/* (delay) load cookie */
104 * this is the last server thread - call creation func for more
106 save
%sp
, -SA
(MINFRAME
), %sp
107 call door_depletion_cb
108 ldn
[%fp
+ DOOR_INFO_PTR
], %o0
/* (delay) load door_info ptr */
111 /* Call the door server function now */
112 ldn
[%sp
+ DOOR_DATA_PTR
], %o1
113 ldn
[%sp
+ DOOR_DATA_SIZE
], %o2
114 ldn
[%sp
+ DOOR_DESC_PTR
], %o3
115 ldn
[%sp
+ DOOR_PC
], %g1
117 ldn
[%sp
+ DOOR_DESC_SIZE
], %o4
119 /* Exit the thread if we return here */
125 * Error during door_return call. Repark the thread in the kernel if
126 * the error code is EINTR (or ERESTART) and this lwp is still part
127 * of the same process.
129 cmp %o0
, ERESTART
/* ERESTART is same as EINTR */
133 cmp %o0
, EINTR
/* interrupted while waiting? */
134 bne __cerror
/* if not, return the error */
137 save
%sp
, -SA
(MINFRAME
), %sp
142 sethi
%hi
(door_create_pid
), %g5
143 or %g5
, %lo
(door_create_pid
), %g5
146 ldn
[%g1
+ door_create_pid
], %g1
149 cmp %o0
, %g1
/* same process? */
150 mov EINTR
, %o0
/* if no, return EINTR (child of forkall) */
154 clr
%o0
/* clear arguments and restart */
158 SET_SIZE
(__door_return
)