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]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
29 * Adr memory based translations
33 #include <sys/types.h>
34 #include <bsm/audit.h>
35 #include <bsm/audit_record.h>
38 adrm_start(adr_t
*adr
, char *p
)
45 * adrm_char - pull out characters
48 adrm_char(adr_t
*adr
, char *cp
, int count
)
51 *cp
++ = *adr
->adr_now
++;
55 * adrm_short - pull out shorts
58 adrm_short(adr_t
*adr
, short *sp
, int count
)
61 *sp
= *adr
->adr_now
++ << 8;
62 *sp
++ += ((short)*adr
->adr_now
++) & 0x00ff;
67 * adrm_int32 - pull out int
69 void adrm_int(adr_t
*adr
, int32_t *lp
, int count
);
70 void adrm_long(adr_t
*adr
, int32_t *lp
, int count
);
71 #pragma weak adrm_int = adrm_int32
72 #pragma weak adrm_long = adrm_int32
75 adrm_int32(adr_t
*adr
, int32_t *lp
, int count
)
79 for (; count
-- > 0; lp
++) {
81 for (i
= 0; i
< 4; i
++) {
83 *lp
+= ((int32_t)*adr
->adr_now
++) & 0x000000ff;
89 adrm_uid(adr_t
*adr
, uid_t
*up
, int count
)
93 for (; count
-- > 0; up
++) {
95 for (i
= 0; i
< 4; i
++) {
97 *up
+= ((uid_t
)*adr
->adr_now
++) & 0x000000ff;
103 adrm_int64(adr_t
*adr
, int64_t *lp
, int count
)
107 for (; count
-- > 0; lp
++) {
109 for (i
= 0; i
< 8; i
++) {
111 *lp
+= ((int64_t)*adr
->adr_now
++) & 0x00000000000000ff;
116 void adrm_u_int(adr_t
*adr
, uint32_t *cp
, int count
);
117 void adrm_u_long(adr_t
*adr
, uint32_t *cp
, int count
);
118 #pragma weak adrm_u_int = adrm_u_int32
119 #pragma weak adrm_u_long = adrm_u_int32
122 adrm_u_int32(adr_t
*adr
, uint32_t *cp
, int count
)
124 adrm_int32(adr
, (int32_t *)cp
, count
);
128 adrm_u_char(adr_t
*adr
, uchar_t
*cp
, int count
)
130 adrm_char(adr
, (char *)cp
, count
);
134 adrm_u_int64(adr_t
*adr
, uint64_t *lp
, int count
)
136 adrm_int64(adr
, (int64_t *)lp
, count
);
140 adrm_u_short(adr_t
*adr
, ushort_t
*sp
, int count
)
142 adrm_short(adr
, (short *)sp
, count
);
146 * adrm_putint32 - pack in int32
148 #pragma weak adrm_putint = adrm_putint32
149 #pragma weak adrm_putlong = adrm_putint32
151 adrm_putint32(adr_t
*adr
, int32_t *lp
, int count
)
153 int i
; /* index for counting */
154 int32_t l
; /* value for shifting */
156 for (; count
-- > 0; lp
++) {
157 for (i
= 0, l
= *lp
; i
< 4; i
++) {
158 *adr
->adr_now
++ = (char)((l
& (int32_t)0xff000000) >>