xref: /titanic_52/usr/src/tools/protocmp/arch.c (revision ca3e8d88e8c867355e441fbc914c52e7416fc537)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <stdio.h>
30 #include <string.h>
31 
32 #include "list.h"
33 
34 int
35 assign_arch(const char *architecture)
36 {
37 	int	arch = 0;
38 
39 #if defined(__sparc)
40 	if (strcmp(architecture, "sparc") == 0)
41 		arch = P_SPARC;
42 	else if (strcmp(architecture, "ISA") == 0)
43 		arch = P_SPARC;
44 	else if (strcmp(architecture, "all") == 0)
45 		arch = P_SPARC;
46 	else if (strcmp(architecture, "sparc.sun4") == 0)
47 		arch = P_SUN4;
48 	else if (strcmp(architecture, "sparc.sun4c") == 0)
49 		arch = P_SUN4c;
50 	else if (strcmp(architecture, "sparc.sun4u") == 0)
51 		arch = P_SUN4u;
52 	else if (strcmp(architecture, "sparc.sun4d") == 0)
53 		arch = P_SUN4d;
54 	else if (strcmp(architecture, "sparc.sun4e") == 0)
55 		arch = P_SUN4e;
56 	else if (strcmp(architecture, "sparc.sun4m") == 0)
57 		arch = P_SUN4m;
58 	else if (strcmp(architecture, "sparc.sun4v") == 0)
59 		arch = P_SUN4v;
60 #elif defined(__i386)
61 	if (strcmp(architecture, "i386") == 0)
62 		arch = P_I386;
63 	else if (strcmp(architecture, "ISA") == 0)
64 		arch = P_I386;
65 	else if (strcmp(architecture, "all") == 0)
66 		arch = P_I386;
67 	else if (strcmp(architecture, "i386.i86pc") == 0)
68 		arch = P_I86PC;
69 #elif defined(__ppc)
70 	if (strcmp(architecture, "ppc") == 0)
71 		arch = P_PPC;
72 	else if (strcmp(architecture, "ISA") == 0)
73 		arch = P_PPC;
74 	else if (strcmp(architecture, "all") == 0)
75 		arch = P_PPC;
76 	else if (strcmp(architecture, "ppc.prep") == 0)
77 		arch = P_PREP;
78 #else
79 #error "Unknown instruction set"
80 #endif
81 
82 	return (arch);
83 }
84