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