1*c13de8f6Sab196087 /* 2*c13de8f6Sab196087 * CDDL HEADER START 3*c13de8f6Sab196087 * 4*c13de8f6Sab196087 * The contents of this file are subject to the terms of the 5*c13de8f6Sab196087 * Common Development and Distribution License (the "License"). 6*c13de8f6Sab196087 * You may not use this file except in compliance with the License. 7*c13de8f6Sab196087 * 8*c13de8f6Sab196087 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*c13de8f6Sab196087 * or http://www.opensolaris.org/os/licensing. 10*c13de8f6Sab196087 * See the License for the specific language governing permissions 11*c13de8f6Sab196087 * and limitations under the License. 12*c13de8f6Sab196087 * 13*c13de8f6Sab196087 * When distributing Covered Code, include this CDDL HEADER in each 14*c13de8f6Sab196087 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*c13de8f6Sab196087 * If applicable, add the following below this CDDL HEADER, with the 16*c13de8f6Sab196087 * fields enclosed by brackets "[]" replaced with your own identifying 17*c13de8f6Sab196087 * information: Portions Copyright [yyyy] [name of copyright owner] 18*c13de8f6Sab196087 * 19*c13de8f6Sab196087 * CDDL HEADER END 20*c13de8f6Sab196087 */ 21*c13de8f6Sab196087 /* 22*c13de8f6Sab196087 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*c13de8f6Sab196087 * Use is subject to license terms. 24*c13de8f6Sab196087 */ 25*c13de8f6Sab196087 26*c13de8f6Sab196087 #ifndef _SGSRTCID_H 27*c13de8f6Sab196087 #define _SGSRTCID_H 28*c13de8f6Sab196087 29*c13de8f6Sab196087 #pragma ident "%Z%%M% %I% %E% SMI" 30*c13de8f6Sab196087 31*c13de8f6Sab196087 #ifdef __cplusplus 32*c13de8f6Sab196087 extern "C" { 33*c13de8f6Sab196087 #endif 34*c13de8f6Sab196087 35*c13de8f6Sab196087 36*c13de8f6Sab196087 /* 37*c13de8f6Sab196087 * This file defines the Rtc_id structure that is found at the beginning 38*c13de8f6Sab196087 * of linker configuration files. It resides at this level so that 39*c13de8f6Sab196087 * it can be accessed by file(1) as well as by crle(1) and the 40*c13de8f6Sab196087 * runtime linker (ld.so.1). The rest of the data structures for 41*c13de8f6Sab196087 * config files are found in usr/src/cmd/sgs/include/rtc.h 42*c13de8f6Sab196087 * 43*c13de8f6Sab196087 * The use of sizeof(char) data (no byte order issue) and explicit 44*c13de8f6Sab196087 * padding in the definition of Rtc_id ensures that it will have 45*c13de8f6Sab196087 * exactly the same layout on all systems, and will have a 46*c13de8f6Sab196087 * size of 16 bytes. The same layout means all systems can read it. 47*c13de8f6Sab196087 * the same size means that any data can be safely placed immediately 48*c13de8f6Sab196087 * following it, without the need for alignment. 49*c13de8f6Sab196087 */ 50*c13de8f6Sab196087 51*c13de8f6Sab196087 /* 52*c13de8f6Sab196087 * Identification header. 53*c13de8f6Sab196087 */ 54*c13de8f6Sab196087 typedef struct { 55*c13de8f6Sab196087 uchar_t id_magic0; /* RTC_ID_MAG0 */ 56*c13de8f6Sab196087 uchar_t id_magic1; /* RTC_ID_MAG1 */ 57*c13de8f6Sab196087 uchar_t id_magic2; /* RTC_ID_MAG2 */ 58*c13de8f6Sab196087 uchar_t id_magic3; /* RTC_ID_MAG0 */ 59*c13de8f6Sab196087 uchar_t id_class; /* File class/capacity (ELFCLASS constant) */ 60*c13de8f6Sab196087 uchar_t id_data; /* Data encoding (ELFDATA constant) */ 61*c13de8f6Sab196087 uchar_t id_machine; /* Architecture (ELF EM_ constant) */ 62*c13de8f6Sab196087 uchar_t id_pad[9]; /* Ensure size is 16 bytes */ 63*c13de8f6Sab196087 } Rtc_id; 64*c13de8f6Sab196087 65*c13de8f6Sab196087 #define RTC_ID_MAG0 '\077' /* ? */ 66*c13de8f6Sab196087 #define RTC_ID_MAG1 'R' /* Runtime */ 67*c13de8f6Sab196087 #define RTC_ID_MAG2 'L' /* Linker */ 68*c13de8f6Sab196087 #define RTC_ID_MAG3 'C' /* Configuration */ 69*c13de8f6Sab196087 70*c13de8f6Sab196087 /* 71*c13de8f6Sab196087 * Ensure that the largest machine constant will not grow beyond 72*c13de8f6Sab196087 * maximum value representable by an unsigned byte without our 73*c13de8f6Sab196087 * being alerted to it. 74*c13de8f6Sab196087 */ 75*c13de8f6Sab196087 #if EM_NUM > 256 76*c13de8f6Sab196087 #error "Maximum machine constant size exceeded. Format requires revision." 77*c13de8f6Sab196087 #endif 78*c13de8f6Sab196087 79*c13de8f6Sab196087 /* 80*c13de8f6Sab196087 * Check the 4 bytes starting at the given address to see if 81*c13de8f6Sab196087 * they contain the Rtc_id magic number. The type of the address 82*c13de8f6Sab196087 * is unimportant as long as it is valid, because RTC_ID_TEST() 83*c13de8f6Sab196087 * will cast it to (uchar_t *). 84*c13de8f6Sab196087 */ 85*c13de8f6Sab196087 #define RTC_ID_TEST(addr) \ 86*c13de8f6Sab196087 ((RTC_ID_MAG0 == *((uchar_t *)addr)) && \ 87*c13de8f6Sab196087 (RTC_ID_MAG1 == *(((uchar_t *)addr) + 1)) && \ 88*c13de8f6Sab196087 (RTC_ID_MAG2 == *(((uchar_t *)addr) + 2)) && \ 89*c13de8f6Sab196087 (RTC_ID_MAG3 == *(((uchar_t *)addr) + 3))) 90*c13de8f6Sab196087 91*c13de8f6Sab196087 #ifdef __cplusplus 92*c13de8f6Sab196087 } 93*c13de8f6Sab196087 #endif 94*c13de8f6Sab196087 95*c13de8f6Sab196087 #endif /* _SGSRTCID_H */ 96