10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*3446Smrj * Common Development and Distribution License (the "License").
6*3446Smrj * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
210Sstevel@tonic-gate
220Sstevel@tonic-gate /*
23*3446Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
240Sstevel@tonic-gate * Use is subject to license terms.
250Sstevel@tonic-gate */
260Sstevel@tonic-gate
270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
280Sstevel@tonic-gate
290Sstevel@tonic-gate #include <stdio.h>
300Sstevel@tonic-gate #include <string.h>
310Sstevel@tonic-gate
320Sstevel@tonic-gate #include "list.h"
330Sstevel@tonic-gate
340Sstevel@tonic-gate int
assign_arch(const char * architecture)350Sstevel@tonic-gate assign_arch(const char *architecture)
360Sstevel@tonic-gate {
370Sstevel@tonic-gate int arch = 0;
380Sstevel@tonic-gate
39*3446Smrj #if defined(__sparc)
400Sstevel@tonic-gate if (strcmp(architecture, "sparc") == 0)
410Sstevel@tonic-gate arch = P_SPARC;
420Sstevel@tonic-gate else if (strcmp(architecture, "ISA") == 0)
430Sstevel@tonic-gate arch = P_SPARC;
440Sstevel@tonic-gate else if (strcmp(architecture, "all") == 0)
450Sstevel@tonic-gate arch = P_SPARC;
460Sstevel@tonic-gate else if (strcmp(architecture, "sparc.sun4") == 0)
470Sstevel@tonic-gate arch = P_SUN4;
480Sstevel@tonic-gate else if (strcmp(architecture, "sparc.sun4c") == 0)
490Sstevel@tonic-gate arch = P_SUN4c;
500Sstevel@tonic-gate else if (strcmp(architecture, "sparc.sun4u") == 0)
510Sstevel@tonic-gate arch = P_SUN4u;
520Sstevel@tonic-gate else if (strcmp(architecture, "sparc.sun4d") == 0)
530Sstevel@tonic-gate arch = P_SUN4d;
540Sstevel@tonic-gate else if (strcmp(architecture, "sparc.sun4e") == 0)
550Sstevel@tonic-gate arch = P_SUN4e;
560Sstevel@tonic-gate else if (strcmp(architecture, "sparc.sun4m") == 0)
570Sstevel@tonic-gate arch = P_SUN4m;
580Sstevel@tonic-gate else if (strcmp(architecture, "sparc.sun4v") == 0)
590Sstevel@tonic-gate arch = P_SUN4v;
60*3446Smrj #elif defined(__i386)
610Sstevel@tonic-gate if (strcmp(architecture, "i386") == 0)
620Sstevel@tonic-gate arch = P_I386;
630Sstevel@tonic-gate else if (strcmp(architecture, "ISA") == 0)
640Sstevel@tonic-gate arch = P_I386;
650Sstevel@tonic-gate else if (strcmp(architecture, "all") == 0)
660Sstevel@tonic-gate arch = P_I386;
670Sstevel@tonic-gate else if (strcmp(architecture, "i386.i86pc") == 0)
680Sstevel@tonic-gate arch = P_I86PC;
690Sstevel@tonic-gate #elif defined(__ppc)
700Sstevel@tonic-gate if (strcmp(architecture, "ppc") == 0)
710Sstevel@tonic-gate arch = P_PPC;
720Sstevel@tonic-gate else if (strcmp(architecture, "ISA") == 0)
730Sstevel@tonic-gate arch = P_PPC;
740Sstevel@tonic-gate else if (strcmp(architecture, "all") == 0)
750Sstevel@tonic-gate arch = P_PPC;
760Sstevel@tonic-gate else if (strcmp(architecture, "ppc.prep") == 0)
770Sstevel@tonic-gate arch = P_PREP;
780Sstevel@tonic-gate #else
790Sstevel@tonic-gate #error "Unknown instruction set"
800Sstevel@tonic-gate #endif
810Sstevel@tonic-gate
820Sstevel@tonic-gate return (arch);
830Sstevel@tonic-gate }
84